Changeset 846 for trunk/src/3rdparty/libjpeg
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 14 deleted
- 62 edited
- 60 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/libjpeg/README
r2 r846 2 2 ========================================== 3 3 4 README for release 6b of 27-Mar-19985 =================================== =6 7 This distribution contains the sixth public release of the Independent JPEG4 README for release 8 of 10-Jan-2010 5 =================================== 6 7 This distribution contains the eighth public release of the Independent JPEG 8 8 Group's free JPEG software. You are welcome to redistribute this software and 9 9 to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. 10 10 11 Serious users of this software (particularly those incorporating it into 12 larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to 13 our electronic mailing list. Mailing list members are notified of updates 14 and have a chance to participate in technical discussions, etc. 15 16 This software is the work of Tom Lane, Philip Gladstone, Jim Boucher, 17 Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, 18 Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG 19 Group. 11 This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone, 12 Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson, 13 Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers, 14 and other members of the Independent JPEG Group. 20 15 21 16 IJG is not affiliated with the official ISO JPEG standards committee. … … 31 26 REFERENCES Where to learn more about JPEG. 32 27 ARCHIVE LOCATIONS Where to find newer versions of this software. 33 RELATED SOFTWARE Other stuff you should get.28 ACKNOWLEDGMENTS Special thanks. 34 29 FILE FORMAT WARS Software *not* to get. 35 30 TO DO Plans for future IJG releases. … … 38 33 39 34 User documentation: 40 install. docHow to configure and install the IJG software.41 usage. docUsage instructions for cjpeg, djpeg, jpegtran,35 install.txt How to configure and install the IJG software. 36 usage.txt Usage instructions for cjpeg, djpeg, jpegtran, 42 37 rdjpgcom, and wrjpgcom. 43 *.1 Unix-style man pages for programs (same info as usage. doc).44 wizard. docAdvanced usage instructions for JPEG wizards only.38 *.1 Unix-style man pages for programs (same info as usage.txt). 39 wizard.txt Advanced usage instructions for JPEG wizards only. 45 40 change.log Version-to-version change highlights. 46 41 Programmer and internal documentation: 47 libjpeg. docHow to use the JPEG library in your own programs.42 libjpeg.txt How to use the JPEG library in your own programs. 48 43 example.c Sample code for calling the JPEG library. 49 structure. docOverview of the JPEG library's internal structure.50 filelist. docRoad map of IJG files.51 coderules. docCoding style rules --- please read if you contribute code.52 53 Please read at least the files install. doc and usage.doc. Usefulinformation44 structure.txt Overview of the JPEG library's internal structure. 45 filelist.txt Road map of IJG files. 46 coderules.txt Coding style rules --- please read if you contribute code. 47 48 Please read at least the files install.txt and usage.txt. Some information 54 49 can also be found in the JPEG FAQ (Frequently Asked Questions) article. See 55 50 ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. … … 63 58 ======== 64 59 65 This package contains C software to implement JPEG image compression and 66 decompression. JPEG (pronounced "jay-peg") is a standardized compression 67 method for full-color and gray-scale images. JPEG is intended for compressing 68 "real-world" scenes; line drawings, cartoons and other non-realistic images 69 are not its strong suit. JPEG is lossy, meaning that the output image is not 70 exactly identical to the input image. Hence you must not use JPEG if you 71 have to have identical output bits. However, on typical photographic images, 72 very good compression levels can be obtained with no visible change, and 73 remarkably high compression levels are possible if you can tolerate a 74 low-quality image. For more details, see the references, or just experiment 75 with various compression settings. 60 This package contains C software to implement JPEG image encoding, decoding, 61 and transcoding. JPEG (pronounced "jay-peg") is a standardized compression 62 method for full-color and gray-scale images. 76 63 77 64 This software implements JPEG baseline, extended-sequential, and progressive 78 65 compression processes. Provision is made for supporting all variants of these 79 66 processes, although some uncommon parameter settings aren't implemented yet. 80 For legal reasons, we are not distributing code for the arithmetic-coding 81 variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting 82 the hierarchical or lossless processes defined in the standard. 67 We have made no provision for supporting the hierarchical or lossless 68 processes defined in the standard. 83 69 84 70 We provide a set of library routines for reading and writing JPEG image files, … … 92 78 decoding, but they are essential for output to colormapped file formats or 93 79 colormapped displays. These extra functions can be compiled out of the 94 library if not required for a particular application. We have also included 95 "jpegtran", a utility for lossless transcoding between different JPEG 96 processes, and "rdjpgcom" and "wrjpgcom", two simple applications for 97 inserting and extracting textual comments in JFIF files. 80 library if not required for a particular application. 81 82 We have also included "jpegtran", a utility for lossless transcoding between 83 different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple 84 applications for inserting and extracting textual comments in JFIF files. 98 85 99 86 The emphasis in designing this software has been on achieving portability and … … 128 115 its user, assume the entire risk as to its quality and accuracy. 129 116 130 This software is copyright (C) 1991- 1998, Thomas G. Lane.117 This software is copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding. 131 118 All Rights Reserved except as specified below. 132 119 … … 171 158 It is copyright by the Free Software Foundation but is freely distributable. 172 159 The same holds for its supporting scripts (config.guess, config.sub, 173 ltconfig, ltmain.sh). Another support script, install-sh, is copyright 174 by M.I.T. but is also freely distributable. 175 176 It appears that the arithmetic coding option of the JPEG spec is covered by 177 patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot 178 legally be used without obtaining one or more licenses. For this reason, 179 support for arithmetic coding has been removed from the free JPEG software. 180 (Since arithmetic coding provides only a marginal gain over the unpatented 181 Huffman mode, it is unlikely that very many implementations will support it.) 182 So far as we are aware, there are no patent restrictions on the remaining 183 code. 160 ltmain.sh). Another support script, install-sh, is copyright by X Consortium 161 but is also freely distributable. 184 162 185 163 The IJG distribution formerly included code to read and write GIF files. … … 199 177 ========== 200 178 201 We highlyrecommend reading one or more of these references before trying to179 We recommend reading one or more of these references before trying to 202 180 understand the innards of the JPEG software. 203 181 … … 208 186 applications of JPEG, and related topics.) If you don't have the CACM issue 209 187 handy, a PostScript file containing a revised version of Wallace's article is 210 available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually188 available at http://www.ijg.org/files/wallace.ps.gz. The file (actually 211 189 a preprint for an article that appeared in IEEE Trans. Consumer Electronics) 212 190 omits the sample images that appeared in CACM, but it includes corrections … … 223 201 at a full implementation, you've got one here... 224 202 225 The best full description of JPEG is the textbook "JPEG Still Image Data 226 Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published 227 by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. 228 The book includes the complete text of the ISO JPEG standards (DIS 10918-1 229 and draft DIS 10918-2). This is by far the most complete exposition of JPEG 230 in existence, and we highly recommend it. 231 232 The JPEG standard itself is not available electronically; you must order a 233 paper copy through ISO or ITU. (Unless you feel a need to own a certified 234 official copy, we recommend buying the Pennebaker and Mitchell book instead; 235 it's much cheaper and includes a great deal of useful explanatory material.) 236 In the USA, copies of the standard may be ordered from ANSI Sales at (212) 237 642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI 238 doesn't take credit card orders, but Global does.) It's not cheap: as of 239 1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% 240 shipping/handling. The standard is divided into two parts, Part 1 being the 241 actual specification, while Part 2 covers compliance testing methods. Part 1 242 is titled "Digital Compression and Coding of Continuous-tone Still Images, 203 The best currently available description of JPEG is the textbook "JPEG Still 204 Image Data Compression Standard" by William B. Pennebaker and Joan L. 205 Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. 206 Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG 207 standards (DIS 10918-1 and draft DIS 10918-2). 208 Although this is by far the most detailed and comprehensive exposition of 209 JPEG publicly available, we point out that it is still missing an explanation 210 of the most essential properties and algorithms of the underlying DCT 211 technology. 212 If you think that you know about DCT-based JPEG after reading this book, 213 then you are in delusion. The real fundamentals and corresponding potential 214 of DCT-based JPEG are not publicly known so far, and that is the reason for 215 all the mistaken developments taking place in the image coding domain. 216 217 The original JPEG standard is divided into two parts, Part 1 being the actual 218 specification, while Part 2 covers compliance testing methods. Part 1 is 219 titled "Digital Compression and Coding of Continuous-tone Still Images, 243 220 Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS 244 221 10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of 245 222 Continuous-tone Still Images, Part 2: Compliance testing" and has document 246 223 numbers ISO/IEC IS 10918-2, ITU-T T.83. 247 248 Some extensions to the original JPEG standard are defined in JPEG Part 3, 249 a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG 250 currently does not support any Part 3 extensions.224 IJG JPEG 8 introduces an implementation of the JPEG SmartScale extension 225 which is specified in a contributed document at ITU and ISO with title "ITU-T 226 JPEG-Plus Proposal for Extending ITU-T T.81 for Advanced Image Coding", April 227 2006, Geneva, Switzerland. The latest version of the document is Revision 3. 251 228 252 229 The JPEG standard does not specify all details of an interchangeable file 253 230 format. For the omitted details we follow the "JFIF" conventions, revision 254 1.02. A copy of the JFIF spec is available from: 255 Literature Department 256 C-Cube Microsystems, Inc. 257 1778 McCarthy Blvd. 258 Milpitas, CA 95035 259 phone (408) 944-6300, fax (408) 944-6314 260 A PostScript version of this document is available by FTP at 261 ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text 262 version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing 263 the figures. 231 1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report 232 and thus received a formal publication status. It is available as a free 233 download in PDF format from 234 http://www.ecma-international.org/publications/techreports/E-TR-098.htm. 235 A PostScript version of the JFIF document is available at 236 http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at 237 http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. 264 238 265 239 The TIFF 6.0 file format specification can be obtained by FTP from … … 268 242 IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). 269 243 Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 270 (Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or271 from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision244 (Compression tag 7). Copies of this Note can be obtained from 245 http://www.ijg.org/files/. It is expected that the next revision 272 246 of the TIFF spec will replace the 6.0 JPEG design with the Note's design. 273 247 Although IJG's own code does not support TIFF/JPEG, the free libtiff library 274 uses our library to implement TIFF/JPEG per the Note. libtiff is available 275 from ftp://ftp.sgi.com/graphics/tiff/. 248 uses our library to implement TIFF/JPEG per the Note. 276 249 277 250 … … 279 252 ================= 280 253 281 The "official" archive site for this software is ftp.uu.net (Internet 282 address 192.48.96.9). The most recent released version can always be found 283 there in directory graphics/jpeg. This particular version will be archived 284 as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have 285 direct Internet access, UUNET's archives are also available via UUCP; contact 286 help@uunet.uu.net for information on retrieving files that way. 287 288 Numerous Internet sites maintain copies of the UUNET files. However, only 289 ftp.uu.net is guaranteed to have the latest official version. 290 291 You can also obtain this software in DOS-compatible "zip" archive format from 292 the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or 293 on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 294 "JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net 295 release. 296 297 The JPEG FAQ (Frequently Asked Questions) article is a useful source of 298 general information about JPEG. It is updated constantly and therefore is 299 not included in this distribution. The FAQ is posted every two weeks to 300 Usenet newsgroups comp.graphics.misc, news.answers, and other groups. 254 The "official" archive site for this software is www.ijg.org. 255 The most recent released version can always be found there in 256 directory "files". This particular version will be archived as 257 http://www.ijg.org/files/jpegsrc.v8.tar.gz, and in Windows-compatible 258 "zip" archive format as http://www.ijg.org/files/jpegsr8.zip. 259 260 The JPEG FAQ (Frequently Asked Questions) article is a source of some 261 general information about JPEG. 301 262 It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ 302 263 and other news.answers archive sites, including the official news.answers … … 308 269 309 270 310 RELATED SOFTWARE 311 ================ 312 313 Numerous viewing and image manipulation programs now support JPEG. (Quite a 314 few of them use this library to do so.) The JPEG FAQ described above lists 315 some of the more popular free and shareware viewers, and tells where to 316 obtain them on Internet. 317 318 If you are on a Unix machine, we highly recommend Jef Poskanzer's free 319 PBMPLUS software, which provides many useful operations on PPM-format image 320 files. In particular, it can convert PPM images to and from a wide range of 321 other formats, thus making cjpeg/djpeg considerably more useful. The latest 322 version is distributed by the NetPBM group, and is available from numerous 323 sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/. 324 Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is; 325 you are likely to have difficulty making it work on any non-Unix machine. 326 327 A different free JPEG implementation, written by the PVRG group at Stanford, 328 is available from ftp://havefun.stanford.edu/pub/jpeg/. This program 329 is designed for research and experimentation rather than production use; 330 it is slower, harder to use, and less portable than the IJG code, but it 331 is easier to read and modify. Also, the PVRG code supports lossless JPEG, 332 which we do not. (On the other hand, it doesn't do progressive JPEG.) 271 ACKNOWLEDGMENTS 272 =============== 273 274 Thank to Juergen Bruder for providing me with a copy of the common DCT 275 algorithm article, only to find out that I had come to the same result 276 in a more direct and comprehensible way with a more generative approach. 277 278 Thank to Istvan Sebestyen and Joan L. Mitchell for inviting me to the 279 ITU JPEG (Study Group 16) meeting in Geneva, Switzerland. 280 281 Thank to Thomas Wiegand and Gary Sullivan for inviting me to the 282 Joint Video Team (MPEG & ITU) meeting in Geneva, Switzerland. 283 284 Thank to John Korejwa and Massimo Ballerini for inviting me to 285 fruitful consultations in Boston, MA and Milan, Italy. 286 287 Thank to Hendrik Elstner, Roland Fassauer, Simone Zuck, Guenther 288 Maier-Gerber, and Walter Stoeber for corresponding business development. 289 290 Thank to Nico Zschach and Dirk Stelling of the technical support team 291 at the Digital Images company in Halle for providing me with extra 292 equipment for configuration tests. 293 294 Thank to Richard F. Lyon (then of Foveon Inc.) for fruitful 295 communication about JPEG configuration in Sigma Photo Pro software. 296 297 Thank to Andrew Finkenstadt for hosting the ijg.org site. 298 299 Last but not least special thank to Thomas G. Lane for the original 300 design and development of this singular software package. 333 301 334 302 … … 336 304 ================ 337 305 338 Some JPEG programs produce files that are not compatible with our library. 339 The root of the problem is that the ISO JPEG committee failed to specify a 340 concrete file format. Some vendors "filled in the blanks" on their own, 341 creating proprietary formats that no one else could read. (For example, none 342 of the early commercial JPEG implementations for the Macintosh were able to 343 exchange compressed files.) 344 345 The file format we have adopted is called JFIF (see REFERENCES). This format 346 has been agreed to by a number of major commercial JPEG vendors, and it has 347 become the de facto standard. JFIF is a minimal or "low end" representation. 348 We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF 349 Technical Note #2) for "high end" applications that need to record a lot of 350 additional data about an image. TIFF/JPEG is fairly new and not yet widely 351 supported, unfortunately. 352 353 The upcoming JPEG Part 3 standard defines a file format called SPIFF. 354 SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should 355 be able to read the most common variant of SPIFF. SPIFF has some technical 356 advantages over JFIF, but its major claim to fame is simply that it is an 357 official standard rather than an informal one. At this point it is unclear 358 whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto 359 standard. IJG intends to support SPIFF once the standard is frozen, but we 360 have not decided whether it should become our default output format or not. 361 (In any case, our decoder will remain capable of reading JFIF indefinitely.) 362 363 Various proprietary file formats incorporating JPEG compression also exist. 364 We have little or no sympathy for the existence of these formats. Indeed, 306 The ISO JPEG standards committee actually promotes different formats like 307 "JPEG 2000" or "JPEG XR" which are incompatible with original DCT-based 308 JPEG and which are based on faulty technologies. IJG therefore does not 309 and will not support such momentary mistakes (see REFERENCES). 310 We have little or no sympathy for the promotion of these formats. Indeed, 365 311 one of the original reasons for developing this free software was to help 366 force convergence on common, open format standards for JPEG files. Don't 367 use a proprietary file format! 312 force convergence on common, interoperable format standards for JPEG files. 313 Don't use an incompatible file format! 314 (In any case, our decoder will remain capable of reading existing JPEG 315 image files indefinitely.) 368 316 369 317 … … 371 319 ===== 372 320 373 The major thrust for v7 will probably be improvement of visual quality. 374 The current method for scaling the quantization tables is known not to be 375 very good at low Q values. We also intend to investigate block boundary 376 smoothing, "poor man's variable quantization", and other means of improving 377 quality-vs-file-size performance without sacrificing compatibility. 378 379 In future versions, we are considering supporting some of the upcoming JPEG 380 Part 3 extensions --- principally, variable quantization and the SPIFF file 381 format. 382 383 As always, speeding things up is of great interest. 384 385 Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. 321 Version 8.0 is the first release of a new generation JPEG standard 322 to overcome the limitations of the original JPEG specification. 323 More features are being prepared for coming releases... 324 325 Please send bug reports, offers of help, etc. to jpeg-info@uc.ag. -
trunk/src/3rdparty/libjpeg/change.log
r2 r846 1 1 CHANGE LOG for Independent JPEG Group's JPEG software 2 3 4 Version 8 10-Jan-2010 5 ---------------------- 6 7 jpegtran now supports the same -scale option as djpeg for "lossless" resize. 8 An implementation of the JPEG SmartScale extension is required for this 9 feature. A (draft) specification of the JPEG SmartScale extension is 10 available as a contributed document at ITU and ISO. Revision 2 or later 11 of the document is required (latest document version is Revision 3). 12 The SmartScale extension will enable more features beside lossless resize 13 in future implementations, as described in the document (new compression 14 options). 15 16 Add sanity check in BMP reader module to avoid cjpeg crash for empty input 17 image (thank to Isaev Ildar of ISP RAS, Moscow, RU for reporting this error). 18 19 Add data source and destination managers for read from and write to 20 memory buffers. New API functions jpeg_mem_src and jpeg_mem_dest. 21 Thank to Roberto Boni from Italy for the suggestion. 22 23 24 Version 7 27-Jun-2009 25 ---------------------- 26 27 New scaled DCTs implemented. 28 djpeg now supports scalings N/8 with all N from 1 to 16. 29 cjpeg now supports scalings 8/N with all N from 1 to 16. 30 Scaled DCTs with size larger than 8 are now also used for resolving the 31 common 2x2 chroma subsampling case without additional spatial resampling. 32 Separate spatial resampling for those kind of files is now only necessary 33 for N>8 scaling cases. 34 Furthermore, separate scaled DCT functions are provided for direct resolving 35 of the common asymmetric subsampling cases (2x1 and 1x2) without additional 36 spatial resampling. 37 38 cjpeg -quality option has been extended for support of separate quality 39 settings for luminance and chrominance (or in general, for every provided 40 quantization table slot). 41 New API function jpeg_default_qtables() and q_scale_factor array in library. 42 43 Added -nosmooth option to cjpeg, complementary to djpeg. 44 New variable "do_fancy_downsampling" in library, complement to fancy 45 upsampling. Fancy upsampling now uses direct DCT scaling with sizes 46 larger than 8. The old method is not reversible and has been removed. 47 48 Support arithmetic entropy encoding and decoding. 49 Added files jaricom.c, jcarith.c, jdarith.c. 50 51 Straighten the file structure: 52 Removed files jidctred.c, jcphuff.c, jchuff.h, jdphuff.c, jdhuff.h. 53 54 jpegtran has a new "lossless" cropping feature. 55 56 Implement -perfect option in jpegtran, new API function 57 jtransform_perfect_transform() in transupp. (DP 204_perfect.dpatch) 58 59 Better error messages for jpegtran fopen failure. 60 (DP 203_jpegtran_errmsg.dpatch) 61 62 Fix byte order issue with 16bit PPM/PGM files in rdppm.c/wrppm.c: 63 according to Netpbm, the de facto standard implementation of the PNM formats, 64 the most significant byte is first. (DP 203_rdppm.dpatch) 65 66 Add -raw option to rdjpgcom not to mangle the output. 67 (DP 205_rdjpgcom_raw.dpatch) 68 69 Make rdjpgcom locale aware. (DP 201_rdjpgcom_locale.dpatch) 70 71 Add extern "C" to jpeglib.h. 72 This avoids the need to put extern "C" { ... } around #include "jpeglib.h" 73 in your C++ application. Defining the symbol DONT_USE_EXTERN_C in the 74 configuration prevents this. (DP 202_jpeglib.h_c++.dpatch) 2 75 3 76 -
trunk/src/3rdparty/libjpeg/jcapimin.c
r2 r846 64 64 cinfo->comp_info = NULL; 65 65 66 for (i = 0; i < NUM_QUANT_TBLS; i++) 66 for (i = 0; i < NUM_QUANT_TBLS; i++) { 67 67 cinfo->quant_tbl_ptrs[i] = NULL; 68 cinfo->q_scale_factor[i] = 100; 69 } 68 70 69 71 for (i = 0; i < NUM_HUFF_TBLS; i++) { -
trunk/src/3rdparty/libjpeg/jccoefct.c
r2 r846 150 150 JDIMENSION ypos, xpos; 151 151 jpeg_component_info *compptr; 152 forward_DCT_ptr forward_DCT; 152 153 153 154 /* Loop to write as much as one whole iMCU row */ … … 168 169 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 169 170 compptr = cinfo->cur_comp_info[ci]; 171 forward_DCT = cinfo->fdct->forward_DCT[compptr->component_index]; 170 172 blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width 171 173 : compptr->last_col_width; 172 174 xpos = MCU_col_num * compptr->MCU_sample_width; 173 ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ 175 ypos = yoffset * compptr->DCT_v_scaled_size; 176 /* ypos == (yoffset+yindex) * DCTSIZE */ 174 177 for (yindex = 0; yindex < compptr->MCU_height; yindex++) { 175 178 if (coef->iMCU_row_num < last_iMCU_row || 176 179 yoffset+yindex < compptr->last_row_height) { 177 (* cinfo->fdct->forward_DCT) (cinfo, compptr,178 179 180 180 (*forward_DCT) (cinfo, compptr, 181 input_buf[compptr->component_index], 182 coef->MCU_buffer[blkn], 183 ypos, xpos, (JDIMENSION) blockcnt); 181 184 if (blockcnt < compptr->MCU_width) { 182 185 /* Create some dummy blocks at the right edge of the image. */ … … 196 199 } 197 200 blkn += compptr->MCU_width; 198 ypos += DCTSIZE;201 ypos += compptr->DCT_v_scaled_size; 199 202 } 200 203 } … … 253 256 JBLOCKARRAY buffer; 254 257 JBLOCKROW thisblockrow, lastblockrow; 258 forward_DCT_ptr forward_DCT; 255 259 256 260 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; … … 275 279 if (ndummy > 0) 276 280 ndummy = h_samp_factor - ndummy; 281 forward_DCT = cinfo->fdct->forward_DCT[ci]; 277 282 /* Perform DCT for all non-dummy blocks in this iMCU row. Each call 278 283 * on forward_DCT processes a complete horizontal row of DCT blocks. … … 280 285 for (block_row = 0; block_row < block_rows; block_row++) { 281 286 thisblockrow = buffer[block_row]; 282 (*cinfo->fdct->forward_DCT) (cinfo, compptr, 283 input_buf[ci], thisblockrow, 284 (JDIMENSION) (block_row * DCTSIZE), 285 (JDIMENSION) 0, blocks_across); 287 (*forward_DCT) (cinfo, compptr, input_buf[ci], thisblockrow, 288 (JDIMENSION) (block_row * compptr->DCT_v_scaled_size), 289 (JDIMENSION) 0, blocks_across); 286 290 if (ndummy > 0) { 287 291 /* Create dummy blocks at the right edge of the image. */ -
trunk/src/3rdparty/libjpeg/jcdctmgr.c
r2 r846 24 24 25 25 /* Pointer to the DCT routine actually in use */ 26 forward_DCT_method_ptr do_dct ;26 forward_DCT_method_ptr do_dct[MAX_COMPONENTS]; 27 27 28 28 /* The actual post-DCT divisors --- not identical to the quant table … … 34 34 #ifdef DCT_FLOAT_SUPPORTED 35 35 /* Same as above for the floating-point case. */ 36 float_DCT_method_ptr do_float_dct ;36 float_DCT_method_ptr do_float_dct[MAX_COMPONENTS]; 37 37 FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; 38 38 #endif … … 40 40 41 41 typedef my_fdct_controller * my_fdct_ptr; 42 43 44 /* The current scaled-DCT routines require ISLOW-style divisor tables, 45 * so be sure to compile that code if either ISLOW or SCALING is requested. 46 */ 47 #ifdef DCT_ISLOW_SUPPORTED 48 #define PROVIDE_ISLOW_TABLES 49 #else 50 #ifdef DCT_SCALING_SUPPORTED 51 #define PROVIDE_ISLOW_TABLES 52 #endif 53 #endif 54 55 56 /* 57 * Perform forward DCT on one or more blocks of a component. 58 * 59 * The input samples are taken from the sample_data[] array starting at 60 * position start_row/start_col, and moving to the right for any additional 61 * blocks. The quantized coefficients are returned in coef_blocks[]. 62 */ 63 64 METHODDEF(void) 65 forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, 66 JSAMPARRAY sample_data, JBLOCKROW coef_blocks, 67 JDIMENSION start_row, JDIMENSION start_col, 68 JDIMENSION num_blocks) 69 /* This version is used for integer DCT implementations. */ 70 { 71 /* This routine is heavily used, so it's worth coding it tightly. */ 72 my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; 73 forward_DCT_method_ptr do_dct = fdct->do_dct[compptr->component_index]; 74 DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; 75 DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ 76 JDIMENSION bi; 77 78 sample_data += start_row; /* fold in the vertical offset once */ 79 80 for (bi = 0; bi < num_blocks; bi++, start_col += compptr->DCT_h_scaled_size) { 81 /* Perform the DCT */ 82 (*do_dct) (workspace, sample_data, start_col); 83 84 /* Quantize/descale the coefficients, and store into coef_blocks[] */ 85 { register DCTELEM temp, qval; 86 register int i; 87 register JCOEFPTR output_ptr = coef_blocks[bi]; 88 89 for (i = 0; i < DCTSIZE2; i++) { 90 qval = divisors[i]; 91 temp = workspace[i]; 92 /* Divide the coefficient value by qval, ensuring proper rounding. 93 * Since C does not specify the direction of rounding for negative 94 * quotients, we have to force the dividend positive for portability. 95 * 96 * In most files, at least half of the output values will be zero 97 * (at default quantization settings, more like three-quarters...) 98 * so we should ensure that this case is fast. On many machines, 99 * a comparison is enough cheaper than a divide to make a special test 100 * a win. Since both inputs will be nonnegative, we need only test 101 * for a < b to discover whether a/b is 0. 102 * If your machine's division is fast enough, define FAST_DIVIDE. 103 */ 104 #ifdef FAST_DIVIDE 105 #define DIVIDE_BY(a,b) a /= b 106 #else 107 #define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 108 #endif 109 if (temp < 0) { 110 temp = -temp; 111 temp += qval>>1; /* for rounding */ 112 DIVIDE_BY(temp, qval); 113 temp = -temp; 114 } else { 115 temp += qval>>1; /* for rounding */ 116 DIVIDE_BY(temp, qval); 117 } 118 output_ptr[i] = (JCOEF) temp; 119 } 120 } 121 } 122 } 123 124 125 #ifdef DCT_FLOAT_SUPPORTED 126 127 METHODDEF(void) 128 forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, 129 JSAMPARRAY sample_data, JBLOCKROW coef_blocks, 130 JDIMENSION start_row, JDIMENSION start_col, 131 JDIMENSION num_blocks) 132 /* This version is used for floating-point DCT implementations. */ 133 { 134 /* This routine is heavily used, so it's worth coding it tightly. */ 135 my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; 136 float_DCT_method_ptr do_dct = fdct->do_float_dct[compptr->component_index]; 137 FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; 138 FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ 139 JDIMENSION bi; 140 141 sample_data += start_row; /* fold in the vertical offset once */ 142 143 for (bi = 0; bi < num_blocks; bi++, start_col += compptr->DCT_h_scaled_size) { 144 /* Perform the DCT */ 145 (*do_dct) (workspace, sample_data, start_col); 146 147 /* Quantize/descale the coefficients, and store into coef_blocks[] */ 148 { register FAST_FLOAT temp; 149 register int i; 150 register JCOEFPTR output_ptr = coef_blocks[bi]; 151 152 for (i = 0; i < DCTSIZE2; i++) { 153 /* Apply the quantization and scaling factor */ 154 temp = workspace[i] * divisors[i]; 155 /* Round to nearest integer. 156 * Since C does not specify the direction of rounding for negative 157 * quotients, we have to force the dividend positive for portability. 158 * The maximum coefficient size is +-16K (for 12-bit data), so this 159 * code should work for either 16-bit or 32-bit ints. 160 */ 161 output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); 162 } 163 } 164 } 165 } 166 167 #endif /* DCT_FLOAT_SUPPORTED */ 42 168 43 169 … … 57 183 int ci, qtblno, i; 58 184 jpeg_component_info *compptr; 185 int method = 0; 59 186 JQUANT_TBL * qtbl; 60 187 DCTELEM * dtbl; … … 62 189 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 63 190 ci++, compptr++) { 191 /* Select the proper DCT routine for this component's scaling */ 192 switch ((compptr->DCT_h_scaled_size << 8) + compptr->DCT_v_scaled_size) { 193 #ifdef DCT_SCALING_SUPPORTED 194 case ((1 << 8) + 1): 195 fdct->do_dct[ci] = jpeg_fdct_1x1; 196 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 197 break; 198 case ((2 << 8) + 2): 199 fdct->do_dct[ci] = jpeg_fdct_2x2; 200 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 201 break; 202 case ((3 << 8) + 3): 203 fdct->do_dct[ci] = jpeg_fdct_3x3; 204 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 205 break; 206 case ((4 << 8) + 4): 207 fdct->do_dct[ci] = jpeg_fdct_4x4; 208 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 209 break; 210 case ((5 << 8) + 5): 211 fdct->do_dct[ci] = jpeg_fdct_5x5; 212 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 213 break; 214 case ((6 << 8) + 6): 215 fdct->do_dct[ci] = jpeg_fdct_6x6; 216 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 217 break; 218 case ((7 << 8) + 7): 219 fdct->do_dct[ci] = jpeg_fdct_7x7; 220 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 221 break; 222 case ((9 << 8) + 9): 223 fdct->do_dct[ci] = jpeg_fdct_9x9; 224 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 225 break; 226 case ((10 << 8) + 10): 227 fdct->do_dct[ci] = jpeg_fdct_10x10; 228 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 229 break; 230 case ((11 << 8) + 11): 231 fdct->do_dct[ci] = jpeg_fdct_11x11; 232 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 233 break; 234 case ((12 << 8) + 12): 235 fdct->do_dct[ci] = jpeg_fdct_12x12; 236 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 237 break; 238 case ((13 << 8) + 13): 239 fdct->do_dct[ci] = jpeg_fdct_13x13; 240 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 241 break; 242 case ((14 << 8) + 14): 243 fdct->do_dct[ci] = jpeg_fdct_14x14; 244 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 245 break; 246 case ((15 << 8) + 15): 247 fdct->do_dct[ci] = jpeg_fdct_15x15; 248 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 249 break; 250 case ((16 << 8) + 16): 251 fdct->do_dct[ci] = jpeg_fdct_16x16; 252 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 253 break; 254 case ((16 << 8) + 8): 255 fdct->do_dct[ci] = jpeg_fdct_16x8; 256 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 257 break; 258 case ((14 << 8) + 7): 259 fdct->do_dct[ci] = jpeg_fdct_14x7; 260 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 261 break; 262 case ((12 << 8) + 6): 263 fdct->do_dct[ci] = jpeg_fdct_12x6; 264 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 265 break; 266 case ((10 << 8) + 5): 267 fdct->do_dct[ci] = jpeg_fdct_10x5; 268 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 269 break; 270 case ((8 << 8) + 4): 271 fdct->do_dct[ci] = jpeg_fdct_8x4; 272 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 273 break; 274 case ((6 << 8) + 3): 275 fdct->do_dct[ci] = jpeg_fdct_6x3; 276 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 277 break; 278 case ((4 << 8) + 2): 279 fdct->do_dct[ci] = jpeg_fdct_4x2; 280 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 281 break; 282 case ((2 << 8) + 1): 283 fdct->do_dct[ci] = jpeg_fdct_2x1; 284 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 285 break; 286 case ((8 << 8) + 16): 287 fdct->do_dct[ci] = jpeg_fdct_8x16; 288 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 289 break; 290 case ((7 << 8) + 14): 291 fdct->do_dct[ci] = jpeg_fdct_7x14; 292 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 293 break; 294 case ((6 << 8) + 12): 295 fdct->do_dct[ci] = jpeg_fdct_6x12; 296 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 297 break; 298 case ((5 << 8) + 10): 299 fdct->do_dct[ci] = jpeg_fdct_5x10; 300 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 301 break; 302 case ((4 << 8) + 8): 303 fdct->do_dct[ci] = jpeg_fdct_4x8; 304 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 305 break; 306 case ((3 << 8) + 6): 307 fdct->do_dct[ci] = jpeg_fdct_3x6; 308 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 309 break; 310 case ((2 << 8) + 4): 311 fdct->do_dct[ci] = jpeg_fdct_2x4; 312 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 313 break; 314 case ((1 << 8) + 2): 315 fdct->do_dct[ci] = jpeg_fdct_1x2; 316 method = JDCT_ISLOW; /* jfdctint uses islow-style table */ 317 break; 318 #endif 319 case ((DCTSIZE << 8) + DCTSIZE): 320 switch (cinfo->dct_method) { 321 #ifdef DCT_ISLOW_SUPPORTED 322 case JDCT_ISLOW: 323 fdct->do_dct[ci] = jpeg_fdct_islow; 324 method = JDCT_ISLOW; 325 break; 326 #endif 327 #ifdef DCT_IFAST_SUPPORTED 328 case JDCT_IFAST: 329 fdct->do_dct[ci] = jpeg_fdct_ifast; 330 method = JDCT_IFAST; 331 break; 332 #endif 333 #ifdef DCT_FLOAT_SUPPORTED 334 case JDCT_FLOAT: 335 fdct->do_float_dct[ci] = jpeg_fdct_float; 336 method = JDCT_FLOAT; 337 break; 338 #endif 339 default: 340 ERREXIT(cinfo, JERR_NOT_COMPILED); 341 break; 342 } 343 break; 344 default: 345 ERREXIT2(cinfo, JERR_BAD_DCTSIZE, 346 compptr->DCT_h_scaled_size, compptr->DCT_v_scaled_size); 347 break; 348 } 64 349 qtblno = compptr->quant_tbl_no; 65 350 /* Make sure specified quantization table is present */ … … 70 355 /* Compute divisors for this quant table */ 71 356 /* We may do this more than once for same table, but it's not a big deal */ 72 switch ( cinfo->dct_method) {73 #ifdef DCT_ISLOW_SUPPORTED357 switch (method) { 358 #ifdef PROVIDE_ISLOW_TABLES 74 359 case JDCT_ISLOW: 75 360 /* For LL&M IDCT method, divisors are equal to raw quantization … … 85 370 dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; 86 371 } 372 fdct->pub.forward_DCT[ci] = forward_DCT; 87 373 break; 88 374 #endif … … 123 409 } 124 410 } 411 fdct->pub.forward_DCT[ci] = forward_DCT; 125 412 break; 126 413 #endif … … 159 446 } 160 447 } 448 fdct->pub.forward_DCT[ci] = forward_DCT_float; 161 449 break; 162 450 #endif … … 167 455 } 168 456 } 169 170 171 /*172 * Perform forward DCT on one or more blocks of a component.173 *174 * The input samples are taken from the sample_data[] array starting at175 * position start_row/start_col, and moving to the right for any additional176 * blocks. The quantized coefficients are returned in coef_blocks[].177 */178 179 METHODDEF(void)180 forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,181 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,182 JDIMENSION start_row, JDIMENSION start_col,183 JDIMENSION num_blocks)184 /* This version is used for integer DCT implementations. */185 {186 /* This routine is heavily used, so it's worth coding it tightly. */187 my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;188 forward_DCT_method_ptr do_dct = fdct->do_dct;189 DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];190 DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */191 JDIMENSION bi;192 193 sample_data += start_row; /* fold in the vertical offset once */194 195 for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {196 /* Load data into workspace, applying unsigned->signed conversion */197 { register DCTELEM *workspaceptr;198 register JSAMPROW elemptr;199 register int elemr;200 201 workspaceptr = workspace;202 for (elemr = 0; elemr < DCTSIZE; elemr++) {203 elemptr = sample_data[elemr] + start_col;204 #if DCTSIZE == 8 /* unroll the inner loop */205 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;206 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;207 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;208 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;209 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;210 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;211 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;212 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;213 #else214 { register int elemc;215 for (elemc = DCTSIZE; elemc > 0; elemc--) {216 *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;217 }218 }219 #endif220 }221 }222 223 /* Perform the DCT */224 (*do_dct) (workspace);225 226 /* Quantize/descale the coefficients, and store into coef_blocks[] */227 { register DCTELEM temp, qval;228 register int i;229 register JCOEFPTR output_ptr = coef_blocks[bi];230 231 for (i = 0; i < DCTSIZE2; i++) {232 qval = divisors[i];233 temp = workspace[i];234 /* Divide the coefficient value by qval, ensuring proper rounding.235 * Since C does not specify the direction of rounding for negative236 * quotients, we have to force the dividend positive for portability.237 *238 * In most files, at least half of the output values will be zero239 * (at default quantization settings, more like three-quarters...)240 * so we should ensure that this case is fast. On many machines,241 * a comparison is enough cheaper than a divide to make a special test242 * a win. Since both inputs will be nonnegative, we need only test243 * for a < b to discover whether a/b is 0.244 * If your machine's division is fast enough, define FAST_DIVIDE.245 */246 #ifdef FAST_DIVIDE247 #define DIVIDE_BY(a,b) a /= b248 #else249 #define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0250 #endif251 if (temp < 0) {252 temp = -temp;253 temp += qval>>1; /* for rounding */254 DIVIDE_BY(temp, qval);255 temp = -temp;256 } else {257 temp += qval>>1; /* for rounding */258 DIVIDE_BY(temp, qval);259 }260 output_ptr[i] = (JCOEF) temp;261 }262 }263 }264 }265 266 267 #ifdef DCT_FLOAT_SUPPORTED268 269 METHODDEF(void)270 forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,271 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,272 JDIMENSION start_row, JDIMENSION start_col,273 JDIMENSION num_blocks)274 /* This version is used for floating-point DCT implementations. */275 {276 /* This routine is heavily used, so it's worth coding it tightly. */277 my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;278 float_DCT_method_ptr do_dct = fdct->do_float_dct;279 FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no];280 FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */281 JDIMENSION bi;282 283 sample_data += start_row; /* fold in the vertical offset once */284 285 for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {286 /* Load data into workspace, applying unsigned->signed conversion */287 { register FAST_FLOAT *workspaceptr;288 register JSAMPROW elemptr;289 register int elemr;290 291 workspaceptr = workspace;292 for (elemr = 0; elemr < DCTSIZE; elemr++) {293 elemptr = sample_data[elemr] + start_col;294 #if DCTSIZE == 8 /* unroll the inner loop */295 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);296 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);297 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);298 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);299 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);300 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);301 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);302 *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);303 #else304 { register int elemc;305 for (elemc = DCTSIZE; elemc > 0; elemc--) {306 *workspaceptr++ = (FAST_FLOAT)307 (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);308 }309 }310 #endif311 }312 }313 314 /* Perform the DCT */315 (*do_dct) (workspace);316 317 /* Quantize/descale the coefficients, and store into coef_blocks[] */318 { register FAST_FLOAT temp;319 register int i;320 register JCOEFPTR output_ptr = coef_blocks[bi];321 322 for (i = 0; i < DCTSIZE2; i++) {323 /* Apply the quantization and scaling factor */324 temp = workspace[i] * divisors[i];325 /* Round to nearest integer.326 * Since C does not specify the direction of rounding for negative327 * quotients, we have to force the dividend positive for portability.328 * The maximum coefficient size is +-16K (for 12-bit data), so this329 * code should work for either 16-bit or 32-bit ints.330 */331 output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);332 }333 }334 }335 }336 337 #endif /* DCT_FLOAT_SUPPORTED */338 457 339 458 … … 354 473 fdct->pub.start_pass = start_pass_fdctmgr; 355 474 356 switch (cinfo->dct_method) {357 #ifdef DCT_ISLOW_SUPPORTED358 case JDCT_ISLOW:359 fdct->pub.forward_DCT = forward_DCT;360 fdct->do_dct = jpeg_fdct_islow;361 break;362 #endif363 #ifdef DCT_IFAST_SUPPORTED364 case JDCT_IFAST:365 fdct->pub.forward_DCT = forward_DCT;366 fdct->do_dct = jpeg_fdct_ifast;367 break;368 #endif369 #ifdef DCT_FLOAT_SUPPORTED370 case JDCT_FLOAT:371 fdct->pub.forward_DCT = forward_DCT_float;372 fdct->do_float_dct = jpeg_fdct_float;373 break;374 #endif375 default:376 ERREXIT(cinfo, JERR_NOT_COMPILED);377 break;378 }379 380 475 /* Mark divisor tables unallocated */ 381 476 for (i = 0; i < NUM_QUANT_TBLS; i++) { -
trunk/src/3rdparty/libjpeg/jchuff.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 2006-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. 7 8 * 8 9 * This file contains Huffman entropy encoding routines. 10 * Both sequential and progressive modes are supported in this single module. 9 11 * 10 12 * Much of the complexity here has to do with supporting output suspension. … … 13 15 * variables into local working storage, and update them back to the 14 16 * permanent JPEG objects only upon successful completion of an MCU. 17 * 18 * We do not support output suspension for the progressive JPEG mode, since 19 * the library currently does not allow multiple-scan files to be written 20 * with output suspension. 15 21 */ 16 22 … … 18 24 #include "jinclude.h" 19 25 #include "jpeglib.h" 20 #include "jchuff.h" /* Declarations shared with jcphuff.c */ 26 27 28 /* The legal range of a DCT coefficient is 29 * -1024 .. +1023 for 8-bit data; 30 * -16384 .. +16383 for 12-bit data. 31 * Hence the magnitude should always fit in 10 or 14 bits respectively. 32 */ 33 34 #if BITS_IN_JSAMPLE == 8 35 #define MAX_COEF_BITS 10 36 #else 37 #define MAX_COEF_BITS 14 38 #endif 39 40 /* Derived data constructed for each Huffman table */ 41 42 typedef struct { 43 unsigned int ehufco[256]; /* code for each symbol */ 44 char ehufsi[256]; /* length of code for each symbol */ 45 /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 46 } c_derived_tbl; 21 47 22 48 … … 66 92 c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; 67 93 68 #ifdef ENTROPY_OPT_SUPPORTED/* Statistics tables for optimization */94 /* Statistics tables for optimization */ 69 95 long * dc_count_ptrs[NUM_HUFF_TBLS]; 70 96 long * ac_count_ptrs[NUM_HUFF_TBLS]; 71 #endif 97 98 /* Following fields used only in progressive mode */ 99 100 /* Mode flag: TRUE for optimization, FALSE for actual data output */ 101 boolean gather_statistics; 102 103 /* next_output_byte/free_in_buffer are local copies of cinfo->dest fields. 104 */ 105 JOCTET * next_output_byte; /* => next byte to write in buffer */ 106 size_t free_in_buffer; /* # of byte spaces remaining in buffer */ 107 j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ 108 109 /* Coding status for AC components */ 110 int ac_tbl_no; /* the table number of the single component */ 111 unsigned int EOBRUN; /* run length of EOBs */ 112 unsigned int BE; /* # of buffered correction bits before MCU */ 113 char * bit_buffer; /* buffer for correction bits (1 per char) */ 114 /* packing correction bits tightly would save some space but cost time... */ 72 115 } huff_entropy_encoder; 73 116 74 117 typedef huff_entropy_encoder * huff_entropy_ptr; 75 118 76 /* Working state while writing an MCU .119 /* Working state while writing an MCU (sequential mode). 77 120 * This struct contains all the fields that are needed by subroutines. 78 121 */ … … 85 128 } working_state; 86 129 87 88 /* Forward declarations */ 89 METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, 90 JBLOCKROW *MCU_data)); 91 METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); 92 #ifdef ENTROPY_OPT_SUPPORTED 93 METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo, 94 JBLOCKROW *MCU_data)); 95 METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); 130 /* MAX_CORR_BITS is the number of bits the AC refinement correction-bit 131 * buffer can hold. Larger sizes may slightly improve compression, but 132 * 1000 is already well into the realm of overkill. 133 * The minimum safe size is 64 bits. 134 */ 135 136 #define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ 137 138 /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. 139 * We assume that int right shift is unsigned if INT32 right shift is, 140 * which should be safe. 141 */ 142 143 #ifdef RIGHT_SHIFT_IS_UNSIGNED 144 #define ISHIFT_TEMPS int ishift_temp; 145 #define IRIGHT_SHIFT(x,shft) \ 146 ((ishift_temp = (x)) < 0 ? \ 147 (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ 148 (ishift_temp >> (shft))) 149 #else 150 #define ISHIFT_TEMPS 151 #define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) 96 152 #endif 97 98 99 /*100 * Initialize for a Huffman-compressed scan.101 * If gather_statistics is TRUE, we do not output anything during the scan,102 * just count the Huffman symbols used and generate Huffman code tables.103 */104 105 METHODDEF(void)106 start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)107 {108 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;109 int ci, dctbl, actbl;110 jpeg_component_info * compptr;111 112 if (gather_statistics) {113 #ifdef ENTROPY_OPT_SUPPORTED114 entropy->pub.encode_mcu = encode_mcu_gather;115 entropy->pub.finish_pass = finish_pass_gather;116 #else117 ERREXIT(cinfo, JERR_NOT_COMPILED);118 #endif119 } else {120 entropy->pub.encode_mcu = encode_mcu_huff;121 entropy->pub.finish_pass = finish_pass_huff;122 }123 124 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {125 compptr = cinfo->cur_comp_info[ci];126 dctbl = compptr->dc_tbl_no;127 actbl = compptr->ac_tbl_no;128 if (gather_statistics) {129 #ifdef ENTROPY_OPT_SUPPORTED130 /* Check for invalid table indexes */131 /* (make_c_derived_tbl does this in the other path) */132 if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)133 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);134 if (actbl < 0 || actbl >= NUM_HUFF_TBLS)135 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);136 /* Allocate and zero the statistics tables */137 /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */138 if (entropy->dc_count_ptrs[dctbl] == NULL)139 entropy->dc_count_ptrs[dctbl] = (long *)140 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,141 257 * SIZEOF(long));142 MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));143 if (entropy->ac_count_ptrs[actbl] == NULL)144 entropy->ac_count_ptrs[actbl] = (long *)145 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,146 257 * SIZEOF(long));147 MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));148 #endif149 } else {150 /* Compute derived values for Huffman tables */151 /* We may do this more than once for a table, but it's not expensive */152 jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,153 & entropy->dc_derived_tbls[dctbl]);154 jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,155 & entropy->ac_derived_tbls[actbl]);156 }157 /* Initialize DC predictions to 0 */158 entropy->saved.last_dc_val[ci] = 0;159 }160 161 /* Initialize bit buffer to empty */162 entropy->saved.put_buffer = 0;163 entropy->saved.put_bits = 0;164 165 /* Initialize restart stuff */166 entropy->restarts_to_go = cinfo->restart_interval;167 entropy->next_restart_num = 0;168 }169 153 170 154 … … 172 156 * Compute the derived values for a Huffman table. 173 157 * This routine also performs some validation checks on the table. 174 * 175 * Note this is also used by jcphuff.c. 176 */ 177 178 GLOBAL(void) 158 */ 159 160 LOCAL(void) 179 161 jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, 180 162 c_derived_tbl ** pdtbl) … … 265 247 266 248 267 /* Outputting bytes to the file */ 249 /* Outputting bytes to the file. 250 * NB: these must be called only when actually outputting, 251 * that is, entropy->gather_statistics == FALSE. 252 */ 268 253 269 254 /* Emit a byte, taking 'action' if must suspend. */ 270 #define emit_byte (state,val,action) \255 #define emit_byte_s(state,val,action) \ 271 256 { *(state)->next_output_byte++ = (JOCTET) (val); \ 272 257 if (--(state)->free_in_buffer == 0) \ 273 if (! dump_buffer (state)) \258 if (! dump_buffer_s(state)) \ 274 259 { action; } } 275 260 261 /* Emit a byte */ 262 #define emit_byte_e(entropy,val) \ 263 { *(entropy)->next_output_byte++ = (JOCTET) (val); \ 264 if (--(entropy)->free_in_buffer == 0) \ 265 dump_buffer_e(entropy); } 266 276 267 277 268 LOCAL(boolean) 278 dump_buffer (working_state * state)269 dump_buffer_s (working_state * state) 279 270 /* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ 280 271 { … … 290 281 291 282 283 LOCAL(void) 284 dump_buffer_e (huff_entropy_ptr entropy) 285 /* Empty the output buffer; we do not support suspension in this case. */ 286 { 287 struct jpeg_destination_mgr * dest = entropy->cinfo->dest; 288 289 if (! (*dest->empty_output_buffer) (entropy->cinfo)) 290 ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND); 291 /* After a successful buffer dump, must reset buffer pointers */ 292 entropy->next_output_byte = dest->next_output_byte; 293 entropy->free_in_buffer = dest->free_in_buffer; 294 } 295 296 292 297 /* Outputting bits to the file */ 293 298 … … 300 305 INLINE 301 306 LOCAL(boolean) 302 emit_bits (working_state * state, unsigned int code, int size)307 emit_bits_s (working_state * state, unsigned int code, int size) 303 308 /* Emit some bits; return TRUE if successful, FALSE if must suspend */ 304 309 { … … 322 327 int c = (int) ((put_buffer >> 16) & 0xFF); 323 328 324 emit_byte (state, c, return FALSE);329 emit_byte_s(state, c, return FALSE); 325 330 if (c == 0xFF) { /* need to stuff a zero byte? */ 326 emit_byte (state, 0, return FALSE);331 emit_byte_s(state, 0, return FALSE); 327 332 } 328 333 put_buffer <<= 8; … … 337 342 338 343 344 INLINE 345 LOCAL(void) 346 emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size) 347 /* Emit some bits, unless we are in gather mode */ 348 { 349 /* This routine is heavily used, so it's worth coding tightly. */ 350 register INT32 put_buffer = (INT32) code; 351 register int put_bits = entropy->saved.put_bits; 352 353 /* if size is 0, caller used an invalid Huffman table entry */ 354 if (size == 0) 355 ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); 356 357 if (entropy->gather_statistics) 358 return; /* do nothing if we're only getting stats */ 359 360 put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ 361 362 put_bits += size; /* new number of bits in buffer */ 363 364 put_buffer <<= 24 - put_bits; /* align incoming bits */ 365 366 /* and merge with old buffer contents */ 367 put_buffer |= entropy->saved.put_buffer; 368 369 while (put_bits >= 8) { 370 int c = (int) ((put_buffer >> 16) & 0xFF); 371 372 emit_byte_e(entropy, c); 373 if (c == 0xFF) { /* need to stuff a zero byte? */ 374 emit_byte_e(entropy, 0); 375 } 376 put_buffer <<= 8; 377 put_bits -= 8; 378 } 379 380 entropy->saved.put_buffer = put_buffer; /* update variables */ 381 entropy->saved.put_bits = put_bits; 382 } 383 384 339 385 LOCAL(boolean) 340 flush_bits (working_state * state)341 { 342 if (! emit_bits (state, 0x7F, 7)) /* fill any partial byte with ones */386 flush_bits_s (working_state * state) 387 { 388 if (! emit_bits_s(state, 0x7F, 7)) /* fill any partial byte with ones */ 343 389 return FALSE; 344 state->cur.put_buffer = 0; /* and reset bit-buffer to empty */390 state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ 345 391 state->cur.put_bits = 0; 392 return TRUE; 393 } 394 395 396 LOCAL(void) 397 flush_bits_e (huff_entropy_ptr entropy) 398 { 399 emit_bits_e(entropy, 0x7F, 7); /* fill any partial byte with ones */ 400 entropy->saved.put_buffer = 0; /* and reset bit-buffer to empty */ 401 entropy->saved.put_bits = 0; 402 } 403 404 405 /* 406 * Emit (or just count) a Huffman symbol. 407 */ 408 409 INLINE 410 LOCAL(void) 411 emit_dc_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol) 412 { 413 if (entropy->gather_statistics) 414 entropy->dc_count_ptrs[tbl_no][symbol]++; 415 else { 416 c_derived_tbl * tbl = entropy->dc_derived_tbls[tbl_no]; 417 emit_bits_e(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); 418 } 419 } 420 421 422 INLINE 423 LOCAL(void) 424 emit_ac_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol) 425 { 426 if (entropy->gather_statistics) 427 entropy->ac_count_ptrs[tbl_no][symbol]++; 428 else { 429 c_derived_tbl * tbl = entropy->ac_derived_tbls[tbl_no]; 430 emit_bits_e(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); 431 } 432 } 433 434 435 /* 436 * Emit bits from a correction bit buffer. 437 */ 438 439 LOCAL(void) 440 emit_buffered_bits (huff_entropy_ptr entropy, char * bufstart, 441 unsigned int nbits) 442 { 443 if (entropy->gather_statistics) 444 return; /* no real work */ 445 446 while (nbits > 0) { 447 emit_bits_e(entropy, (unsigned int) (*bufstart), 1); 448 bufstart++; 449 nbits--; 450 } 451 } 452 453 454 /* 455 * Emit any pending EOBRUN symbol. 456 */ 457 458 LOCAL(void) 459 emit_eobrun (huff_entropy_ptr entropy) 460 { 461 register int temp, nbits; 462 463 if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ 464 temp = entropy->EOBRUN; 465 nbits = 0; 466 while ((temp >>= 1)) 467 nbits++; 468 /* safety check: shouldn't happen given limited correction-bit buffer */ 469 if (nbits > 14) 470 ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); 471 472 emit_ac_symbol(entropy, entropy->ac_tbl_no, nbits << 4); 473 if (nbits) 474 emit_bits_e(entropy, entropy->EOBRUN, nbits); 475 476 entropy->EOBRUN = 0; 477 478 /* Emit any buffered correction bits */ 479 emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE); 480 entropy->BE = 0; 481 } 482 } 483 484 485 /* 486 * Emit a restart marker & resynchronize predictions. 487 */ 488 489 LOCAL(boolean) 490 emit_restart_s (working_state * state, int restart_num) 491 { 492 int ci; 493 494 if (! flush_bits_s(state)) 495 return FALSE; 496 497 emit_byte_s(state, 0xFF, return FALSE); 498 emit_byte_s(state, JPEG_RST0 + restart_num, return FALSE); 499 500 /* Re-initialize DC predictions to 0 */ 501 for (ci = 0; ci < state->cinfo->comps_in_scan; ci++) 502 state->cur.last_dc_val[ci] = 0; 503 504 /* The restart counter is not updated until we successfully write the MCU. */ 505 506 return TRUE; 507 } 508 509 510 LOCAL(void) 511 emit_restart_e (huff_entropy_ptr entropy, int restart_num) 512 { 513 int ci; 514 515 emit_eobrun(entropy); 516 517 if (! entropy->gather_statistics) { 518 flush_bits_e(entropy); 519 emit_byte_e(entropy, 0xFF); 520 emit_byte_e(entropy, JPEG_RST0 + restart_num); 521 } 522 523 if (entropy->cinfo->Ss == 0) { 524 /* Re-initialize DC predictions to 0 */ 525 for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++) 526 entropy->saved.last_dc_val[ci] = 0; 527 } else { 528 /* Re-initialize all AC-related fields to 0 */ 529 entropy->EOBRUN = 0; 530 entropy->BE = 0; 531 } 532 } 533 534 535 /* 536 * MCU encoding for DC initial scan (either spectral selection, 537 * or first pass of successive approximation). 538 */ 539 540 METHODDEF(boolean) 541 encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) 542 { 543 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 544 register int temp, temp2; 545 register int nbits; 546 int blkn, ci; 547 int Al = cinfo->Al; 548 JBLOCKROW block; 549 jpeg_component_info * compptr; 550 ISHIFT_TEMPS 551 552 entropy->next_output_byte = cinfo->dest->next_output_byte; 553 entropy->free_in_buffer = cinfo->dest->free_in_buffer; 554 555 /* Emit restart marker if needed */ 556 if (cinfo->restart_interval) 557 if (entropy->restarts_to_go == 0) 558 emit_restart_e(entropy, entropy->next_restart_num); 559 560 /* Encode the MCU data blocks */ 561 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 562 block = MCU_data[blkn]; 563 ci = cinfo->MCU_membership[blkn]; 564 compptr = cinfo->cur_comp_info[ci]; 565 566 /* Compute the DC value after the required point transform by Al. 567 * This is simply an arithmetic right shift. 568 */ 569 temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); 570 571 /* DC differences are figured on the point-transformed values. */ 572 temp = temp2 - entropy->saved.last_dc_val[ci]; 573 entropy->saved.last_dc_val[ci] = temp2; 574 575 /* Encode the DC coefficient difference per section G.1.2.1 */ 576 temp2 = temp; 577 if (temp < 0) { 578 temp = -temp; /* temp is abs value of input */ 579 /* For a negative input, want temp2 = bitwise complement of abs(input) */ 580 /* This code assumes we are on a two's complement machine */ 581 temp2--; 582 } 583 584 /* Find the number of bits needed for the magnitude of the coefficient */ 585 nbits = 0; 586 while (temp) { 587 nbits++; 588 temp >>= 1; 589 } 590 /* Check for out-of-range coefficient values. 591 * Since we're encoding a difference, the range limit is twice as much. 592 */ 593 if (nbits > MAX_COEF_BITS+1) 594 ERREXIT(cinfo, JERR_BAD_DCT_COEF); 595 596 /* Count/emit the Huffman-coded symbol for the number of bits */ 597 emit_dc_symbol(entropy, compptr->dc_tbl_no, nbits); 598 599 /* Emit that number of bits of the value, if positive, */ 600 /* or the complement of its magnitude, if negative. */ 601 if (nbits) /* emit_bits rejects calls with size 0 */ 602 emit_bits_e(entropy, (unsigned int) temp2, nbits); 603 } 604 605 cinfo->dest->next_output_byte = entropy->next_output_byte; 606 cinfo->dest->free_in_buffer = entropy->free_in_buffer; 607 608 /* Update restart-interval state too */ 609 if (cinfo->restart_interval) { 610 if (entropy->restarts_to_go == 0) { 611 entropy->restarts_to_go = cinfo->restart_interval; 612 entropy->next_restart_num++; 613 entropy->next_restart_num &= 7; 614 } 615 entropy->restarts_to_go--; 616 } 617 618 return TRUE; 619 } 620 621 622 /* 623 * MCU encoding for AC initial scan (either spectral selection, 624 * or first pass of successive approximation). 625 */ 626 627 METHODDEF(boolean) 628 encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) 629 { 630 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 631 register int temp, temp2; 632 register int nbits; 633 register int r, k; 634 int Se, Al; 635 const int * natural_order; 636 JBLOCKROW block; 637 638 entropy->next_output_byte = cinfo->dest->next_output_byte; 639 entropy->free_in_buffer = cinfo->dest->free_in_buffer; 640 641 /* Emit restart marker if needed */ 642 if (cinfo->restart_interval) 643 if (entropy->restarts_to_go == 0) 644 emit_restart_e(entropy, entropy->next_restart_num); 645 646 Se = cinfo->Se; 647 Al = cinfo->Al; 648 natural_order = cinfo->natural_order; 649 650 /* Encode the MCU data block */ 651 block = MCU_data[0]; 652 653 /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ 654 655 r = 0; /* r = run length of zeros */ 656 657 for (k = cinfo->Ss; k <= Se; k++) { 658 if ((temp = (*block)[natural_order[k]]) == 0) { 659 r++; 660 continue; 661 } 662 /* We must apply the point transform by Al. For AC coefficients this 663 * is an integer division with rounding towards 0. To do this portably 664 * in C, we shift after obtaining the absolute value; so the code is 665 * interwoven with finding the abs value (temp) and output bits (temp2). 666 */ 667 if (temp < 0) { 668 temp = -temp; /* temp is abs value of input */ 669 temp >>= Al; /* apply the point transform */ 670 /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ 671 temp2 = ~temp; 672 } else { 673 temp >>= Al; /* apply the point transform */ 674 temp2 = temp; 675 } 676 /* Watch out for case that nonzero coef is zero after point transform */ 677 if (temp == 0) { 678 r++; 679 continue; 680 } 681 682 /* Emit any pending EOBRUN */ 683 if (entropy->EOBRUN > 0) 684 emit_eobrun(entropy); 685 /* if run length > 15, must emit special run-length-16 codes (0xF0) */ 686 while (r > 15) { 687 emit_ac_symbol(entropy, entropy->ac_tbl_no, 0xF0); 688 r -= 16; 689 } 690 691 /* Find the number of bits needed for the magnitude of the coefficient */ 692 nbits = 1; /* there must be at least one 1 bit */ 693 while ((temp >>= 1)) 694 nbits++; 695 /* Check for out-of-range coefficient values */ 696 if (nbits > MAX_COEF_BITS) 697 ERREXIT(cinfo, JERR_BAD_DCT_COEF); 698 699 /* Count/emit Huffman symbol for run length / number of bits */ 700 emit_ac_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); 701 702 /* Emit that number of bits of the value, if positive, */ 703 /* or the complement of its magnitude, if negative. */ 704 emit_bits_e(entropy, (unsigned int) temp2, nbits); 705 706 r = 0; /* reset zero run length */ 707 } 708 709 if (r > 0) { /* If there are trailing zeroes, */ 710 entropy->EOBRUN++; /* count an EOB */ 711 if (entropy->EOBRUN == 0x7FFF) 712 emit_eobrun(entropy); /* force it out to avoid overflow */ 713 } 714 715 cinfo->dest->next_output_byte = entropy->next_output_byte; 716 cinfo->dest->free_in_buffer = entropy->free_in_buffer; 717 718 /* Update restart-interval state too */ 719 if (cinfo->restart_interval) { 720 if (entropy->restarts_to_go == 0) { 721 entropy->restarts_to_go = cinfo->restart_interval; 722 entropy->next_restart_num++; 723 entropy->next_restart_num &= 7; 724 } 725 entropy->restarts_to_go--; 726 } 727 728 return TRUE; 729 } 730 731 732 /* 733 * MCU encoding for DC successive approximation refinement scan. 734 * Note: we assume such scans can be multi-component, although the spec 735 * is not very clear on the point. 736 */ 737 738 METHODDEF(boolean) 739 encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) 740 { 741 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 742 register int temp; 743 int blkn; 744 int Al = cinfo->Al; 745 JBLOCKROW block; 746 747 entropy->next_output_byte = cinfo->dest->next_output_byte; 748 entropy->free_in_buffer = cinfo->dest->free_in_buffer; 749 750 /* Emit restart marker if needed */ 751 if (cinfo->restart_interval) 752 if (entropy->restarts_to_go == 0) 753 emit_restart_e(entropy, entropy->next_restart_num); 754 755 /* Encode the MCU data blocks */ 756 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 757 block = MCU_data[blkn]; 758 759 /* We simply emit the Al'th bit of the DC coefficient value. */ 760 temp = (*block)[0]; 761 emit_bits_e(entropy, (unsigned int) (temp >> Al), 1); 762 } 763 764 cinfo->dest->next_output_byte = entropy->next_output_byte; 765 cinfo->dest->free_in_buffer = entropy->free_in_buffer; 766 767 /* Update restart-interval state too */ 768 if (cinfo->restart_interval) { 769 if (entropy->restarts_to_go == 0) { 770 entropy->restarts_to_go = cinfo->restart_interval; 771 entropy->next_restart_num++; 772 entropy->next_restart_num &= 7; 773 } 774 entropy->restarts_to_go--; 775 } 776 777 return TRUE; 778 } 779 780 781 /* 782 * MCU encoding for AC successive approximation refinement scan. 783 */ 784 785 METHODDEF(boolean) 786 encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) 787 { 788 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 789 register int temp; 790 register int r, k; 791 int EOB; 792 char *BR_buffer; 793 unsigned int BR; 794 int Se, Al; 795 const int * natural_order; 796 JBLOCKROW block; 797 int absvalues[DCTSIZE2]; 798 799 entropy->next_output_byte = cinfo->dest->next_output_byte; 800 entropy->free_in_buffer = cinfo->dest->free_in_buffer; 801 802 /* Emit restart marker if needed */ 803 if (cinfo->restart_interval) 804 if (entropy->restarts_to_go == 0) 805 emit_restart_e(entropy, entropy->next_restart_num); 806 807 Se = cinfo->Se; 808 Al = cinfo->Al; 809 natural_order = cinfo->natural_order; 810 811 /* Encode the MCU data block */ 812 block = MCU_data[0]; 813 814 /* It is convenient to make a pre-pass to determine the transformed 815 * coefficients' absolute values and the EOB position. 816 */ 817 EOB = 0; 818 for (k = cinfo->Ss; k <= Se; k++) { 819 temp = (*block)[natural_order[k]]; 820 /* We must apply the point transform by Al. For AC coefficients this 821 * is an integer division with rounding towards 0. To do this portably 822 * in C, we shift after obtaining the absolute value. 823 */ 824 if (temp < 0) 825 temp = -temp; /* temp is abs value of input */ 826 temp >>= Al; /* apply the point transform */ 827 absvalues[k] = temp; /* save abs value for main pass */ 828 if (temp == 1) 829 EOB = k; /* EOB = index of last newly-nonzero coef */ 830 } 831 832 /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ 833 834 r = 0; /* r = run length of zeros */ 835 BR = 0; /* BR = count of buffered bits added now */ 836 BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ 837 838 for (k = cinfo->Ss; k <= Se; k++) { 839 if ((temp = absvalues[k]) == 0) { 840 r++; 841 continue; 842 } 843 844 /* Emit any required ZRLs, but not if they can be folded into EOB */ 845 while (r > 15 && k <= EOB) { 846 /* emit any pending EOBRUN and the BE correction bits */ 847 emit_eobrun(entropy); 848 /* Emit ZRL */ 849 emit_ac_symbol(entropy, entropy->ac_tbl_no, 0xF0); 850 r -= 16; 851 /* Emit buffered correction bits that must be associated with ZRL */ 852 emit_buffered_bits(entropy, BR_buffer, BR); 853 BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ 854 BR = 0; 855 } 856 857 /* If the coef was previously nonzero, it only needs a correction bit. 858 * NOTE: a straight translation of the spec's figure G.7 would suggest 859 * that we also need to test r > 15. But if r > 15, we can only get here 860 * if k > EOB, which implies that this coefficient is not 1. 861 */ 862 if (temp > 1) { 863 /* The correction bit is the next bit of the absolute value. */ 864 BR_buffer[BR++] = (char) (temp & 1); 865 continue; 866 } 867 868 /* Emit any pending EOBRUN and the BE correction bits */ 869 emit_eobrun(entropy); 870 871 /* Count/emit Huffman symbol for run length / number of bits */ 872 emit_ac_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); 873 874 /* Emit output bit for newly-nonzero coef */ 875 temp = ((*block)[natural_order[k]] < 0) ? 0 : 1; 876 emit_bits_e(entropy, (unsigned int) temp, 1); 877 878 /* Emit buffered correction bits that must be associated with this code */ 879 emit_buffered_bits(entropy, BR_buffer, BR); 880 BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ 881 BR = 0; 882 r = 0; /* reset zero run length */ 883 } 884 885 if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ 886 entropy->EOBRUN++; /* count an EOB */ 887 entropy->BE += BR; /* concat my correction bits to older ones */ 888 /* We force out the EOB if we risk either: 889 * 1. overflow of the EOB counter; 890 * 2. overflow of the correction bit buffer during the next MCU. 891 */ 892 if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) 893 emit_eobrun(entropy); 894 } 895 896 cinfo->dest->next_output_byte = entropy->next_output_byte; 897 cinfo->dest->free_in_buffer = entropy->free_in_buffer; 898 899 /* Update restart-interval state too */ 900 if (cinfo->restart_interval) { 901 if (entropy->restarts_to_go == 0) { 902 entropy->restarts_to_go = cinfo->restart_interval; 903 entropy->next_restart_num++; 904 entropy->next_restart_num &= 7; 905 } 906 entropy->restarts_to_go--; 907 } 908 346 909 return TRUE; 347 910 } … … 357 920 register int nbits; 358 921 register int k, r, i; 359 922 int Se = state->cinfo->lim_Se; 923 const int * natural_order = state->cinfo->natural_order; 924 360 925 /* Encode the DC coefficient difference per section F.1.2.1 */ 361 926 362 927 temp = temp2 = block[0] - last_dc_val; 363 928 … … 368 933 temp2--; 369 934 } 370 935 371 936 /* Find the number of bits needed for the magnitude of the coefficient */ 372 937 nbits = 0; … … 380 945 if (nbits > MAX_COEF_BITS+1) 381 946 ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); 382 947 383 948 /* Emit the Huffman-coded symbol for the number of bits */ 384 if (! emit_bits (state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))949 if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) 385 950 return FALSE; 386 951 … … 388 953 /* or the complement of its magnitude, if negative. */ 389 954 if (nbits) /* emit_bits rejects calls with size 0 */ 390 if (! emit_bits (state, (unsigned int) temp2, nbits))955 if (! emit_bits_s(state, (unsigned int) temp2, nbits)) 391 956 return FALSE; 392 957 393 958 /* Encode the AC coefficients per section F.1.2.2 */ 394 959 395 960 r = 0; /* r = run length of zeros */ 396 397 for (k = 1; k < DCTSIZE2; k++) {398 if ((temp = block[ jpeg_natural_order[k]]) == 0) {961 962 for (k = 1; k <= Se; k++) { 963 if ((temp = block[natural_order[k]]) == 0) { 399 964 r++; 400 965 } else { 401 966 /* if run length > 15, must emit special run-length-16 codes (0xF0) */ 402 967 while (r > 15) { 403 if (! emit_bits (state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))968 if (! emit_bits_s(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) 404 969 return FALSE; 405 970 r -= 16; … … 412 977 temp2--; 413 978 } 414 979 415 980 /* Find the number of bits needed for the magnitude of the coefficient */ 416 981 nbits = 1; /* there must be at least one 1 bit */ … … 420 985 if (nbits > MAX_COEF_BITS) 421 986 ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); 422 987 423 988 /* Emit Huffman symbol for run length / number of bits */ 424 989 i = (r << 4) + nbits; 425 if (! emit_bits (state, actbl->ehufco[i], actbl->ehufsi[i]))990 if (! emit_bits_s(state, actbl->ehufco[i], actbl->ehufsi[i])) 426 991 return FALSE; 427 992 428 993 /* Emit that number of bits of the value, if positive, */ 429 994 /* or the complement of its magnitude, if negative. */ 430 if (! emit_bits (state, (unsigned int) temp2, nbits))995 if (! emit_bits_s(state, (unsigned int) temp2, nbits)) 431 996 return FALSE; 432 997 433 998 r = 0; 434 999 } … … 437 1002 /* If the last coef(s) were zero, emit an end-of-block code */ 438 1003 if (r > 0) 439 if (! emit_bits (state, actbl->ehufco[0], actbl->ehufsi[0]))1004 if (! emit_bits_s(state, actbl->ehufco[0], actbl->ehufsi[0])) 440 1005 return FALSE; 441 442 return TRUE;443 }444 445 446 /*447 * Emit a restart marker & resynchronize predictions.448 */449 450 LOCAL(boolean)451 emit_restart (working_state * state, int restart_num)452 {453 int ci;454 455 if (! flush_bits(state))456 return FALSE;457 458 emit_byte(state, 0xFF, return FALSE);459 emit_byte(state, JPEG_RST0 + restart_num, return FALSE);460 461 /* Re-initialize DC predictions to 0 */462 for (ci = 0; ci < state->cinfo->comps_in_scan; ci++)463 state->cur.last_dc_val[ci] = 0;464 465 /* The restart counter is not updated until we successfully write the MCU. */466 1006 467 1007 return TRUE; … … 490 1030 if (cinfo->restart_interval) { 491 1031 if (entropy->restarts_to_go == 0) 492 if (! emit_restart (&state, entropy->next_restart_num))1032 if (! emit_restart_s(&state, entropy->next_restart_num)) 493 1033 return FALSE; 494 1034 } … … 536 1076 working_state state; 537 1077 538 /* Load up working state ... flush_bits needs it */ 539 state.next_output_byte = cinfo->dest->next_output_byte; 540 state.free_in_buffer = cinfo->dest->free_in_buffer; 541 ASSIGN_STATE(state.cur, entropy->saved); 542 state.cinfo = cinfo; 543 544 /* Flush out the last data */ 545 if (! flush_bits(&state)) 546 ERREXIT(cinfo, JERR_CANT_SUSPEND); 547 548 /* Update state */ 549 cinfo->dest->next_output_byte = state.next_output_byte; 550 cinfo->dest->free_in_buffer = state.free_in_buffer; 551 ASSIGN_STATE(entropy->saved, state.cur); 1078 if (cinfo->progressive_mode) { 1079 entropy->next_output_byte = cinfo->dest->next_output_byte; 1080 entropy->free_in_buffer = cinfo->dest->free_in_buffer; 1081 1082 /* Flush out any buffered data */ 1083 emit_eobrun(entropy); 1084 flush_bits_e(entropy); 1085 1086 cinfo->dest->next_output_byte = entropy->next_output_byte; 1087 cinfo->dest->free_in_buffer = entropy->free_in_buffer; 1088 } else { 1089 /* Load up working state ... flush_bits needs it */ 1090 state.next_output_byte = cinfo->dest->next_output_byte; 1091 state.free_in_buffer = cinfo->dest->free_in_buffer; 1092 ASSIGN_STATE(state.cur, entropy->saved); 1093 state.cinfo = cinfo; 1094 1095 /* Flush out the last data */ 1096 if (! flush_bits_s(&state)) 1097 ERREXIT(cinfo, JERR_CANT_SUSPEND); 1098 1099 /* Update state */ 1100 cinfo->dest->next_output_byte = state.next_output_byte; 1101 cinfo->dest->free_in_buffer = state.free_in_buffer; 1102 ASSIGN_STATE(entropy->saved, state.cur); 1103 } 552 1104 } 553 1105 … … 564 1116 */ 565 1117 566 #ifdef ENTROPY_OPT_SUPPORTED567 568 1118 569 1119 /* Process a single block's worth of coefficients */ … … 576 1126 register int nbits; 577 1127 register int k, r; 1128 int Se = cinfo->lim_Se; 1129 const int * natural_order = cinfo->natural_order; 578 1130 579 1131 /* Encode the DC coefficient difference per section F.1.2.1 */ … … 602 1154 r = 0; /* r = run length of zeros */ 603 1155 604 for (k = 1; k < DCTSIZE2; k++) {605 if ((temp = block[ jpeg_natural_order[k]]) == 0) {1156 for (k = 1; k <= Se; k++) { 1157 if ((temp = block[natural_order[k]]) == 0) { 606 1158 r++; 607 1159 } else { … … 676 1228 /* 677 1229 * Generate the best Huffman code table for the given counts, fill htbl. 678 * Note this is also used by jcphuff.c.679 1230 * 680 1231 * The JPEG standard requires that no symbol be assigned a codeword of all … … 702 1253 */ 703 1254 704 GLOBAL(void)1255 LOCAL(void) 705 1256 jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) 706 1257 { … … 847 1398 { 848 1399 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 849 int ci, dctbl, actbl;1400 int ci, tbl; 850 1401 jpeg_component_info * compptr; 851 1402 JHUFF_TBL **htblptr; … … 856 1407 * per table, because it clobbers the input frequency counts! 857 1408 */ 1409 if (cinfo->progressive_mode) 1410 /* Flush out buffered data (all we care about is counting the EOB symbol) */ 1411 emit_eobrun(entropy); 1412 858 1413 MEMZERO(did_dc, SIZEOF(did_dc)); 859 1414 MEMZERO(did_ac, SIZEOF(did_ac)); … … 861 1416 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 862 1417 compptr = cinfo->cur_comp_info[ci]; 863 dctbl = compptr->dc_tbl_no; 864 actbl = compptr->ac_tbl_no; 865 if (! did_dc[dctbl]) { 866 htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; 867 if (*htblptr == NULL) 868 *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); 869 jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); 870 did_dc[dctbl] = TRUE; 871 } 872 if (! did_ac[actbl]) { 873 htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; 874 if (*htblptr == NULL) 875 *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); 876 jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); 877 did_ac[actbl] = TRUE; 878 } 879 } 880 } 881 882 883 #endif /* ENTROPY_OPT_SUPPORTED */ 1418 /* DC needs no table for refinement scan */ 1419 if (cinfo->Ss == 0 && cinfo->Ah == 0) { 1420 tbl = compptr->dc_tbl_no; 1421 if (! did_dc[tbl]) { 1422 htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; 1423 if (*htblptr == NULL) 1424 *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); 1425 jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[tbl]); 1426 did_dc[tbl] = TRUE; 1427 } 1428 } 1429 /* AC needs no table when not present */ 1430 if (cinfo->Se) { 1431 tbl = compptr->ac_tbl_no; 1432 if (! did_ac[tbl]) { 1433 htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; 1434 if (*htblptr == NULL) 1435 *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); 1436 jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[tbl]); 1437 did_ac[tbl] = TRUE; 1438 } 1439 } 1440 } 1441 } 1442 1443 1444 /* 1445 * Initialize for a Huffman-compressed scan. 1446 * If gather_statistics is TRUE, we do not output anything during the scan, 1447 * just count the Huffman symbols used and generate Huffman code tables. 1448 */ 1449 1450 METHODDEF(void) 1451 start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) 1452 { 1453 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 1454 int ci, tbl; 1455 jpeg_component_info * compptr; 1456 1457 if (gather_statistics) 1458 entropy->pub.finish_pass = finish_pass_gather; 1459 else 1460 entropy->pub.finish_pass = finish_pass_huff; 1461 1462 if (cinfo->progressive_mode) { 1463 entropy->cinfo = cinfo; 1464 entropy->gather_statistics = gather_statistics; 1465 1466 /* We assume jcmaster.c already validated the scan parameters. */ 1467 1468 /* Select execution routine */ 1469 if (cinfo->Ah == 0) { 1470 if (cinfo->Ss == 0) 1471 entropy->pub.encode_mcu = encode_mcu_DC_first; 1472 else 1473 entropy->pub.encode_mcu = encode_mcu_AC_first; 1474 } else { 1475 if (cinfo->Ss == 0) 1476 entropy->pub.encode_mcu = encode_mcu_DC_refine; 1477 else { 1478 entropy->pub.encode_mcu = encode_mcu_AC_refine; 1479 /* AC refinement needs a correction bit buffer */ 1480 if (entropy->bit_buffer == NULL) 1481 entropy->bit_buffer = (char *) 1482 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 1483 MAX_CORR_BITS * SIZEOF(char)); 1484 } 1485 } 1486 1487 /* Initialize AC stuff */ 1488 entropy->ac_tbl_no = cinfo->cur_comp_info[0]->ac_tbl_no; 1489 entropy->EOBRUN = 0; 1490 entropy->BE = 0; 1491 } else { 1492 if (gather_statistics) 1493 entropy->pub.encode_mcu = encode_mcu_gather; 1494 else 1495 entropy->pub.encode_mcu = encode_mcu_huff; 1496 } 1497 1498 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 1499 compptr = cinfo->cur_comp_info[ci]; 1500 /* DC needs no table for refinement scan */ 1501 if (cinfo->Ss == 0 && cinfo->Ah == 0) { 1502 tbl = compptr->dc_tbl_no; 1503 if (gather_statistics) { 1504 /* Check for invalid table index */ 1505 /* (make_c_derived_tbl does this in the other path) */ 1506 if (tbl < 0 || tbl >= NUM_HUFF_TBLS) 1507 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl); 1508 /* Allocate and zero the statistics tables */ 1509 /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ 1510 if (entropy->dc_count_ptrs[tbl] == NULL) 1511 entropy->dc_count_ptrs[tbl] = (long *) 1512 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 1513 257 * SIZEOF(long)); 1514 MEMZERO(entropy->dc_count_ptrs[tbl], 257 * SIZEOF(long)); 1515 } else { 1516 /* Compute derived values for Huffman tables */ 1517 /* We may do this more than once for a table, but it's not expensive */ 1518 jpeg_make_c_derived_tbl(cinfo, TRUE, tbl, 1519 & entropy->dc_derived_tbls[tbl]); 1520 } 1521 /* Initialize DC predictions to 0 */ 1522 entropy->saved.last_dc_val[ci] = 0; 1523 } 1524 /* AC needs no table when not present */ 1525 if (cinfo->Se) { 1526 tbl = compptr->ac_tbl_no; 1527 if (gather_statistics) { 1528 if (tbl < 0 || tbl >= NUM_HUFF_TBLS) 1529 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl); 1530 if (entropy->ac_count_ptrs[tbl] == NULL) 1531 entropy->ac_count_ptrs[tbl] = (long *) 1532 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 1533 257 * SIZEOF(long)); 1534 MEMZERO(entropy->ac_count_ptrs[tbl], 257 * SIZEOF(long)); 1535 } else { 1536 jpeg_make_c_derived_tbl(cinfo, FALSE, tbl, 1537 & entropy->ac_derived_tbls[tbl]); 1538 } 1539 } 1540 } 1541 1542 /* Initialize bit buffer to empty */ 1543 entropy->saved.put_buffer = 0; 1544 entropy->saved.put_bits = 0; 1545 1546 /* Initialize restart stuff */ 1547 entropy->restarts_to_go = cinfo->restart_interval; 1548 entropy->next_restart_num = 0; 1549 } 884 1550 885 1551 … … 903 1569 for (i = 0; i < NUM_HUFF_TBLS; i++) { 904 1570 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; 905 #ifdef ENTROPY_OPT_SUPPORTED906 1571 entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL; 907 #endif 908 } 909 } 1572 } 1573 1574 if (cinfo->progressive_mode) 1575 entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ 1576 } -
trunk/src/3rdparty/libjpeg/jcinit.c
r2 r846 42 42 jinit_forward_dct(cinfo); 43 43 /* Entropy encoding: either Huffman or arithmetic coding. */ 44 if (cinfo->arith_code) { 45 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 46 } else { 47 if (cinfo->progressive_mode) { 48 #ifdef C_PROGRESSIVE_SUPPORTED 49 jinit_phuff_encoder(cinfo); 50 #else 51 ERREXIT(cinfo, JERR_NOT_COMPILED); 52 #endif 53 } else 54 jinit_huff_encoder(cinfo); 44 if (cinfo->arith_code) 45 jinit_arith_encoder(cinfo); 46 else { 47 jinit_huff_encoder(cinfo); 55 48 } 56 49 -
trunk/src/3rdparty/libjpeg/jcmainct.c
r2 r846 119 119 while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { 120 120 /* Read input data if we haven't filled the main buffer yet */ 121 if (main->rowgroup_ctr < DCTSIZE)121 if (main->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size) 122 122 (*cinfo->prep->pre_process_data) (cinfo, 123 123 input_buf, in_row_ctr, in_rows_avail, 124 124 main->buffer, &main->rowgroup_ctr, 125 (JDIMENSION) DCTSIZE);125 (JDIMENSION) cinfo->min_DCT_v_scaled_size); 126 126 127 127 /* If we don't have a full iMCU row buffered, return to application for … … 129 129 * at the bottom of the image. 130 130 */ 131 if (main->rowgroup_ctr != DCTSIZE)131 if (main->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size) 132 132 return; 133 133 … … 270 270 main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) 271 271 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, 272 compptr->width_in_blocks * DCTSIZE,272 compptr->width_in_blocks * compptr->DCT_h_scaled_size, 273 273 (JDIMENSION) jround_up((long) compptr->height_in_blocks, 274 274 (long) compptr->v_samp_factor) * DCTSIZE, 275 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));275 (JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size)); 276 276 } 277 277 #else … … 287 287 main->buffer[ci] = (*cinfo->mem->alloc_sarray) 288 288 ((j_common_ptr) cinfo, JPOOL_IMAGE, 289 compptr->width_in_blocks * DCTSIZE,290 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));291 } 292 } 293 } 289 compptr->width_in_blocks * compptr->DCT_h_scaled_size, 290 (JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size)); 291 } 292 } 293 } -
trunk/src/3rdparty/libjpeg/jcmarker.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1998, Thomas G. Lane. 5 * Modified 2003-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 154 155 155 156 prec = 0; 156 for (i = 0; i < DCTSIZE2; i++) {157 if (qtbl->quantval[ i] > 255)157 for (i = 0; i <= cinfo->lim_Se; i++) { 158 if (qtbl->quantval[cinfo->natural_order[i]] > 255) 158 159 prec = 1; 159 160 } … … 162 163 emit_marker(cinfo, M_DQT); 163 164 164 emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); 165 emit_2bytes(cinfo, 166 prec ? cinfo->lim_Se * 2 + 2 + 1 + 2 : cinfo->lim_Se + 1 + 1 + 2); 165 167 166 168 emit_byte(cinfo, index + (prec<<4)); 167 169 168 for (i = 0; i < DCTSIZE2; i++) {170 for (i = 0; i <= cinfo->lim_Se; i++) { 169 171 /* The table entries must be emitted in zigzag order. */ 170 unsigned int qval = qtbl->quantval[ jpeg_natural_order[i]];172 unsigned int qval = qtbl->quantval[cinfo->natural_order[i]]; 171 173 if (prec) 172 174 emit_byte(cinfo, (int) (qval >> 8)); … … 236 238 for (i = 0; i < cinfo->comps_in_scan; i++) { 237 239 compptr = cinfo->cur_comp_info[i]; 238 dc_in_use[compptr->dc_tbl_no] = 1; 239 ac_in_use[compptr->ac_tbl_no] = 1; 240 /* DC needs no table for refinement scan */ 241 if (cinfo->Ss == 0 && cinfo->Ah == 0) 242 dc_in_use[compptr->dc_tbl_no] = 1; 243 /* AC needs no table when not present */ 244 if (cinfo->Se) 245 ac_in_use[compptr->ac_tbl_no] = 1; 240 246 } 241 247 … … 286 292 287 293 /* Make sure image isn't bigger than SOF field can handle */ 288 if ((long) cinfo-> image_height > 65535L ||289 (long) cinfo-> image_width > 65535L)294 if ((long) cinfo->jpeg_height > 65535L || 295 (long) cinfo->jpeg_width > 65535L) 290 296 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); 291 297 292 298 emit_byte(cinfo, cinfo->data_precision); 293 emit_2bytes(cinfo, (int) cinfo-> image_height);294 emit_2bytes(cinfo, (int) cinfo-> image_width);299 emit_2bytes(cinfo, (int) cinfo->jpeg_height); 300 emit_2bytes(cinfo, (int) cinfo->jpeg_width); 295 301 296 302 emit_byte(cinfo, cinfo->num_components); … … 321 327 compptr = cinfo->cur_comp_info[i]; 322 328 emit_byte(cinfo, compptr->component_id); 323 td = compptr->dc_tbl_no; 324 ta = compptr->ac_tbl_no; 325 if (cinfo->progressive_mode) { 326 /* Progressive mode: only DC or only AC tables are used in one scan; 327 * furthermore, Huffman coding of DC refinement uses no table at all. 328 * We emit 0 for unused field(s); this is recommended by the P&M text 329 * but does not seem to be specified in the standard. 330 */ 331 if (cinfo->Ss == 0) { 332 ta = 0; /* DC scan */ 333 if (cinfo->Ah != 0 && !cinfo->arith_code) 334 td = 0; /* no DC table either */ 335 } else { 336 td = 0; /* AC scan */ 337 } 338 } 329 330 /* We emit 0 for unused field(s); this is recommended by the P&M text 331 * but does not seem to be specified in the standard. 332 */ 333 334 /* DC needs no table for refinement scan */ 335 td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0; 336 /* AC needs no table when not present */ 337 ta = cinfo->Se ? compptr->ac_tbl_no : 0; 338 339 339 emit_byte(cinfo, (td << 4) + ta); 340 340 } … … 343 343 emit_byte(cinfo, cinfo->Se); 344 344 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); 345 } 346 347 348 LOCAL(void) 349 emit_pseudo_sos (j_compress_ptr cinfo) 350 /* Emit a pseudo SOS marker */ 351 { 352 emit_marker(cinfo, M_SOS); 353 354 emit_2bytes(cinfo, 2 + 1 + 3); /* length */ 355 356 emit_byte(cinfo, 0); /* Ns */ 357 358 emit_byte(cinfo, 0); /* Ss */ 359 emit_byte(cinfo, cinfo->block_size * cinfo->block_size - 1); /* Se */ 360 emit_byte(cinfo, 0); /* Ah/Al */ 345 361 } 346 362 … … 485 501 /* 486 502 * Write frame header. 487 * This consists of DQT and SOFn markers .503 * This consists of DQT and SOFn markers, and a conditional pseudo SOS marker. 488 504 * Note that we do not emit the SOF until we have emitted the DQT(s). 489 505 * This avoids compatibility problems with incorrect implementations that … … 512 528 */ 513 529 if (cinfo->arith_code || cinfo->progressive_mode || 514 cinfo->data_precision != 8 ) {530 cinfo->data_precision != 8 || cinfo->block_size != DCTSIZE) { 515 531 is_baseline = FALSE; 516 532 } else { … … 530 546 /* Emit the proper SOF marker */ 531 547 if (cinfo->arith_code) { 532 emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ 548 if (cinfo->progressive_mode) 549 emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */ 550 else 551 emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */ 533 552 } else { 534 553 if (cinfo->progressive_mode) … … 539 558 emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ 540 559 } 560 561 /* Check to emit pseudo SOS marker */ 562 if (cinfo->progressive_mode && cinfo->block_size != DCTSIZE) 563 emit_pseudo_sos(cinfo); 541 564 } 542 565 … … 567 590 for (i = 0; i < cinfo->comps_in_scan; i++) { 568 591 compptr = cinfo->cur_comp_info[i]; 569 if (cinfo->progressive_mode) { 570 /* Progressive mode: only DC or only AC tables are used in one scan */ 571 if (cinfo->Ss == 0) { 572 if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ 573 emit_dht(cinfo, compptr->dc_tbl_no, FALSE); 574 } else { 575 emit_dht(cinfo, compptr->ac_tbl_no, TRUE); 576 } 577 } else { 578 /* Sequential mode: need both DC and AC tables */ 592 /* DC needs no table for refinement scan */ 593 if (cinfo->Ss == 0 && cinfo->Ah == 0) 579 594 emit_dht(cinfo, compptr->dc_tbl_no, FALSE); 595 /* AC needs no table when not present */ 596 if (cinfo->Se) 580 597 emit_dht(cinfo, compptr->ac_tbl_no, TRUE); 581 }582 598 } 583 599 } -
trunk/src/3rdparty/libjpeg/jcmaster.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 2003-2010 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 43 44 */ 44 45 46 /* 47 * Compute JPEG image dimensions and related values. 48 * NOTE: this is exported for possible use by application. 49 * Hence it mustn't do anything that can't be done twice. 50 */ 51 52 GLOBAL(void) 53 jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo) 54 /* Do computations that are needed before master selection phase */ 55 { 56 #ifdef DCT_SCALING_SUPPORTED 57 58 /* Compute actual JPEG image dimensions and DCT scaling choices. */ 59 if (cinfo->scale_num >= cinfo->scale_denom * 8) { 60 /* Provide 8/1 scaling */ 61 cinfo->jpeg_width = cinfo->image_width << 3; 62 cinfo->jpeg_height = cinfo->image_height << 3; 63 cinfo->min_DCT_h_scaled_size = 1; 64 cinfo->min_DCT_v_scaled_size = 1; 65 } else if (cinfo->scale_num >= cinfo->scale_denom * 4) { 66 /* Provide 4/1 scaling */ 67 cinfo->jpeg_width = cinfo->image_width << 2; 68 cinfo->jpeg_height = cinfo->image_height << 2; 69 cinfo->min_DCT_h_scaled_size = 2; 70 cinfo->min_DCT_v_scaled_size = 2; 71 } else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 8) { 72 /* Provide 8/3 scaling */ 73 cinfo->jpeg_width = (cinfo->image_width << 1) + (JDIMENSION) 74 jdiv_round_up((long) cinfo->image_width * 2, 3L); 75 cinfo->jpeg_height = (cinfo->image_height << 1) + (JDIMENSION) 76 jdiv_round_up((long) cinfo->image_height * 2, 3L); 77 cinfo->min_DCT_h_scaled_size = 3; 78 cinfo->min_DCT_v_scaled_size = 3; 79 } else if (cinfo->scale_num >= cinfo->scale_denom * 2) { 80 /* Provide 2/1 scaling */ 81 cinfo->jpeg_width = cinfo->image_width << 1; 82 cinfo->jpeg_height = cinfo->image_height << 1; 83 cinfo->min_DCT_h_scaled_size = 4; 84 cinfo->min_DCT_v_scaled_size = 4; 85 } else if (cinfo->scale_num * 5 >= cinfo->scale_denom * 8) { 86 /* Provide 8/5 scaling */ 87 cinfo->jpeg_width = cinfo->image_width + (JDIMENSION) 88 jdiv_round_up((long) cinfo->image_width * 3, 5L); 89 cinfo->jpeg_height = cinfo->image_height + (JDIMENSION) 90 jdiv_round_up((long) cinfo->image_height * 3, 5L); 91 cinfo->min_DCT_h_scaled_size = 5; 92 cinfo->min_DCT_v_scaled_size = 5; 93 } else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 4) { 94 /* Provide 4/3 scaling */ 95 cinfo->jpeg_width = cinfo->image_width + (JDIMENSION) 96 jdiv_round_up((long) cinfo->image_width, 3L); 97 cinfo->jpeg_height = cinfo->image_height + (JDIMENSION) 98 jdiv_round_up((long) cinfo->image_height, 3L); 99 cinfo->min_DCT_h_scaled_size = 6; 100 cinfo->min_DCT_v_scaled_size = 6; 101 } else if (cinfo->scale_num * 7 >= cinfo->scale_denom * 8) { 102 /* Provide 8/7 scaling */ 103 cinfo->jpeg_width = cinfo->image_width + (JDIMENSION) 104 jdiv_round_up((long) cinfo->image_width, 7L); 105 cinfo->jpeg_height = cinfo->image_height + (JDIMENSION) 106 jdiv_round_up((long) cinfo->image_height, 7L); 107 cinfo->min_DCT_h_scaled_size = 7; 108 cinfo->min_DCT_v_scaled_size = 7; 109 } else if (cinfo->scale_num >= cinfo->scale_denom) { 110 /* Provide 1/1 scaling */ 111 cinfo->jpeg_width = cinfo->image_width; 112 cinfo->jpeg_height = cinfo->image_height; 113 cinfo->min_DCT_h_scaled_size = 8; 114 cinfo->min_DCT_v_scaled_size = 8; 115 } else if (cinfo->scale_num * 9 >= cinfo->scale_denom * 8) { 116 /* Provide 8/9 scaling */ 117 cinfo->jpeg_width = (JDIMENSION) 118 jdiv_round_up((long) cinfo->image_width * 8, 9L); 119 cinfo->jpeg_height = (JDIMENSION) 120 jdiv_round_up((long) cinfo->image_height * 8, 9L); 121 cinfo->min_DCT_h_scaled_size = 9; 122 cinfo->min_DCT_v_scaled_size = 9; 123 } else if (cinfo->scale_num * 5 >= cinfo->scale_denom * 4) { 124 /* Provide 4/5 scaling */ 125 cinfo->jpeg_width = (JDIMENSION) 126 jdiv_round_up((long) cinfo->image_width * 4, 5L); 127 cinfo->jpeg_height = (JDIMENSION) 128 jdiv_round_up((long) cinfo->image_height * 4, 5L); 129 cinfo->min_DCT_h_scaled_size = 10; 130 cinfo->min_DCT_v_scaled_size = 10; 131 } else if (cinfo->scale_num * 11 >= cinfo->scale_denom * 8) { 132 /* Provide 8/11 scaling */ 133 cinfo->jpeg_width = (JDIMENSION) 134 jdiv_round_up((long) cinfo->image_width * 8, 11L); 135 cinfo->jpeg_height = (JDIMENSION) 136 jdiv_round_up((long) cinfo->image_height * 8, 11L); 137 cinfo->min_DCT_h_scaled_size = 11; 138 cinfo->min_DCT_v_scaled_size = 11; 139 } else if (cinfo->scale_num * 3 >= cinfo->scale_denom * 2) { 140 /* Provide 2/3 scaling */ 141 cinfo->jpeg_width = (JDIMENSION) 142 jdiv_round_up((long) cinfo->image_width * 2, 3L); 143 cinfo->jpeg_height = (JDIMENSION) 144 jdiv_round_up((long) cinfo->image_height * 2, 3L); 145 cinfo->min_DCT_h_scaled_size = 12; 146 cinfo->min_DCT_v_scaled_size = 12; 147 } else if (cinfo->scale_num * 13 >= cinfo->scale_denom * 8) { 148 /* Provide 8/13 scaling */ 149 cinfo->jpeg_width = (JDIMENSION) 150 jdiv_round_up((long) cinfo->image_width * 8, 13L); 151 cinfo->jpeg_height = (JDIMENSION) 152 jdiv_round_up((long) cinfo->image_height * 8, 13L); 153 cinfo->min_DCT_h_scaled_size = 13; 154 cinfo->min_DCT_v_scaled_size = 13; 155 } else if (cinfo->scale_num * 7 >= cinfo->scale_denom * 4) { 156 /* Provide 4/7 scaling */ 157 cinfo->jpeg_width = (JDIMENSION) 158 jdiv_round_up((long) cinfo->image_width * 4, 7L); 159 cinfo->jpeg_height = (JDIMENSION) 160 jdiv_round_up((long) cinfo->image_height * 4, 7L); 161 cinfo->min_DCT_h_scaled_size = 14; 162 cinfo->min_DCT_v_scaled_size = 14; 163 } else if (cinfo->scale_num * 15 >= cinfo->scale_denom * 8) { 164 /* Provide 8/15 scaling */ 165 cinfo->jpeg_width = (JDIMENSION) 166 jdiv_round_up((long) cinfo->image_width * 8, 15L); 167 cinfo->jpeg_height = (JDIMENSION) 168 jdiv_round_up((long) cinfo->image_height * 8, 15L); 169 cinfo->min_DCT_h_scaled_size = 15; 170 cinfo->min_DCT_v_scaled_size = 15; 171 } else { 172 /* Provide 1/2 scaling */ 173 cinfo->jpeg_width = (JDIMENSION) 174 jdiv_round_up((long) cinfo->image_width, 2L); 175 cinfo->jpeg_height = (JDIMENSION) 176 jdiv_round_up((long) cinfo->image_height, 2L); 177 cinfo->min_DCT_h_scaled_size = 16; 178 cinfo->min_DCT_v_scaled_size = 16; 179 } 180 181 #else /* !DCT_SCALING_SUPPORTED */ 182 183 /* Hardwire it to "no scaling" */ 184 cinfo->jpeg_width = cinfo->image_width; 185 cinfo->jpeg_height = cinfo->image_height; 186 cinfo->min_DCT_h_scaled_size = DCTSIZE; 187 cinfo->min_DCT_v_scaled_size = DCTSIZE; 188 189 #endif /* DCT_SCALING_SUPPORTED */ 190 191 cinfo->block_size = DCTSIZE; 192 cinfo->natural_order = jpeg_natural_order; 193 cinfo->lim_Se = DCTSIZE2-1; 194 } 195 196 45 197 LOCAL(void) 46 initial_setup (j_compress_ptr cinfo) 198 jpeg_calc_trans_dimensions (j_compress_ptr cinfo) 199 { 200 if (cinfo->min_DCT_h_scaled_size < 1 || cinfo->min_DCT_h_scaled_size > 16 201 || cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size) 202 ERREXIT2(cinfo, JERR_BAD_DCTSIZE, 203 cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size); 204 205 cinfo->block_size = cinfo->min_DCT_h_scaled_size; 206 207 switch (cinfo->block_size) { 208 case 2: cinfo->natural_order = jpeg_natural_order2; break; 209 case 3: cinfo->natural_order = jpeg_natural_order3; break; 210 case 4: cinfo->natural_order = jpeg_natural_order4; break; 211 case 5: cinfo->natural_order = jpeg_natural_order5; break; 212 case 6: cinfo->natural_order = jpeg_natural_order6; break; 213 case 7: cinfo->natural_order = jpeg_natural_order7; break; 214 default: cinfo->natural_order = jpeg_natural_order; break; 215 } 216 217 cinfo->lim_Se = cinfo->block_size < DCTSIZE ? 218 cinfo->block_size * cinfo->block_size - 1 : DCTSIZE2-1; 219 } 220 221 222 LOCAL(void) 223 initial_setup (j_compress_ptr cinfo, boolean transcode_only) 47 224 /* Do computations that are needed before master selection phase */ 48 225 { 49 int ci ;226 int ci, ssize; 50 227 jpeg_component_info *compptr; 51 228 long samplesperrow; 52 229 JDIMENSION jd_samplesperrow; 53 230 231 if (transcode_only) 232 jpeg_calc_trans_dimensions(cinfo); 233 else 234 jpeg_calc_jpeg_dimensions(cinfo); 235 54 236 /* Sanity check on image dimensions */ 55 if (cinfo-> image_height <= 0 || cinfo->image_width <= 056 ||cinfo->num_components <= 0 || cinfo->input_components <= 0)237 if (cinfo->jpeg_height <= 0 || cinfo->jpeg_width <= 0 || 238 cinfo->num_components <= 0 || cinfo->input_components <= 0) 57 239 ERREXIT(cinfo, JERR_EMPTY_IMAGE); 58 240 59 241 /* Make sure image isn't bigger than I can handle */ 60 if ((long) cinfo-> image_height > (long) JPEG_MAX_DIMENSION ||61 (long) cinfo-> image_width > (long) JPEG_MAX_DIMENSION)242 if ((long) cinfo->jpeg_height > (long) JPEG_MAX_DIMENSION || 243 (long) cinfo->jpeg_width > (long) JPEG_MAX_DIMENSION) 62 244 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); 63 245 … … 96 278 /* Fill in the correct component_index value; don't rely on application */ 97 279 compptr->component_index = ci; 98 /* For compression, we never do DCT scaling. */ 99 compptr->DCT_scaled_size = DCTSIZE; 280 /* In selecting the actual DCT scaling for each component, we try to 281 * scale down the chroma components via DCT scaling rather than downsampling. 282 * This saves time if the downsampler gets to use 1:1 scaling. 283 * Note this code adapts subsampling ratios which are powers of 2. 284 */ 285 ssize = 1; 286 #ifdef DCT_SCALING_SUPPORTED 287 while (cinfo->min_DCT_h_scaled_size * ssize <= 288 (cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) && 289 (cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) { 290 ssize = ssize * 2; 291 } 292 #endif 293 compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size * ssize; 294 ssize = 1; 295 #ifdef DCT_SCALING_SUPPORTED 296 while (cinfo->min_DCT_v_scaled_size * ssize <= 297 (cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) && 298 (cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) == 0) { 299 ssize = ssize * 2; 300 } 301 #endif 302 compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size * ssize; 303 304 /* We don't support DCT ratios larger than 2. */ 305 if (compptr->DCT_h_scaled_size > compptr->DCT_v_scaled_size * 2) 306 compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size * 2; 307 else if (compptr->DCT_v_scaled_size > compptr->DCT_h_scaled_size * 2) 308 compptr->DCT_v_scaled_size = compptr->DCT_h_scaled_size * 2; 309 100 310 /* Size in DCT blocks */ 101 311 compptr->width_in_blocks = (JDIMENSION) 102 jdiv_round_up((long) cinfo-> image_width * (long) compptr->h_samp_factor,103 (long) (cinfo->max_h_samp_factor * DCTSIZE));312 jdiv_round_up((long) cinfo->jpeg_width * (long) compptr->h_samp_factor, 313 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 104 314 compptr->height_in_blocks = (JDIMENSION) 105 jdiv_round_up((long) cinfo-> image_height * (long) compptr->v_samp_factor,106 (long) (cinfo->max_v_samp_factor * DCTSIZE));315 jdiv_round_up((long) cinfo->jpeg_height * (long) compptr->v_samp_factor, 316 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 107 317 /* Size in samples */ 108 318 compptr->downsampled_width = (JDIMENSION) 109 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, 110 (long) cinfo->max_h_samp_factor); 319 jdiv_round_up((long) cinfo->jpeg_width * 320 (long) (compptr->h_samp_factor * compptr->DCT_h_scaled_size), 321 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 111 322 compptr->downsampled_height = (JDIMENSION) 112 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, 113 (long) cinfo->max_v_samp_factor); 323 jdiv_round_up((long) cinfo->jpeg_height * 324 (long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size), 325 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 114 326 /* Mark component needed (this flag isn't actually used for compression) */ 115 327 compptr->component_needed = TRUE; … … 120 332 */ 121 333 cinfo->total_iMCU_rows = (JDIMENSION) 122 jdiv_round_up((long) cinfo-> image_height,123 (long) (cinfo->max_v_samp_factor *DCTSIZE));334 jdiv_round_up((long) cinfo->jpeg_height, 335 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 124 336 } 125 337 … … 261 473 } 262 474 475 476 LOCAL(void) 477 reduce_script (j_compress_ptr cinfo) 478 /* Adapt scan script for use with reduced block size; 479 * assume that script has been validated before. 480 */ 481 { 482 jpeg_scan_info * scanptr; 483 int idxout, idxin; 484 485 /* Circumvent const declaration for this function */ 486 scanptr = (jpeg_scan_info *) cinfo->scan_info; 487 idxout = 0; 488 489 for (idxin = 0; idxin < cinfo->num_scans; idxin++) { 490 /* After skipping, idxout becomes smaller than idxin */ 491 if (idxin != idxout) 492 /* Copy rest of data; 493 * note we stay in given chunk of allocated memory. 494 */ 495 scanptr[idxout] = scanptr[idxin]; 496 if (scanptr[idxout].Ss > cinfo->lim_Se) 497 /* Entire scan out of range - skip this entry */ 498 continue; 499 if (scanptr[idxout].Se > cinfo->lim_Se) 500 /* Limit scan to end of block */ 501 scanptr[idxout].Se = cinfo->lim_Se; 502 idxout++; 503 } 504 505 cinfo->num_scans = idxout; 506 } 507 263 508 #endif /* C_MULTISCAN_FILES_SUPPORTED */ 264 509 … … 281 526 &cinfo->comp_info[scanptr->component_index[ci]]; 282 527 } 283 cinfo->Ss = scanptr->Ss; 284 cinfo->Se = scanptr->Se; 285 cinfo->Ah = scanptr->Ah; 286 cinfo->Al = scanptr->Al; 528 if (cinfo->progressive_mode) { 529 cinfo->Ss = scanptr->Ss; 530 cinfo->Se = scanptr->Se; 531 cinfo->Ah = scanptr->Ah; 532 cinfo->Al = scanptr->Al; 533 return; 534 } 287 535 } 288 536 else … … 297 545 cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; 298 546 } 299 cinfo->Ss = 0;300 cinfo->Se = DCTSIZE2-1;301 cinfo->Ah = 0;302 cinfo->Al= 0;303 }547 } 548 cinfo->Ss = 0; 549 cinfo->Se = cinfo->block_size * cinfo->block_size - 1; 550 cinfo->Ah = 0; 551 cinfo->Al = 0; 304 552 } 305 553 … … 326 574 compptr->MCU_height = 1; 327 575 compptr->MCU_blocks = 1; 328 compptr->MCU_sample_width = DCTSIZE;576 compptr->MCU_sample_width = compptr->DCT_h_scaled_size; 329 577 compptr->last_col_width = 1; 330 578 /* For noninterleaved scans, it is convenient to define last_row_height … … 348 596 /* Overall image size in MCUs */ 349 597 cinfo->MCUs_per_row = (JDIMENSION) 350 jdiv_round_up((long) cinfo-> image_width,351 (long) (cinfo->max_h_samp_factor *DCTSIZE));598 jdiv_round_up((long) cinfo->jpeg_width, 599 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 352 600 cinfo->MCU_rows_in_scan = (JDIMENSION) 353 jdiv_round_up((long) cinfo-> image_height,354 (long) (cinfo->max_v_samp_factor *DCTSIZE));601 jdiv_round_up((long) cinfo->jpeg_height, 602 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 355 603 356 604 cinfo->blocks_in_MCU = 0; … … 362 610 compptr->MCU_height = compptr->v_samp_factor; 363 611 compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; 364 compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;612 compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_h_scaled_size; 365 613 /* Figure number of non-dummy blocks in last MCU column & row */ 366 614 tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); … … 434 682 select_scan_parameters(cinfo); 435 683 per_scan_setup(cinfo); 436 if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) {684 if (cinfo->Ss != 0 || cinfo->Ah == 0) { 437 685 (*cinfo->entropy->start_pass) (cinfo, TRUE); 438 686 (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); … … 555 803 556 804 /* Validate parameters, determine derived values */ 557 initial_setup(cinfo );805 initial_setup(cinfo, transcode_only); 558 806 559 807 if (cinfo->scan_info != NULL) { 560 808 #ifdef C_MULTISCAN_FILES_SUPPORTED 561 809 validate_script(cinfo); 810 if (cinfo->block_size < DCTSIZE) 811 reduce_script(cinfo); 562 812 #else 563 813 ERREXIT(cinfo, JERR_NOT_COMPILED); … … 568 818 } 569 819 570 if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */ 571 cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ 820 if ((cinfo->progressive_mode || cinfo->block_size < DCTSIZE) && 821 !cinfo->arith_code) /* TEMPORARY HACK ??? */ 822 /* assume default tables no good for progressive or downscale mode */ 823 cinfo->optimize_coding = TRUE; 572 824 573 825 /* Initialize my private state */ -
trunk/src/3rdparty/libjpeg/jconfig.bcc
r2 r846 1 1 /* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.cfg
r2 r846 1 1 /* jconfig.cfg --- source file edited by configure script */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #undef HAVE_PROTOTYPES … … 10 10 #undef HAVE_STDDEF_H 11 11 #undef HAVE_STDLIB_H 12 #undef HAVE_LOCALE_H 12 13 #undef NEED_BSD_STRINGS 13 14 #undef NEED_SYS_TYPES_H -
trunk/src/3rdparty/libjpeg/jconfig.dj
r2 r846 1 1 /* jconfig.dj --- jconfig.h for DJGPP (Delorie's GNU C port) on MS-DOS. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.h
r2 r846 1 /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ 2 /* see jconfig.doc for explanations */ 1 /* see jconfig.txt for explanations */ 3 2 4 3 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.mac
r2 r846 1 1 /* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.manx
r2 r846 1 1 /* jconfig.manx --- jconfig.h for Amiga systems using Manx Aztec C ver 5.x. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.mc6
r2 r846 1 1 /* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.sas
r2 r846 1 1 /* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.st
r2 r846 1 1 /* jconfig.st --- jconfig.h for Atari ST/STE/TT using Pure C or Turbo C. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.vc
r2 r846 1 1 /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.vms
r2 r846 1 1 /* jconfig.vms --- jconfig.h for use on Digital VMS. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jconfig.wat
r2 r846 1 1 /* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */ 2 /* see jconfig. docfor explanations */2 /* see jconfig.txt for explanations */ 3 3 4 4 #define HAVE_PROTOTYPES -
trunk/src/3rdparty/libjpeg/jcparam.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1998, Thomas G. Lane. 5 * Modified 2003-2008 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 61 62 62 63 64 /* These are the sample quantization tables given in JPEG spec section K.1. 65 * The spec says that the values given produce "good" quality, and 66 * when divided by 2, "very good" quality. 67 */ 68 static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { 69 16, 11, 10, 16, 24, 40, 51, 61, 70 12, 12, 14, 19, 26, 58, 60, 55, 71 14, 13, 16, 24, 40, 57, 69, 56, 72 14, 17, 22, 29, 51, 87, 80, 62, 73 18, 22, 37, 56, 68, 109, 103, 77, 74 24, 35, 55, 64, 81, 104, 113, 92, 75 49, 64, 78, 87, 103, 121, 120, 101, 76 72, 92, 95, 98, 112, 100, 103, 99 77 }; 78 static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { 79 17, 18, 24, 47, 99, 99, 99, 99, 80 18, 21, 26, 66, 99, 99, 99, 99, 81 24, 26, 56, 99, 99, 99, 99, 99, 82 47, 66, 99, 99, 99, 99, 99, 99, 83 99, 99, 99, 99, 99, 99, 99, 99, 84 99, 99, 99, 99, 99, 99, 99, 99, 85 99, 99, 99, 99, 99, 99, 99, 99, 86 99, 99, 99, 99, 99, 99, 99, 99 87 }; 88 89 90 GLOBAL(void) 91 jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) 92 /* Set or change the 'quality' (quantization) setting, using default tables 93 * and straight percentage-scaling quality scales. 94 * This entry point allows different scalings for luminance and chrominance. 95 */ 96 { 97 /* Set up two quantization tables using the specified scaling */ 98 jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, 99 cinfo->q_scale_factor[0], force_baseline); 100 jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, 101 cinfo->q_scale_factor[1], force_baseline); 102 } 103 104 63 105 GLOBAL(void) 64 106 jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, … … 70 112 */ 71 113 { 72 /* These are the sample quantization tables given in JPEG spec section K.1.73 * The spec says that the values given produce "good" quality, and74 * when divided by 2, "very good" quality.75 */76 static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {77 16, 11, 10, 16, 24, 40, 51, 61,78 12, 12, 14, 19, 26, 58, 60, 55,79 14, 13, 16, 24, 40, 57, 69, 56,80 14, 17, 22, 29, 51, 87, 80, 62,81 18, 22, 37, 56, 68, 109, 103, 77,82 24, 35, 55, 64, 81, 104, 113, 92,83 49, 64, 78, 87, 103, 121, 120, 101,84 72, 92, 95, 98, 112, 100, 103, 9985 };86 static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {87 17, 18, 24, 47, 99, 99, 99, 99,88 18, 21, 26, 66, 99, 99, 99, 99,89 24, 26, 56, 99, 99, 99, 99, 99,90 47, 66, 99, 99, 99, 99, 99, 99,91 99, 99, 99, 99, 99, 99, 99, 99,92 99, 99, 99, 99, 99, 99, 99, 99,93 99, 99, 99, 99, 99, 99, 99, 99,94 99, 99, 99, 99, 99, 99, 99, 9995 };96 97 114 /* Set up two quantization tables using the specified scaling */ 98 115 jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, … … 285 302 /* Initialize everything not dependent on the color space */ 286 303 304 cinfo->scale_num = 1; /* 1:1 scaling */ 305 cinfo->scale_denom = 1; 287 306 cinfo->data_precision = BITS_IN_JSAMPLE; 288 307 /* Set up two quantization tables using default quality of 75 */ … … 320 339 /* By default, use the simpler non-cosited sampling alignment */ 321 340 cinfo->CCIR601_sampling = FALSE; 341 342 /* By default, apply fancy downsampling */ 343 cinfo->do_fancy_downsampling = TRUE; 322 344 323 345 /* No input smoothing */ -
trunk/src/3rdparty/libjpeg/jcprepct.c
r2 r846 174 174 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 175 175 ci++, compptr++) { 176 numrows = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 177 cinfo->min_DCT_v_scaled_size; 176 178 expand_bottom_edge(output_buf[ci], 177 compptr->width_in_blocks * DCTSIZE,178 (int) (*out_row_group_ctr * compptr->v_samp_factor),179 (int) (out_row_groups_avail * compptr->v_samp_factor));179 compptr->width_in_blocks * compptr->DCT_h_scaled_size, 180 (int) (*out_row_group_ctr * numrows), 181 (int) (out_row_groups_avail * numrows)); 180 182 } 181 183 *out_row_group_ctr = out_row_groups_avail; … … 289 291 true_buffer = (*cinfo->mem->alloc_sarray) 290 292 ((j_common_ptr) cinfo, JPOOL_IMAGE, 291 (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * 293 (JDIMENSION) (((long) compptr->width_in_blocks * 294 cinfo->min_DCT_h_scaled_size * 292 295 cinfo->max_h_samp_factor) / compptr->h_samp_factor), 293 296 (JDIMENSION) (3 * rgroup_height)); … … 347 350 prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) 348 351 ((j_common_ptr) cinfo, JPOOL_IMAGE, 349 (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * 352 (JDIMENSION) (((long) compptr->width_in_blocks * 353 cinfo->min_DCT_h_scaled_size * 350 354 cinfo->max_h_samp_factor) / compptr->h_samp_factor), 351 355 (JDIMENSION) cinfo->max_v_samp_factor); -
trunk/src/3rdparty/libjpeg/jcsample.c
r2 r846 63 63 /* Downsampling method pointers, one per component */ 64 64 downsample1_ptr methods[MAX_COMPONENTS]; 65 66 /* Height of an output row group for each component. */ 67 int rowgroup_height[MAX_COMPONENTS]; 68 69 /* These arrays save pixel expansion factors so that int_downsample need not 70 * recompute them each time. They are unused for other downsampling methods. 71 */ 72 UINT8 h_expand[MAX_COMPONENTS]; 73 UINT8 v_expand[MAX_COMPONENTS]; 65 74 } my_downsampler; 66 75 … … 124 133 ci++, compptr++) { 125 134 in_ptr = input_buf[ci] + in_row_index; 126 out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); 135 out_ptr = output_buf[ci] + 136 (out_row_group_index * downsample->rowgroup_height[ci]); 127 137 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); 128 138 } … … 141 151 JSAMPARRAY input_data, JSAMPARRAY output_data) 142 152 { 153 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; 143 154 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; 144 155 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ 145 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;156 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 146 157 JSAMPROW inptr, outptr; 147 158 INT32 outvalue; 148 159 149 h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;150 v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;160 h_expand = downsample->h_expand[compptr->component_index]; 161 v_expand = downsample->v_expand[compptr->component_index]; 151 162 numpix = h_expand * v_expand; 152 163 numpix2 = numpix/2; … … 159 170 cinfo->image_width, output_cols * h_expand); 160 171 161 inrow = 0;162 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {172 inrow = outrow = 0; 173 while (inrow < cinfo->max_v_samp_factor) { 163 174 outptr = output_data[outrow]; 164 175 for (outcol = 0, outcol_h = 0; outcol < output_cols; … … 174 185 } 175 186 inrow += v_expand; 187 outrow++; 176 188 } 177 189 } … … 192 204 cinfo->max_v_samp_factor, cinfo->image_width); 193 205 /* Edge-expand */ 194 expand_right_edge(output_data, cinfo->max_v_samp_factor, 195 c info->image_width, compptr->width_in_blocks * DCTSIZE);206 expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width, 207 compptr->width_in_blocks * compptr->DCT_h_scaled_size); 196 208 } 197 209 … … 213 225 JSAMPARRAY input_data, JSAMPARRAY output_data) 214 226 { 215 int outrow;227 int inrow; 216 228 JDIMENSION outcol; 217 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;229 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 218 230 register JSAMPROW inptr, outptr; 219 231 register int bias; … … 226 238 cinfo->image_width, output_cols * 2); 227 239 228 for ( outrow = 0; outrow < compptr->v_samp_factor; outrow++) {229 outptr = output_data[ outrow];230 inptr = input_data[ outrow];240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 241 outptr = output_data[inrow]; 242 inptr = input_data[inrow]; 231 243 bias = 0; /* bias = 0,1,0,1,... for successive samples */ 232 244 for (outcol = 0; outcol < output_cols; outcol++) { … … 252 264 int inrow, outrow; 253 265 JDIMENSION outcol; 254 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;266 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 255 267 register JSAMPROW inptr0, inptr1, outptr; 256 268 register int bias; … … 263 275 cinfo->image_width, output_cols * 2); 264 276 265 inrow = 0;266 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {277 inrow = outrow = 0; 278 while (inrow < cinfo->max_v_samp_factor) { 267 279 outptr = output_data[outrow]; 268 280 inptr0 = input_data[inrow]; … … 277 289 } 278 290 inrow += 2; 291 outrow++; 279 292 } 280 293 } … … 295 308 int inrow, outrow; 296 309 JDIMENSION colctr; 297 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;310 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 298 311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; 299 312 INT32 membersum, neighsum, memberscale, neighscale; … … 322 335 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ 323 336 324 inrow = 0;325 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {337 inrow = outrow = 0; 338 while (inrow < cinfo->max_v_samp_factor) { 326 339 outptr = output_data[outrow]; 327 340 inptr0 = input_data[inrow]; … … 379 392 380 393 inrow += 2; 394 outrow++; 381 395 } 382 396 } … … 393 407 JSAMPARRAY input_data, JSAMPARRAY output_data) 394 408 { 395 int outrow;409 int inrow; 396 410 JDIMENSION colctr; 397 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;411 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 398 412 register JSAMPROW inptr, above_ptr, below_ptr, outptr; 399 413 INT32 membersum, neighsum, memberscale, neighscale; … … 416 430 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ 417 431 418 for ( outrow = 0; outrow < compptr->v_samp_factor; outrow++) {419 outptr = output_data[ outrow];420 inptr = input_data[ outrow];421 above_ptr = input_data[ outrow-1];422 below_ptr = input_data[ outrow+1];432 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 433 outptr = output_data[inrow]; 434 inptr = input_data[inrow]; 435 above_ptr = input_data[inrow-1]; 436 below_ptr = input_data[inrow+1]; 423 437 424 438 /* Special case for first column */ … … 468 482 jpeg_component_info * compptr; 469 483 boolean smoothok = TRUE; 484 int h_in_group, v_in_group, h_out_group, v_out_group; 470 485 471 486 downsample = (my_downsample_ptr) … … 483 498 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 484 499 ci++, compptr++) { 485 if (compptr->h_samp_factor == cinfo->max_h_samp_factor && 486 compptr->v_samp_factor == cinfo->max_v_samp_factor) { 500 /* Compute size of an "output group" for DCT scaling. This many samples 501 * are to be converted from max_h_samp_factor * max_v_samp_factor pixels. 502 */ 503 h_out_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) / 504 cinfo->min_DCT_h_scaled_size; 505 v_out_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 506 cinfo->min_DCT_v_scaled_size; 507 h_in_group = cinfo->max_h_samp_factor; 508 v_in_group = cinfo->max_v_samp_factor; 509 downsample->rowgroup_height[ci] = v_out_group; /* save for use later */ 510 if (h_in_group == h_out_group && v_in_group == v_out_group) { 487 511 #ifdef INPUT_SMOOTHING_SUPPORTED 488 512 if (cinfo->smoothing_factor) { … … 492 516 #endif 493 517 downsample->methods[ci] = fullsize_downsample; 494 } else if ( compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor&&495 compptr->v_samp_factor == cinfo->max_v_samp_factor) {518 } else if (h_in_group == h_out_group * 2 && 519 v_in_group == v_out_group) { 496 520 smoothok = FALSE; 497 521 downsample->methods[ci] = h2v1_downsample; 498 } else if ( compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor&&499 compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {522 } else if (h_in_group == h_out_group * 2 && 523 v_in_group == v_out_group * 2) { 500 524 #ifdef INPUT_SMOOTHING_SUPPORTED 501 525 if (cinfo->smoothing_factor) { … … 505 529 #endif 506 530 downsample->methods[ci] = h2v2_downsample; 507 } else if (( cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&508 ( cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {531 } else if ((h_in_group % h_out_group) == 0 && 532 (v_in_group % v_out_group) == 0) { 509 533 smoothok = FALSE; 510 534 downsample->methods[ci] = int_downsample; 535 downsample->h_expand[ci] = (UINT8) (h_in_group / h_out_group); 536 downsample->v_expand[ci] = (UINT8) (v_in_group / v_out_group); 511 537 } else 512 538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); -
trunk/src/3rdparty/libjpeg/jctrans.c
r2 r846 3 3 * 4 4 * Copyright (C) 1995-1998, Thomas G. Lane. 5 * Modified 2000-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 77 78 dstinfo->input_components = srcinfo->num_components; 78 79 dstinfo->in_color_space = srcinfo->jpeg_color_space; 80 dstinfo->jpeg_width = srcinfo->output_width; 81 dstinfo->jpeg_height = srcinfo->output_height; 82 dstinfo->min_DCT_h_scaled_size = srcinfo->min_DCT_h_scaled_size; 83 dstinfo->min_DCT_v_scaled_size = srcinfo->min_DCT_v_scaled_size; 79 84 /* Initialize all parameters to default values */ 80 85 jpeg_set_defaults(dstinfo); … … 159 164 jvirt_barray_ptr * coef_arrays) 160 165 { 161 /* Although we don't actually use input_components for transcoding,162 * jcmaster.c's initial_setup will complain if input_components is 0.163 */164 cinfo->input_components = 1;165 166 /* Initialize master control (includes parameter checking/processing) */ 166 167 jinit_c_master_control(cinfo, TRUE /* transcode only */); 167 168 168 169 /* Entropy encoding: either Huffman or arithmetic coding. */ 169 if (cinfo->arith_code) { 170 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 171 } else { 172 if (cinfo->progressive_mode) { 173 #ifdef C_PROGRESSIVE_SUPPORTED 174 jinit_phuff_encoder(cinfo); 175 #else 176 ERREXIT(cinfo, JERR_NOT_COMPILED); 177 #endif 178 } else 179 jinit_huff_encoder(cinfo); 170 if (cinfo->arith_code) 171 jinit_arith_encoder(cinfo); 172 else { 173 jinit_huff_encoder(cinfo); 180 174 } 181 175 -
trunk/src/3rdparty/libjpeg/jdapimin.c
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1998, Thomas G. Lane. 5 * Modified 2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 186 187 187 188 /* Set defaults for other decompression parameters. */ 188 cinfo->scale_num = 1; /* 1:1 scaling */189 cinfo->scale_denom = 1;189 cinfo->scale_num = cinfo->block_size; /* 1:1 scaling */ 190 cinfo->scale_denom = cinfo->block_size; 190 191 cinfo->output_gamma = 1.0; 191 192 cinfo->buffered_image = FALSE; -
trunk/src/3rdparty/libjpeg/jdapistd.c
r2 r846 203 203 204 204 /* Verify that at least one iMCU row can be returned. */ 205 lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_ scaled_size;205 lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size; 206 206 if (max_lines < lines_per_iMCU_row) 207 207 ERREXIT(cinfo, JERR_BUFFER_SIZE); -
trunk/src/3rdparty/libjpeg/jdatadst.c
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1996, Thomas G. Lane. 5 * Modified 2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. 7 8 * 8 9 * This file contains compression data destination routines for the case of 9 * emitting JPEG data to a file (or any stdio stream). While these routines10 * are sufficient for most applications, some will want to use a different11 * destination manager.10 * emitting JPEG data to memory or to a file (or any stdio stream). 11 * While these routines are sufficient for most applications, 12 * some will want to use a different destination manager. 12 13 * IMPORTANT: we assume that fwrite() will correctly transcribe an array of 13 14 * JOCTETs into 8-bit-wide elements on external storage. If char is wider … … 20 21 #include "jerror.h" 21 22 23 #ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */ 24 extern void * malloc JPP((size_t size)); 25 extern void free JPP((void *ptr)); 26 #endif 27 22 28 23 29 /* Expanded data destination object for stdio output */ … … 33 39 34 40 #define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ 41 42 43 /* Expanded data destination object for memory output */ 44 45 typedef struct { 46 struct jpeg_destination_mgr pub; /* public fields */ 47 48 unsigned char ** outbuffer; /* target buffer */ 49 unsigned long * outsize; 50 unsigned char * newbuffer; /* newly allocated buffer */ 51 JOCTET * buffer; /* start of buffer */ 52 size_t bufsize; 53 } my_mem_destination_mgr; 54 55 typedef my_mem_destination_mgr * my_mem_dest_ptr; 35 56 36 57 … … 52 73 dest->pub.next_output_byte = dest->buffer; 53 74 dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; 75 } 76 77 METHODDEF(void) 78 init_mem_destination (j_compress_ptr cinfo) 79 { 80 /* no work necessary here */ 54 81 } 55 82 … … 93 120 } 94 121 122 METHODDEF(boolean) 123 empty_mem_output_buffer (j_compress_ptr cinfo) 124 { 125 size_t nextsize; 126 JOCTET * nextbuffer; 127 my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest; 128 129 /* Try to allocate new buffer with double size */ 130 nextsize = dest->bufsize * 2; 131 nextbuffer = malloc(nextsize); 132 133 if (nextbuffer == NULL) 134 ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10); 135 136 MEMCOPY(nextbuffer, dest->buffer, dest->bufsize); 137 138 if (dest->newbuffer != NULL) 139 free(dest->newbuffer); 140 141 dest->newbuffer = nextbuffer; 142 143 dest->pub.next_output_byte = nextbuffer + dest->bufsize; 144 dest->pub.free_in_buffer = dest->bufsize; 145 146 dest->buffer = nextbuffer; 147 dest->bufsize = nextsize; 148 149 return TRUE; 150 } 151 95 152 96 153 /* … … 118 175 if (ferror(dest->outfile)) 119 176 ERREXIT(cinfo, JERR_FILE_WRITE); 177 } 178 179 METHODDEF(void) 180 term_mem_destination (j_compress_ptr cinfo) 181 { 182 my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest; 183 184 *dest->outbuffer = dest->buffer; 185 *dest->outsize = dest->bufsize - dest->pub.free_in_buffer; 120 186 } 121 187 … … 150 216 dest->outfile = outfile; 151 217 } 218 219 220 /* 221 * Prepare for output to a memory buffer. 222 * The caller may supply an own initial buffer with appropriate size. 223 * Otherwise, or when the actual data output exceeds the given size, 224 * the library adapts the buffer size as necessary. 225 * The standard library functions malloc/free are used for allocating 226 * larger memory, so the buffer is available to the application after 227 * finishing compression, and then the application is responsible for 228 * freeing the requested memory. 229 */ 230 231 GLOBAL(void) 232 jpeg_mem_dest (j_compress_ptr cinfo, 233 unsigned char ** outbuffer, unsigned long * outsize) 234 { 235 my_mem_dest_ptr dest; 236 237 if (outbuffer == NULL || outsize == NULL) /* sanity check */ 238 ERREXIT(cinfo, JERR_BUFFER_SIZE); 239 240 /* The destination object is made permanent so that multiple JPEG images 241 * can be written to the same buffer without re-executing jpeg_mem_dest. 242 */ 243 if (cinfo->dest == NULL) { /* first time for this JPEG object? */ 244 cinfo->dest = (struct jpeg_destination_mgr *) 245 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 246 SIZEOF(my_mem_destination_mgr)); 247 } 248 249 dest = (my_mem_dest_ptr) cinfo->dest; 250 dest->pub.init_destination = init_mem_destination; 251 dest->pub.empty_output_buffer = empty_mem_output_buffer; 252 dest->pub.term_destination = term_mem_destination; 253 dest->outbuffer = outbuffer; 254 dest->outsize = outsize; 255 dest->newbuffer = NULL; 256 257 if (*outbuffer == NULL || *outsize == 0) { 258 /* Allocate initial buffer */ 259 dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE); 260 if (dest->newbuffer == NULL) 261 ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10); 262 *outsize = OUTPUT_BUF_SIZE; 263 } 264 265 dest->pub.next_output_byte = dest->buffer = *outbuffer; 266 dest->pub.free_in_buffer = dest->bufsize = *outsize; 267 } -
trunk/src/3rdparty/libjpeg/jdatasrc.c
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1996, Thomas G. Lane. 5 * Modified 2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. 7 8 * 8 9 * This file contains decompression data source routines for the case of 9 * reading JPEG data from a file (or any stdio stream). While these routines10 * are sufficient for most applications, some will want to use a different11 * so urce manager.10 * reading JPEG data from memory or from a file (or any stdio stream). 11 * While these routines are sufficient for most applications, 12 * some will want to use a different source manager. 12 13 * IMPORTANT: we assume that fread() will correctly transcribe an array of 13 14 * JOCTETs from 8-bit-wide elements on external storage. If char is wider … … 51 52 */ 52 53 src->start_of_file = TRUE; 54 } 55 56 METHODDEF(void) 57 init_mem_source (j_decompress_ptr cinfo) 58 { 59 /* no work necessary here */ 53 60 } 54 61 … … 112 119 } 113 120 121 METHODDEF(boolean) 122 fill_mem_input_buffer (j_decompress_ptr cinfo) 123 { 124 static JOCTET mybuffer[4]; 125 126 /* The whole JPEG data is expected to reside in the supplied memory 127 * buffer, so any request for more data beyond the given buffer size 128 * is treated as an error. 129 */ 130 WARNMS(cinfo, JWRN_JPEG_EOF); 131 /* Insert a fake EOI marker */ 132 mybuffer[0] = (JOCTET) 0xFF; 133 mybuffer[1] = (JOCTET) JPEG_EOI; 134 135 cinfo->src->next_input_byte = mybuffer; 136 cinfo->src->bytes_in_buffer = 2; 137 138 return TRUE; 139 } 140 114 141 115 142 /* … … 128 155 skip_input_data (j_decompress_ptr cinfo, long num_bytes) 129 156 { 130 my_src_ptr src = (my_src_ptr)cinfo->src;157 struct jpeg_source_mgr * src = cinfo->src; 131 158 132 159 /* Just a dumb implementation for now. Could use fseek() except … … 135 162 */ 136 163 if (num_bytes > 0) { 137 while (num_bytes > (long) src-> pub.bytes_in_buffer) {138 num_bytes -= (long) src-> pub.bytes_in_buffer;164 while (num_bytes > (long) src->bytes_in_buffer) { 165 num_bytes -= (long) src->bytes_in_buffer; 139 166 (void) fill_input_buffer(cinfo); 140 167 /* note we assume that fill_input_buffer will never return FALSE, … … 142 169 */ 143 170 } 144 src-> pub.next_input_byte += (size_t) num_bytes;145 src-> pub.bytes_in_buffer -= (size_t) num_bytes;171 src->next_input_byte += (size_t) num_bytes; 172 src->bytes_in_buffer -= (size_t) num_bytes; 146 173 } 147 174 } … … 211 238 src->pub.next_input_byte = NULL; /* until buffer loaded */ 212 239 } 240 241 242 /* 243 * Prepare for input from a supplied memory buffer. 244 * The buffer must contain the whole JPEG data. 245 */ 246 247 GLOBAL(void) 248 jpeg_mem_src (j_decompress_ptr cinfo, 249 unsigned char * inbuffer, unsigned long insize) 250 { 251 struct jpeg_source_mgr * src; 252 253 if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */ 254 ERREXIT(cinfo, JERR_INPUT_EMPTY); 255 256 /* The source object is made permanent so that a series of JPEG images 257 * can be read from the same buffer by calling jpeg_mem_src only before 258 * the first one. 259 */ 260 if (cinfo->src == NULL) { /* first time for this JPEG object? */ 261 cinfo->src = (struct jpeg_source_mgr *) 262 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 263 SIZEOF(struct jpeg_source_mgr)); 264 } 265 266 src = cinfo->src; 267 src->init_source = init_mem_source; 268 src->fill_input_buffer = fill_mem_input_buffer; 269 src->skip_input_data = skip_input_data; 270 src->resync_to_restart = jpeg_resync_to_restart; /* use default method */ 271 src->term_source = term_source; 272 src->bytes_in_buffer = (size_t) insize; 273 src->next_input_byte = (JOCTET *) inbuffer; 274 } -
trunk/src/3rdparty/libjpeg/jdcoefct.c
r2 r846 188 188 : compptr->last_col_width; 189 189 output_ptr = output_buf[compptr->component_index] + 190 yoffset * compptr->DCT_ scaled_size;190 yoffset * compptr->DCT_v_scaled_size; 191 191 start_col = MCU_col_num * compptr->MCU_sample_width; 192 192 for (yindex = 0; yindex < compptr->MCU_height; yindex++) { … … 198 198 (JCOEFPTR) coef->MCU_buffer[blkn+xindex], 199 199 output_ptr, output_col); 200 output_col += compptr->DCT_ scaled_size;200 output_col += compptr->DCT_h_scaled_size; 201 201 } 202 202 } 203 203 blkn += compptr->MCU_width; 204 output_ptr += compptr->DCT_ scaled_size;204 output_ptr += compptr->DCT_v_scaled_size; 205 205 } 206 206 } … … 363 363 output_ptr, output_col); 364 364 buffer_ptr++; 365 output_col += compptr->DCT_ scaled_size;365 output_col += compptr->DCT_h_scaled_size; 366 366 } 367 output_ptr += compptr->DCT_ scaled_size;367 output_ptr += compptr->DCT_v_scaled_size; 368 368 } 369 369 } … … 655 655 DC7 = DC8; DC8 = DC9; 656 656 buffer_ptr++, prev_block_row++, next_block_row++; 657 output_col += compptr->DCT_ scaled_size;657 output_col += compptr->DCT_h_scaled_size; 658 658 } 659 output_ptr += compptr->DCT_ scaled_size;659 output_ptr += compptr->DCT_v_scaled_size; 660 660 } 661 661 } -
trunk/src/3rdparty/libjpeg/jdct.h
r2 r846 15 15 16 16 /* 17 * A forward DCT routine is given a pointer to a work area of type DCTELEM[]; 18 * the DCT is to be performed in-place in that buffer. Type DCTELEM is int 19 * for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT 20 * implementations use an array of type FAST_FLOAT, instead.) 21 * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). 17 * A forward DCT routine is given a pointer to an input sample array and 18 * a pointer to a work area of type DCTELEM[]; the DCT is to be performed 19 * in-place in that buffer. Type DCTELEM is int for 8-bit samples, INT32 20 * for 12-bit samples. (NOTE: Floating-point DCT implementations use an 21 * array of type FAST_FLOAT, instead.) 22 * The input data is to be fetched from the sample array starting at a 23 * specified column. (Any row offset needed will be applied to the array 24 * pointer before it is passed to the FDCT code.) 25 * Note that the number of samples fetched by the FDCT routine is 26 * DCT_h_scaled_size * DCT_v_scaled_size. 22 27 * The DCT outputs are returned scaled up by a factor of 8; they therefore 23 28 * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This … … 33 38 #endif 34 39 35 typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); 36 typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); 40 typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data, 41 JSAMPARRAY sample_data, 42 JDIMENSION start_col)); 43 typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data, 44 JSAMPARRAY sample_data, 45 JDIMENSION start_col)); 37 46 38 47 … … 45 54 * be applied to the array pointer before it is passed to the IDCT code.) 46 55 * Note that the number of samples emitted by the IDCT routine is 47 * DCT_ scaled_size * DCT_scaled_size.56 * DCT_h_scaled_size * DCT_v_scaled_size. 48 57 */ 49 58 … … 85 94 #define jpeg_fdct_ifast jFDifast 86 95 #define jpeg_fdct_float jFDfloat 96 #define jpeg_fdct_7x7 jFD7x7 97 #define jpeg_fdct_6x6 jFD6x6 98 #define jpeg_fdct_5x5 jFD5x5 99 #define jpeg_fdct_4x4 jFD4x4 100 #define jpeg_fdct_3x3 jFD3x3 101 #define jpeg_fdct_2x2 jFD2x2 102 #define jpeg_fdct_1x1 jFD1x1 103 #define jpeg_fdct_9x9 jFD9x9 104 #define jpeg_fdct_10x10 jFD10x10 105 #define jpeg_fdct_11x11 jFD11x11 106 #define jpeg_fdct_12x12 jFD12x12 107 #define jpeg_fdct_13x13 jFD13x13 108 #define jpeg_fdct_14x14 jFD14x14 109 #define jpeg_fdct_15x15 jFD15x15 110 #define jpeg_fdct_16x16 jFD16x16 111 #define jpeg_fdct_16x8 jFD16x8 112 #define jpeg_fdct_14x7 jFD14x7 113 #define jpeg_fdct_12x6 jFD12x6 114 #define jpeg_fdct_10x5 jFD10x5 115 #define jpeg_fdct_8x4 jFD8x4 116 #define jpeg_fdct_6x3 jFD6x3 117 #define jpeg_fdct_4x2 jFD4x2 118 #define jpeg_fdct_2x1 jFD2x1 119 #define jpeg_fdct_8x16 jFD8x16 120 #define jpeg_fdct_7x14 jFD7x14 121 #define jpeg_fdct_6x12 jFD6x12 122 #define jpeg_fdct_5x10 jFD5x10 123 #define jpeg_fdct_4x8 jFD4x8 124 #define jpeg_fdct_3x6 jFD3x6 125 #define jpeg_fdct_2x4 jFD2x4 126 #define jpeg_fdct_1x2 jFD1x2 87 127 #define jpeg_idct_islow jRDislow 88 128 #define jpeg_idct_ifast jRDifast 89 129 #define jpeg_idct_float jRDfloat 130 #define jpeg_idct_7x7 jRD7x7 131 #define jpeg_idct_6x6 jRD6x6 132 #define jpeg_idct_5x5 jRD5x5 90 133 #define jpeg_idct_4x4 jRD4x4 134 #define jpeg_idct_3x3 jRD3x3 91 135 #define jpeg_idct_2x2 jRD2x2 92 136 #define jpeg_idct_1x1 jRD1x1 137 #define jpeg_idct_9x9 jRD9x9 138 #define jpeg_idct_10x10 jRD10x10 139 #define jpeg_idct_11x11 jRD11x11 140 #define jpeg_idct_12x12 jRD12x12 141 #define jpeg_idct_13x13 jRD13x13 142 #define jpeg_idct_14x14 jRD14x14 143 #define jpeg_idct_15x15 jRD15x15 144 #define jpeg_idct_16x16 jRD16x16 145 #define jpeg_idct_16x8 jRD16x8 146 #define jpeg_idct_14x7 jRD14x7 147 #define jpeg_idct_12x6 jRD12x6 148 #define jpeg_idct_10x5 jRD10x5 149 #define jpeg_idct_8x4 jRD8x4 150 #define jpeg_idct_6x3 jRD6x3 151 #define jpeg_idct_4x2 jRD4x2 152 #define jpeg_idct_2x1 jRD2x1 153 #define jpeg_idct_8x16 jRD8x16 154 #define jpeg_idct_7x14 jRD7x14 155 #define jpeg_idct_6x12 jRD6x12 156 #define jpeg_idct_5x10 jRD5x10 157 #define jpeg_idct_4x8 jRD4x8 158 #define jpeg_idct_3x6 jRD3x8 159 #define jpeg_idct_2x4 jRD2x4 160 #define jpeg_idct_1x2 jRD1x2 93 161 #endif /* NEED_SHORT_EXTERNAL_NAMES */ 94 162 95 163 /* Extern declarations for the forward and inverse DCT routines. */ 96 164 97 EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); 98 EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data)); 99 EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); 165 EXTERN(void) jpeg_fdct_islow 166 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 167 EXTERN(void) jpeg_fdct_ifast 168 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 169 EXTERN(void) jpeg_fdct_float 170 JPP((FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 171 EXTERN(void) jpeg_fdct_7x7 172 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 173 EXTERN(void) jpeg_fdct_6x6 174 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 175 EXTERN(void) jpeg_fdct_5x5 176 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 177 EXTERN(void) jpeg_fdct_4x4 178 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 179 EXTERN(void) jpeg_fdct_3x3 180 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 181 EXTERN(void) jpeg_fdct_2x2 182 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 183 EXTERN(void) jpeg_fdct_1x1 184 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 185 EXTERN(void) jpeg_fdct_9x9 186 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 187 EXTERN(void) jpeg_fdct_10x10 188 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 189 EXTERN(void) jpeg_fdct_11x11 190 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 191 EXTERN(void) jpeg_fdct_12x12 192 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 193 EXTERN(void) jpeg_fdct_13x13 194 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 195 EXTERN(void) jpeg_fdct_14x14 196 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 197 EXTERN(void) jpeg_fdct_15x15 198 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 199 EXTERN(void) jpeg_fdct_16x16 200 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 201 EXTERN(void) jpeg_fdct_16x8 202 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 203 EXTERN(void) jpeg_fdct_14x7 204 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 205 EXTERN(void) jpeg_fdct_12x6 206 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 207 EXTERN(void) jpeg_fdct_10x5 208 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 209 EXTERN(void) jpeg_fdct_8x4 210 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 211 EXTERN(void) jpeg_fdct_6x3 212 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 213 EXTERN(void) jpeg_fdct_4x2 214 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 215 EXTERN(void) jpeg_fdct_2x1 216 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 217 EXTERN(void) jpeg_fdct_8x16 218 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 219 EXTERN(void) jpeg_fdct_7x14 220 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 221 EXTERN(void) jpeg_fdct_6x12 222 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 223 EXTERN(void) jpeg_fdct_5x10 224 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 225 EXTERN(void) jpeg_fdct_4x8 226 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 227 EXTERN(void) jpeg_fdct_3x6 228 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 229 EXTERN(void) jpeg_fdct_2x4 230 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 231 EXTERN(void) jpeg_fdct_1x2 232 JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)); 100 233 101 234 EXTERN(void) jpeg_idct_islow … … 108 241 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 109 242 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 243 EXTERN(void) jpeg_idct_7x7 244 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 245 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 246 EXTERN(void) jpeg_idct_6x6 247 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 248 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 249 EXTERN(void) jpeg_idct_5x5 250 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 251 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 110 252 EXTERN(void) jpeg_idct_4x4 111 253 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 112 254 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 255 EXTERN(void) jpeg_idct_3x3 256 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 257 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 113 258 EXTERN(void) jpeg_idct_2x2 114 259 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 115 260 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 116 261 EXTERN(void) jpeg_idct_1x1 262 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 263 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 264 EXTERN(void) jpeg_idct_9x9 265 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 266 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 267 EXTERN(void) jpeg_idct_10x10 268 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 269 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 270 EXTERN(void) jpeg_idct_11x11 271 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 272 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 273 EXTERN(void) jpeg_idct_12x12 274 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 275 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 276 EXTERN(void) jpeg_idct_13x13 277 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 278 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 279 EXTERN(void) jpeg_idct_14x14 280 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 281 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 282 EXTERN(void) jpeg_idct_15x15 283 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 284 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 285 EXTERN(void) jpeg_idct_16x16 286 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 287 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 288 EXTERN(void) jpeg_idct_16x8 289 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 290 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 291 EXTERN(void) jpeg_idct_14x7 292 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 293 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 294 EXTERN(void) jpeg_idct_12x6 295 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 296 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 297 EXTERN(void) jpeg_idct_10x5 298 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 299 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 300 EXTERN(void) jpeg_idct_8x4 301 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 302 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 303 EXTERN(void) jpeg_idct_6x3 304 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 305 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 306 EXTERN(void) jpeg_idct_4x2 307 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 308 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 309 EXTERN(void) jpeg_idct_2x1 310 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 311 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 312 EXTERN(void) jpeg_idct_8x16 313 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 314 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 315 EXTERN(void) jpeg_idct_7x14 316 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 317 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 318 EXTERN(void) jpeg_idct_6x12 319 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 320 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 321 EXTERN(void) jpeg_idct_5x10 322 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 323 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 324 EXTERN(void) jpeg_idct_4x8 325 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 326 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 327 EXTERN(void) jpeg_idct_3x6 328 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 329 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 330 EXTERN(void) jpeg_idct_2x4 331 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 332 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 333 EXTERN(void) jpeg_idct_1x2 117 334 JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 118 335 JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); -
trunk/src/3rdparty/libjpeg/jddctmgr.c
r2 r846 99 99 ci++, compptr++) { 100 100 /* Select the proper IDCT routine for this component's scaling */ 101 switch ( compptr->DCT_scaled_size) {101 switch ((compptr->DCT_h_scaled_size << 8) + compptr->DCT_v_scaled_size) { 102 102 #ifdef IDCT_SCALING_SUPPORTED 103 case 1:103 case ((1 << 8) + 1): 104 104 method_ptr = jpeg_idct_1x1; 105 method = JDCT_ISLOW; /* jidct reduses islow-style table */106 break; 107 case 2:105 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 106 break; 107 case ((2 << 8) + 2): 108 108 method_ptr = jpeg_idct_2x2; 109 method = JDCT_ISLOW; /* jidctred uses islow-style table */ 110 break; 111 case 4: 109 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 110 break; 111 case ((3 << 8) + 3): 112 method_ptr = jpeg_idct_3x3; 113 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 114 break; 115 case ((4 << 8) + 4): 112 116 method_ptr = jpeg_idct_4x4; 113 method = JDCT_ISLOW; /* jidctred uses islow-style table */ 114 break; 115 #endif 116 case DCTSIZE: 117 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 118 break; 119 case ((5 << 8) + 5): 120 method_ptr = jpeg_idct_5x5; 121 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 122 break; 123 case ((6 << 8) + 6): 124 method_ptr = jpeg_idct_6x6; 125 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 126 break; 127 case ((7 << 8) + 7): 128 method_ptr = jpeg_idct_7x7; 129 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 130 break; 131 case ((9 << 8) + 9): 132 method_ptr = jpeg_idct_9x9; 133 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 134 break; 135 case ((10 << 8) + 10): 136 method_ptr = jpeg_idct_10x10; 137 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 138 break; 139 case ((11 << 8) + 11): 140 method_ptr = jpeg_idct_11x11; 141 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 142 break; 143 case ((12 << 8) + 12): 144 method_ptr = jpeg_idct_12x12; 145 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 146 break; 147 case ((13 << 8) + 13): 148 method_ptr = jpeg_idct_13x13; 149 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 150 break; 151 case ((14 << 8) + 14): 152 method_ptr = jpeg_idct_14x14; 153 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 154 break; 155 case ((15 << 8) + 15): 156 method_ptr = jpeg_idct_15x15; 157 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 158 break; 159 case ((16 << 8) + 16): 160 method_ptr = jpeg_idct_16x16; 161 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 162 break; 163 case ((16 << 8) + 8): 164 method_ptr = jpeg_idct_16x8; 165 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 166 break; 167 case ((14 << 8) + 7): 168 method_ptr = jpeg_idct_14x7; 169 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 170 break; 171 case ((12 << 8) + 6): 172 method_ptr = jpeg_idct_12x6; 173 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 174 break; 175 case ((10 << 8) + 5): 176 method_ptr = jpeg_idct_10x5; 177 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 178 break; 179 case ((8 << 8) + 4): 180 method_ptr = jpeg_idct_8x4; 181 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 182 break; 183 case ((6 << 8) + 3): 184 method_ptr = jpeg_idct_6x3; 185 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 186 break; 187 case ((4 << 8) + 2): 188 method_ptr = jpeg_idct_4x2; 189 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 190 break; 191 case ((2 << 8) + 1): 192 method_ptr = jpeg_idct_2x1; 193 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 194 break; 195 case ((8 << 8) + 16): 196 method_ptr = jpeg_idct_8x16; 197 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 198 break; 199 case ((7 << 8) + 14): 200 method_ptr = jpeg_idct_7x14; 201 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 202 break; 203 case ((6 << 8) + 12): 204 method_ptr = jpeg_idct_6x12; 205 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 206 break; 207 case ((5 << 8) + 10): 208 method_ptr = jpeg_idct_5x10; 209 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 210 break; 211 case ((4 << 8) + 8): 212 method_ptr = jpeg_idct_4x8; 213 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 214 break; 215 case ((3 << 8) + 6): 216 method_ptr = jpeg_idct_3x6; 217 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 218 break; 219 case ((2 << 8) + 4): 220 method_ptr = jpeg_idct_2x4; 221 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 222 break; 223 case ((1 << 8) + 2): 224 method_ptr = jpeg_idct_1x2; 225 method = JDCT_ISLOW; /* jidctint uses islow-style table */ 226 break; 227 #endif 228 case ((DCTSIZE << 8) + DCTSIZE): 117 229 switch (cinfo->dct_method) { 118 230 #ifdef DCT_ISLOW_SUPPORTED … … 140 252 break; 141 253 default: 142 ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size); 254 ERREXIT2(cinfo, JERR_BAD_DCTSIZE, 255 compptr->DCT_h_scaled_size, compptr->DCT_v_scaled_size); 143 256 break; 144 257 } -
trunk/src/3rdparty/libjpeg/jdhuff.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 2006-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. 7 8 * 8 9 * This file contains Huffman entropy decoding routines. 10 * Both sequential and progressive modes are supported in this single module. 9 11 * 10 12 * Much of the complexity here has to do with supporting input suspension. … … 18 20 #include "jinclude.h" 19 21 #include "jpeglib.h" 20 #include "jdhuff.h" /* Declarations shared with jdphuff.c */ 22 23 24 /* Derived data constructed for each Huffman table */ 25 26 #define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ 27 28 typedef struct { 29 /* Basic tables: (element [0] of each array is unused) */ 30 INT32 maxcode[18]; /* largest code of length k (-1 if none) */ 31 /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ 32 INT32 valoffset[17]; /* huffval[] offset for codes of length k */ 33 /* valoffset[k] = huffval[] index of 1st symbol of code length k, less 34 * the smallest code of length k; so given a code of length k, the 35 * corresponding symbol is huffval[code + valoffset[k]] 36 */ 37 38 /* Link to public Huffman table (needed only in jpeg_huff_decode) */ 39 JHUFF_TBL *pub; 40 41 /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of 42 * the input data stream. If the next Huffman code is no more 43 * than HUFF_LOOKAHEAD bits long, we can obtain its length and 44 * the corresponding symbol directly from these tables. 45 */ 46 int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */ 47 UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */ 48 } d_derived_tbl; 49 50 51 /* 52 * Fetching the next N bits from the input stream is a time-critical operation 53 * for the Huffman decoders. We implement it with a combination of inline 54 * macros and out-of-line subroutines. Note that N (the number of bits 55 * demanded at one time) never exceeds 15 for JPEG use. 56 * 57 * We read source bytes into get_buffer and dole out bits as needed. 58 * If get_buffer already contains enough bits, they are fetched in-line 59 * by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough 60 * bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer 61 * as full as possible (not just to the number of bits needed; this 62 * prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer). 63 * Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension. 64 * On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains 65 * at least the requested number of bits --- dummy zeroes are inserted if 66 * necessary. 67 */ 68 69 typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ 70 #define BIT_BUF_SIZE 32 /* size of buffer in bits */ 71 72 /* If long is > 32 bits on your machine, and shifting/masking longs is 73 * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE 74 * appropriately should be a win. Unfortunately we can't define the size 75 * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) 76 * because not all machines measure sizeof in 8-bit bytes. 77 */ 78 79 typedef struct { /* Bitreading state saved across MCUs */ 80 bit_buf_type get_buffer; /* current bit-extraction buffer */ 81 int bits_left; /* # of unused bits in it */ 82 } bitread_perm_state; 83 84 typedef struct { /* Bitreading working state within an MCU */ 85 /* Current data source location */ 86 /* We need a copy, rather than munging the original, in case of suspension */ 87 const JOCTET * next_input_byte; /* => next byte to read from source */ 88 size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ 89 /* Bit input buffer --- note these values are kept in register variables, 90 * not in this struct, inside the inner loops. 91 */ 92 bit_buf_type get_buffer; /* current bit-extraction buffer */ 93 int bits_left; /* # of unused bits in it */ 94 /* Pointer needed by jpeg_fill_bit_buffer. */ 95 j_decompress_ptr cinfo; /* back link to decompress master record */ 96 } bitread_working_state; 97 98 /* Macros to declare and load/save bitread local variables. */ 99 #define BITREAD_STATE_VARS \ 100 register bit_buf_type get_buffer; \ 101 register int bits_left; \ 102 bitread_working_state br_state 103 104 #define BITREAD_LOAD_STATE(cinfop,permstate) \ 105 br_state.cinfo = cinfop; \ 106 br_state.next_input_byte = cinfop->src->next_input_byte; \ 107 br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ 108 get_buffer = permstate.get_buffer; \ 109 bits_left = permstate.bits_left; 110 111 #define BITREAD_SAVE_STATE(cinfop,permstate) \ 112 cinfop->src->next_input_byte = br_state.next_input_byte; \ 113 cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ 114 permstate.get_buffer = get_buffer; \ 115 permstate.bits_left = bits_left 116 117 /* 118 * These macros provide the in-line portion of bit fetching. 119 * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer 120 * before using GET_BITS, PEEK_BITS, or DROP_BITS. 121 * The variables get_buffer and bits_left are assumed to be locals, 122 * but the state struct might not be (jpeg_huff_decode needs this). 123 * CHECK_BIT_BUFFER(state,n,action); 124 * Ensure there are N bits in get_buffer; if suspend, take action. 125 * val = GET_BITS(n); 126 * Fetch next N bits. 127 * val = PEEK_BITS(n); 128 * Fetch next N bits without removing them from the buffer. 129 * DROP_BITS(n); 130 * Discard next N bits. 131 * The value N should be a simple variable, not an expression, because it 132 * is evaluated multiple times. 133 */ 134 135 #define CHECK_BIT_BUFFER(state,nbits,action) \ 136 { if (bits_left < (nbits)) { \ 137 if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ 138 { action; } \ 139 get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } 140 141 #define GET_BITS(nbits) \ 142 (((int) (get_buffer >> (bits_left -= (nbits)))) & BIT_MASK(nbits)) 143 144 #define PEEK_BITS(nbits) \ 145 (((int) (get_buffer >> (bits_left - (nbits)))) & BIT_MASK(nbits)) 146 147 #define DROP_BITS(nbits) \ 148 (bits_left -= (nbits)) 149 150 151 /* 152 * Code for extracting next Huffman-coded symbol from input bit stream. 153 * Again, this is time-critical and we make the main paths be macros. 154 * 155 * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits 156 * without looping. Usually, more than 95% of the Huffman codes will be 8 157 * or fewer bits long. The few overlength codes are handled with a loop, 158 * which need not be inline code. 159 * 160 * Notes about the HUFF_DECODE macro: 161 * 1. Near the end of the data segment, we may fail to get enough bits 162 * for a lookahead. In that case, we do it the hard way. 163 * 2. If the lookahead table contains no entry, the next code must be 164 * more than HUFF_LOOKAHEAD bits long. 165 * 3. jpeg_huff_decode returns -1 if forced to suspend. 166 */ 167 168 #define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ 169 { register int nb, look; \ 170 if (bits_left < HUFF_LOOKAHEAD) { \ 171 if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ 172 get_buffer = state.get_buffer; bits_left = state.bits_left; \ 173 if (bits_left < HUFF_LOOKAHEAD) { \ 174 nb = 1; goto slowlabel; \ 175 } \ 176 } \ 177 look = PEEK_BITS(HUFF_LOOKAHEAD); \ 178 if ((nb = htbl->look_nbits[look]) != 0) { \ 179 DROP_BITS(nb); \ 180 result = htbl->look_sym[look]; \ 181 } else { \ 182 nb = HUFF_LOOKAHEAD+1; \ 183 slowlabel: \ 184 if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ 185 { failaction; } \ 186 get_buffer = state.get_buffer; bits_left = state.bits_left; \ 187 } \ 188 } 21 189 22 190 … … 29 197 30 198 typedef struct { 31 int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ 199 unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ 200 int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ 32 201 } savable_state; 33 202 … … 42 211 #if MAX_COMPS_IN_SCAN == 4 43 212 #define ASSIGN_STATE(dest,src) \ 44 ((dest).last_dc_val[0] = (src).last_dc_val[0], \ 213 ((dest).EOBRUN = (src).EOBRUN, \ 214 (dest).last_dc_val[0] = (src).last_dc_val[0], \ 45 215 (dest).last_dc_val[1] = (src).last_dc_val[1], \ 46 216 (dest).last_dc_val[2] = (src).last_dc_val[2], \ … … 60 230 61 231 /* These fields are NOT loaded into local working state. */ 232 boolean insufficient_data; /* set TRUE after emitting warning */ 62 233 unsigned int restarts_to_go; /* MCUs left in this restart interval */ 234 235 /* Following two fields used only in progressive mode */ 236 237 /* Pointers to derived tables (these workspaces have image lifespan) */ 238 d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; 239 240 d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */ 241 242 /* Following fields used only in sequential mode */ 63 243 64 244 /* Pointers to derived tables (these workspaces have image lifespan) */ … … 72 252 d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU]; 73 253 /* Whether we care about the DC and AC coefficient values for each block */ 74 boolean dc_needed[D_MAX_BLOCKS_IN_MCU]; 75 boolean ac_needed[D_MAX_BLOCKS_IN_MCU]; 254 int coef_limit[D_MAX_BLOCKS_IN_MCU]; 76 255 } huff_entropy_decoder; 77 256 … … 79 258 80 259 81 /* 82 * Initialize for a Huffman-compressed scan. 83 */ 84 85 METHODDEF(void) 86 start_pass_huff_decoder (j_decompress_ptr cinfo) 87 { 88 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 89 int ci, blkn, dctbl, actbl; 90 jpeg_component_info * compptr; 91 92 /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. 93 * This ought to be an error condition, but we make it a warning because 94 * there are some baseline files out there with all zeroes in these bytes. 95 */ 96 if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 || 97 cinfo->Ah != 0 || cinfo->Al != 0) 98 WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); 99 100 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 101 compptr = cinfo->cur_comp_info[ci]; 102 dctbl = compptr->dc_tbl_no; 103 actbl = compptr->ac_tbl_no; 104 /* Compute derived values for Huffman tables */ 105 /* We may do this more than once for a table, but it's not expensive */ 106 jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, 107 & entropy->dc_derived_tbls[dctbl]); 108 jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, 109 & entropy->ac_derived_tbls[actbl]); 110 /* Initialize DC predictions to 0 */ 111 entropy->saved.last_dc_val[ci] = 0; 112 } 113 114 /* Precalculate decoding info for each block in an MCU of this scan */ 115 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 116 ci = cinfo->MCU_membership[blkn]; 117 compptr = cinfo->cur_comp_info[ci]; 118 /* Precalculate which table to use for each block */ 119 entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no]; 120 entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no]; 121 /* Decide whether we really care about the coefficient values */ 122 if (compptr->component_needed) { 123 entropy->dc_needed[blkn] = TRUE; 124 /* we don't need the ACs if producing a 1/8th-size image */ 125 entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1); 126 } else { 127 entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE; 128 } 129 } 130 131 /* Initialize bitread state variables */ 132 entropy->bitstate.bits_left = 0; 133 entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ 134 entropy->pub.insufficient_data = FALSE; 135 136 /* Initialize restart counter */ 137 entropy->restarts_to_go = cinfo->restart_interval; 138 } 260 static const int jpeg_zigzag_order[8][8] = { 261 { 0, 1, 5, 6, 14, 15, 27, 28 }, 262 { 2, 4, 7, 13, 16, 26, 29, 42 }, 263 { 3, 8, 12, 17, 25, 30, 41, 43 }, 264 { 9, 11, 18, 24, 31, 40, 44, 53 }, 265 { 10, 19, 23, 32, 39, 45, 52, 54 }, 266 { 20, 22, 33, 38, 46, 51, 55, 60 }, 267 { 21, 34, 37, 47, 50, 56, 59, 61 }, 268 { 35, 36, 48, 49, 57, 58, 62, 63 } 269 }; 270 271 static const int jpeg_zigzag_order7[7][7] = { 272 { 0, 1, 5, 6, 14, 15, 27 }, 273 { 2, 4, 7, 13, 16, 26, 28 }, 274 { 3, 8, 12, 17, 25, 29, 38 }, 275 { 9, 11, 18, 24, 30, 37, 39 }, 276 { 10, 19, 23, 31, 36, 40, 45 }, 277 { 20, 22, 32, 35, 41, 44, 46 }, 278 { 21, 33, 34, 42, 43, 47, 48 } 279 }; 280 281 static const int jpeg_zigzag_order6[6][6] = { 282 { 0, 1, 5, 6, 14, 15 }, 283 { 2, 4, 7, 13, 16, 25 }, 284 { 3, 8, 12, 17, 24, 26 }, 285 { 9, 11, 18, 23, 27, 32 }, 286 { 10, 19, 22, 28, 31, 33 }, 287 { 20, 21, 29, 30, 34, 35 } 288 }; 289 290 static const int jpeg_zigzag_order5[5][5] = { 291 { 0, 1, 5, 6, 14 }, 292 { 2, 4, 7, 13, 15 }, 293 { 3, 8, 12, 16, 21 }, 294 { 9, 11, 17, 20, 22 }, 295 { 10, 18, 19, 23, 24 } 296 }; 297 298 static const int jpeg_zigzag_order4[4][4] = { 299 { 0, 1, 5, 6 }, 300 { 2, 4, 7, 12 }, 301 { 3, 8, 11, 13 }, 302 { 9, 10, 14, 15 } 303 }; 304 305 static const int jpeg_zigzag_order3[3][3] = { 306 { 0, 1, 5 }, 307 { 2, 4, 6 }, 308 { 3, 7, 8 } 309 }; 310 311 static const int jpeg_zigzag_order2[2][2] = { 312 { 0, 1 }, 313 { 2, 3 } 314 }; 139 315 140 316 … … 142 318 * Compute the derived values for a Huffman table. 143 319 * This routine also performs some validation checks on the table. 144 * 145 * Note this is also used by jdphuff.c. 146 */ 147 148 GLOBAL(void) 320 */ 321 322 LOCAL(void) 149 323 jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, 150 324 d_derived_tbl ** pdtbl) … … 268 442 269 443 /* 270 * Out-of-line code for bit fetching (shared with jdphuff.c). 271 * See jdhuff.h for info about usage. 444 * Out-of-line code for bit fetching. 272 445 * Note: current values of get_buffer and bits_left are passed as parameters, 273 446 * but are returned in the corresponding fields of the state struct. … … 289 462 290 463 291 GLOBAL(boolean)464 LOCAL(boolean) 292 465 jpeg_fill_bit_buffer (bitread_working_state * state, 293 466 register bit_buf_type get_buffer, register int bits_left, … … 370 543 * appears per data segment. 371 544 */ 372 if (! cinfo->entropy->insufficient_data) {545 if (! ((huff_entropy_ptr) cinfo->entropy)->insufficient_data) { 373 546 WARNMS(cinfo, JWRN_HIT_MARKER); 374 cinfo->entropy->insufficient_data = TRUE;547 ((huff_entropy_ptr) cinfo->entropy)->insufficient_data = TRUE; 375 548 } 376 549 /* Fill the buffer with zero bits */ … … 391 564 392 565 /* 566 * Figure F.12: extend sign bit. 567 * On some machines, a shift and sub will be faster than a table lookup. 568 */ 569 570 #ifdef AVOID_TABLES 571 572 #define BIT_MASK(nbits) ((1<<(nbits))-1) 573 #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) - ((1<<(s))-1) : (x)) 574 575 #else 576 577 #define BIT_MASK(nbits) bmask[nbits] 578 #define HUFF_EXTEND(x,s) ((x) <= bmask[(s) - 1] ? (x) - bmask[s] : (x)) 579 580 static const int bmask[16] = /* bmask[n] is mask for n rightmost bits */ 581 { 0, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 582 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF }; 583 584 #endif /* AVOID_TABLES */ 585 586 587 /* 393 588 * Out-of-line code for Huffman code decoding. 394 * See jdhuff.h for info about usage. 395 */ 396 397 GLOBAL(int) 589 */ 590 591 LOCAL(int) 398 592 jpeg_huff_decode (bitread_working_state * state, 399 593 register bit_buf_type get_buffer, register int bits_left, … … 435 629 436 630 /* 437 * Figure F.12: extend sign bit.438 * On some machines, a shift and add will be faster than a table lookup.439 */440 441 #ifdef AVOID_TABLES442 443 #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))444 445 #else446 447 #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))448 449 static const int extend_test[16] = /* entry n is 2**(n-1) */450 { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,451 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };452 453 static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */454 { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,455 ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,456 ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,457 ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };458 459 #endif /* AVOID_TABLES */460 461 462 /*463 631 * Check for a restart marker & resynchronize decoder. 464 632 * Returns FALSE if must suspend. … … 483 651 for (ci = 0; ci < cinfo->comps_in_scan; ci++) 484 652 entropy->saved.last_dc_val[ci] = 0; 653 /* Re-init EOB run count, too */ 654 entropy->saved.EOBRUN = 0; 485 655 486 656 /* Reset restart counter */ … … 493 663 */ 494 664 if (cinfo->unread_marker == 0) 495 entropy-> pub.insufficient_data = FALSE;665 entropy->insufficient_data = FALSE; 496 666 497 667 return TRUE; … … 500 670 501 671 /* 502 * Decode and return one MCU's worth of Huffman-compressed coefficients. 672 * Huffman MCU decoding. 673 * Each of these routines decodes and returns one MCU's worth of 674 * Huffman-compressed coefficients. 503 675 * The coefficients are reordered from zigzag order into natural array order, 504 676 * but are not dequantized. 505 677 * 506 678 * The i'th block of the MCU is stored into the block pointed to by 507 * MCU_data[i]. WE ASSUME THIS AREA HAS BEENZEROED BY THE CALLER.679 * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. 508 680 * (Wholesale zeroing is usually a little faster than retail...) 509 681 * 510 * ReturnsFALSE if data source requested suspension. In that case no682 * We return FALSE if data source requested suspension. In that case no 511 683 * changes have been made to permanent state. (Exception: some output 512 684 * coefficients may already have been assigned. This is harmless for 513 * this module, since we'll just re-assign them on the next call.) 685 * spectral selection, since we'll just re-assign them on the next call. 686 * Successive approximation AC refinement has to be more careful, however.) 687 */ 688 689 /* 690 * MCU decoding for DC initial scan (either spectral selection, 691 * or first pass of successive approximation). 692 */ 693 694 METHODDEF(boolean) 695 decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) 696 { 697 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 698 int Al = cinfo->Al; 699 register int s, r; 700 int blkn, ci; 701 JBLOCKROW block; 702 BITREAD_STATE_VARS; 703 savable_state state; 704 d_derived_tbl * tbl; 705 jpeg_component_info * compptr; 706 707 /* Process restart marker if needed; may have to suspend */ 708 if (cinfo->restart_interval) { 709 if (entropy->restarts_to_go == 0) 710 if (! process_restart(cinfo)) 711 return FALSE; 712 } 713 714 /* If we've run out of data, just leave the MCU set to zeroes. 715 * This way, we return uniform gray for the remainder of the segment. 716 */ 717 if (! entropy->insufficient_data) { 718 719 /* Load up working state */ 720 BITREAD_LOAD_STATE(cinfo,entropy->bitstate); 721 ASSIGN_STATE(state, entropy->saved); 722 723 /* Outer loop handles each block in the MCU */ 724 725 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 726 block = MCU_data[blkn]; 727 ci = cinfo->MCU_membership[blkn]; 728 compptr = cinfo->cur_comp_info[ci]; 729 tbl = entropy->derived_tbls[compptr->dc_tbl_no]; 730 731 /* Decode a single block's worth of coefficients */ 732 733 /* Section F.2.2.1: decode the DC coefficient difference */ 734 HUFF_DECODE(s, br_state, tbl, return FALSE, label1); 735 if (s) { 736 CHECK_BIT_BUFFER(br_state, s, return FALSE); 737 r = GET_BITS(s); 738 s = HUFF_EXTEND(r, s); 739 } 740 741 /* Convert DC difference to actual value, update last_dc_val */ 742 s += state.last_dc_val[ci]; 743 state.last_dc_val[ci] = s; 744 /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ 745 (*block)[0] = (JCOEF) (s << Al); 746 } 747 748 /* Completed MCU, so update state */ 749 BITREAD_SAVE_STATE(cinfo,entropy->bitstate); 750 ASSIGN_STATE(entropy->saved, state); 751 } 752 753 /* Account for restart interval (no-op if not using restarts) */ 754 entropy->restarts_to_go--; 755 756 return TRUE; 757 } 758 759 760 /* 761 * MCU decoding for AC initial scan (either spectral selection, 762 * or first pass of successive approximation). 763 */ 764 765 METHODDEF(boolean) 766 decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) 767 { 768 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 769 register int s, k, r; 770 unsigned int EOBRUN; 771 int Se, Al; 772 const int * natural_order; 773 JBLOCKROW block; 774 BITREAD_STATE_VARS; 775 d_derived_tbl * tbl; 776 777 /* Process restart marker if needed; may have to suspend */ 778 if (cinfo->restart_interval) { 779 if (entropy->restarts_to_go == 0) 780 if (! process_restart(cinfo)) 781 return FALSE; 782 } 783 784 /* If we've run out of data, just leave the MCU set to zeroes. 785 * This way, we return uniform gray for the remainder of the segment. 786 */ 787 if (! entropy->insufficient_data) { 788 789 Se = cinfo->Se; 790 Al = cinfo->Al; 791 natural_order = cinfo->natural_order; 792 793 /* Load up working state. 794 * We can avoid loading/saving bitread state if in an EOB run. 795 */ 796 EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ 797 798 /* There is always only one block per MCU */ 799 800 if (EOBRUN > 0) /* if it's a band of zeroes... */ 801 EOBRUN--; /* ...process it now (we do nothing) */ 802 else { 803 BITREAD_LOAD_STATE(cinfo,entropy->bitstate); 804 block = MCU_data[0]; 805 tbl = entropy->ac_derived_tbl; 806 807 for (k = cinfo->Ss; k <= Se; k++) { 808 HUFF_DECODE(s, br_state, tbl, return FALSE, label2); 809 r = s >> 4; 810 s &= 15; 811 if (s) { 812 k += r; 813 CHECK_BIT_BUFFER(br_state, s, return FALSE); 814 r = GET_BITS(s); 815 s = HUFF_EXTEND(r, s); 816 /* Scale and output coefficient in natural (dezigzagged) order */ 817 (*block)[natural_order[k]] = (JCOEF) (s << Al); 818 } else { 819 if (r == 15) { /* ZRL */ 820 k += 15; /* skip 15 zeroes in band */ 821 } else { /* EOBr, run length is 2^r + appended bits */ 822 EOBRUN = 1 << r; 823 if (r) { /* EOBr, r > 0 */ 824 CHECK_BIT_BUFFER(br_state, r, return FALSE); 825 r = GET_BITS(r); 826 EOBRUN += r; 827 } 828 EOBRUN--; /* this band is processed at this moment */ 829 break; /* force end-of-band */ 830 } 831 } 832 } 833 834 BITREAD_SAVE_STATE(cinfo,entropy->bitstate); 835 } 836 837 /* Completed MCU, so update state */ 838 entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ 839 } 840 841 /* Account for restart interval (no-op if not using restarts) */ 842 entropy->restarts_to_go--; 843 844 return TRUE; 845 } 846 847 848 /* 849 * MCU decoding for DC successive approximation refinement scan. 850 * Note: we assume such scans can be multi-component, although the spec 851 * is not very clear on the point. 852 */ 853 854 METHODDEF(boolean) 855 decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) 856 { 857 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 858 int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ 859 int blkn; 860 JBLOCKROW block; 861 BITREAD_STATE_VARS; 862 863 /* Process restart marker if needed; may have to suspend */ 864 if (cinfo->restart_interval) { 865 if (entropy->restarts_to_go == 0) 866 if (! process_restart(cinfo)) 867 return FALSE; 868 } 869 870 /* Not worth the cycles to check insufficient_data here, 871 * since we will not change the data anyway if we read zeroes. 872 */ 873 874 /* Load up working state */ 875 BITREAD_LOAD_STATE(cinfo,entropy->bitstate); 876 877 /* Outer loop handles each block in the MCU */ 878 879 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 880 block = MCU_data[blkn]; 881 882 /* Encoded data is simply the next bit of the two's-complement DC value */ 883 CHECK_BIT_BUFFER(br_state, 1, return FALSE); 884 if (GET_BITS(1)) 885 (*block)[0] |= p1; 886 /* Note: since we use |=, repeating the assignment later is safe */ 887 } 888 889 /* Completed MCU, so update state */ 890 BITREAD_SAVE_STATE(cinfo,entropy->bitstate); 891 892 /* Account for restart interval (no-op if not using restarts) */ 893 entropy->restarts_to_go--; 894 895 return TRUE; 896 } 897 898 899 /* 900 * MCU decoding for AC successive approximation refinement scan. 901 */ 902 903 METHODDEF(boolean) 904 decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) 905 { 906 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 907 register int s, k, r; 908 unsigned int EOBRUN; 909 int Se, p1, m1; 910 const int * natural_order; 911 JBLOCKROW block; 912 JCOEFPTR thiscoef; 913 BITREAD_STATE_VARS; 914 d_derived_tbl * tbl; 915 int num_newnz; 916 int newnz_pos[DCTSIZE2]; 917 918 /* Process restart marker if needed; may have to suspend */ 919 if (cinfo->restart_interval) { 920 if (entropy->restarts_to_go == 0) 921 if (! process_restart(cinfo)) 922 return FALSE; 923 } 924 925 /* If we've run out of data, don't modify the MCU. 926 */ 927 if (! entropy->insufficient_data) { 928 929 Se = cinfo->Se; 930 p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ 931 m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ 932 natural_order = cinfo->natural_order; 933 934 /* Load up working state */ 935 BITREAD_LOAD_STATE(cinfo,entropy->bitstate); 936 EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ 937 938 /* There is always only one block per MCU */ 939 block = MCU_data[0]; 940 tbl = entropy->ac_derived_tbl; 941 942 /* If we are forced to suspend, we must undo the assignments to any newly 943 * nonzero coefficients in the block, because otherwise we'd get confused 944 * next time about which coefficients were already nonzero. 945 * But we need not undo addition of bits to already-nonzero coefficients; 946 * instead, we can test the current bit to see if we already did it. 947 */ 948 num_newnz = 0; 949 950 /* initialize coefficient loop counter to start of band */ 951 k = cinfo->Ss; 952 953 if (EOBRUN == 0) { 954 for (; k <= Se; k++) { 955 HUFF_DECODE(s, br_state, tbl, goto undoit, label3); 956 r = s >> 4; 957 s &= 15; 958 if (s) { 959 if (s != 1) /* size of new coef should always be 1 */ 960 WARNMS(cinfo, JWRN_HUFF_BAD_CODE); 961 CHECK_BIT_BUFFER(br_state, 1, goto undoit); 962 if (GET_BITS(1)) 963 s = p1; /* newly nonzero coef is positive */ 964 else 965 s = m1; /* newly nonzero coef is negative */ 966 } else { 967 if (r != 15) { 968 EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ 969 if (r) { 970 CHECK_BIT_BUFFER(br_state, r, goto undoit); 971 r = GET_BITS(r); 972 EOBRUN += r; 973 } 974 break; /* rest of block is handled by EOB logic */ 975 } 976 /* note s = 0 for processing ZRL */ 977 } 978 /* Advance over already-nonzero coefs and r still-zero coefs, 979 * appending correction bits to the nonzeroes. A correction bit is 1 980 * if the absolute value of the coefficient must be increased. 981 */ 982 do { 983 thiscoef = *block + natural_order[k]; 984 if (*thiscoef != 0) { 985 CHECK_BIT_BUFFER(br_state, 1, goto undoit); 986 if (GET_BITS(1)) { 987 if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ 988 if (*thiscoef >= 0) 989 *thiscoef += p1; 990 else 991 *thiscoef += m1; 992 } 993 } 994 } else { 995 if (--r < 0) 996 break; /* reached target zero coefficient */ 997 } 998 k++; 999 } while (k <= Se); 1000 if (s) { 1001 int pos = natural_order[k]; 1002 /* Output newly nonzero coefficient */ 1003 (*block)[pos] = (JCOEF) s; 1004 /* Remember its position in case we have to suspend */ 1005 newnz_pos[num_newnz++] = pos; 1006 } 1007 } 1008 } 1009 1010 if (EOBRUN > 0) { 1011 /* Scan any remaining coefficient positions after the end-of-band 1012 * (the last newly nonzero coefficient, if any). Append a correction 1013 * bit to each already-nonzero coefficient. A correction bit is 1 1014 * if the absolute value of the coefficient must be increased. 1015 */ 1016 for (; k <= Se; k++) { 1017 thiscoef = *block + natural_order[k]; 1018 if (*thiscoef != 0) { 1019 CHECK_BIT_BUFFER(br_state, 1, goto undoit); 1020 if (GET_BITS(1)) { 1021 if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ 1022 if (*thiscoef >= 0) 1023 *thiscoef += p1; 1024 else 1025 *thiscoef += m1; 1026 } 1027 } 1028 } 1029 } 1030 /* Count one block completed in EOB run */ 1031 EOBRUN--; 1032 } 1033 1034 /* Completed MCU, so update state */ 1035 BITREAD_SAVE_STATE(cinfo,entropy->bitstate); 1036 entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ 1037 } 1038 1039 /* Account for restart interval (no-op if not using restarts) */ 1040 entropy->restarts_to_go--; 1041 1042 return TRUE; 1043 1044 undoit: 1045 /* Re-zero any output coefficients that we made newly nonzero */ 1046 while (num_newnz > 0) 1047 (*block)[newnz_pos[--num_newnz]] = 0; 1048 1049 return FALSE; 1050 } 1051 1052 1053 /* 1054 * Decode one MCU's worth of Huffman-compressed coefficients, 1055 * partial blocks. 1056 */ 1057 1058 METHODDEF(boolean) 1059 decode_mcu_sub (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) 1060 { 1061 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 1062 const int * natural_order; 1063 int Se, blkn; 1064 BITREAD_STATE_VARS; 1065 savable_state state; 1066 1067 /* Process restart marker if needed; may have to suspend */ 1068 if (cinfo->restart_interval) { 1069 if (entropy->restarts_to_go == 0) 1070 if (! process_restart(cinfo)) 1071 return FALSE; 1072 } 1073 1074 /* If we've run out of data, just leave the MCU set to zeroes. 1075 * This way, we return uniform gray for the remainder of the segment. 1076 */ 1077 if (! entropy->insufficient_data) { 1078 1079 natural_order = cinfo->natural_order; 1080 Se = cinfo->lim_Se; 1081 1082 /* Load up working state */ 1083 BITREAD_LOAD_STATE(cinfo,entropy->bitstate); 1084 ASSIGN_STATE(state, entropy->saved); 1085 1086 /* Outer loop handles each block in the MCU */ 1087 1088 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 1089 JBLOCKROW block = MCU_data[blkn]; 1090 d_derived_tbl * htbl; 1091 register int s, k, r; 1092 int coef_limit, ci; 1093 1094 /* Decode a single block's worth of coefficients */ 1095 1096 /* Section F.2.2.1: decode the DC coefficient difference */ 1097 htbl = entropy->dc_cur_tbls[blkn]; 1098 HUFF_DECODE(s, br_state, htbl, return FALSE, label1); 1099 1100 htbl = entropy->ac_cur_tbls[blkn]; 1101 k = 1; 1102 coef_limit = entropy->coef_limit[blkn]; 1103 if (coef_limit) { 1104 /* Convert DC difference to actual value, update last_dc_val */ 1105 if (s) { 1106 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1107 r = GET_BITS(s); 1108 s = HUFF_EXTEND(r, s); 1109 } 1110 ci = cinfo->MCU_membership[blkn]; 1111 s += state.last_dc_val[ci]; 1112 state.last_dc_val[ci] = s; 1113 /* Output the DC coefficient */ 1114 (*block)[0] = (JCOEF) s; 1115 1116 /* Section F.2.2.2: decode the AC coefficients */ 1117 /* Since zeroes are skipped, output area must be cleared beforehand */ 1118 for (; k < coef_limit; k++) { 1119 HUFF_DECODE(s, br_state, htbl, return FALSE, label2); 1120 1121 r = s >> 4; 1122 s &= 15; 1123 1124 if (s) { 1125 k += r; 1126 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1127 r = GET_BITS(s); 1128 s = HUFF_EXTEND(r, s); 1129 /* Output coefficient in natural (dezigzagged) order. 1130 * Note: the extra entries in natural_order[] will save us 1131 * if k > Se, which could happen if the data is corrupted. 1132 */ 1133 (*block)[natural_order[k]] = (JCOEF) s; 1134 } else { 1135 if (r != 15) 1136 goto EndOfBlock; 1137 k += 15; 1138 } 1139 } 1140 } else { 1141 if (s) { 1142 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1143 DROP_BITS(s); 1144 } 1145 } 1146 1147 /* Section F.2.2.2: decode the AC coefficients */ 1148 /* In this path we just discard the values */ 1149 for (; k <= Se; k++) { 1150 HUFF_DECODE(s, br_state, htbl, return FALSE, label3); 1151 1152 r = s >> 4; 1153 s &= 15; 1154 1155 if (s) { 1156 k += r; 1157 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1158 DROP_BITS(s); 1159 } else { 1160 if (r != 15) 1161 break; 1162 k += 15; 1163 } 1164 } 1165 1166 EndOfBlock: ; 1167 } 1168 1169 /* Completed MCU, so update state */ 1170 BITREAD_SAVE_STATE(cinfo,entropy->bitstate); 1171 ASSIGN_STATE(entropy->saved, state); 1172 } 1173 1174 /* Account for restart interval (no-op if not using restarts) */ 1175 entropy->restarts_to_go--; 1176 1177 return TRUE; 1178 } 1179 1180 1181 /* 1182 * Decode one MCU's worth of Huffman-compressed coefficients, 1183 * full-size blocks. 514 1184 */ 515 1185 … … 532 1202 * This way, we return uniform gray for the remainder of the segment. 533 1203 */ 534 if (! entropy-> pub.insufficient_data) {1204 if (! entropy->insufficient_data) { 535 1205 536 1206 /* Load up working state */ … … 542 1212 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 543 1213 JBLOCKROW block = MCU_data[blkn]; 544 d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; 545 d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; 1214 d_derived_tbl * htbl; 546 1215 register int s, k, r; 1216 int coef_limit, ci; 547 1217 548 1218 /* Decode a single block's worth of coefficients */ 549 1219 550 1220 /* Section F.2.2.1: decode the DC coefficient difference */ 551 HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); 552 if (s) { 553 CHECK_BIT_BUFFER(br_state, s, return FALSE); 554 r = GET_BITS(s); 555 s = HUFF_EXTEND(r, s); 556 } 557 558 if (entropy->dc_needed[blkn]) { 1221 htbl = entropy->dc_cur_tbls[blkn]; 1222 HUFF_DECODE(s, br_state, htbl, return FALSE, label1); 1223 1224 htbl = entropy->ac_cur_tbls[blkn]; 1225 k = 1; 1226 coef_limit = entropy->coef_limit[blkn]; 1227 if (coef_limit) { 559 1228 /* Convert DC difference to actual value, update last_dc_val */ 560 int ci = cinfo->MCU_membership[blkn]; 1229 if (s) { 1230 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1231 r = GET_BITS(s); 1232 s = HUFF_EXTEND(r, s); 1233 } 1234 ci = cinfo->MCU_membership[blkn]; 561 1235 s += state.last_dc_val[ci]; 562 1236 state.last_dc_val[ci] = s; 563 /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0)*/1237 /* Output the DC coefficient */ 564 1238 (*block)[0] = (JCOEF) s; 565 }566 567 if (entropy->ac_needed[blkn]) {568 1239 569 1240 /* Section F.2.2.2: decode the AC coefficients */ 570 1241 /* Since zeroes are skipped, output area must be cleared beforehand */ 571 for ( k = 1; k < DCTSIZE2; k++) {572 HUFF_DECODE(s, br_state, actbl, return FALSE, label2);573 1242 for (; k < coef_limit; k++) { 1243 HUFF_DECODE(s, br_state, htbl, return FALSE, label2); 1244 574 1245 r = s >> 4; 575 1246 s &= 15; 576 1247 577 1248 if (s) { 578 1249 k += r; … … 587 1258 } else { 588 1259 if (r != 15) 589 break;1260 goto EndOfBlock; 590 1261 k += 15; 591 1262 } 592 1263 } 593 594 1264 } else { 595 596 /* Section F.2.2.2: decode the AC coefficients */ 597 /* In this path we just discard the values */ 598 for (k = 1; k < DCTSIZE2; k++) { 599 HUFF_DECODE(s, br_state, actbl, return FALSE, label3); 600 601 r = s >> 4; 602 s &= 15; 603 604 if (s) { 605 k += r; 606 CHECK_BIT_BUFFER(br_state, s, return FALSE); 607 DROP_BITS(s); 608 } else { 609 if (r != 15) 610 break; 611 k += 15; 612 } 1265 if (s) { 1266 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1267 DROP_BITS(s); 613 1268 } 614 615 1269 } 1270 1271 /* Section F.2.2.2: decode the AC coefficients */ 1272 /* In this path we just discard the values */ 1273 for (; k < DCTSIZE2; k++) { 1274 HUFF_DECODE(s, br_state, htbl, return FALSE, label3); 1275 1276 r = s >> 4; 1277 s &= 15; 1278 1279 if (s) { 1280 k += r; 1281 CHECK_BIT_BUFFER(br_state, s, return FALSE); 1282 DROP_BITS(s); 1283 } else { 1284 if (r != 15) 1285 break; 1286 k += 15; 1287 } 1288 } 1289 1290 EndOfBlock: ; 616 1291 } 617 1292 … … 625 1300 626 1301 return TRUE; 1302 } 1303 1304 1305 /* 1306 * Initialize for a Huffman-compressed scan. 1307 */ 1308 1309 METHODDEF(void) 1310 start_pass_huff_decoder (j_decompress_ptr cinfo) 1311 { 1312 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; 1313 int ci, blkn, tbl, i; 1314 jpeg_component_info * compptr; 1315 1316 if (cinfo->progressive_mode) { 1317 /* Validate progressive scan parameters */ 1318 if (cinfo->Ss == 0) { 1319 if (cinfo->Se != 0) 1320 goto bad; 1321 } else { 1322 /* need not check Ss/Se < 0 since they came from unsigned bytes */ 1323 if (cinfo->Se < cinfo->Ss || cinfo->Se > cinfo->lim_Se) 1324 goto bad; 1325 /* AC scans may have only one component */ 1326 if (cinfo->comps_in_scan != 1) 1327 goto bad; 1328 } 1329 if (cinfo->Ah != 0) { 1330 /* Successive approximation refinement scan: must have Al = Ah-1. */ 1331 if (cinfo->Ah-1 != cinfo->Al) 1332 goto bad; 1333 } 1334 if (cinfo->Al > 13) { /* need not check for < 0 */ 1335 /* Arguably the maximum Al value should be less than 13 for 8-bit precision, 1336 * but the spec doesn't say so, and we try to be liberal about what we 1337 * accept. Note: large Al values could result in out-of-range DC 1338 * coefficients during early scans, leading to bizarre displays due to 1339 * overflows in the IDCT math. But we won't crash. 1340 */ 1341 bad: 1342 ERREXIT4(cinfo, JERR_BAD_PROGRESSION, 1343 cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); 1344 } 1345 /* Update progression status, and verify that scan order is legal. 1346 * Note that inter-scan inconsistencies are treated as warnings 1347 * not fatal errors ... not clear if this is right way to behave. 1348 */ 1349 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 1350 int coefi, cindex = cinfo->cur_comp_info[ci]->component_index; 1351 int *coef_bit_ptr = & cinfo->coef_bits[cindex][0]; 1352 if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */ 1353 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); 1354 for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { 1355 int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; 1356 if (cinfo->Ah != expected) 1357 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); 1358 coef_bit_ptr[coefi] = cinfo->Al; 1359 } 1360 } 1361 1362 /* Select MCU decoding routine */ 1363 if (cinfo->Ah == 0) { 1364 if (cinfo->Ss == 0) 1365 entropy->pub.decode_mcu = decode_mcu_DC_first; 1366 else 1367 entropy->pub.decode_mcu = decode_mcu_AC_first; 1368 } else { 1369 if (cinfo->Ss == 0) 1370 entropy->pub.decode_mcu = decode_mcu_DC_refine; 1371 else 1372 entropy->pub.decode_mcu = decode_mcu_AC_refine; 1373 } 1374 1375 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 1376 compptr = cinfo->cur_comp_info[ci]; 1377 /* Make sure requested tables are present, and compute derived tables. 1378 * We may build same derived table more than once, but it's not expensive. 1379 */ 1380 if (cinfo->Ss == 0) { 1381 if (cinfo->Ah == 0) { /* DC refinement needs no table */ 1382 tbl = compptr->dc_tbl_no; 1383 jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, 1384 & entropy->derived_tbls[tbl]); 1385 } 1386 } else { 1387 tbl = compptr->ac_tbl_no; 1388 jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, 1389 & entropy->derived_tbls[tbl]); 1390 /* remember the single active table */ 1391 entropy->ac_derived_tbl = entropy->derived_tbls[tbl]; 1392 } 1393 /* Initialize DC predictions to 0 */ 1394 entropy->saved.last_dc_val[ci] = 0; 1395 } 1396 1397 /* Initialize private state variables */ 1398 entropy->saved.EOBRUN = 0; 1399 } else { 1400 /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. 1401 * This ought to be an error condition, but we make it a warning because 1402 * there are some baseline files out there with all zeroes in these bytes. 1403 */ 1404 if (cinfo->Ss != 0 || cinfo->Ah != 0 || cinfo->Al != 0 || 1405 ((cinfo->is_baseline || cinfo->Se < DCTSIZE2) && 1406 cinfo->Se != cinfo->lim_Se)) 1407 WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); 1408 1409 /* Select MCU decoding routine */ 1410 /* We retain the hard-coded case for full-size blocks. 1411 * This is not necessary, but it appears that this version is slightly 1412 * more performant in the given implementation. 1413 * With an improved implementation we would prefer a single optimized 1414 * function. 1415 */ 1416 if (cinfo->lim_Se != DCTSIZE2-1) 1417 entropy->pub.decode_mcu = decode_mcu_sub; 1418 else 1419 entropy->pub.decode_mcu = decode_mcu; 1420 1421 for (ci = 0; ci < cinfo->comps_in_scan; ci++) { 1422 compptr = cinfo->cur_comp_info[ci]; 1423 /* Compute derived values for Huffman tables */ 1424 /* We may do this more than once for a table, but it's not expensive */ 1425 tbl = compptr->dc_tbl_no; 1426 jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, 1427 & entropy->dc_derived_tbls[tbl]); 1428 if (cinfo->lim_Se) { /* AC needs no table when not present */ 1429 tbl = compptr->ac_tbl_no; 1430 jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, 1431 & entropy->ac_derived_tbls[tbl]); 1432 } 1433 /* Initialize DC predictions to 0 */ 1434 entropy->saved.last_dc_val[ci] = 0; 1435 } 1436 1437 /* Precalculate decoding info for each block in an MCU of this scan */ 1438 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { 1439 ci = cinfo->MCU_membership[blkn]; 1440 compptr = cinfo->cur_comp_info[ci]; 1441 /* Precalculate which table to use for each block */ 1442 entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no]; 1443 entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no]; 1444 /* Decide whether we really care about the coefficient values */ 1445 if (compptr->component_needed) { 1446 ci = compptr->DCT_v_scaled_size; 1447 i = compptr->DCT_h_scaled_size; 1448 switch (cinfo->lim_Se) { 1449 case (1*1-1): 1450 entropy->coef_limit[blkn] = 1; 1451 break; 1452 case (2*2-1): 1453 if (ci <= 0 || ci > 2) ci = 2; 1454 if (i <= 0 || i > 2) i = 2; 1455 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order2[ci - 1][i - 1]; 1456 break; 1457 case (3*3-1): 1458 if (ci <= 0 || ci > 3) ci = 3; 1459 if (i <= 0 || i > 3) i = 3; 1460 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order3[ci - 1][i - 1]; 1461 break; 1462 case (4*4-1): 1463 if (ci <= 0 || ci > 4) ci = 4; 1464 if (i <= 0 || i > 4) i = 4; 1465 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order4[ci - 1][i - 1]; 1466 break; 1467 case (5*5-1): 1468 if (ci <= 0 || ci > 5) ci = 5; 1469 if (i <= 0 || i > 5) i = 5; 1470 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order5[ci - 1][i - 1]; 1471 break; 1472 case (6*6-1): 1473 if (ci <= 0 || ci > 6) ci = 6; 1474 if (i <= 0 || i > 6) i = 6; 1475 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order6[ci - 1][i - 1]; 1476 break; 1477 case (7*7-1): 1478 if (ci <= 0 || ci > 7) ci = 7; 1479 if (i <= 0 || i > 7) i = 7; 1480 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order7[ci - 1][i - 1]; 1481 break; 1482 default: 1483 if (ci <= 0 || ci > 8) ci = 8; 1484 if (i <= 0 || i > 8) i = 8; 1485 entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order[ci - 1][i - 1]; 1486 break; 1487 } 1488 } else { 1489 entropy->coef_limit[blkn] = 0; 1490 } 1491 } 1492 } 1493 1494 /* Initialize bitread state variables */ 1495 entropy->bitstate.bits_left = 0; 1496 entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ 1497 entropy->insufficient_data = FALSE; 1498 1499 /* Initialize restart counter */ 1500 entropy->restarts_to_go = cinfo->restart_interval; 627 1501 } 628 1502 … … 643 1517 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; 644 1518 entropy->pub.start_pass = start_pass_huff_decoder; 645 entropy->pub.decode_mcu = decode_mcu; 646 647 /* Mark tables unallocated */ 648 for (i = 0; i < NUM_HUFF_TBLS; i++) { 649 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; 1519 1520 if (cinfo->progressive_mode) { 1521 /* Create progression status table */ 1522 int *coef_bit_ptr, ci; 1523 cinfo->coef_bits = (int (*)[DCTSIZE2]) 1524 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 1525 cinfo->num_components*DCTSIZE2*SIZEOF(int)); 1526 coef_bit_ptr = & cinfo->coef_bits[0][0]; 1527 for (ci = 0; ci < cinfo->num_components; ci++) 1528 for (i = 0; i < DCTSIZE2; i++) 1529 *coef_bit_ptr++ = -1; 1530 1531 /* Mark derived tables unallocated */ 1532 for (i = 0; i < NUM_HUFF_TBLS; i++) { 1533 entropy->derived_tbls[i] = NULL; 1534 } 1535 } else { 1536 /* Mark tables unallocated */ 1537 for (i = 0; i < NUM_HUFF_TBLS; i++) { 1538 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; 1539 } 650 1540 } 651 1541 } -
trunk/src/3rdparty/libjpeg/jdinput.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 2002-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 9 10 * These routines are concerned with controlling the decompressor's input 10 11 * processing (marker reading and coefficient decoding). The actual input 11 * reading is done in jdmarker.c, jdhuff.c, and jd phuff.c.12 * reading is done in jdmarker.c, jdhuff.c, and jdarith.c. 12 13 */ 13 14 … … 22 23 struct jpeg_input_controller pub; /* public fields */ 23 24 24 boolean inheaders; /* TRUEuntil first SOS is reached */25 int inheaders; /* Nonzero until first SOS is reached */ 25 26 } my_input_controller; 26 27 … … 35 36 * Routines to calculate various quantities related to the size of the image. 36 37 */ 38 39 40 /* 41 * Compute output image dimensions and related values. 42 * NOTE: this is exported for possible use by application. 43 * Hence it mustn't do anything that can't be done twice. 44 */ 45 46 GLOBAL(void) 47 jpeg_core_output_dimensions (j_decompress_ptr cinfo) 48 /* Do computations that are needed before master selection phase. 49 * This function is used for transcoding and full decompression. 50 */ 51 { 52 #ifdef IDCT_SCALING_SUPPORTED 53 int ci; 54 jpeg_component_info *compptr; 55 56 /* Compute actual output image dimensions and DCT scaling choices. */ 57 if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom) { 58 /* Provide 1/block_size scaling */ 59 cinfo->output_width = (JDIMENSION) 60 jdiv_round_up((long) cinfo->image_width, (long) cinfo->block_size); 61 cinfo->output_height = (JDIMENSION) 62 jdiv_round_up((long) cinfo->image_height, (long) cinfo->block_size); 63 cinfo->min_DCT_h_scaled_size = 1; 64 cinfo->min_DCT_v_scaled_size = 1; 65 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 2) { 66 /* Provide 2/block_size scaling */ 67 cinfo->output_width = (JDIMENSION) 68 jdiv_round_up((long) cinfo->image_width * 2L, (long) cinfo->block_size); 69 cinfo->output_height = (JDIMENSION) 70 jdiv_round_up((long) cinfo->image_height * 2L, (long) cinfo->block_size); 71 cinfo->min_DCT_h_scaled_size = 2; 72 cinfo->min_DCT_v_scaled_size = 2; 73 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 3) { 74 /* Provide 3/block_size scaling */ 75 cinfo->output_width = (JDIMENSION) 76 jdiv_round_up((long) cinfo->image_width * 3L, (long) cinfo->block_size); 77 cinfo->output_height = (JDIMENSION) 78 jdiv_round_up((long) cinfo->image_height * 3L, (long) cinfo->block_size); 79 cinfo->min_DCT_h_scaled_size = 3; 80 cinfo->min_DCT_v_scaled_size = 3; 81 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 4) { 82 /* Provide 4/block_size scaling */ 83 cinfo->output_width = (JDIMENSION) 84 jdiv_round_up((long) cinfo->image_width * 4L, (long) cinfo->block_size); 85 cinfo->output_height = (JDIMENSION) 86 jdiv_round_up((long) cinfo->image_height * 4L, (long) cinfo->block_size); 87 cinfo->min_DCT_h_scaled_size = 4; 88 cinfo->min_DCT_v_scaled_size = 4; 89 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 5) { 90 /* Provide 5/block_size scaling */ 91 cinfo->output_width = (JDIMENSION) 92 jdiv_round_up((long) cinfo->image_width * 5L, (long) cinfo->block_size); 93 cinfo->output_height = (JDIMENSION) 94 jdiv_round_up((long) cinfo->image_height * 5L, (long) cinfo->block_size); 95 cinfo->min_DCT_h_scaled_size = 5; 96 cinfo->min_DCT_v_scaled_size = 5; 97 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 6) { 98 /* Provide 6/block_size scaling */ 99 cinfo->output_width = (JDIMENSION) 100 jdiv_round_up((long) cinfo->image_width * 6L, (long) cinfo->block_size); 101 cinfo->output_height = (JDIMENSION) 102 jdiv_round_up((long) cinfo->image_height * 6L, (long) cinfo->block_size); 103 cinfo->min_DCT_h_scaled_size = 6; 104 cinfo->min_DCT_v_scaled_size = 6; 105 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 7) { 106 /* Provide 7/block_size scaling */ 107 cinfo->output_width = (JDIMENSION) 108 jdiv_round_up((long) cinfo->image_width * 7L, (long) cinfo->block_size); 109 cinfo->output_height = (JDIMENSION) 110 jdiv_round_up((long) cinfo->image_height * 7L, (long) cinfo->block_size); 111 cinfo->min_DCT_h_scaled_size = 7; 112 cinfo->min_DCT_v_scaled_size = 7; 113 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 8) { 114 /* Provide 8/block_size scaling */ 115 cinfo->output_width = (JDIMENSION) 116 jdiv_round_up((long) cinfo->image_width * 8L, (long) cinfo->block_size); 117 cinfo->output_height = (JDIMENSION) 118 jdiv_round_up((long) cinfo->image_height * 8L, (long) cinfo->block_size); 119 cinfo->min_DCT_h_scaled_size = 8; 120 cinfo->min_DCT_v_scaled_size = 8; 121 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 9) { 122 /* Provide 9/block_size scaling */ 123 cinfo->output_width = (JDIMENSION) 124 jdiv_round_up((long) cinfo->image_width * 9L, (long) cinfo->block_size); 125 cinfo->output_height = (JDIMENSION) 126 jdiv_round_up((long) cinfo->image_height * 9L, (long) cinfo->block_size); 127 cinfo->min_DCT_h_scaled_size = 9; 128 cinfo->min_DCT_v_scaled_size = 9; 129 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 10) { 130 /* Provide 10/block_size scaling */ 131 cinfo->output_width = (JDIMENSION) 132 jdiv_round_up((long) cinfo->image_width * 10L, (long) cinfo->block_size); 133 cinfo->output_height = (JDIMENSION) 134 jdiv_round_up((long) cinfo->image_height * 10L, (long) cinfo->block_size); 135 cinfo->min_DCT_h_scaled_size = 10; 136 cinfo->min_DCT_v_scaled_size = 10; 137 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 11) { 138 /* Provide 11/block_size scaling */ 139 cinfo->output_width = (JDIMENSION) 140 jdiv_round_up((long) cinfo->image_width * 11L, (long) cinfo->block_size); 141 cinfo->output_height = (JDIMENSION) 142 jdiv_round_up((long) cinfo->image_height * 11L, (long) cinfo->block_size); 143 cinfo->min_DCT_h_scaled_size = 11; 144 cinfo->min_DCT_v_scaled_size = 11; 145 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 12) { 146 /* Provide 12/block_size scaling */ 147 cinfo->output_width = (JDIMENSION) 148 jdiv_round_up((long) cinfo->image_width * 12L, (long) cinfo->block_size); 149 cinfo->output_height = (JDIMENSION) 150 jdiv_round_up((long) cinfo->image_height * 12L, (long) cinfo->block_size); 151 cinfo->min_DCT_h_scaled_size = 12; 152 cinfo->min_DCT_v_scaled_size = 12; 153 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 13) { 154 /* Provide 13/block_size scaling */ 155 cinfo->output_width = (JDIMENSION) 156 jdiv_round_up((long) cinfo->image_width * 13L, (long) cinfo->block_size); 157 cinfo->output_height = (JDIMENSION) 158 jdiv_round_up((long) cinfo->image_height * 13L, (long) cinfo->block_size); 159 cinfo->min_DCT_h_scaled_size = 13; 160 cinfo->min_DCT_v_scaled_size = 13; 161 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 14) { 162 /* Provide 14/block_size scaling */ 163 cinfo->output_width = (JDIMENSION) 164 jdiv_round_up((long) cinfo->image_width * 14L, (long) cinfo->block_size); 165 cinfo->output_height = (JDIMENSION) 166 jdiv_round_up((long) cinfo->image_height * 14L, (long) cinfo->block_size); 167 cinfo->min_DCT_h_scaled_size = 14; 168 cinfo->min_DCT_v_scaled_size = 14; 169 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 15) { 170 /* Provide 15/block_size scaling */ 171 cinfo->output_width = (JDIMENSION) 172 jdiv_round_up((long) cinfo->image_width * 15L, (long) cinfo->block_size); 173 cinfo->output_height = (JDIMENSION) 174 jdiv_round_up((long) cinfo->image_height * 15L, (long) cinfo->block_size); 175 cinfo->min_DCT_h_scaled_size = 15; 176 cinfo->min_DCT_v_scaled_size = 15; 177 } else { 178 /* Provide 16/block_size scaling */ 179 cinfo->output_width = (JDIMENSION) 180 jdiv_round_up((long) cinfo->image_width * 16L, (long) cinfo->block_size); 181 cinfo->output_height = (JDIMENSION) 182 jdiv_round_up((long) cinfo->image_height * 16L, (long) cinfo->block_size); 183 cinfo->min_DCT_h_scaled_size = 16; 184 cinfo->min_DCT_v_scaled_size = 16; 185 } 186 187 /* Recompute dimensions of components */ 188 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 189 ci++, compptr++) { 190 compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size; 191 compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size; 192 } 193 194 #else /* !IDCT_SCALING_SUPPORTED */ 195 196 /* Hardwire it to "no scaling" */ 197 cinfo->output_width = cinfo->image_width; 198 cinfo->output_height = cinfo->image_height; 199 /* jdinput.c has already initialized DCT_scaled_size, 200 * and has computed unscaled downsampled_width and downsampled_height. 201 */ 202 203 #endif /* IDCT_SCALING_SUPPORTED */ 204 } 205 37 206 38 207 LOCAL(void) … … 71 240 } 72 241 73 /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE. 74 * In the full decompressor, this will be overridden by jdmaster.c; 75 * but in the transcoder, jdmaster.c is not used, so we must do it here. 242 /* Derive block_size, natural_order, and lim_Se */ 243 if (cinfo->is_baseline || (cinfo->progressive_mode && 244 cinfo->comps_in_scan)) { /* no pseudo SOS marker */ 245 cinfo->block_size = DCTSIZE; 246 cinfo->natural_order = jpeg_natural_order; 247 cinfo->lim_Se = DCTSIZE2-1; 248 } else 249 switch (cinfo->Se) { 250 case (1*1-1): 251 cinfo->block_size = 1; 252 cinfo->natural_order = jpeg_natural_order; /* not needed */ 253 cinfo->lim_Se = cinfo->Se; 254 break; 255 case (2*2-1): 256 cinfo->block_size = 2; 257 cinfo->natural_order = jpeg_natural_order2; 258 cinfo->lim_Se = cinfo->Se; 259 break; 260 case (3*3-1): 261 cinfo->block_size = 3; 262 cinfo->natural_order = jpeg_natural_order3; 263 cinfo->lim_Se = cinfo->Se; 264 break; 265 case (4*4-1): 266 cinfo->block_size = 4; 267 cinfo->natural_order = jpeg_natural_order4; 268 cinfo->lim_Se = cinfo->Se; 269 break; 270 case (5*5-1): 271 cinfo->block_size = 5; 272 cinfo->natural_order = jpeg_natural_order5; 273 cinfo->lim_Se = cinfo->Se; 274 break; 275 case (6*6-1): 276 cinfo->block_size = 6; 277 cinfo->natural_order = jpeg_natural_order6; 278 cinfo->lim_Se = cinfo->Se; 279 break; 280 case (7*7-1): 281 cinfo->block_size = 7; 282 cinfo->natural_order = jpeg_natural_order7; 283 cinfo->lim_Se = cinfo->Se; 284 break; 285 case (8*8-1): 286 cinfo->block_size = 8; 287 cinfo->natural_order = jpeg_natural_order; 288 cinfo->lim_Se = DCTSIZE2-1; 289 break; 290 case (9*9-1): 291 cinfo->block_size = 9; 292 cinfo->natural_order = jpeg_natural_order; 293 cinfo->lim_Se = DCTSIZE2-1; 294 break; 295 case (10*10-1): 296 cinfo->block_size = 10; 297 cinfo->natural_order = jpeg_natural_order; 298 cinfo->lim_Se = DCTSIZE2-1; 299 break; 300 case (11*11-1): 301 cinfo->block_size = 11; 302 cinfo->natural_order = jpeg_natural_order; 303 cinfo->lim_Se = DCTSIZE2-1; 304 break; 305 case (12*12-1): 306 cinfo->block_size = 12; 307 cinfo->natural_order = jpeg_natural_order; 308 cinfo->lim_Se = DCTSIZE2-1; 309 break; 310 case (13*13-1): 311 cinfo->block_size = 13; 312 cinfo->natural_order = jpeg_natural_order; 313 cinfo->lim_Se = DCTSIZE2-1; 314 break; 315 case (14*14-1): 316 cinfo->block_size = 14; 317 cinfo->natural_order = jpeg_natural_order; 318 cinfo->lim_Se = DCTSIZE2-1; 319 break; 320 case (15*15-1): 321 cinfo->block_size = 15; 322 cinfo->natural_order = jpeg_natural_order; 323 cinfo->lim_Se = DCTSIZE2-1; 324 break; 325 case (16*16-1): 326 cinfo->block_size = 16; 327 cinfo->natural_order = jpeg_natural_order; 328 cinfo->lim_Se = DCTSIZE2-1; 329 break; 330 default: 331 ERREXIT4(cinfo, JERR_BAD_PROGRESSION, 332 cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); 333 break; 334 } 335 336 /* We initialize DCT_scaled_size and min_DCT_scaled_size to block_size. 337 * In the full decompressor, 338 * this will be overridden by jpeg_calc_output_dimensions in jdmaster.c; 339 * but in the transcoder, 340 * jpeg_calc_output_dimensions is not used, so we must do it here. 76 341 */ 77 cinfo->min_DCT_scaled_size = DCTSIZE; 342 cinfo->min_DCT_h_scaled_size = cinfo->block_size; 343 cinfo->min_DCT_v_scaled_size = cinfo->block_size; 78 344 79 345 /* Compute dimensions of components */ 80 346 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 81 347 ci++, compptr++) { 82 compptr->DCT_scaled_size = DCTSIZE; 348 compptr->DCT_h_scaled_size = cinfo->block_size; 349 compptr->DCT_v_scaled_size = cinfo->block_size; 83 350 /* Size in DCT blocks */ 84 351 compptr->width_in_blocks = (JDIMENSION) 85 352 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, 86 (long) (cinfo->max_h_samp_factor * DCTSIZE));353 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 87 354 compptr->height_in_blocks = (JDIMENSION) 88 355 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, 89 (long) (cinfo->max_v_samp_factor * DCTSIZE));356 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 90 357 /* downsampled_width and downsampled_height will also be overridden by 91 358 * jdmaster.c if we are doing full decompression. The transcoder library … … 108 375 cinfo->total_iMCU_rows = (JDIMENSION) 109 376 jdiv_round_up((long) cinfo->image_height, 110 (long) (cinfo->max_v_samp_factor*DCTSIZE));377 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 111 378 112 379 /* Decide whether file contains multiple scans */ … … 139 406 compptr->MCU_height = 1; 140 407 compptr->MCU_blocks = 1; 141 compptr->MCU_sample_width = compptr->DCT_ scaled_size;408 compptr->MCU_sample_width = compptr->DCT_h_scaled_size; 142 409 compptr->last_col_width = 1; 143 410 /* For noninterleaved scans, it is convenient to define last_row_height … … 162 429 cinfo->MCUs_per_row = (JDIMENSION) 163 430 jdiv_round_up((long) cinfo->image_width, 164 (long) (cinfo->max_h_samp_factor *DCTSIZE));431 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 165 432 cinfo->MCU_rows_in_scan = (JDIMENSION) 166 433 jdiv_round_up((long) cinfo->image_height, 167 (long) (cinfo->max_v_samp_factor *DCTSIZE));434 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 168 435 169 436 cinfo->blocks_in_MCU = 0; … … 175 442 compptr->MCU_height = compptr->v_samp_factor; 176 443 compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; 177 compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_ scaled_size;444 compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_h_scaled_size; 178 445 /* Figure number of non-dummy blocks in last MCU column & row */ 179 446 tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); … … 283 550 * coefficient controller's consume_data routine, depending on whether 284 551 * we are reading a compressed data segment or inter-segment markers. 552 * 553 * Note: This function should NOT return a pseudo SOS marker (with zero 554 * component number) to the caller. A pseudo marker received by 555 * read_markers is processed and then skipped for other markers. 285 556 */ 286 557 … … 294 565 return JPEG_REACHED_EOI; 295 566 296 val = (*cinfo->marker->read_markers) (cinfo); 297 298 switch (val) { 299 case JPEG_REACHED_SOS: /* Found SOS */ 300 if (inputctl->inheaders) { /* 1st SOS */ 301 initial_setup(cinfo); 302 inputctl->inheaders = FALSE; 303 /* Note: start_input_pass must be called by jdmaster.c 304 * before any more input can be consumed. jdapimin.c is 305 * responsible for enforcing this sequencing. 306 */ 307 } else { /* 2nd or later SOS marker */ 308 if (! inputctl->pub.has_multiple_scans) 309 ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ 310 start_input_pass(cinfo); 567 for (;;) { /* Loop to pass pseudo SOS marker */ 568 val = (*cinfo->marker->read_markers) (cinfo); 569 570 switch (val) { 571 case JPEG_REACHED_SOS: /* Found SOS */ 572 if (inputctl->inheaders) { /* 1st SOS */ 573 if (inputctl->inheaders == 1) 574 initial_setup(cinfo); 575 if (cinfo->comps_in_scan == 0) { /* pseudo SOS marker */ 576 inputctl->inheaders = 2; 577 break; 578 } 579 inputctl->inheaders = 0; 580 /* Note: start_input_pass must be called by jdmaster.c 581 * before any more input can be consumed. jdapimin.c is 582 * responsible for enforcing this sequencing. 583 */ 584 } else { /* 2nd or later SOS marker */ 585 if (! inputctl->pub.has_multiple_scans) 586 ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ 587 if (cinfo->comps_in_scan == 0) /* unexpected pseudo SOS marker */ 588 break; 589 start_input_pass(cinfo); 590 } 591 return val; 592 case JPEG_REACHED_EOI: /* Found EOI */ 593 inputctl->pub.eoi_reached = TRUE; 594 if (inputctl->inheaders) { /* Tables-only datastream, apparently */ 595 if (cinfo->marker->saw_SOF) 596 ERREXIT(cinfo, JERR_SOF_NO_SOS); 597 } else { 598 /* Prevent infinite loop in coef ctlr's decompress_data routine 599 * if user set output_scan_number larger than number of scans. 600 */ 601 if (cinfo->output_scan_number > cinfo->input_scan_number) 602 cinfo->output_scan_number = cinfo->input_scan_number; 603 } 604 return val; 605 case JPEG_SUSPENDED: 606 return val; 607 default: 608 return val; 311 609 } 312 break;313 case JPEG_REACHED_EOI: /* Found EOI */314 inputctl->pub.eoi_reached = TRUE;315 if (inputctl->inheaders) { /* Tables-only datastream, apparently */316 if (cinfo->marker->saw_SOF)317 ERREXIT(cinfo, JERR_SOF_NO_SOS);318 } else {319 /* Prevent infinite loop in coef ctlr's decompress_data routine320 * if user set output_scan_number larger than number of scans.321 */322 if (cinfo->output_scan_number > cinfo->input_scan_number)323 cinfo->output_scan_number = cinfo->input_scan_number;324 }325 break;326 case JPEG_SUSPENDED:327 break;328 610 } 329 330 return val;331 611 } 332 612 … … 344 624 inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ 345 625 inputctl->pub.eoi_reached = FALSE; 346 inputctl->inheaders = TRUE;626 inputctl->inheaders = 1; 347 627 /* Reset other modules */ 348 628 (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); … … 378 658 inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ 379 659 inputctl->pub.eoi_reached = FALSE; 380 inputctl->inheaders = TRUE;381 } 660 inputctl->inheaders = 1; 661 } -
trunk/src/3rdparty/libjpeg/jdmainct.c
r2 r846 162 162 my_main_ptr main = (my_main_ptr) cinfo->main; 163 163 int ci, rgroup; 164 int M = cinfo->min_DCT_ scaled_size;164 int M = cinfo->min_DCT_v_scaled_size; 165 165 jpeg_component_info *compptr; 166 166 JSAMPARRAY xbuf; … … 176 176 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 177 177 ci++, compptr++) { 178 rgroup = (compptr->v_samp_factor * compptr->DCT_ scaled_size) /179 cinfo->min_DCT_ scaled_size; /* height of a row group of component */178 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 179 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 180 180 /* Get space for pointer lists --- M+4 row groups in each list. 181 181 * We alloc both pointer lists with one call to save a few cycles. … … 203 203 my_main_ptr main = (my_main_ptr) cinfo->main; 204 204 int ci, i, rgroup; 205 int M = cinfo->min_DCT_ scaled_size;205 int M = cinfo->min_DCT_v_scaled_size; 206 206 jpeg_component_info *compptr; 207 207 JSAMPARRAY buf, xbuf0, xbuf1; … … 209 209 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 210 210 ci++, compptr++) { 211 rgroup = (compptr->v_samp_factor * compptr->DCT_ scaled_size) /212 cinfo->min_DCT_ scaled_size; /* height of a row group of component */211 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 212 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 213 213 xbuf0 = main->xbuffer[0][ci]; 214 214 xbuf1 = main->xbuffer[1][ci]; … … 243 243 my_main_ptr main = (my_main_ptr) cinfo->main; 244 244 int ci, i, rgroup; 245 int M = cinfo->min_DCT_ scaled_size;245 int M = cinfo->min_DCT_v_scaled_size; 246 246 jpeg_component_info *compptr; 247 247 JSAMPARRAY xbuf0, xbuf1; … … 249 249 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 250 250 ci++, compptr++) { 251 rgroup = (compptr->v_samp_factor * compptr->DCT_ scaled_size) /252 cinfo->min_DCT_ scaled_size; /* height of a row group of component */251 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 252 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 253 253 xbuf0 = main->xbuffer[0][ci]; 254 254 xbuf1 = main->xbuffer[1][ci]; … … 278 278 ci++, compptr++) { 279 279 /* Count sample rows in one iMCU row and in one row group */ 280 iMCUheight = compptr->v_samp_factor * compptr->DCT_ scaled_size;281 rgroup = iMCUheight / cinfo->min_DCT_ scaled_size;280 iMCUheight = compptr->v_samp_factor * compptr->DCT_v_scaled_size; 281 rgroup = iMCUheight / cinfo->min_DCT_v_scaled_size; 282 282 /* Count nondummy sample rows remaining for this component */ 283 283 rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); … … 358 358 359 359 /* There are always min_DCT_scaled_size row groups in an iMCU row. */ 360 rowgroups_avail = (JDIMENSION) cinfo->min_DCT_ scaled_size;360 rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size; 361 361 /* Note: at the bottom of the image, we may pass extra garbage row groups 362 362 * to the postprocessor. The postprocessor has to check for bottom … … 418 418 /* Prepare to process first M-1 row groups of this iMCU row */ 419 419 main->rowgroup_ctr = 0; 420 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_ scaled_size - 1);420 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1); 421 421 /* Check for bottom of image: if so, tweak pointers to "duplicate" 422 422 * the last sample row, and adjust rowgroups_avail to ignore padding rows. … … 441 441 /* Still need to process last row group of this iMCU row, */ 442 442 /* which is saved at index M+1 of the other xbuffer */ 443 main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_ scaled_size + 1);444 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_ scaled_size + 2);443 main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1); 444 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2); 445 445 main->context_state = CTX_POSTPONED_ROW; 446 446 } … … 493 493 */ 494 494 if (cinfo->upsample->need_context_rows) { 495 if (cinfo->min_DCT_ scaled_size < 2) /* unsupported, see comments above */495 if (cinfo->min_DCT_v_scaled_size < 2) /* unsupported, see comments above */ 496 496 ERREXIT(cinfo, JERR_NOTIMPL); 497 497 alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ 498 ngroups = cinfo->min_DCT_ scaled_size + 2;498 ngroups = cinfo->min_DCT_v_scaled_size + 2; 499 499 } else { 500 ngroups = cinfo->min_DCT_ scaled_size;500 ngroups = cinfo->min_DCT_v_scaled_size; 501 501 } 502 502 503 503 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 504 504 ci++, compptr++) { 505 rgroup = (compptr->v_samp_factor * compptr->DCT_ scaled_size) /506 cinfo->min_DCT_ scaled_size; /* height of a row group of component */505 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 506 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 507 507 main->buffer[ci] = (*cinfo->mem->alloc_sarray) 508 508 ((j_common_ptr) cinfo, JPOOL_IMAGE, 509 compptr->width_in_blocks * compptr->DCT_ scaled_size,509 compptr->width_in_blocks * compptr->DCT_h_scaled_size, 510 510 (JDIMENSION) (rgroup * ngroups)); 511 511 } -
trunk/src/3rdparty/libjpeg/jdmarker.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1998, Thomas G. Lane. 5 * Modified 2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 235 236 236 237 LOCAL(boolean) 237 get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) 238 get_sof (j_decompress_ptr cinfo, boolean is_baseline, boolean is_prog, 239 boolean is_arith) 238 240 /* Process a SOFn marker */ 239 241 { … … 243 245 INPUT_VARS(cinfo); 244 246 247 cinfo->is_baseline = is_baseline; 245 248 cinfo->progressive_mode = is_prog; 246 249 cinfo->arith_code = is_arith; … … 316 319 TRACEMS1(cinfo, 1, JTRC_SOS, n); 317 320 318 if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) 321 if (length != (n * 2 + 6) || n > MAX_COMPS_IN_SCAN || 322 (n == 0 && !cinfo->progressive_mode)) 323 /* pseudo SOS marker only allowed in progressive mode */ 319 324 ERREXIT(cinfo, JERR_BAD_LENGTH); 320 325 … … 360 365 cinfo->marker->next_restart_num = 0; 361 366 362 /* Count another SOS marker */363 cinfo->input_scan_number++;367 /* Count another (non-pseudo) SOS marker */ 368 if (n) cinfo->input_scan_number++; 364 369 365 370 INPUT_SYNC(cinfo); … … 491 496 /* Process a DQT marker */ 492 497 { 493 INT32 length ;494 int n, i,prec;498 INT32 length, count, i; 499 int n, prec; 495 500 unsigned int tmp; 496 501 JQUANT_TBL *quant_ptr; 502 const int *natural_order; 497 503 INPUT_VARS(cinfo); 498 504 … … 501 507 502 508 while (length > 0) { 509 length--; 503 510 INPUT_BYTE(cinfo, n, return FALSE); 504 511 prec = n >> 4; … … 514 521 quant_ptr = cinfo->quant_tbl_ptrs[n]; 515 522 516 for (i = 0; i < DCTSIZE2; i++) { 523 if (prec) { 524 if (length < DCTSIZE2 * 2) { 525 /* Initialize full table for safety. */ 526 for (i = 0; i < DCTSIZE2; i++) { 527 quant_ptr->quantval[i] = 1; 528 } 529 count = length >> 1; 530 } else 531 count = DCTSIZE2; 532 } else { 533 if (length < DCTSIZE2) { 534 /* Initialize full table for safety. */ 535 for (i = 0; i < DCTSIZE2; i++) { 536 quant_ptr->quantval[i] = 1; 537 } 538 count = length; 539 } else 540 count = DCTSIZE2; 541 } 542 543 switch (count) { 544 case (2*2): natural_order = jpeg_natural_order2; break; 545 case (3*3): natural_order = jpeg_natural_order3; break; 546 case (4*4): natural_order = jpeg_natural_order4; break; 547 case (5*5): natural_order = jpeg_natural_order5; break; 548 case (6*6): natural_order = jpeg_natural_order6; break; 549 case (7*7): natural_order = jpeg_natural_order7; break; 550 default: natural_order = jpeg_natural_order; break; 551 } 552 553 for (i = 0; i < count; i++) { 517 554 if (prec) 518 555 INPUT_2BYTES(cinfo, tmp, return FALSE); … … 520 557 INPUT_BYTE(cinfo, tmp, return FALSE); 521 558 /* We convert the zigzag-order table to natural array order. */ 522 quant_ptr->quantval[ jpeg_natural_order[i]] = (UINT16) tmp;559 quant_ptr->quantval[natural_order[i]] = (UINT16) tmp; 523 560 } 524 561 … … 533 570 } 534 571 535 length -= DCTSIZE2+1;536 if (prec) length -= DCTSIZE2;572 length -= count; 573 if (prec) length -= count; 537 574 } 538 575 … … 947 984 * Returns same codes as are defined for jpeg_consume_input: 948 985 * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. 986 * 987 * Note: This function may return a pseudo SOS marker (with zero 988 * component number) for treat by input controller's consume_input. 989 * consume_input itself should filter out (skip) the pseudo marker 990 * after processing for the caller. 949 991 */ 950 992 … … 976 1018 977 1019 case M_SOF0: /* Baseline */ 1020 if (! get_sof(cinfo, TRUE, FALSE, FALSE)) 1021 return JPEG_SUSPENDED; 1022 break; 1023 978 1024 case M_SOF1: /* Extended sequential, Huffman */ 979 if (! get_sof(cinfo, FALSE, FALSE ))1025 if (! get_sof(cinfo, FALSE, FALSE, FALSE)) 980 1026 return JPEG_SUSPENDED; 981 1027 break; 982 1028 983 1029 case M_SOF2: /* Progressive, Huffman */ 984 if (! get_sof(cinfo, TRUE, FALSE))1030 if (! get_sof(cinfo, FALSE, TRUE, FALSE)) 985 1031 return JPEG_SUSPENDED; 986 1032 break; 987 1033 988 1034 case M_SOF9: /* Extended sequential, arithmetic */ 989 if (! get_sof(cinfo, FALSE, TRUE))1035 if (! get_sof(cinfo, FALSE, FALSE, TRUE)) 990 1036 return JPEG_SUSPENDED; 991 1037 break; 992 1038 993 1039 case M_SOF10: /* Progressive, arithmetic */ 994 if (! get_sof(cinfo, TRUE, TRUE))1040 if (! get_sof(cinfo, FALSE, TRUE, TRUE)) 995 1041 return JPEG_SUSPENDED; 996 1042 break; -
trunk/src/3rdparty/libjpeg/jdmaster.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 2002-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 62 63 return FALSE; 63 64 /* furthermore, it doesn't work if we've scaled the IDCTs differently */ 64 if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || 65 cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || 66 cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) 65 if (cinfo->comp_info[0].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size || 66 cinfo->comp_info[1].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size || 67 cinfo->comp_info[2].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size || 68 cinfo->comp_info[0].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size || 69 cinfo->comp_info[1].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size || 70 cinfo->comp_info[2].DCT_v_scaled_size != cinfo->min_DCT_v_scaled_size) 67 71 return FALSE; 68 72 /* ??? also need to test for upsample-time rescaling, when & if supported */ … … 83 87 GLOBAL(void) 84 88 jpeg_calc_output_dimensions (j_decompress_ptr cinfo) 85 /* Do computations that are needed before master selection phase */ 89 /* Do computations that are needed before master selection phase. 90 * This function is used for full decompression. 91 */ 86 92 { 87 93 #ifdef IDCT_SCALING_SUPPORTED … … 94 100 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 95 101 102 /* Compute core output image dimensions and DCT scaling choices. */ 103 jpeg_core_output_dimensions(cinfo); 104 96 105 #ifdef IDCT_SCALING_SUPPORTED 97 106 98 /* Compute actual output image dimensions and DCT scaling choices. */99 if (cinfo->scale_num * 8 <= cinfo->scale_denom) {100 /* Provide 1/8 scaling */101 cinfo->output_width = (JDIMENSION)102 jdiv_round_up((long) cinfo->image_width, 8L);103 cinfo->output_height = (JDIMENSION)104 jdiv_round_up((long) cinfo->image_height, 8L);105 cinfo->min_DCT_scaled_size = 1;106 } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {107 /* Provide 1/4 scaling */108 cinfo->output_width = (JDIMENSION)109 jdiv_round_up((long) cinfo->image_width, 4L);110 cinfo->output_height = (JDIMENSION)111 jdiv_round_up((long) cinfo->image_height, 4L);112 cinfo->min_DCT_scaled_size = 2;113 } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {114 /* Provide 1/2 scaling */115 cinfo->output_width = (JDIMENSION)116 jdiv_round_up((long) cinfo->image_width, 2L);117 cinfo->output_height = (JDIMENSION)118 jdiv_round_up((long) cinfo->image_height, 2L);119 cinfo->min_DCT_scaled_size = 4;120 } else {121 /* Provide 1/1 scaling */122 cinfo->output_width = cinfo->image_width;123 cinfo->output_height = cinfo->image_height;124 cinfo->min_DCT_scaled_size = DCTSIZE;125 }126 107 /* In selecting the actual DCT scaling for each component, we try to 127 108 * scale up the chroma components via IDCT scaling rather than upsampling. 128 109 * This saves time if the upsampler gets to use 1:1 scaling. 129 * Note this code a ssumes that the supported DCT scalingsare powers of 2.110 * Note this code adapts subsampling ratios which are powers of 2. 130 111 */ 131 112 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 132 113 ci++, compptr++) { 133 int ssize = cinfo->min_DCT_scaled_size; 134 while (ssize < DCTSIZE && 135 (compptr->h_samp_factor * ssize * 2 <= 136 cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) && 137 (compptr->v_samp_factor * ssize * 2 <= 138 cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) { 114 int ssize = 1; 115 while (cinfo->min_DCT_h_scaled_size * ssize <= 116 (cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) && 117 (cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) { 139 118 ssize = ssize * 2; 140 119 } 141 compptr->DCT_scaled_size = ssize; 120 compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size * ssize; 121 ssize = 1; 122 while (cinfo->min_DCT_v_scaled_size * ssize <= 123 (cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) && 124 (cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) == 0) { 125 ssize = ssize * 2; 126 } 127 compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size * ssize; 128 129 /* We don't support IDCT ratios larger than 2. */ 130 if (compptr->DCT_h_scaled_size > compptr->DCT_v_scaled_size * 2) 131 compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size * 2; 132 else if (compptr->DCT_v_scaled_size > compptr->DCT_h_scaled_size * 2) 133 compptr->DCT_v_scaled_size = compptr->DCT_h_scaled_size * 2; 142 134 } 143 135 … … 150 142 compptr->downsampled_width = (JDIMENSION) 151 143 jdiv_round_up((long) cinfo->image_width * 152 (long) (compptr->h_samp_factor * compptr->DCT_ scaled_size),153 (long) (cinfo->max_h_samp_factor * DCTSIZE));144 (long) (compptr->h_samp_factor * compptr->DCT_h_scaled_size), 145 (long) (cinfo->max_h_samp_factor * cinfo->block_size)); 154 146 compptr->downsampled_height = (JDIMENSION) 155 147 jdiv_round_up((long) cinfo->image_height * 156 (long) (compptr->v_samp_factor * compptr->DCT_scaled_size), 157 (long) (cinfo->max_v_samp_factor * DCTSIZE)); 158 } 159 160 #else /* !IDCT_SCALING_SUPPORTED */ 161 162 /* Hardwire it to "no scaling" */ 163 cinfo->output_width = cinfo->image_width; 164 cinfo->output_height = cinfo->image_height; 165 /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE, 166 * and has computed unscaled downsampled_width and downsampled_height. 167 */ 148 (long) (compptr->v_samp_factor * compptr->DCT_v_scaled_size), 149 (long) (cinfo->max_v_samp_factor * cinfo->block_size)); 150 } 168 151 169 152 #endif /* IDCT_SCALING_SUPPORTED */ … … 373 356 jinit_inverse_dct(cinfo); 374 357 /* Entropy decoding: either Huffman or arithmetic coding. */ 375 if (cinfo->arith_code) { 376 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 377 } else { 378 if (cinfo->progressive_mode) { 379 #ifdef D_PROGRESSIVE_SUPPORTED 380 jinit_phuff_decoder(cinfo); 381 #else 382 ERREXIT(cinfo, JERR_NOT_COMPILED); 383 #endif 384 } else 385 jinit_huff_decoder(cinfo); 358 if (cinfo->arith_code) 359 jinit_arith_decoder(cinfo); 360 else { 361 jinit_huff_decoder(cinfo); 386 362 } 387 363 -
trunk/src/3rdparty/libjpeg/jdsample.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1996, Thomas G. Lane. 5 * Modified 2002-2008 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 9 10 * 10 11 * Upsampling input data is counted in "row groups". A row group 11 * is defined to be (v_samp_factor * DCT_ scaled_size / min_DCT_scaled_size)12 * is defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size) 12 13 * sample rows of each component. Upsampling will normally produce 13 14 * max_v_samp_factor pixel rows from each row group (but this could vary … … 238 239 register JSAMPLE invalue; 239 240 JSAMPROW outend; 240 int inrow;241 242 for ( inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {243 inptr = input_data[ inrow];244 outptr = output_data[ inrow];241 int outrow; 242 243 for (outrow = 0; outrow < cinfo->max_v_samp_factor; outrow++) { 244 inptr = input_data[outrow]; 245 outptr = output_data[outrow]; 245 246 outend = outptr + cinfo->output_width; 246 247 while (outptr < outend) { … … 287 288 288 289 /* 289 * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.290 *291 * The upsampling algorithm is linear interpolation between pixel centers,292 * also known as a "triangle filter". This is a good compromise between293 * speed and visual quality. The centers of the output pixels are 1/4 and 3/4294 * of the way between input pixel centers.295 *296 * A note about the "bias" calculations: when rounding fractional values to297 * integer, we do not want to always round 0.5 up to the next integer.298 * If we did that, we'd introduce a noticeable bias towards larger values.299 * Instead, this code is arranged so that 0.5 will be rounded up or down at300 * alternate pixel locations (a simple ordered dither pattern).301 */302 303 METHODDEF(void)304 h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,305 JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)306 {307 JSAMPARRAY output_data = *output_data_ptr;308 register JSAMPROW inptr, outptr;309 register int invalue;310 register JDIMENSION colctr;311 int inrow;312 313 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {314 inptr = input_data[inrow];315 outptr = output_data[inrow];316 /* Special case for first column */317 invalue = GETJSAMPLE(*inptr++);318 *outptr++ = (JSAMPLE) invalue;319 *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);320 321 for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {322 /* General case: 3/4 * nearer pixel + 1/4 * further pixel */323 invalue = GETJSAMPLE(*inptr++) * 3;324 *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);325 *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2);326 }327 328 /* Special case for last column */329 invalue = GETJSAMPLE(*inptr);330 *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);331 *outptr++ = (JSAMPLE) invalue;332 }333 }334 335 336 /*337 * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.338 * Again a triangle filter; see comments for h2v1 case, above.339 *340 * It is OK for us to reference the adjacent input rows because we demanded341 * context from the main buffer controller (see initialization code).342 */343 344 METHODDEF(void)345 h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,346 JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)347 {348 JSAMPARRAY output_data = *output_data_ptr;349 register JSAMPROW inptr0, inptr1, outptr;350 #if BITS_IN_JSAMPLE == 8351 register int thiscolsum, lastcolsum, nextcolsum;352 #else353 register INT32 thiscolsum, lastcolsum, nextcolsum;354 #endif355 register JDIMENSION colctr;356 int inrow, outrow, v;357 358 inrow = outrow = 0;359 while (outrow < cinfo->max_v_samp_factor) {360 for (v = 0; v < 2; v++) {361 /* inptr0 points to nearest input row, inptr1 points to next nearest */362 inptr0 = input_data[inrow];363 if (v == 0) /* next nearest is row above */364 inptr1 = input_data[inrow-1];365 else /* next nearest is row below */366 inptr1 = input_data[inrow+1];367 outptr = output_data[outrow++];368 369 /* Special case for first column */370 thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);371 nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);372 *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4);373 *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);374 lastcolsum = thiscolsum; thiscolsum = nextcolsum;375 376 for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {377 /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */378 /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */379 nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);380 *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);381 *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);382 lastcolsum = thiscolsum; thiscolsum = nextcolsum;383 }384 385 /* Special case for last column */386 *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);387 *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4);388 }389 inrow++;390 }391 }392 393 394 /*395 290 * Module initialization routine for upsampling. 396 291 */ … … 402 297 int ci; 403 298 jpeg_component_info * compptr; 404 boolean need_buffer , do_fancy;299 boolean need_buffer; 405 300 int h_in_group, v_in_group, h_out_group, v_out_group; 406 301 … … 415 310 if (cinfo->CCIR601_sampling) /* this isn't supported */ 416 311 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); 417 418 /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,419 * so don't ask for it.420 */421 do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1;422 312 423 313 /* Verify we can handle the sampling factors, select per-component methods, … … 429 319 * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. 430 320 */ 431 h_in_group = (compptr->h_samp_factor * compptr->DCT_ scaled_size) /432 cinfo->min_DCT_ scaled_size;433 v_in_group = (compptr->v_samp_factor * compptr->DCT_ scaled_size) /434 cinfo->min_DCT_ scaled_size;321 h_in_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) / 322 cinfo->min_DCT_h_scaled_size; 323 v_in_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 324 cinfo->min_DCT_v_scaled_size; 435 325 h_out_group = cinfo->max_h_samp_factor; 436 326 v_out_group = cinfo->max_v_samp_factor; … … 447 337 } else if (h_in_group * 2 == h_out_group && 448 338 v_in_group == v_out_group) { 449 /* Special cases for 2h1v upsampling */ 450 if (do_fancy && compptr->downsampled_width > 2) 451 upsample->methods[ci] = h2v1_fancy_upsample; 452 else 453 upsample->methods[ci] = h2v1_upsample; 339 /* Special case for 2h1v upsampling */ 340 upsample->methods[ci] = h2v1_upsample; 454 341 } else if (h_in_group * 2 == h_out_group && 455 342 v_in_group * 2 == v_out_group) { 456 /* Special cases for 2h2v upsampling */ 457 if (do_fancy && compptr->downsampled_width > 2) { 458 upsample->methods[ci] = h2v2_fancy_upsample; 459 upsample->pub.need_context_rows = TRUE; 460 } else 461 upsample->methods[ci] = h2v2_upsample; 343 /* Special case for 2h2v upsampling */ 344 upsample->methods[ci] = h2v2_upsample; 462 345 } else if ((h_out_group % h_in_group) == 0 && 463 346 (v_out_group % v_in_group) == 0) { -
trunk/src/3rdparty/libjpeg/jdtrans.c
r2 r846 3 3 * 4 4 * Copyright (C) 1995-1997, Thomas G. Lane. 5 * Modified 2000-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 100 101 cinfo->buffered_image = TRUE; 101 102 103 /* Compute output image dimensions and related values. */ 104 jpeg_core_output_dimensions(cinfo); 105 102 106 /* Entropy decoding: either Huffman or arithmetic coding. */ 103 if (cinfo->arith_code) { 104 ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 105 } else { 106 if (cinfo->progressive_mode) { 107 #ifdef D_PROGRESSIVE_SUPPORTED 108 jinit_phuff_decoder(cinfo); 109 #else 110 ERREXIT(cinfo, JERR_NOT_COMPILED); 111 #endif 112 } else 113 jinit_huff_decoder(cinfo); 107 if (cinfo->arith_code) 108 jinit_arith_decoder(cinfo); 109 else { 110 jinit_huff_decoder(cinfo); 114 111 } 115 112 -
trunk/src/3rdparty/libjpeg/jerror.h
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1997, Thomas G. Lane. 5 * Modified 1997-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 40 41 41 42 /* For maintenance convenience, list is alphabetical by message code name */ 42 JMESSAGE(JERR_ARITH_NOTIMPL,43 "Sorry, there are legal restrictions on arithmetic coding")44 43 JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") 45 44 JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") 46 45 JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") 47 46 JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") 47 JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") 48 48 JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") 49 JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") 49 JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported") 50 JMESSAGE(JERR_BAD_DROP_SAMPLING, 51 "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") 50 52 JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") 51 53 JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") … … 94 96 JMESSAGE(JERR_NOTIMPL, "Not implemented yet") 95 97 JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") 98 JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") 96 99 JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") 97 100 JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") … … 171 174 JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") 172 175 JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") 176 JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") 173 177 JMESSAGE(JWRN_BOGUS_PROGRESSION, 174 178 "Inconsistent progression sequence for component %d coefficient %d") … … 227 231 (cinfo)->err->msg_parm.i[2] = (p3), \ 228 232 (cinfo)->err->msg_parm.i[3] = (p4), \ 233 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) 234 #define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \ 235 ((cinfo)->err->msg_code = (code), \ 236 (cinfo)->err->msg_parm.i[0] = (p1), \ 237 (cinfo)->err->msg_parm.i[1] = (p2), \ 238 (cinfo)->err->msg_parm.i[2] = (p3), \ 239 (cinfo)->err->msg_parm.i[3] = (p4), \ 240 (cinfo)->err->msg_parm.i[4] = (p5), \ 241 (cinfo)->err->msg_parm.i[5] = (p6), \ 229 242 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) 230 243 #define ERREXITS(cinfo,code,str) \ -
trunk/src/3rdparty/libjpeg/jfdctflt.c
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1996, Thomas G. Lane. 5 * Modified 2003-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 57 58 58 59 GLOBAL(void) 59 jpeg_fdct_float (FAST_FLOAT * data )60 jpeg_fdct_float (FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col) 60 61 { 61 62 FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; … … 63 64 FAST_FLOAT z1, z2, z3, z4, z5, z11, z13; 64 65 FAST_FLOAT *dataptr; 66 JSAMPROW elemptr; 65 67 int ctr; 66 68 … … 68 70 69 71 dataptr = data; 70 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 71 tmp0 = dataptr[0] + dataptr[7]; 72 tmp7 = dataptr[0] - dataptr[7]; 73 tmp1 = dataptr[1] + dataptr[6]; 74 tmp6 = dataptr[1] - dataptr[6]; 75 tmp2 = dataptr[2] + dataptr[5]; 76 tmp5 = dataptr[2] - dataptr[5]; 77 tmp3 = dataptr[3] + dataptr[4]; 78 tmp4 = dataptr[3] - dataptr[4]; 79 72 for (ctr = 0; ctr < DCTSIZE; ctr++) { 73 elemptr = sample_data[ctr] + start_col; 74 75 /* Load data into workspace */ 76 tmp0 = (FAST_FLOAT) (GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[7])); 77 tmp7 = (FAST_FLOAT) (GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[7])); 78 tmp1 = (FAST_FLOAT) (GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[6])); 79 tmp6 = (FAST_FLOAT) (GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[6])); 80 tmp2 = (FAST_FLOAT) (GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[5])); 81 tmp5 = (FAST_FLOAT) (GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5])); 82 tmp3 = (FAST_FLOAT) (GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[4])); 83 tmp4 = (FAST_FLOAT) (GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4])); 84 80 85 /* Even part */ 81 86 82 87 tmp10 = tmp0 + tmp3; /* phase 2 */ 83 88 tmp13 = tmp0 - tmp3; 84 89 tmp11 = tmp1 + tmp2; 85 90 tmp12 = tmp1 - tmp2; 86 87 dataptr[0] = tmp10 + tmp11; /* phase 3 */ 91 92 /* Apply unsigned->signed conversion */ 93 dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ 88 94 dataptr[4] = tmp10 - tmp11; 89 95 90 96 z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ 91 97 dataptr[2] = tmp13 + z1; /* phase 5 */ 92 98 dataptr[6] = tmp13 - z1; 93 99 94 100 /* Odd part */ 95 101 … … 127 133 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 128 134 tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 129 135 130 136 /* Even part */ 131 137 132 138 tmp10 = tmp0 + tmp3; /* phase 2 */ 133 139 tmp13 = tmp0 - tmp3; 134 140 tmp11 = tmp1 + tmp2; 135 141 tmp12 = tmp1 - tmp2; 136 142 137 143 dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ 138 144 dataptr[DCTSIZE*4] = tmp10 - tmp11; 139 145 140 146 z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ 141 147 dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ 142 148 dataptr[DCTSIZE*6] = tmp13 - z1; 143 149 144 150 /* Odd part */ 145 151 -
trunk/src/3rdparty/libjpeg/jfdctfst.c
r2 r846 3 3 * 4 4 * Copyright (C) 1994-1996, Thomas G. Lane. 5 * Modified 2003-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 112 113 113 114 GLOBAL(void) 114 jpeg_fdct_ifast (DCTELEM * data )115 jpeg_fdct_ifast (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 115 116 { 116 117 DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; … … 118 119 DCTELEM z1, z2, z3, z4, z5, z11, z13; 119 120 DCTELEM *dataptr; 121 JSAMPROW elemptr; 120 122 int ctr; 121 123 SHIFT_TEMPS … … 124 126 125 127 dataptr = data; 126 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 127 tmp0 = dataptr[0] + dataptr[7]; 128 tmp7 = dataptr[0] - dataptr[7]; 129 tmp1 = dataptr[1] + dataptr[6]; 130 tmp6 = dataptr[1] - dataptr[6]; 131 tmp2 = dataptr[2] + dataptr[5]; 132 tmp5 = dataptr[2] - dataptr[5]; 133 tmp3 = dataptr[3] + dataptr[4]; 134 tmp4 = dataptr[3] - dataptr[4]; 135 128 for (ctr = 0; ctr < DCTSIZE; ctr++) { 129 elemptr = sample_data[ctr] + start_col; 130 131 /* Load data into workspace */ 132 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[7]); 133 tmp7 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[7]); 134 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[6]); 135 tmp6 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[6]); 136 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[5]); 137 tmp5 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); 138 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[4]); 139 tmp4 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); 140 136 141 /* Even part */ 137 142 138 143 tmp10 = tmp0 + tmp3; /* phase 2 */ 139 144 tmp13 = tmp0 - tmp3; 140 145 tmp11 = tmp1 + tmp2; 141 146 tmp12 = tmp1 - tmp2; 142 143 dataptr[0] = tmp10 + tmp11; /* phase 3 */ 147 148 /* Apply unsigned->signed conversion */ 149 dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ 144 150 dataptr[4] = tmp10 - tmp11; 145 151 146 152 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ 147 153 dataptr[2] = tmp13 + z1; /* phase 5 */ 148 154 dataptr[6] = tmp13 - z1; 149 155 150 156 /* Odd part */ 151 157 … … 183 189 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 184 190 tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 185 191 186 192 /* Even part */ 187 193 188 194 tmp10 = tmp0 + tmp3; /* phase 2 */ 189 195 tmp13 = tmp0 - tmp3; 190 196 tmp11 = tmp1 + tmp2; 191 197 tmp12 = tmp1 - tmp2; 192 198 193 199 dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ 194 200 dataptr[DCTSIZE*4] = tmp10 - tmp11; 195 201 196 202 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ 197 203 dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ 198 204 dataptr[DCTSIZE*6] = tmp13 - z1; 199 205 200 206 /* Odd part */ 201 207 -
trunk/src/3rdparty/libjpeg/jfdctint.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1996, Thomas G. Lane. 5 * Modification developed 2003-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 22 23 * multiplication; this allows a very simple and accurate implementation in 23 24 * scaled fixed-point arithmetic, with a minimal number of shifts. 25 * 26 * We also provide FDCT routines with various input sample block sizes for 27 * direct resolution reduction or enlargement and for direct resolving the 28 * common 2x1 and 1x2 subsampling cases without additional resampling: NxN 29 * (N=1...16), 2NxN, and Nx2N (N=1...8) pixels for one 8x8 output DCT block. 30 * 31 * For N<8 we fill the remaining block coefficients with zero. 32 * For N>8 we apply a partial N-point FDCT on the input samples, computing 33 * just the lower 8 frequency coefficients and discarding the rest. 34 * 35 * We must scale the output coefficients of the N-point FDCT appropriately 36 * to the standard 8-point FDCT level by 8/N per 1-D pass. This scaling 37 * is folded into the constant multipliers (pass 2) and/or final/initial 38 * shifting. 39 * 40 * CAUTION: We rely on the FIX() macro except for the N=1,2,4,8 cases 41 * since there would be too many additional constants to pre-calculate. 24 42 */ 25 43 … … 37 55 38 56 #if DCTSIZE != 8 39 Sorry, this code only copes with 8x8 DCT s. /* deliberate syntax err */57 Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */ 40 58 #endif 41 59 … … 138 156 139 157 GLOBAL(void) 140 jpeg_fdct_islow (DCTELEM * data )158 jpeg_fdct_islow (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 141 159 { 142 INT32 tmp0, tmp1, tmp2, tmp3 , tmp4, tmp5, tmp6, tmp7;160 INT32 tmp0, tmp1, tmp2, tmp3; 143 161 INT32 tmp10, tmp11, tmp12, tmp13; 144 INT32 z1 , z2, z3, z4, z5;162 INT32 z1; 145 163 DCTELEM *dataptr; 164 JSAMPROW elemptr; 146 165 int ctr; 147 166 SHIFT_TEMPS … … 152 171 153 172 dataptr = data; 154 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 155 tmp0 = dataptr[0] + dataptr[7]; 156 tmp7 = dataptr[0] - dataptr[7]; 157 tmp1 = dataptr[1] + dataptr[6]; 158 tmp6 = dataptr[1] - dataptr[6]; 159 tmp2 = dataptr[2] + dataptr[5]; 160 tmp5 = dataptr[2] - dataptr[5]; 161 tmp3 = dataptr[3] + dataptr[4]; 162 tmp4 = dataptr[3] - dataptr[4]; 163 173 for (ctr = 0; ctr < DCTSIZE; ctr++) { 174 elemptr = sample_data[ctr] + start_col; 175 164 176 /* Even part per LL&M figure 1 --- note that published figure is faulty; 165 177 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 166 178 */ 167 179 180 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[7]); 181 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[6]); 182 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[5]); 183 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[4]); 184 168 185 tmp10 = tmp0 + tmp3; 169 tmp1 3= tmp0 - tmp3;186 tmp12 = tmp0 - tmp3; 170 187 tmp11 = tmp1 + tmp2; 171 tmp12 = tmp1 - tmp2; 172 173 dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); 188 tmp13 = tmp1 - tmp2; 189 190 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[7]); 191 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[6]); 192 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); 193 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); 194 195 /* Apply unsigned->signed conversion */ 196 dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << PASS1_BITS); 174 197 dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); 175 198 176 199 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 177 dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), 178 CONST_BITS-PASS1_BITS); 179 dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), 180 CONST_BITS-PASS1_BITS); 181 200 /* Add fudge factor here for final descale. */ 201 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 202 dataptr[2] = (DCTELEM) RIGHT_SHIFT(z1 + MULTIPLY(tmp12, FIX_0_765366865), 203 CONST_BITS-PASS1_BITS); 204 dataptr[6] = (DCTELEM) RIGHT_SHIFT(z1 - MULTIPLY(tmp13, FIX_1_847759065), 205 CONST_BITS-PASS1_BITS); 206 182 207 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 183 * cK represents cos(K*pi/16).184 * i0..i3 in the paper are tmp 4..tmp7here.208 * cK represents sqrt(2) * cos(K*pi/16). 209 * i0..i3 in the paper are tmp0..tmp3 here. 185 210 */ 186 187 z1 = tmp4 + tmp7; 188 z2 = tmp5 + tmp6; 189 z3 = tmp4 + tmp6; 190 z4 = tmp5 + tmp7; 191 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ 192 193 tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 194 tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 195 tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 196 tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 197 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 198 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 199 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 200 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 201 202 z3 += z5; 203 z4 += z5; 204 205 dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); 206 dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); 207 dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); 208 dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); 209 211 212 tmp10 = tmp0 + tmp3; 213 tmp11 = tmp1 + tmp2; 214 tmp12 = tmp0 + tmp2; 215 tmp13 = tmp1 + tmp3; 216 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 217 /* Add fudge factor here for final descale. */ 218 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 219 220 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 221 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 222 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 223 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 224 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 225 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 226 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 227 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 228 229 tmp12 += z1; 230 tmp13 += z1; 231 232 dataptr[1] = (DCTELEM) 233 RIGHT_SHIFT(tmp0 + tmp10 + tmp12, CONST_BITS-PASS1_BITS); 234 dataptr[3] = (DCTELEM) 235 RIGHT_SHIFT(tmp1 + tmp11 + tmp13, CONST_BITS-PASS1_BITS); 236 dataptr[5] = (DCTELEM) 237 RIGHT_SHIFT(tmp2 + tmp11 + tmp12, CONST_BITS-PASS1_BITS); 238 dataptr[7] = (DCTELEM) 239 RIGHT_SHIFT(tmp3 + tmp10 + tmp13, CONST_BITS-PASS1_BITS); 240 210 241 dataptr += DCTSIZE; /* advance pointer to next row */ 211 242 } … … 218 249 dataptr = data; 219 250 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 220 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];221 tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];222 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];223 tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];224 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];225 tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];226 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];227 tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];228 229 251 /* Even part per LL&M figure 1 --- note that published figure is faulty; 230 252 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 231 253 */ 232 254 255 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; 256 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; 257 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; 258 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 259 260 /* Add fudge factor here for final descale. */ 261 tmp10 = tmp0 + tmp3 + (ONE << (PASS1_BITS-1)); 262 tmp12 = tmp0 - tmp3; 263 tmp11 = tmp1 + tmp2; 264 tmp13 = tmp1 - tmp2; 265 266 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; 267 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; 268 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; 269 tmp3 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 270 271 dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp10 + tmp11, PASS1_BITS); 272 dataptr[DCTSIZE*4] = (DCTELEM) RIGHT_SHIFT(tmp10 - tmp11, PASS1_BITS); 273 274 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 275 /* Add fudge factor here for final descale. */ 276 z1 += ONE << (CONST_BITS+PASS1_BITS-1); 277 dataptr[DCTSIZE*2] = (DCTELEM) 278 RIGHT_SHIFT(z1 + MULTIPLY(tmp12, FIX_0_765366865), CONST_BITS+PASS1_BITS); 279 dataptr[DCTSIZE*6] = (DCTELEM) 280 RIGHT_SHIFT(z1 - MULTIPLY(tmp13, FIX_1_847759065), CONST_BITS+PASS1_BITS); 281 282 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 283 * cK represents sqrt(2) * cos(K*pi/16). 284 * i0..i3 in the paper are tmp0..tmp3 here. 285 */ 286 233 287 tmp10 = tmp0 + tmp3; 234 tmp13 = tmp0 - tmp3;235 288 tmp11 = tmp1 + tmp2; 236 tmp12 = tmp1 - tmp2; 237 238 dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); 239 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); 240 289 tmp12 = tmp0 + tmp2; 290 tmp13 = tmp1 + tmp3; 291 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 292 /* Add fudge factor here for final descale. */ 293 z1 += ONE << (CONST_BITS+PASS1_BITS-1); 294 295 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 296 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 297 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 298 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 299 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 300 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 301 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 302 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 303 304 tmp12 += z1; 305 tmp13 += z1; 306 307 dataptr[DCTSIZE*1] = (DCTELEM) 308 RIGHT_SHIFT(tmp0 + tmp10 + tmp12, CONST_BITS+PASS1_BITS); 309 dataptr[DCTSIZE*3] = (DCTELEM) 310 RIGHT_SHIFT(tmp1 + tmp11 + tmp13, CONST_BITS+PASS1_BITS); 311 dataptr[DCTSIZE*5] = (DCTELEM) 312 RIGHT_SHIFT(tmp2 + tmp11 + tmp12, CONST_BITS+PASS1_BITS); 313 dataptr[DCTSIZE*7] = (DCTELEM) 314 RIGHT_SHIFT(tmp3 + tmp10 + tmp13, CONST_BITS+PASS1_BITS); 315 316 dataptr++; /* advance pointer to next column */ 317 } 318 } 319 320 #ifdef DCT_SCALING_SUPPORTED 321 322 323 /* 324 * Perform the forward DCT on a 7x7 sample block. 325 */ 326 327 GLOBAL(void) 328 jpeg_fdct_7x7 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 329 { 330 INT32 tmp0, tmp1, tmp2, tmp3; 331 INT32 tmp10, tmp11, tmp12; 332 INT32 z1, z2, z3; 333 DCTELEM *dataptr; 334 JSAMPROW elemptr; 335 int ctr; 336 SHIFT_TEMPS 337 338 /* Pre-zero output coefficient block. */ 339 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 340 341 /* Pass 1: process rows. */ 342 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 343 /* furthermore, we scale the results by 2**PASS1_BITS. */ 344 /* cK represents sqrt(2) * cos(K*pi/14). */ 345 346 dataptr = data; 347 for (ctr = 0; ctr < 7; ctr++) { 348 elemptr = sample_data[ctr] + start_col; 349 350 /* Even part */ 351 352 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[6]); 353 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[5]); 354 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[4]); 355 tmp3 = GETJSAMPLE(elemptr[3]); 356 357 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[6]); 358 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[5]); 359 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[4]); 360 361 z1 = tmp0 + tmp2; 362 /* Apply unsigned->signed conversion */ 363 dataptr[0] = (DCTELEM) 364 ((z1 + tmp1 + tmp3 - 7 * CENTERJSAMPLE) << PASS1_BITS); 365 tmp3 += tmp3; 366 z1 -= tmp3; 367 z1 -= tmp3; 368 z1 = MULTIPLY(z1, FIX(0.353553391)); /* (c2+c6-c4)/2 */ 369 z2 = MULTIPLY(tmp0 - tmp2, FIX(0.920609002)); /* (c2+c4-c6)/2 */ 370 z3 = MULTIPLY(tmp1 - tmp2, FIX(0.314692123)); /* c6 */ 371 dataptr[2] = (DCTELEM) DESCALE(z1 + z2 + z3, CONST_BITS-PASS1_BITS); 372 z1 -= z2; 373 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.881747734)); /* c4 */ 374 dataptr[4] = (DCTELEM) 375 DESCALE(z2 + z3 - MULTIPLY(tmp1 - tmp3, FIX(0.707106781)), /* c2+c6-c4 */ 376 CONST_BITS-PASS1_BITS); 377 dataptr[6] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS-PASS1_BITS); 378 379 /* Odd part */ 380 381 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 382 tmp2 = MULTIPLY(tmp10 - tmp11, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 383 tmp0 = tmp1 - tmp2; 384 tmp1 += tmp2; 385 tmp2 = MULTIPLY(tmp11 + tmp12, - FIX(1.378756276)); /* -c1 */ 386 tmp1 += tmp2; 387 tmp3 = MULTIPLY(tmp10 + tmp12, FIX(0.613604268)); /* c5 */ 388 tmp0 += tmp3; 389 tmp2 += tmp3 + MULTIPLY(tmp12, FIX(1.870828693)); /* c3+c1-c5 */ 390 391 dataptr[1] = (DCTELEM) DESCALE(tmp0, CONST_BITS-PASS1_BITS); 392 dataptr[3] = (DCTELEM) DESCALE(tmp1, CONST_BITS-PASS1_BITS); 393 dataptr[5] = (DCTELEM) DESCALE(tmp2, CONST_BITS-PASS1_BITS); 394 395 dataptr += DCTSIZE; /* advance pointer to next row */ 396 } 397 398 /* Pass 2: process columns. 399 * We remove the PASS1_BITS scaling, but leave the results scaled up 400 * by an overall factor of 8. 401 * We must also scale the output by (8/7)**2 = 64/49, which we fold 402 * into the constant multipliers: 403 * cK now represents sqrt(2) * cos(K*pi/14) * 64/49. 404 */ 405 406 dataptr = data; 407 for (ctr = 0; ctr < 7; ctr++) { 408 /* Even part */ 409 410 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*6]; 411 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*5]; 412 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*4]; 413 tmp3 = dataptr[DCTSIZE*3]; 414 415 tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*6]; 416 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*5]; 417 tmp12 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*4]; 418 419 z1 = tmp0 + tmp2; 420 dataptr[DCTSIZE*0] = (DCTELEM) 421 DESCALE(MULTIPLY(z1 + tmp1 + tmp3, FIX(1.306122449)), /* 64/49 */ 422 CONST_BITS+PASS1_BITS); 423 tmp3 += tmp3; 424 z1 -= tmp3; 425 z1 -= tmp3; 426 z1 = MULTIPLY(z1, FIX(0.461784020)); /* (c2+c6-c4)/2 */ 427 z2 = MULTIPLY(tmp0 - tmp2, FIX(1.202428084)); /* (c2+c4-c6)/2 */ 428 z3 = MULTIPLY(tmp1 - tmp2, FIX(0.411026446)); /* c6 */ 429 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + z2 + z3, CONST_BITS+PASS1_BITS); 430 z1 -= z2; 431 z2 = MULTIPLY(tmp0 - tmp1, FIX(1.151670509)); /* c4 */ 432 dataptr[DCTSIZE*4] = (DCTELEM) 433 DESCALE(z2 + z3 - MULTIPLY(tmp1 - tmp3, FIX(0.923568041)), /* c2+c6-c4 */ 434 CONST_BITS+PASS1_BITS); 435 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS+PASS1_BITS); 436 437 /* Odd part */ 438 439 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.221765677)); /* (c3+c1-c5)/2 */ 440 tmp2 = MULTIPLY(tmp10 - tmp11, FIX(0.222383464)); /* (c3+c5-c1)/2 */ 441 tmp0 = tmp1 - tmp2; 442 tmp1 += tmp2; 443 tmp2 = MULTIPLY(tmp11 + tmp12, - FIX(1.800824523)); /* -c1 */ 444 tmp1 += tmp2; 445 tmp3 = MULTIPLY(tmp10 + tmp12, FIX(0.801442310)); /* c5 */ 446 tmp0 += tmp3; 447 tmp2 += tmp3 + MULTIPLY(tmp12, FIX(2.443531355)); /* c3+c1-c5 */ 448 449 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0, CONST_BITS+PASS1_BITS); 450 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1, CONST_BITS+PASS1_BITS); 451 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2, CONST_BITS+PASS1_BITS); 452 453 dataptr++; /* advance pointer to next column */ 454 } 455 } 456 457 458 /* 459 * Perform the forward DCT on a 6x6 sample block. 460 */ 461 462 GLOBAL(void) 463 jpeg_fdct_6x6 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 464 { 465 INT32 tmp0, tmp1, tmp2; 466 INT32 tmp10, tmp11, tmp12; 467 DCTELEM *dataptr; 468 JSAMPROW elemptr; 469 int ctr; 470 SHIFT_TEMPS 471 472 /* Pre-zero output coefficient block. */ 473 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 474 475 /* Pass 1: process rows. */ 476 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 477 /* furthermore, we scale the results by 2**PASS1_BITS. */ 478 /* cK represents sqrt(2) * cos(K*pi/12). */ 479 480 dataptr = data; 481 for (ctr = 0; ctr < 6; ctr++) { 482 elemptr = sample_data[ctr] + start_col; 483 484 /* Even part */ 485 486 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[5]); 487 tmp11 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[4]); 488 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[3]); 489 490 tmp10 = tmp0 + tmp2; 491 tmp12 = tmp0 - tmp2; 492 493 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[5]); 494 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); 495 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); 496 497 /* Apply unsigned->signed conversion */ 498 dataptr[0] = (DCTELEM) 499 ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << PASS1_BITS); 500 dataptr[2] = (DCTELEM) 501 DESCALE(MULTIPLY(tmp12, FIX(1.224744871)), /* c2 */ 502 CONST_BITS-PASS1_BITS); 503 dataptr[4] = (DCTELEM) 504 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(0.707106781)), /* c4 */ 505 CONST_BITS-PASS1_BITS); 506 507 /* Odd part */ 508 509 tmp10 = DESCALE(MULTIPLY(tmp0 + tmp2, FIX(0.366025404)), /* c5 */ 510 CONST_BITS-PASS1_BITS); 511 512 dataptr[1] = (DCTELEM) (tmp10 + ((tmp0 + tmp1) << PASS1_BITS)); 513 dataptr[3] = (DCTELEM) ((tmp0 - tmp1 - tmp2) << PASS1_BITS); 514 dataptr[5] = (DCTELEM) (tmp10 + ((tmp2 - tmp1) << PASS1_BITS)); 515 516 dataptr += DCTSIZE; /* advance pointer to next row */ 517 } 518 519 /* Pass 2: process columns. 520 * We remove the PASS1_BITS scaling, but leave the results scaled up 521 * by an overall factor of 8. 522 * We must also scale the output by (8/6)**2 = 16/9, which we fold 523 * into the constant multipliers: 524 * cK now represents sqrt(2) * cos(K*pi/12) * 16/9. 525 */ 526 527 dataptr = data; 528 for (ctr = 0; ctr < 6; ctr++) { 529 /* Even part */ 530 531 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*5]; 532 tmp11 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*4]; 533 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*3]; 534 535 tmp10 = tmp0 + tmp2; 536 tmp12 = tmp0 - tmp2; 537 538 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*5]; 539 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*4]; 540 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*3]; 541 542 dataptr[DCTSIZE*0] = (DCTELEM) 543 DESCALE(MULTIPLY(tmp10 + tmp11, FIX(1.777777778)), /* 16/9 */ 544 CONST_BITS+PASS1_BITS); 545 dataptr[DCTSIZE*2] = (DCTELEM) 546 DESCALE(MULTIPLY(tmp12, FIX(2.177324216)), /* c2 */ 547 CONST_BITS+PASS1_BITS); 548 dataptr[DCTSIZE*4] = (DCTELEM) 549 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(1.257078722)), /* c4 */ 550 CONST_BITS+PASS1_BITS); 551 552 /* Odd part */ 553 554 tmp10 = MULTIPLY(tmp0 + tmp2, FIX(0.650711829)); /* c5 */ 555 556 dataptr[DCTSIZE*1] = (DCTELEM) 557 DESCALE(tmp10 + MULTIPLY(tmp0 + tmp1, FIX(1.777777778)), /* 16/9 */ 558 CONST_BITS+PASS1_BITS); 559 dataptr[DCTSIZE*3] = (DCTELEM) 560 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp2, FIX(1.777777778)), /* 16/9 */ 561 CONST_BITS+PASS1_BITS); 562 dataptr[DCTSIZE*5] = (DCTELEM) 563 DESCALE(tmp10 + MULTIPLY(tmp2 - tmp1, FIX(1.777777778)), /* 16/9 */ 564 CONST_BITS+PASS1_BITS); 565 566 dataptr++; /* advance pointer to next column */ 567 } 568 } 569 570 571 /* 572 * Perform the forward DCT on a 5x5 sample block. 573 */ 574 575 GLOBAL(void) 576 jpeg_fdct_5x5 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 577 { 578 INT32 tmp0, tmp1, tmp2; 579 INT32 tmp10, tmp11; 580 DCTELEM *dataptr; 581 JSAMPROW elemptr; 582 int ctr; 583 SHIFT_TEMPS 584 585 /* Pre-zero output coefficient block. */ 586 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 587 588 /* Pass 1: process rows. */ 589 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 590 /* furthermore, we scale the results by 2**PASS1_BITS. */ 591 /* We scale the results further by 2 as part of output adaption */ 592 /* scaling for different DCT size. */ 593 /* cK represents sqrt(2) * cos(K*pi/10). */ 594 595 dataptr = data; 596 for (ctr = 0; ctr < 5; ctr++) { 597 elemptr = sample_data[ctr] + start_col; 598 599 /* Even part */ 600 601 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[4]); 602 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[3]); 603 tmp2 = GETJSAMPLE(elemptr[2]); 604 605 tmp10 = tmp0 + tmp1; 606 tmp11 = tmp0 - tmp1; 607 608 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[4]); 609 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[3]); 610 611 /* Apply unsigned->signed conversion */ 612 dataptr[0] = (DCTELEM) 613 ((tmp10 + tmp2 - 5 * CENTERJSAMPLE) << (PASS1_BITS+1)); 614 tmp11 = MULTIPLY(tmp11, FIX(0.790569415)); /* (c2+c4)/2 */ 615 tmp10 -= tmp2 << 2; 616 tmp10 = MULTIPLY(tmp10, FIX(0.353553391)); /* (c2-c4)/2 */ 617 dataptr[2] = (DCTELEM) DESCALE(tmp11 + tmp10, CONST_BITS-PASS1_BITS-1); 618 dataptr[4] = (DCTELEM) DESCALE(tmp11 - tmp10, CONST_BITS-PASS1_BITS-1); 619 620 /* Odd part */ 621 622 tmp10 = MULTIPLY(tmp0 + tmp1, FIX(0.831253876)); /* c3 */ 623 624 dataptr[1] = (DCTELEM) 625 DESCALE(tmp10 + MULTIPLY(tmp0, FIX(0.513743148)), /* c1-c3 */ 626 CONST_BITS-PASS1_BITS-1); 627 dataptr[3] = (DCTELEM) 628 DESCALE(tmp10 - MULTIPLY(tmp1, FIX(2.176250899)), /* c1+c3 */ 629 CONST_BITS-PASS1_BITS-1); 630 631 dataptr += DCTSIZE; /* advance pointer to next row */ 632 } 633 634 /* Pass 2: process columns. 635 * We remove the PASS1_BITS scaling, but leave the results scaled up 636 * by an overall factor of 8. 637 * We must also scale the output by (8/5)**2 = 64/25, which we partially 638 * fold into the constant multipliers (other part was done in pass 1): 639 * cK now represents sqrt(2) * cos(K*pi/10) * 32/25. 640 */ 641 642 dataptr = data; 643 for (ctr = 0; ctr < 5; ctr++) { 644 /* Even part */ 645 646 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*4]; 647 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*3]; 648 tmp2 = dataptr[DCTSIZE*2]; 649 650 tmp10 = tmp0 + tmp1; 651 tmp11 = tmp0 - tmp1; 652 653 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*4]; 654 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*3]; 655 656 dataptr[DCTSIZE*0] = (DCTELEM) 657 DESCALE(MULTIPLY(tmp10 + tmp2, FIX(1.28)), /* 32/25 */ 658 CONST_BITS+PASS1_BITS); 659 tmp11 = MULTIPLY(tmp11, FIX(1.011928851)); /* (c2+c4)/2 */ 660 tmp10 -= tmp2 << 2; 661 tmp10 = MULTIPLY(tmp10, FIX(0.452548340)); /* (c2-c4)/2 */ 662 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp11 + tmp10, CONST_BITS+PASS1_BITS); 663 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp11 - tmp10, CONST_BITS+PASS1_BITS); 664 665 /* Odd part */ 666 667 tmp10 = MULTIPLY(tmp0 + tmp1, FIX(1.064004961)); /* c3 */ 668 669 dataptr[DCTSIZE*1] = (DCTELEM) 670 DESCALE(tmp10 + MULTIPLY(tmp0, FIX(0.657591230)), /* c1-c3 */ 671 CONST_BITS+PASS1_BITS); 672 dataptr[DCTSIZE*3] = (DCTELEM) 673 DESCALE(tmp10 - MULTIPLY(tmp1, FIX(2.785601151)), /* c1+c3 */ 674 CONST_BITS+PASS1_BITS); 675 676 dataptr++; /* advance pointer to next column */ 677 } 678 } 679 680 681 /* 682 * Perform the forward DCT on a 4x4 sample block. 683 */ 684 685 GLOBAL(void) 686 jpeg_fdct_4x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 687 { 688 INT32 tmp0, tmp1; 689 INT32 tmp10, tmp11; 690 DCTELEM *dataptr; 691 JSAMPROW elemptr; 692 int ctr; 693 SHIFT_TEMPS 694 695 /* Pre-zero output coefficient block. */ 696 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 697 698 /* Pass 1: process rows. */ 699 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 700 /* furthermore, we scale the results by 2**PASS1_BITS. */ 701 /* We must also scale the output by (8/4)**2 = 2**2, which we add here. */ 702 /* cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ 703 704 dataptr = data; 705 for (ctr = 0; ctr < 4; ctr++) { 706 elemptr = sample_data[ctr] + start_col; 707 708 /* Even part */ 709 710 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]); 711 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]); 712 713 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); 714 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); 715 716 /* Apply unsigned->signed conversion */ 717 dataptr[0] = (DCTELEM) 718 ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+2)); 719 dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+2)); 720 721 /* Odd part */ 722 723 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 724 /* Add fudge factor here for final descale. */ 725 tmp0 += ONE << (CONST_BITS-PASS1_BITS-3); 726 727 dataptr[1] = (DCTELEM) 728 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 729 CONST_BITS-PASS1_BITS-2); 730 dataptr[3] = (DCTELEM) 731 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 732 CONST_BITS-PASS1_BITS-2); 733 734 dataptr += DCTSIZE; /* advance pointer to next row */ 735 } 736 737 /* Pass 2: process columns. 738 * We remove the PASS1_BITS scaling, but leave the results scaled up 739 * by an overall factor of 8. 740 */ 741 742 dataptr = data; 743 for (ctr = 0; ctr < 4; ctr++) { 744 /* Even part */ 745 746 /* Add fudge factor here for final descale. */ 747 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*3] + (ONE << (PASS1_BITS-1)); 748 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*2]; 749 750 tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*3]; 751 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*2]; 752 753 dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp0 + tmp1, PASS1_BITS); 754 dataptr[DCTSIZE*2] = (DCTELEM) RIGHT_SHIFT(tmp0 - tmp1, PASS1_BITS); 755 756 /* Odd part */ 757 758 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 759 /* Add fudge factor here for final descale. */ 760 tmp0 += ONE << (CONST_BITS+PASS1_BITS-1); 761 762 dataptr[DCTSIZE*1] = (DCTELEM) 763 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 764 CONST_BITS+PASS1_BITS); 765 dataptr[DCTSIZE*3] = (DCTELEM) 766 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 767 CONST_BITS+PASS1_BITS); 768 769 dataptr++; /* advance pointer to next column */ 770 } 771 } 772 773 774 /* 775 * Perform the forward DCT on a 3x3 sample block. 776 */ 777 778 GLOBAL(void) 779 jpeg_fdct_3x3 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 780 { 781 INT32 tmp0, tmp1, tmp2; 782 DCTELEM *dataptr; 783 JSAMPROW elemptr; 784 int ctr; 785 SHIFT_TEMPS 786 787 /* Pre-zero output coefficient block. */ 788 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 789 790 /* Pass 1: process rows. */ 791 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 792 /* furthermore, we scale the results by 2**PASS1_BITS. */ 793 /* We scale the results further by 2**2 as part of output adaption */ 794 /* scaling for different DCT size. */ 795 /* cK represents sqrt(2) * cos(K*pi/6). */ 796 797 dataptr = data; 798 for (ctr = 0; ctr < 3; ctr++) { 799 elemptr = sample_data[ctr] + start_col; 800 801 /* Even part */ 802 803 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[2]); 804 tmp1 = GETJSAMPLE(elemptr[1]); 805 806 tmp2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[2]); 807 808 /* Apply unsigned->signed conversion */ 809 dataptr[0] = (DCTELEM) 810 ((tmp0 + tmp1 - 3 * CENTERJSAMPLE) << (PASS1_BITS+2)); 811 dataptr[2] = (DCTELEM) 812 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp1, FIX(0.707106781)), /* c2 */ 813 CONST_BITS-PASS1_BITS-2); 814 815 /* Odd part */ 816 817 dataptr[1] = (DCTELEM) 818 DESCALE(MULTIPLY(tmp2, FIX(1.224744871)), /* c1 */ 819 CONST_BITS-PASS1_BITS-2); 820 821 dataptr += DCTSIZE; /* advance pointer to next row */ 822 } 823 824 /* Pass 2: process columns. 825 * We remove the PASS1_BITS scaling, but leave the results scaled up 826 * by an overall factor of 8. 827 * We must also scale the output by (8/3)**2 = 64/9, which we partially 828 * fold into the constant multipliers (other part was done in pass 1): 829 * cK now represents sqrt(2) * cos(K*pi/6) * 16/9. 830 */ 831 832 dataptr = data; 833 for (ctr = 0; ctr < 3; ctr++) { 834 /* Even part */ 835 836 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*2]; 837 tmp1 = dataptr[DCTSIZE*1]; 838 839 tmp2 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*2]; 840 841 dataptr[DCTSIZE*0] = (DCTELEM) 842 DESCALE(MULTIPLY(tmp0 + tmp1, FIX(1.777777778)), /* 16/9 */ 843 CONST_BITS+PASS1_BITS); 844 dataptr[DCTSIZE*2] = (DCTELEM) 845 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp1, FIX(1.257078722)), /* c2 */ 846 CONST_BITS+PASS1_BITS); 847 848 /* Odd part */ 849 850 dataptr[DCTSIZE*1] = (DCTELEM) 851 DESCALE(MULTIPLY(tmp2, FIX(2.177324216)), /* c1 */ 852 CONST_BITS+PASS1_BITS); 853 854 dataptr++; /* advance pointer to next column */ 855 } 856 } 857 858 859 /* 860 * Perform the forward DCT on a 2x2 sample block. 861 */ 862 863 GLOBAL(void) 864 jpeg_fdct_2x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 865 { 866 INT32 tmp0, tmp1, tmp2, tmp3; 867 JSAMPROW elemptr; 868 869 /* Pre-zero output coefficient block. */ 870 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 871 872 /* Pass 1: process rows. */ 873 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 874 875 /* Row 0 */ 876 elemptr = sample_data[0] + start_col; 877 878 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[1]); 879 tmp1 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[1]); 880 881 /* Row 1 */ 882 elemptr = sample_data[1] + start_col; 883 884 tmp2 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[1]); 885 tmp3 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[1]); 886 887 /* Pass 2: process columns. 888 * We leave the results scaled up by an overall factor of 8. 889 * We must also scale the output by (8/2)**2 = 2**4. 890 */ 891 892 /* Column 0 */ 893 /* Apply unsigned->signed conversion */ 894 data[DCTSIZE*0] = (DCTELEM) ((tmp0 + tmp2 - 4 * CENTERJSAMPLE) << 4); 895 data[DCTSIZE*1] = (DCTELEM) ((tmp0 - tmp2) << 4); 896 897 /* Column 1 */ 898 data[DCTSIZE*0+1] = (DCTELEM) ((tmp1 + tmp3) << 4); 899 data[DCTSIZE*1+1] = (DCTELEM) ((tmp1 - tmp3) << 4); 900 } 901 902 903 /* 904 * Perform the forward DCT on a 1x1 sample block. 905 */ 906 907 GLOBAL(void) 908 jpeg_fdct_1x1 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 909 { 910 /* Pre-zero output coefficient block. */ 911 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 912 913 /* We leave the result scaled up by an overall factor of 8. */ 914 /* We must also scale the output by (8/1)**2 = 2**6. */ 915 /* Apply unsigned->signed conversion */ 916 data[0] = (DCTELEM) 917 ((GETJSAMPLE(sample_data[0][start_col]) - CENTERJSAMPLE) << 6); 918 } 919 920 921 /* 922 * Perform the forward DCT on a 9x9 sample block. 923 */ 924 925 GLOBAL(void) 926 jpeg_fdct_9x9 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 927 { 928 INT32 tmp0, tmp1, tmp2, tmp3, tmp4; 929 INT32 tmp10, tmp11, tmp12, tmp13; 930 INT32 z1, z2; 931 DCTELEM workspace[8]; 932 DCTELEM *dataptr; 933 DCTELEM *wsptr; 934 JSAMPROW elemptr; 935 int ctr; 936 SHIFT_TEMPS 937 938 /* Pass 1: process rows. */ 939 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 940 /* we scale the results further by 2 as part of output adaption */ 941 /* scaling for different DCT size. */ 942 /* cK represents sqrt(2) * cos(K*pi/18). */ 943 944 dataptr = data; 945 ctr = 0; 946 for (;;) { 947 elemptr = sample_data[ctr] + start_col; 948 949 /* Even part */ 950 951 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[8]); 952 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[7]); 953 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[6]); 954 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[5]); 955 tmp4 = GETJSAMPLE(elemptr[4]); 956 957 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[8]); 958 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[7]); 959 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[6]); 960 tmp13 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[5]); 961 962 z1 = tmp0 + tmp2 + tmp3; 963 z2 = tmp1 + tmp4; 964 /* Apply unsigned->signed conversion */ 965 dataptr[0] = (DCTELEM) ((z1 + z2 - 9 * CENTERJSAMPLE) << 1); 966 dataptr[6] = (DCTELEM) 967 DESCALE(MULTIPLY(z1 - z2 - z2, FIX(0.707106781)), /* c6 */ 968 CONST_BITS-1); 969 z1 = MULTIPLY(tmp0 - tmp2, FIX(1.328926049)); /* c2 */ 970 z2 = MULTIPLY(tmp1 - tmp4 - tmp4, FIX(0.707106781)); /* c6 */ 971 dataptr[2] = (DCTELEM) 972 DESCALE(MULTIPLY(tmp2 - tmp3, FIX(1.083350441)) /* c4 */ 973 + z1 + z2, CONST_BITS-1); 974 dataptr[4] = (DCTELEM) 975 DESCALE(MULTIPLY(tmp3 - tmp0, FIX(0.245575608)) /* c8 */ 976 + z1 - z2, CONST_BITS-1); 977 978 /* Odd part */ 979 980 dataptr[3] = (DCTELEM) 981 DESCALE(MULTIPLY(tmp10 - tmp12 - tmp13, FIX(1.224744871)), /* c3 */ 982 CONST_BITS-1); 983 984 tmp11 = MULTIPLY(tmp11, FIX(1.224744871)); /* c3 */ 985 tmp0 = MULTIPLY(tmp10 + tmp12, FIX(0.909038955)); /* c5 */ 986 tmp1 = MULTIPLY(tmp10 + tmp13, FIX(0.483689525)); /* c7 */ 987 988 dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp0 + tmp1, CONST_BITS-1); 989 990 tmp2 = MULTIPLY(tmp12 - tmp13, FIX(1.392728481)); /* c1 */ 991 992 dataptr[5] = (DCTELEM) DESCALE(tmp0 - tmp11 - tmp2, CONST_BITS-1); 993 dataptr[7] = (DCTELEM) DESCALE(tmp1 - tmp11 + tmp2, CONST_BITS-1); 994 995 ctr++; 996 997 if (ctr != DCTSIZE) { 998 if (ctr == 9) 999 break; /* Done. */ 1000 dataptr += DCTSIZE; /* advance pointer to next row */ 1001 } else 1002 dataptr = workspace; /* switch pointer to extended workspace */ 1003 } 1004 1005 /* Pass 2: process columns. 1006 * We leave the results scaled up by an overall factor of 8. 1007 * We must also scale the output by (8/9)**2 = 64/81, which we partially 1008 * fold into the constant multipliers and final/initial shifting: 1009 * cK now represents sqrt(2) * cos(K*pi/18) * 128/81. 1010 */ 1011 1012 dataptr = data; 1013 wsptr = workspace; 1014 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1015 /* Even part */ 1016 1017 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*0]; 1018 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*7]; 1019 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*6]; 1020 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*5]; 1021 tmp4 = dataptr[DCTSIZE*4]; 1022 1023 tmp10 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*0]; 1024 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*7]; 1025 tmp12 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*6]; 1026 tmp13 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*5]; 1027 1028 z1 = tmp0 + tmp2 + tmp3; 1029 z2 = tmp1 + tmp4; 1030 dataptr[DCTSIZE*0] = (DCTELEM) 1031 DESCALE(MULTIPLY(z1 + z2, FIX(1.580246914)), /* 128/81 */ 1032 CONST_BITS+2); 1033 dataptr[DCTSIZE*6] = (DCTELEM) 1034 DESCALE(MULTIPLY(z1 - z2 - z2, FIX(1.117403309)), /* c6 */ 1035 CONST_BITS+2); 1036 z1 = MULTIPLY(tmp0 - tmp2, FIX(2.100031287)); /* c2 */ 1037 z2 = MULTIPLY(tmp1 - tmp4 - tmp4, FIX(1.117403309)); /* c6 */ 1038 dataptr[DCTSIZE*2] = (DCTELEM) 1039 DESCALE(MULTIPLY(tmp2 - tmp3, FIX(1.711961190)) /* c4 */ 1040 + z1 + z2, CONST_BITS+2); 1041 dataptr[DCTSIZE*4] = (DCTELEM) 1042 DESCALE(MULTIPLY(tmp3 - tmp0, FIX(0.388070096)) /* c8 */ 1043 + z1 - z2, CONST_BITS+2); 1044 1045 /* Odd part */ 1046 1047 dataptr[DCTSIZE*3] = (DCTELEM) 1048 DESCALE(MULTIPLY(tmp10 - tmp12 - tmp13, FIX(1.935399303)), /* c3 */ 1049 CONST_BITS+2); 1050 1051 tmp11 = MULTIPLY(tmp11, FIX(1.935399303)); /* c3 */ 1052 tmp0 = MULTIPLY(tmp10 + tmp12, FIX(1.436506004)); /* c5 */ 1053 tmp1 = MULTIPLY(tmp10 + tmp13, FIX(0.764348879)); /* c7 */ 1054 1055 dataptr[DCTSIZE*1] = (DCTELEM) 1056 DESCALE(tmp11 + tmp0 + tmp1, CONST_BITS+2); 1057 1058 tmp2 = MULTIPLY(tmp12 - tmp13, FIX(2.200854883)); /* c1 */ 1059 1060 dataptr[DCTSIZE*5] = (DCTELEM) 1061 DESCALE(tmp0 - tmp11 - tmp2, CONST_BITS+2); 1062 dataptr[DCTSIZE*7] = (DCTELEM) 1063 DESCALE(tmp1 - tmp11 + tmp2, CONST_BITS+2); 1064 1065 dataptr++; /* advance pointer to next column */ 1066 wsptr++; /* advance pointer to next column */ 1067 } 1068 } 1069 1070 1071 /* 1072 * Perform the forward DCT on a 10x10 sample block. 1073 */ 1074 1075 GLOBAL(void) 1076 jpeg_fdct_10x10 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1077 { 1078 INT32 tmp0, tmp1, tmp2, tmp3, tmp4; 1079 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 1080 DCTELEM workspace[8*2]; 1081 DCTELEM *dataptr; 1082 DCTELEM *wsptr; 1083 JSAMPROW elemptr; 1084 int ctr; 1085 SHIFT_TEMPS 1086 1087 /* Pass 1: process rows. */ 1088 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 1089 /* we scale the results further by 2 as part of output adaption */ 1090 /* scaling for different DCT size. */ 1091 /* cK represents sqrt(2) * cos(K*pi/20). */ 1092 1093 dataptr = data; 1094 ctr = 0; 1095 for (;;) { 1096 elemptr = sample_data[ctr] + start_col; 1097 1098 /* Even part */ 1099 1100 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[9]); 1101 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[8]); 1102 tmp12 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[7]); 1103 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[6]); 1104 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[5]); 1105 1106 tmp10 = tmp0 + tmp4; 1107 tmp13 = tmp0 - tmp4; 1108 tmp11 = tmp1 + tmp3; 1109 tmp14 = tmp1 - tmp3; 1110 1111 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[9]); 1112 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[8]); 1113 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[7]); 1114 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[6]); 1115 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[5]); 1116 1117 /* Apply unsigned->signed conversion */ 1118 dataptr[0] = (DCTELEM) 1119 ((tmp10 + tmp11 + tmp12 - 10 * CENTERJSAMPLE) << 1); 1120 tmp12 += tmp12; 1121 dataptr[4] = (DCTELEM) 1122 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.144122806)) - /* c4 */ 1123 MULTIPLY(tmp11 - tmp12, FIX(0.437016024)), /* c8 */ 1124 CONST_BITS-1); 1125 tmp10 = MULTIPLY(tmp13 + tmp14, FIX(0.831253876)); /* c6 */ 1126 dataptr[2] = (DCTELEM) 1127 DESCALE(tmp10 + MULTIPLY(tmp13, FIX(0.513743148)), /* c2-c6 */ 1128 CONST_BITS-1); 1129 dataptr[6] = (DCTELEM) 1130 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(2.176250899)), /* c2+c6 */ 1131 CONST_BITS-1); 1132 1133 /* Odd part */ 1134 1135 tmp10 = tmp0 + tmp4; 1136 tmp11 = tmp1 - tmp3; 1137 dataptr[5] = (DCTELEM) ((tmp10 - tmp11 - tmp2) << 1); 1138 tmp2 <<= CONST_BITS; 1139 dataptr[1] = (DCTELEM) 1140 DESCALE(MULTIPLY(tmp0, FIX(1.396802247)) + /* c1 */ 1141 MULTIPLY(tmp1, FIX(1.260073511)) + tmp2 + /* c3 */ 1142 MULTIPLY(tmp3, FIX(0.642039522)) + /* c7 */ 1143 MULTIPLY(tmp4, FIX(0.221231742)), /* c9 */ 1144 CONST_BITS-1); 1145 tmp12 = MULTIPLY(tmp0 - tmp4, FIX(0.951056516)) - /* (c3+c7)/2 */ 1146 MULTIPLY(tmp1 + tmp3, FIX(0.587785252)); /* (c1-c9)/2 */ 1147 tmp13 = MULTIPLY(tmp10 + tmp11, FIX(0.309016994)) + /* (c3-c7)/2 */ 1148 (tmp11 << (CONST_BITS - 1)) - tmp2; 1149 dataptr[3] = (DCTELEM) DESCALE(tmp12 + tmp13, CONST_BITS-1); 1150 dataptr[7] = (DCTELEM) DESCALE(tmp12 - tmp13, CONST_BITS-1); 1151 1152 ctr++; 1153 1154 if (ctr != DCTSIZE) { 1155 if (ctr == 10) 1156 break; /* Done. */ 1157 dataptr += DCTSIZE; /* advance pointer to next row */ 1158 } else 1159 dataptr = workspace; /* switch pointer to extended workspace */ 1160 } 1161 1162 /* Pass 2: process columns. 1163 * We leave the results scaled up by an overall factor of 8. 1164 * We must also scale the output by (8/10)**2 = 16/25, which we partially 1165 * fold into the constant multipliers and final/initial shifting: 1166 * cK now represents sqrt(2) * cos(K*pi/20) * 32/25. 1167 */ 1168 1169 dataptr = data; 1170 wsptr = workspace; 1171 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1172 /* Even part */ 1173 1174 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*1]; 1175 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*0]; 1176 tmp12 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*7]; 1177 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*6]; 1178 tmp4 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*5]; 1179 1180 tmp10 = tmp0 + tmp4; 1181 tmp13 = tmp0 - tmp4; 1182 tmp11 = tmp1 + tmp3; 1183 tmp14 = tmp1 - tmp3; 1184 1185 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*1]; 1186 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*0]; 1187 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*7]; 1188 tmp3 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*6]; 1189 tmp4 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*5]; 1190 1191 dataptr[DCTSIZE*0] = (DCTELEM) 1192 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12, FIX(1.28)), /* 32/25 */ 1193 CONST_BITS+2); 1194 tmp12 += tmp12; 1195 dataptr[DCTSIZE*4] = (DCTELEM) 1196 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.464477191)) - /* c4 */ 1197 MULTIPLY(tmp11 - tmp12, FIX(0.559380511)), /* c8 */ 1198 CONST_BITS+2); 1199 tmp10 = MULTIPLY(tmp13 + tmp14, FIX(1.064004961)); /* c6 */ 1200 dataptr[DCTSIZE*2] = (DCTELEM) 1201 DESCALE(tmp10 + MULTIPLY(tmp13, FIX(0.657591230)), /* c2-c6 */ 1202 CONST_BITS+2); 1203 dataptr[DCTSIZE*6] = (DCTELEM) 1204 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(2.785601151)), /* c2+c6 */ 1205 CONST_BITS+2); 1206 1207 /* Odd part */ 1208 1209 tmp10 = tmp0 + tmp4; 1210 tmp11 = tmp1 - tmp3; 1211 dataptr[DCTSIZE*5] = (DCTELEM) 1212 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp2, FIX(1.28)), /* 32/25 */ 1213 CONST_BITS+2); 1214 tmp2 = MULTIPLY(tmp2, FIX(1.28)); /* 32/25 */ 1215 dataptr[DCTSIZE*1] = (DCTELEM) 1216 DESCALE(MULTIPLY(tmp0, FIX(1.787906876)) + /* c1 */ 1217 MULTIPLY(tmp1, FIX(1.612894094)) + tmp2 + /* c3 */ 1218 MULTIPLY(tmp3, FIX(0.821810588)) + /* c7 */ 1219 MULTIPLY(tmp4, FIX(0.283176630)), /* c9 */ 1220 CONST_BITS+2); 1221 tmp12 = MULTIPLY(tmp0 - tmp4, FIX(1.217352341)) - /* (c3+c7)/2 */ 1222 MULTIPLY(tmp1 + tmp3, FIX(0.752365123)); /* (c1-c9)/2 */ 1223 tmp13 = MULTIPLY(tmp10 + tmp11, FIX(0.395541753)) + /* (c3-c7)/2 */ 1224 MULTIPLY(tmp11, FIX(0.64)) - tmp2; /* 16/25 */ 1225 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp12 + tmp13, CONST_BITS+2); 1226 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp12 - tmp13, CONST_BITS+2); 1227 1228 dataptr++; /* advance pointer to next column */ 1229 wsptr++; /* advance pointer to next column */ 1230 } 1231 } 1232 1233 1234 /* 1235 * Perform the forward DCT on an 11x11 sample block. 1236 */ 1237 1238 GLOBAL(void) 1239 jpeg_fdct_11x11 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1240 { 1241 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; 1242 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 1243 INT32 z1, z2, z3; 1244 DCTELEM workspace[8*3]; 1245 DCTELEM *dataptr; 1246 DCTELEM *wsptr; 1247 JSAMPROW elemptr; 1248 int ctr; 1249 SHIFT_TEMPS 1250 1251 /* Pass 1: process rows. */ 1252 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 1253 /* we scale the results further by 2 as part of output adaption */ 1254 /* scaling for different DCT size. */ 1255 /* cK represents sqrt(2) * cos(K*pi/22). */ 1256 1257 dataptr = data; 1258 ctr = 0; 1259 for (;;) { 1260 elemptr = sample_data[ctr] + start_col; 1261 1262 /* Even part */ 1263 1264 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[10]); 1265 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[9]); 1266 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[8]); 1267 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[7]); 1268 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[6]); 1269 tmp5 = GETJSAMPLE(elemptr[5]); 1270 1271 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[10]); 1272 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[9]); 1273 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[8]); 1274 tmp13 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[7]); 1275 tmp14 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[6]); 1276 1277 /* Apply unsigned->signed conversion */ 1278 dataptr[0] = (DCTELEM) 1279 ((tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 - 11 * CENTERJSAMPLE) << 1); 1280 tmp5 += tmp5; 1281 tmp0 -= tmp5; 1282 tmp1 -= tmp5; 1283 tmp2 -= tmp5; 1284 tmp3 -= tmp5; 1285 tmp4 -= tmp5; 1286 z1 = MULTIPLY(tmp0 + tmp3, FIX(1.356927976)) + /* c2 */ 1287 MULTIPLY(tmp2 + tmp4, FIX(0.201263574)); /* c10 */ 1288 z2 = MULTIPLY(tmp1 - tmp3, FIX(0.926112931)); /* c6 */ 1289 z3 = MULTIPLY(tmp0 - tmp1, FIX(1.189712156)); /* c4 */ 1290 dataptr[2] = (DCTELEM) 1291 DESCALE(z1 + z2 - MULTIPLY(tmp3, FIX(1.018300590)) /* c2+c8-c6 */ 1292 - MULTIPLY(tmp4, FIX(1.390975730)), /* c4+c10 */ 1293 CONST_BITS-1); 1294 dataptr[4] = (DCTELEM) 1295 DESCALE(z2 + z3 + MULTIPLY(tmp1, FIX(0.062335650)) /* c4-c6-c10 */ 1296 - MULTIPLY(tmp2, FIX(1.356927976)) /* c2 */ 1297 + MULTIPLY(tmp4, FIX(0.587485545)), /* c8 */ 1298 CONST_BITS-1); 1299 dataptr[6] = (DCTELEM) 1300 DESCALE(z1 + z3 - MULTIPLY(tmp0, FIX(1.620527200)) /* c2+c4-c6 */ 1301 - MULTIPLY(tmp2, FIX(0.788749120)), /* c8+c10 */ 1302 CONST_BITS-1); 1303 1304 /* Odd part */ 1305 1306 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.286413905)); /* c3 */ 1307 tmp2 = MULTIPLY(tmp10 + tmp12, FIX(1.068791298)); /* c5 */ 1308 tmp3 = MULTIPLY(tmp10 + tmp13, FIX(0.764581576)); /* c7 */ 1309 tmp0 = tmp1 + tmp2 + tmp3 - MULTIPLY(tmp10, FIX(1.719967871)) /* c7+c5+c3-c1 */ 1310 + MULTIPLY(tmp14, FIX(0.398430003)); /* c9 */ 1311 tmp4 = MULTIPLY(tmp11 + tmp12, - FIX(0.764581576)); /* -c7 */ 1312 tmp5 = MULTIPLY(tmp11 + tmp13, - FIX(1.399818907)); /* -c1 */ 1313 tmp1 += tmp4 + tmp5 + MULTIPLY(tmp11, FIX(1.276416582)) /* c9+c7+c1-c3 */ 1314 - MULTIPLY(tmp14, FIX(1.068791298)); /* c5 */ 1315 tmp10 = MULTIPLY(tmp12 + tmp13, FIX(0.398430003)); /* c9 */ 1316 tmp2 += tmp4 + tmp10 - MULTIPLY(tmp12, FIX(1.989053629)) /* c9+c5+c3-c7 */ 1317 + MULTIPLY(tmp14, FIX(1.399818907)); /* c1 */ 1318 tmp3 += tmp5 + tmp10 + MULTIPLY(tmp13, FIX(1.305598626)) /* c1+c5-c9-c7 */ 1319 - MULTIPLY(tmp14, FIX(1.286413905)); /* c3 */ 1320 1321 dataptr[1] = (DCTELEM) DESCALE(tmp0, CONST_BITS-1); 1322 dataptr[3] = (DCTELEM) DESCALE(tmp1, CONST_BITS-1); 1323 dataptr[5] = (DCTELEM) DESCALE(tmp2, CONST_BITS-1); 1324 dataptr[7] = (DCTELEM) DESCALE(tmp3, CONST_BITS-1); 1325 1326 ctr++; 1327 1328 if (ctr != DCTSIZE) { 1329 if (ctr == 11) 1330 break; /* Done. */ 1331 dataptr += DCTSIZE; /* advance pointer to next row */ 1332 } else 1333 dataptr = workspace; /* switch pointer to extended workspace */ 1334 } 1335 1336 /* Pass 2: process columns. 1337 * We leave the results scaled up by an overall factor of 8. 1338 * We must also scale the output by (8/11)**2 = 64/121, which we partially 1339 * fold into the constant multipliers and final/initial shifting: 1340 * cK now represents sqrt(2) * cos(K*pi/22) * 128/121. 1341 */ 1342 1343 dataptr = data; 1344 wsptr = workspace; 1345 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1346 /* Even part */ 1347 1348 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*2]; 1349 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*1]; 1350 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*0]; 1351 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*7]; 1352 tmp4 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*6]; 1353 tmp5 = dataptr[DCTSIZE*5]; 1354 1355 tmp10 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*2]; 1356 tmp11 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*1]; 1357 tmp12 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*0]; 1358 tmp13 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*7]; 1359 tmp14 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*6]; 1360 1361 dataptr[DCTSIZE*0] = (DCTELEM) 1362 DESCALE(MULTIPLY(tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5, 1363 FIX(1.057851240)), /* 128/121 */ 1364 CONST_BITS+2); 1365 tmp5 += tmp5; 1366 tmp0 -= tmp5; 1367 tmp1 -= tmp5; 1368 tmp2 -= tmp5; 1369 tmp3 -= tmp5; 1370 tmp4 -= tmp5; 1371 z1 = MULTIPLY(tmp0 + tmp3, FIX(1.435427942)) + /* c2 */ 1372 MULTIPLY(tmp2 + tmp4, FIX(0.212906922)); /* c10 */ 1373 z2 = MULTIPLY(tmp1 - tmp3, FIX(0.979689713)); /* c6 */ 1374 z3 = MULTIPLY(tmp0 - tmp1, FIX(1.258538479)); /* c4 */ 1375 dataptr[DCTSIZE*2] = (DCTELEM) 1376 DESCALE(z1 + z2 - MULTIPLY(tmp3, FIX(1.077210542)) /* c2+c8-c6 */ 1377 - MULTIPLY(tmp4, FIX(1.471445400)), /* c4+c10 */ 1378 CONST_BITS+2); 1379 dataptr[DCTSIZE*4] = (DCTELEM) 1380 DESCALE(z2 + z3 + MULTIPLY(tmp1, FIX(0.065941844)) /* c4-c6-c10 */ 1381 - MULTIPLY(tmp2, FIX(1.435427942)) /* c2 */ 1382 + MULTIPLY(tmp4, FIX(0.621472312)), /* c8 */ 1383 CONST_BITS+2); 1384 dataptr[DCTSIZE*6] = (DCTELEM) 1385 DESCALE(z1 + z3 - MULTIPLY(tmp0, FIX(1.714276708)) /* c2+c4-c6 */ 1386 - MULTIPLY(tmp2, FIX(0.834379234)), /* c8+c10 */ 1387 CONST_BITS+2); 1388 1389 /* Odd part */ 1390 1391 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.360834544)); /* c3 */ 1392 tmp2 = MULTIPLY(tmp10 + tmp12, FIX(1.130622199)); /* c5 */ 1393 tmp3 = MULTIPLY(tmp10 + tmp13, FIX(0.808813568)); /* c7 */ 1394 tmp0 = tmp1 + tmp2 + tmp3 - MULTIPLY(tmp10, FIX(1.819470145)) /* c7+c5+c3-c1 */ 1395 + MULTIPLY(tmp14, FIX(0.421479672)); /* c9 */ 1396 tmp4 = MULTIPLY(tmp11 + tmp12, - FIX(0.808813568)); /* -c7 */ 1397 tmp5 = MULTIPLY(tmp11 + tmp13, - FIX(1.480800167)); /* -c1 */ 1398 tmp1 += tmp4 + tmp5 + MULTIPLY(tmp11, FIX(1.350258864)) /* c9+c7+c1-c3 */ 1399 - MULTIPLY(tmp14, FIX(1.130622199)); /* c5 */ 1400 tmp10 = MULTIPLY(tmp12 + tmp13, FIX(0.421479672)); /* c9 */ 1401 tmp2 += tmp4 + tmp10 - MULTIPLY(tmp12, FIX(2.104122847)) /* c9+c5+c3-c7 */ 1402 + MULTIPLY(tmp14, FIX(1.480800167)); /* c1 */ 1403 tmp3 += tmp5 + tmp10 + MULTIPLY(tmp13, FIX(1.381129125)) /* c1+c5-c9-c7 */ 1404 - MULTIPLY(tmp14, FIX(1.360834544)); /* c3 */ 1405 1406 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0, CONST_BITS+2); 1407 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1, CONST_BITS+2); 1408 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2, CONST_BITS+2); 1409 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp3, CONST_BITS+2); 1410 1411 dataptr++; /* advance pointer to next column */ 1412 wsptr++; /* advance pointer to next column */ 1413 } 1414 } 1415 1416 1417 /* 1418 * Perform the forward DCT on a 12x12 sample block. 1419 */ 1420 1421 GLOBAL(void) 1422 jpeg_fdct_12x12 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1423 { 1424 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; 1425 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 1426 DCTELEM workspace[8*4]; 1427 DCTELEM *dataptr; 1428 DCTELEM *wsptr; 1429 JSAMPROW elemptr; 1430 int ctr; 1431 SHIFT_TEMPS 1432 1433 /* Pass 1: process rows. */ 1434 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 1435 /* cK represents sqrt(2) * cos(K*pi/24). */ 1436 1437 dataptr = data; 1438 ctr = 0; 1439 for (;;) { 1440 elemptr = sample_data[ctr] + start_col; 1441 1442 /* Even part */ 1443 1444 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[11]); 1445 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[10]); 1446 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[9]); 1447 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[8]); 1448 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[7]); 1449 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[6]); 1450 1451 tmp10 = tmp0 + tmp5; 1452 tmp13 = tmp0 - tmp5; 1453 tmp11 = tmp1 + tmp4; 1454 tmp14 = tmp1 - tmp4; 1455 tmp12 = tmp2 + tmp3; 1456 tmp15 = tmp2 - tmp3; 1457 1458 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[11]); 1459 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[10]); 1460 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[9]); 1461 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[8]); 1462 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[7]); 1463 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[6]); 1464 1465 /* Apply unsigned->signed conversion */ 1466 dataptr[0] = (DCTELEM) (tmp10 + tmp11 + tmp12 - 12 * CENTERJSAMPLE); 1467 dataptr[6] = (DCTELEM) (tmp13 - tmp14 - tmp15); 1468 dataptr[4] = (DCTELEM) 1469 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.224744871)), /* c4 */ 1470 CONST_BITS); 1471 dataptr[2] = (DCTELEM) 1472 DESCALE(tmp14 - tmp15 + MULTIPLY(tmp13 + tmp15, FIX(1.366025404)), /* c2 */ 1473 CONST_BITS); 1474 1475 /* Odd part */ 1476 1477 tmp10 = MULTIPLY(tmp1 + tmp4, FIX_0_541196100); /* c9 */ 1478 tmp14 = tmp10 + MULTIPLY(tmp1, FIX_0_765366865); /* c3-c9 */ 1479 tmp15 = tmp10 - MULTIPLY(tmp4, FIX_1_847759065); /* c3+c9 */ 1480 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.121971054)); /* c5 */ 1481 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(0.860918669)); /* c7 */ 1482 tmp10 = tmp12 + tmp13 + tmp14 - MULTIPLY(tmp0, FIX(0.580774953)) /* c5+c7-c1 */ 1483 + MULTIPLY(tmp5, FIX(0.184591911)); /* c11 */ 1484 tmp11 = MULTIPLY(tmp2 + tmp3, - FIX(0.184591911)); /* -c11 */ 1485 tmp12 += tmp11 - tmp15 - MULTIPLY(tmp2, FIX(2.339493912)) /* c1+c5-c11 */ 1486 + MULTIPLY(tmp5, FIX(0.860918669)); /* c7 */ 1487 tmp13 += tmp11 - tmp14 + MULTIPLY(tmp3, FIX(0.725788011)) /* c1+c11-c7 */ 1488 - MULTIPLY(tmp5, FIX(1.121971054)); /* c5 */ 1489 tmp11 = tmp15 + MULTIPLY(tmp0 - tmp3, FIX(1.306562965)) /* c3 */ 1490 - MULTIPLY(tmp2 + tmp5, FIX_0_541196100); /* c9 */ 1491 1492 dataptr[1] = (DCTELEM) DESCALE(tmp10, CONST_BITS); 1493 dataptr[3] = (DCTELEM) DESCALE(tmp11, CONST_BITS); 1494 dataptr[5] = (DCTELEM) DESCALE(tmp12, CONST_BITS); 1495 dataptr[7] = (DCTELEM) DESCALE(tmp13, CONST_BITS); 1496 1497 ctr++; 1498 1499 if (ctr != DCTSIZE) { 1500 if (ctr == 12) 1501 break; /* Done. */ 1502 dataptr += DCTSIZE; /* advance pointer to next row */ 1503 } else 1504 dataptr = workspace; /* switch pointer to extended workspace */ 1505 } 1506 1507 /* Pass 2: process columns. 1508 * We leave the results scaled up by an overall factor of 8. 1509 * We must also scale the output by (8/12)**2 = 4/9, which we partially 1510 * fold into the constant multipliers and final shifting: 1511 * cK now represents sqrt(2) * cos(K*pi/24) * 8/9. 1512 */ 1513 1514 dataptr = data; 1515 wsptr = workspace; 1516 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1517 /* Even part */ 1518 1519 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*3]; 1520 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*2]; 1521 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*1]; 1522 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*0]; 1523 tmp4 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*7]; 1524 tmp5 = dataptr[DCTSIZE*5] + dataptr[DCTSIZE*6]; 1525 1526 tmp10 = tmp0 + tmp5; 1527 tmp13 = tmp0 - tmp5; 1528 tmp11 = tmp1 + tmp4; 1529 tmp14 = tmp1 - tmp4; 1530 tmp12 = tmp2 + tmp3; 1531 tmp15 = tmp2 - tmp3; 1532 1533 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*3]; 1534 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*2]; 1535 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*1]; 1536 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*0]; 1537 tmp4 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*7]; 1538 tmp5 = dataptr[DCTSIZE*5] - dataptr[DCTSIZE*6]; 1539 1540 dataptr[DCTSIZE*0] = (DCTELEM) 1541 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12, FIX(0.888888889)), /* 8/9 */ 1542 CONST_BITS+1); 1543 dataptr[DCTSIZE*6] = (DCTELEM) 1544 DESCALE(MULTIPLY(tmp13 - tmp14 - tmp15, FIX(0.888888889)), /* 8/9 */ 1545 CONST_BITS+1); 1546 dataptr[DCTSIZE*4] = (DCTELEM) 1547 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.088662108)), /* c4 */ 1548 CONST_BITS+1); 1549 dataptr[DCTSIZE*2] = (DCTELEM) 1550 DESCALE(MULTIPLY(tmp14 - tmp15, FIX(0.888888889)) + /* 8/9 */ 1551 MULTIPLY(tmp13 + tmp15, FIX(1.214244803)), /* c2 */ 1552 CONST_BITS+1); 1553 1554 /* Odd part */ 1555 1556 tmp10 = MULTIPLY(tmp1 + tmp4, FIX(0.481063200)); /* c9 */ 1557 tmp14 = tmp10 + MULTIPLY(tmp1, FIX(0.680326102)); /* c3-c9 */ 1558 tmp15 = tmp10 - MULTIPLY(tmp4, FIX(1.642452502)); /* c3+c9 */ 1559 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(0.997307603)); /* c5 */ 1560 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(0.765261039)); /* c7 */ 1561 tmp10 = tmp12 + tmp13 + tmp14 - MULTIPLY(tmp0, FIX(0.516244403)) /* c5+c7-c1 */ 1562 + MULTIPLY(tmp5, FIX(0.164081699)); /* c11 */ 1563 tmp11 = MULTIPLY(tmp2 + tmp3, - FIX(0.164081699)); /* -c11 */ 1564 tmp12 += tmp11 - tmp15 - MULTIPLY(tmp2, FIX(2.079550144)) /* c1+c5-c11 */ 1565 + MULTIPLY(tmp5, FIX(0.765261039)); /* c7 */ 1566 tmp13 += tmp11 - tmp14 + MULTIPLY(tmp3, FIX(0.645144899)) /* c1+c11-c7 */ 1567 - MULTIPLY(tmp5, FIX(0.997307603)); /* c5 */ 1568 tmp11 = tmp15 + MULTIPLY(tmp0 - tmp3, FIX(1.161389302)) /* c3 */ 1569 - MULTIPLY(tmp2 + tmp5, FIX(0.481063200)); /* c9 */ 1570 1571 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp10, CONST_BITS+1); 1572 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp11, CONST_BITS+1); 1573 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12, CONST_BITS+1); 1574 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp13, CONST_BITS+1); 1575 1576 dataptr++; /* advance pointer to next column */ 1577 wsptr++; /* advance pointer to next column */ 1578 } 1579 } 1580 1581 1582 /* 1583 * Perform the forward DCT on a 13x13 sample block. 1584 */ 1585 1586 GLOBAL(void) 1587 jpeg_fdct_13x13 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1588 { 1589 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; 1590 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 1591 INT32 z1, z2; 1592 DCTELEM workspace[8*5]; 1593 DCTELEM *dataptr; 1594 DCTELEM *wsptr; 1595 JSAMPROW elemptr; 1596 int ctr; 1597 SHIFT_TEMPS 1598 1599 /* Pass 1: process rows. */ 1600 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 1601 /* cK represents sqrt(2) * cos(K*pi/26). */ 1602 1603 dataptr = data; 1604 ctr = 0; 1605 for (;;) { 1606 elemptr = sample_data[ctr] + start_col; 1607 1608 /* Even part */ 1609 1610 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[12]); 1611 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[11]); 1612 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[10]); 1613 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[9]); 1614 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[8]); 1615 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[7]); 1616 tmp6 = GETJSAMPLE(elemptr[6]); 1617 1618 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[12]); 1619 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[11]); 1620 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[10]); 1621 tmp13 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[9]); 1622 tmp14 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[8]); 1623 tmp15 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[7]); 1624 1625 /* Apply unsigned->signed conversion */ 1626 dataptr[0] = (DCTELEM) 1627 (tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 - 13 * CENTERJSAMPLE); 1628 tmp6 += tmp6; 1629 tmp0 -= tmp6; 1630 tmp1 -= tmp6; 1631 tmp2 -= tmp6; 1632 tmp3 -= tmp6; 1633 tmp4 -= tmp6; 1634 tmp5 -= tmp6; 1635 dataptr[2] = (DCTELEM) 1636 DESCALE(MULTIPLY(tmp0, FIX(1.373119086)) + /* c2 */ 1637 MULTIPLY(tmp1, FIX(1.058554052)) + /* c6 */ 1638 MULTIPLY(tmp2, FIX(0.501487041)) - /* c10 */ 1639 MULTIPLY(tmp3, FIX(0.170464608)) - /* c12 */ 1640 MULTIPLY(tmp4, FIX(0.803364869)) - /* c8 */ 1641 MULTIPLY(tmp5, FIX(1.252223920)), /* c4 */ 1642 CONST_BITS); 1643 z1 = MULTIPLY(tmp0 - tmp2, FIX(1.155388986)) - /* (c4+c6)/2 */ 1644 MULTIPLY(tmp3 - tmp4, FIX(0.435816023)) - /* (c2-c10)/2 */ 1645 MULTIPLY(tmp1 - tmp5, FIX(0.316450131)); /* (c8-c12)/2 */ 1646 z2 = MULTIPLY(tmp0 + tmp2, FIX(0.096834934)) - /* (c4-c6)/2 */ 1647 MULTIPLY(tmp3 + tmp4, FIX(0.937303064)) + /* (c2+c10)/2 */ 1648 MULTIPLY(tmp1 + tmp5, FIX(0.486914739)); /* (c8+c12)/2 */ 1649 1650 dataptr[4] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS); 1651 dataptr[6] = (DCTELEM) DESCALE(z1 - z2, CONST_BITS); 1652 1653 /* Odd part */ 1654 1655 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.322312651)); /* c3 */ 1656 tmp2 = MULTIPLY(tmp10 + tmp12, FIX(1.163874945)); /* c5 */ 1657 tmp3 = MULTIPLY(tmp10 + tmp13, FIX(0.937797057)) + /* c7 */ 1658 MULTIPLY(tmp14 + tmp15, FIX(0.338443458)); /* c11 */ 1659 tmp0 = tmp1 + tmp2 + tmp3 - 1660 MULTIPLY(tmp10, FIX(2.020082300)) + /* c3+c5+c7-c1 */ 1661 MULTIPLY(tmp14, FIX(0.318774355)); /* c9-c11 */ 1662 tmp4 = MULTIPLY(tmp14 - tmp15, FIX(0.937797057)) - /* c7 */ 1663 MULTIPLY(tmp11 + tmp12, FIX(0.338443458)); /* c11 */ 1664 tmp5 = MULTIPLY(tmp11 + tmp13, - FIX(1.163874945)); /* -c5 */ 1665 tmp1 += tmp4 + tmp5 + 1666 MULTIPLY(tmp11, FIX(0.837223564)) - /* c5+c9+c11-c3 */ 1667 MULTIPLY(tmp14, FIX(2.341699410)); /* c1+c7 */ 1668 tmp6 = MULTIPLY(tmp12 + tmp13, - FIX(0.657217813)); /* -c9 */ 1669 tmp2 += tmp4 + tmp6 - 1670 MULTIPLY(tmp12, FIX(1.572116027)) + /* c1+c5-c9-c11 */ 1671 MULTIPLY(tmp15, FIX(2.260109708)); /* c3+c7 */ 1672 tmp3 += tmp5 + tmp6 + 1673 MULTIPLY(tmp13, FIX(2.205608352)) - /* c3+c5+c9-c7 */ 1674 MULTIPLY(tmp15, FIX(1.742345811)); /* c1+c11 */ 1675 1676 dataptr[1] = (DCTELEM) DESCALE(tmp0, CONST_BITS); 1677 dataptr[3] = (DCTELEM) DESCALE(tmp1, CONST_BITS); 1678 dataptr[5] = (DCTELEM) DESCALE(tmp2, CONST_BITS); 1679 dataptr[7] = (DCTELEM) DESCALE(tmp3, CONST_BITS); 1680 1681 ctr++; 1682 1683 if (ctr != DCTSIZE) { 1684 if (ctr == 13) 1685 break; /* Done. */ 1686 dataptr += DCTSIZE; /* advance pointer to next row */ 1687 } else 1688 dataptr = workspace; /* switch pointer to extended workspace */ 1689 } 1690 1691 /* Pass 2: process columns. 1692 * We leave the results scaled up by an overall factor of 8. 1693 * We must also scale the output by (8/13)**2 = 64/169, which we partially 1694 * fold into the constant multipliers and final shifting: 1695 * cK now represents sqrt(2) * cos(K*pi/26) * 128/169. 1696 */ 1697 1698 dataptr = data; 1699 wsptr = workspace; 1700 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1701 /* Even part */ 1702 1703 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*4]; 1704 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*3]; 1705 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*2]; 1706 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*1]; 1707 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*0]; 1708 tmp5 = dataptr[DCTSIZE*5] + dataptr[DCTSIZE*7]; 1709 tmp6 = dataptr[DCTSIZE*6]; 1710 1711 tmp10 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*4]; 1712 tmp11 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*3]; 1713 tmp12 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*2]; 1714 tmp13 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*1]; 1715 tmp14 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*0]; 1716 tmp15 = dataptr[DCTSIZE*5] - dataptr[DCTSIZE*7]; 1717 1718 dataptr[DCTSIZE*0] = (DCTELEM) 1719 DESCALE(MULTIPLY(tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6, 1720 FIX(0.757396450)), /* 128/169 */ 1721 CONST_BITS+1); 1722 tmp6 += tmp6; 1723 tmp0 -= tmp6; 1724 tmp1 -= tmp6; 1725 tmp2 -= tmp6; 1726 tmp3 -= tmp6; 1727 tmp4 -= tmp6; 1728 tmp5 -= tmp6; 1729 dataptr[DCTSIZE*2] = (DCTELEM) 1730 DESCALE(MULTIPLY(tmp0, FIX(1.039995521)) + /* c2 */ 1731 MULTIPLY(tmp1, FIX(0.801745081)) + /* c6 */ 1732 MULTIPLY(tmp2, FIX(0.379824504)) - /* c10 */ 1733 MULTIPLY(tmp3, FIX(0.129109289)) - /* c12 */ 1734 MULTIPLY(tmp4, FIX(0.608465700)) - /* c8 */ 1735 MULTIPLY(tmp5, FIX(0.948429952)), /* c4 */ 1736 CONST_BITS+1); 1737 z1 = MULTIPLY(tmp0 - tmp2, FIX(0.875087516)) - /* (c4+c6)/2 */ 1738 MULTIPLY(tmp3 - tmp4, FIX(0.330085509)) - /* (c2-c10)/2 */ 1739 MULTIPLY(tmp1 - tmp5, FIX(0.239678205)); /* (c8-c12)/2 */ 1740 z2 = MULTIPLY(tmp0 + tmp2, FIX(0.073342435)) - /* (c4-c6)/2 */ 1741 MULTIPLY(tmp3 + tmp4, FIX(0.709910013)) + /* (c2+c10)/2 */ 1742 MULTIPLY(tmp1 + tmp5, FIX(0.368787494)); /* (c8+c12)/2 */ 1743 1744 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS+1); 1745 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 - z2, CONST_BITS+1); 1746 1747 /* Odd part */ 1748 1749 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.001514908)); /* c3 */ 1750 tmp2 = MULTIPLY(tmp10 + tmp12, FIX(0.881514751)); /* c5 */ 1751 tmp3 = MULTIPLY(tmp10 + tmp13, FIX(0.710284161)) + /* c7 */ 1752 MULTIPLY(tmp14 + tmp15, FIX(0.256335874)); /* c11 */ 1753 tmp0 = tmp1 + tmp2 + tmp3 - 1754 MULTIPLY(tmp10, FIX(1.530003162)) + /* c3+c5+c7-c1 */ 1755 MULTIPLY(tmp14, FIX(0.241438564)); /* c9-c11 */ 1756 tmp4 = MULTIPLY(tmp14 - tmp15, FIX(0.710284161)) - /* c7 */ 1757 MULTIPLY(tmp11 + tmp12, FIX(0.256335874)); /* c11 */ 1758 tmp5 = MULTIPLY(tmp11 + tmp13, - FIX(0.881514751)); /* -c5 */ 1759 tmp1 += tmp4 + tmp5 + 1760 MULTIPLY(tmp11, FIX(0.634110155)) - /* c5+c9+c11-c3 */ 1761 MULTIPLY(tmp14, FIX(1.773594819)); /* c1+c7 */ 1762 tmp6 = MULTIPLY(tmp12 + tmp13, - FIX(0.497774438)); /* -c9 */ 1763 tmp2 += tmp4 + tmp6 - 1764 MULTIPLY(tmp12, FIX(1.190715098)) + /* c1+c5-c9-c11 */ 1765 MULTIPLY(tmp15, FIX(1.711799069)); /* c3+c7 */ 1766 tmp3 += tmp5 + tmp6 + 1767 MULTIPLY(tmp13, FIX(1.670519935)) - /* c3+c5+c9-c7 */ 1768 MULTIPLY(tmp15, FIX(1.319646532)); /* c1+c11 */ 1769 1770 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0, CONST_BITS+1); 1771 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1, CONST_BITS+1); 1772 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2, CONST_BITS+1); 1773 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp3, CONST_BITS+1); 1774 1775 dataptr++; /* advance pointer to next column */ 1776 wsptr++; /* advance pointer to next column */ 1777 } 1778 } 1779 1780 1781 /* 1782 * Perform the forward DCT on a 14x14 sample block. 1783 */ 1784 1785 GLOBAL(void) 1786 jpeg_fdct_14x14 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1787 { 1788 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; 1789 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 1790 DCTELEM workspace[8*6]; 1791 DCTELEM *dataptr; 1792 DCTELEM *wsptr; 1793 JSAMPROW elemptr; 1794 int ctr; 1795 SHIFT_TEMPS 1796 1797 /* Pass 1: process rows. */ 1798 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 1799 /* cK represents sqrt(2) * cos(K*pi/28). */ 1800 1801 dataptr = data; 1802 ctr = 0; 1803 for (;;) { 1804 elemptr = sample_data[ctr] + start_col; 1805 1806 /* Even part */ 1807 1808 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[13]); 1809 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[12]); 1810 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[11]); 1811 tmp13 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[10]); 1812 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[9]); 1813 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[8]); 1814 tmp6 = GETJSAMPLE(elemptr[6]) + GETJSAMPLE(elemptr[7]); 1815 1816 tmp10 = tmp0 + tmp6; 1817 tmp14 = tmp0 - tmp6; 1818 tmp11 = tmp1 + tmp5; 1819 tmp15 = tmp1 - tmp5; 1820 tmp12 = tmp2 + tmp4; 1821 tmp16 = tmp2 - tmp4; 1822 1823 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[13]); 1824 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[12]); 1825 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[11]); 1826 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[10]); 1827 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[9]); 1828 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[8]); 1829 tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[7]); 1830 1831 /* Apply unsigned->signed conversion */ 1832 dataptr[0] = (DCTELEM) 1833 (tmp10 + tmp11 + tmp12 + tmp13 - 14 * CENTERJSAMPLE); 1834 tmp13 += tmp13; 1835 dataptr[4] = (DCTELEM) 1836 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.274162392)) + /* c4 */ 1837 MULTIPLY(tmp11 - tmp13, FIX(0.314692123)) - /* c12 */ 1838 MULTIPLY(tmp12 - tmp13, FIX(0.881747734)), /* c8 */ 1839 CONST_BITS); 1840 1841 tmp10 = MULTIPLY(tmp14 + tmp15, FIX(1.105676686)); /* c6 */ 1842 1843 dataptr[2] = (DCTELEM) 1844 DESCALE(tmp10 + MULTIPLY(tmp14, FIX(0.273079590)) /* c2-c6 */ 1845 + MULTIPLY(tmp16, FIX(0.613604268)), /* c10 */ 1846 CONST_BITS); 1847 dataptr[6] = (DCTELEM) 1848 DESCALE(tmp10 - MULTIPLY(tmp15, FIX(1.719280954)) /* c6+c10 */ 1849 - MULTIPLY(tmp16, FIX(1.378756276)), /* c2 */ 1850 CONST_BITS); 1851 1852 /* Odd part */ 1853 1854 tmp10 = tmp1 + tmp2; 1855 tmp11 = tmp5 - tmp4; 1856 dataptr[7] = (DCTELEM) (tmp0 - tmp10 + tmp3 - tmp11 - tmp6); 1857 tmp3 <<= CONST_BITS; 1858 tmp10 = MULTIPLY(tmp10, - FIX(0.158341681)); /* -c13 */ 1859 tmp11 = MULTIPLY(tmp11, FIX(1.405321284)); /* c1 */ 1860 tmp10 += tmp11 - tmp3; 1861 tmp11 = MULTIPLY(tmp0 + tmp2, FIX(1.197448846)) + /* c5 */ 1862 MULTIPLY(tmp4 + tmp6, FIX(0.752406978)); /* c9 */ 1863 dataptr[5] = (DCTELEM) 1864 DESCALE(tmp10 + tmp11 - MULTIPLY(tmp2, FIX(2.373959773)) /* c3+c5-c13 */ 1865 + MULTIPLY(tmp4, FIX(1.119999435)), /* c1+c11-c9 */ 1866 CONST_BITS); 1867 tmp12 = MULTIPLY(tmp0 + tmp1, FIX(1.334852607)) + /* c3 */ 1868 MULTIPLY(tmp5 - tmp6, FIX(0.467085129)); /* c11 */ 1869 dataptr[3] = (DCTELEM) 1870 DESCALE(tmp10 + tmp12 - MULTIPLY(tmp1, FIX(0.424103948)) /* c3-c9-c13 */ 1871 - MULTIPLY(tmp5, FIX(3.069855259)), /* c1+c5+c11 */ 1872 CONST_BITS); 1873 dataptr[1] = (DCTELEM) 1874 DESCALE(tmp11 + tmp12 + tmp3 + tmp6 - 1875 MULTIPLY(tmp0 + tmp6, FIX(1.126980169)), /* c3+c5-c1 */ 1876 CONST_BITS); 1877 1878 ctr++; 1879 1880 if (ctr != DCTSIZE) { 1881 if (ctr == 14) 1882 break; /* Done. */ 1883 dataptr += DCTSIZE; /* advance pointer to next row */ 1884 } else 1885 dataptr = workspace; /* switch pointer to extended workspace */ 1886 } 1887 1888 /* Pass 2: process columns. 1889 * We leave the results scaled up by an overall factor of 8. 1890 * We must also scale the output by (8/14)**2 = 16/49, which we partially 1891 * fold into the constant multipliers and final shifting: 1892 * cK now represents sqrt(2) * cos(K*pi/28) * 32/49. 1893 */ 1894 1895 dataptr = data; 1896 wsptr = workspace; 1897 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 1898 /* Even part */ 1899 1900 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*5]; 1901 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*4]; 1902 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*3]; 1903 tmp13 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*2]; 1904 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*1]; 1905 tmp5 = dataptr[DCTSIZE*5] + wsptr[DCTSIZE*0]; 1906 tmp6 = dataptr[DCTSIZE*6] + dataptr[DCTSIZE*7]; 1907 1908 tmp10 = tmp0 + tmp6; 1909 tmp14 = tmp0 - tmp6; 1910 tmp11 = tmp1 + tmp5; 1911 tmp15 = tmp1 - tmp5; 1912 tmp12 = tmp2 + tmp4; 1913 tmp16 = tmp2 - tmp4; 1914 1915 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*5]; 1916 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*4]; 1917 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*3]; 1918 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*2]; 1919 tmp4 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*1]; 1920 tmp5 = dataptr[DCTSIZE*5] - wsptr[DCTSIZE*0]; 1921 tmp6 = dataptr[DCTSIZE*6] - dataptr[DCTSIZE*7]; 1922 1923 dataptr[DCTSIZE*0] = (DCTELEM) 1924 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12 + tmp13, 1925 FIX(0.653061224)), /* 32/49 */ 1926 CONST_BITS+1); 1927 tmp13 += tmp13; 1928 dataptr[DCTSIZE*4] = (DCTELEM) 1929 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(0.832106052)) + /* c4 */ 1930 MULTIPLY(tmp11 - tmp13, FIX(0.205513223)) - /* c12 */ 1931 MULTIPLY(tmp12 - tmp13, FIX(0.575835255)), /* c8 */ 1932 CONST_BITS+1); 1933 1934 tmp10 = MULTIPLY(tmp14 + tmp15, FIX(0.722074570)); /* c6 */ 1935 1936 dataptr[DCTSIZE*2] = (DCTELEM) 1937 DESCALE(tmp10 + MULTIPLY(tmp14, FIX(0.178337691)) /* c2-c6 */ 1938 + MULTIPLY(tmp16, FIX(0.400721155)), /* c10 */ 1939 CONST_BITS+1); 1940 dataptr[DCTSIZE*6] = (DCTELEM) 1941 DESCALE(tmp10 - MULTIPLY(tmp15, FIX(1.122795725)) /* c6+c10 */ 1942 - MULTIPLY(tmp16, FIX(0.900412262)), /* c2 */ 1943 CONST_BITS+1); 1944 1945 /* Odd part */ 1946 1947 tmp10 = tmp1 + tmp2; 1948 tmp11 = tmp5 - tmp4; 1949 dataptr[DCTSIZE*7] = (DCTELEM) 1950 DESCALE(MULTIPLY(tmp0 - tmp10 + tmp3 - tmp11 - tmp6, 1951 FIX(0.653061224)), /* 32/49 */ 1952 CONST_BITS+1); 1953 tmp3 = MULTIPLY(tmp3 , FIX(0.653061224)); /* 32/49 */ 1954 tmp10 = MULTIPLY(tmp10, - FIX(0.103406812)); /* -c13 */ 1955 tmp11 = MULTIPLY(tmp11, FIX(0.917760839)); /* c1 */ 1956 tmp10 += tmp11 - tmp3; 1957 tmp11 = MULTIPLY(tmp0 + tmp2, FIX(0.782007410)) + /* c5 */ 1958 MULTIPLY(tmp4 + tmp6, FIX(0.491367823)); /* c9 */ 1959 dataptr[DCTSIZE*5] = (DCTELEM) 1960 DESCALE(tmp10 + tmp11 - MULTIPLY(tmp2, FIX(1.550341076)) /* c3+c5-c13 */ 1961 + MULTIPLY(tmp4, FIX(0.731428202)), /* c1+c11-c9 */ 1962 CONST_BITS+1); 1963 tmp12 = MULTIPLY(tmp0 + tmp1, FIX(0.871740478)) + /* c3 */ 1964 MULTIPLY(tmp5 - tmp6, FIX(0.305035186)); /* c11 */ 1965 dataptr[DCTSIZE*3] = (DCTELEM) 1966 DESCALE(tmp10 + tmp12 - MULTIPLY(tmp1, FIX(0.276965844)) /* c3-c9-c13 */ 1967 - MULTIPLY(tmp5, FIX(2.004803435)), /* c1+c5+c11 */ 1968 CONST_BITS+1); 1969 dataptr[DCTSIZE*1] = (DCTELEM) 1970 DESCALE(tmp11 + tmp12 + tmp3 1971 - MULTIPLY(tmp0, FIX(0.735987049)) /* c3+c5-c1 */ 1972 - MULTIPLY(tmp6, FIX(0.082925825)), /* c9-c11-c13 */ 1973 CONST_BITS+1); 1974 1975 dataptr++; /* advance pointer to next column */ 1976 wsptr++; /* advance pointer to next column */ 1977 } 1978 } 1979 1980 1981 /* 1982 * Perform the forward DCT on a 15x15 sample block. 1983 */ 1984 1985 GLOBAL(void) 1986 jpeg_fdct_15x15 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 1987 { 1988 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; 1989 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 1990 INT32 z1, z2, z3; 1991 DCTELEM workspace[8*7]; 1992 DCTELEM *dataptr; 1993 DCTELEM *wsptr; 1994 JSAMPROW elemptr; 1995 int ctr; 1996 SHIFT_TEMPS 1997 1998 /* Pass 1: process rows. */ 1999 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 2000 /* cK represents sqrt(2) * cos(K*pi/30). */ 2001 2002 dataptr = data; 2003 ctr = 0; 2004 for (;;) { 2005 elemptr = sample_data[ctr] + start_col; 2006 2007 /* Even part */ 2008 2009 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[14]); 2010 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[13]); 2011 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[12]); 2012 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[11]); 2013 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[10]); 2014 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[9]); 2015 tmp6 = GETJSAMPLE(elemptr[6]) + GETJSAMPLE(elemptr[8]); 2016 tmp7 = GETJSAMPLE(elemptr[7]); 2017 2018 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[14]); 2019 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[13]); 2020 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[12]); 2021 tmp13 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[11]); 2022 tmp14 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[10]); 2023 tmp15 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[9]); 2024 tmp16 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[8]); 2025 2026 z1 = tmp0 + tmp4 + tmp5; 2027 z2 = tmp1 + tmp3 + tmp6; 2028 z3 = tmp2 + tmp7; 2029 /* Apply unsigned->signed conversion */ 2030 dataptr[0] = (DCTELEM) (z1 + z2 + z3 - 15 * CENTERJSAMPLE); 2031 z3 += z3; 2032 dataptr[6] = (DCTELEM) 2033 DESCALE(MULTIPLY(z1 - z3, FIX(1.144122806)) - /* c6 */ 2034 MULTIPLY(z2 - z3, FIX(0.437016024)), /* c12 */ 2035 CONST_BITS); 2036 tmp2 += ((tmp1 + tmp4) >> 1) - tmp7 - tmp7; 2037 z1 = MULTIPLY(tmp3 - tmp2, FIX(1.531135173)) - /* c2+c14 */ 2038 MULTIPLY(tmp6 - tmp2, FIX(2.238241955)); /* c4+c8 */ 2039 z2 = MULTIPLY(tmp5 - tmp2, FIX(0.798468008)) - /* c8-c14 */ 2040 MULTIPLY(tmp0 - tmp2, FIX(0.091361227)); /* c2-c4 */ 2041 z3 = MULTIPLY(tmp0 - tmp3, FIX(1.383309603)) + /* c2 */ 2042 MULTIPLY(tmp6 - tmp5, FIX(0.946293579)) + /* c8 */ 2043 MULTIPLY(tmp1 - tmp4, FIX(0.790569415)); /* (c6+c12)/2 */ 2044 2045 dataptr[2] = (DCTELEM) DESCALE(z1 + z3, CONST_BITS); 2046 dataptr[4] = (DCTELEM) DESCALE(z2 + z3, CONST_BITS); 2047 2048 /* Odd part */ 2049 2050 tmp2 = MULTIPLY(tmp10 - tmp12 - tmp13 + tmp15 + tmp16, 2051 FIX(1.224744871)); /* c5 */ 2052 tmp1 = MULTIPLY(tmp10 - tmp14 - tmp15, FIX(1.344997024)) + /* c3 */ 2053 MULTIPLY(tmp11 - tmp13 - tmp16, FIX(0.831253876)); /* c9 */ 2054 tmp12 = MULTIPLY(tmp12, FIX(1.224744871)); /* c5 */ 2055 tmp4 = MULTIPLY(tmp10 - tmp16, FIX(1.406466353)) + /* c1 */ 2056 MULTIPLY(tmp11 + tmp14, FIX(1.344997024)) + /* c3 */ 2057 MULTIPLY(tmp13 + tmp15, FIX(0.575212477)); /* c11 */ 2058 tmp0 = MULTIPLY(tmp13, FIX(0.475753014)) - /* c7-c11 */ 2059 MULTIPLY(tmp14, FIX(0.513743148)) + /* c3-c9 */ 2060 MULTIPLY(tmp16, FIX(1.700497885)) + tmp4 + tmp12; /* c1+c13 */ 2061 tmp3 = MULTIPLY(tmp10, - FIX(0.355500862)) - /* -(c1-c7) */ 2062 MULTIPLY(tmp11, FIX(2.176250899)) - /* c3+c9 */ 2063 MULTIPLY(tmp15, FIX(0.869244010)) + tmp4 - tmp12; /* c11+c13 */ 2064 2065 dataptr[1] = (DCTELEM) DESCALE(tmp0, CONST_BITS); 2066 dataptr[3] = (DCTELEM) DESCALE(tmp1, CONST_BITS); 2067 dataptr[5] = (DCTELEM) DESCALE(tmp2, CONST_BITS); 2068 dataptr[7] = (DCTELEM) DESCALE(tmp3, CONST_BITS); 2069 2070 ctr++; 2071 2072 if (ctr != DCTSIZE) { 2073 if (ctr == 15) 2074 break; /* Done. */ 2075 dataptr += DCTSIZE; /* advance pointer to next row */ 2076 } else 2077 dataptr = workspace; /* switch pointer to extended workspace */ 2078 } 2079 2080 /* Pass 2: process columns. 2081 * We leave the results scaled up by an overall factor of 8. 2082 * We must also scale the output by (8/15)**2 = 64/225, which we partially 2083 * fold into the constant multipliers and final shifting: 2084 * cK now represents sqrt(2) * cos(K*pi/30) * 256/225. 2085 */ 2086 2087 dataptr = data; 2088 wsptr = workspace; 2089 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2090 /* Even part */ 2091 2092 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*6]; 2093 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*5]; 2094 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*4]; 2095 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*3]; 2096 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*2]; 2097 tmp5 = dataptr[DCTSIZE*5] + wsptr[DCTSIZE*1]; 2098 tmp6 = dataptr[DCTSIZE*6] + wsptr[DCTSIZE*0]; 2099 tmp7 = dataptr[DCTSIZE*7]; 2100 2101 tmp10 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*6]; 2102 tmp11 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*5]; 2103 tmp12 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*4]; 2104 tmp13 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*3]; 2105 tmp14 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*2]; 2106 tmp15 = dataptr[DCTSIZE*5] - wsptr[DCTSIZE*1]; 2107 tmp16 = dataptr[DCTSIZE*6] - wsptr[DCTSIZE*0]; 2108 2109 z1 = tmp0 + tmp4 + tmp5; 2110 z2 = tmp1 + tmp3 + tmp6; 2111 z3 = tmp2 + tmp7; 2112 dataptr[DCTSIZE*0] = (DCTELEM) 2113 DESCALE(MULTIPLY(z1 + z2 + z3, FIX(1.137777778)), /* 256/225 */ 2114 CONST_BITS+2); 2115 z3 += z3; 2116 dataptr[DCTSIZE*6] = (DCTELEM) 2117 DESCALE(MULTIPLY(z1 - z3, FIX(1.301757503)) - /* c6 */ 2118 MULTIPLY(z2 - z3, FIX(0.497227121)), /* c12 */ 2119 CONST_BITS+2); 2120 tmp2 += ((tmp1 + tmp4) >> 1) - tmp7 - tmp7; 2121 z1 = MULTIPLY(tmp3 - tmp2, FIX(1.742091575)) - /* c2+c14 */ 2122 MULTIPLY(tmp6 - tmp2, FIX(2.546621957)); /* c4+c8 */ 2123 z2 = MULTIPLY(tmp5 - tmp2, FIX(0.908479156)) - /* c8-c14 */ 2124 MULTIPLY(tmp0 - tmp2, FIX(0.103948774)); /* c2-c4 */ 2125 z3 = MULTIPLY(tmp0 - tmp3, FIX(1.573898926)) + /* c2 */ 2126 MULTIPLY(tmp6 - tmp5, FIX(1.076671805)) + /* c8 */ 2127 MULTIPLY(tmp1 - tmp4, FIX(0.899492312)); /* (c6+c12)/2 */ 2128 2129 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + z3, CONST_BITS+2); 2130 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(z2 + z3, CONST_BITS+2); 2131 2132 /* Odd part */ 2133 2134 tmp2 = MULTIPLY(tmp10 - tmp12 - tmp13 + tmp15 + tmp16, 2135 FIX(1.393487498)); /* c5 */ 2136 tmp1 = MULTIPLY(tmp10 - tmp14 - tmp15, FIX(1.530307725)) + /* c3 */ 2137 MULTIPLY(tmp11 - tmp13 - tmp16, FIX(0.945782187)); /* c9 */ 2138 tmp12 = MULTIPLY(tmp12, FIX(1.393487498)); /* c5 */ 2139 tmp4 = MULTIPLY(tmp10 - tmp16, FIX(1.600246161)) + /* c1 */ 2140 MULTIPLY(tmp11 + tmp14, FIX(1.530307725)) + /* c3 */ 2141 MULTIPLY(tmp13 + tmp15, FIX(0.654463974)); /* c11 */ 2142 tmp0 = MULTIPLY(tmp13, FIX(0.541301207)) - /* c7-c11 */ 2143 MULTIPLY(tmp14, FIX(0.584525538)) + /* c3-c9 */ 2144 MULTIPLY(tmp16, FIX(1.934788705)) + tmp4 + tmp12; /* c1+c13 */ 2145 tmp3 = MULTIPLY(tmp10, - FIX(0.404480980)) - /* -(c1-c7) */ 2146 MULTIPLY(tmp11, FIX(2.476089912)) - /* c3+c9 */ 2147 MULTIPLY(tmp15, FIX(0.989006518)) + tmp4 - tmp12; /* c11+c13 */ 2148 2149 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0, CONST_BITS+2); 2150 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1, CONST_BITS+2); 2151 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2, CONST_BITS+2); 2152 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp3, CONST_BITS+2); 2153 2154 dataptr++; /* advance pointer to next column */ 2155 wsptr++; /* advance pointer to next column */ 2156 } 2157 } 2158 2159 2160 /* 2161 * Perform the forward DCT on a 16x16 sample block. 2162 */ 2163 2164 GLOBAL(void) 2165 jpeg_fdct_16x16 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2166 { 2167 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; 2168 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17; 2169 DCTELEM workspace[DCTSIZE2]; 2170 DCTELEM *dataptr; 2171 DCTELEM *wsptr; 2172 JSAMPROW elemptr; 2173 int ctr; 2174 SHIFT_TEMPS 2175 2176 /* Pass 1: process rows. */ 2177 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 2178 /* furthermore, we scale the results by 2**PASS1_BITS. */ 2179 /* cK represents sqrt(2) * cos(K*pi/32). */ 2180 2181 dataptr = data; 2182 ctr = 0; 2183 for (;;) { 2184 elemptr = sample_data[ctr] + start_col; 2185 2186 /* Even part */ 2187 2188 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[15]); 2189 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[14]); 2190 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[13]); 2191 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[12]); 2192 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[11]); 2193 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[10]); 2194 tmp6 = GETJSAMPLE(elemptr[6]) + GETJSAMPLE(elemptr[9]); 2195 tmp7 = GETJSAMPLE(elemptr[7]) + GETJSAMPLE(elemptr[8]); 2196 2197 tmp10 = tmp0 + tmp7; 2198 tmp14 = tmp0 - tmp7; 2199 tmp11 = tmp1 + tmp6; 2200 tmp15 = tmp1 - tmp6; 2201 tmp12 = tmp2 + tmp5; 2202 tmp16 = tmp2 - tmp5; 2203 tmp13 = tmp3 + tmp4; 2204 tmp17 = tmp3 - tmp4; 2205 2206 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[15]); 2207 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[14]); 2208 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[13]); 2209 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[12]); 2210 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[11]); 2211 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[10]); 2212 tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[9]); 2213 tmp7 = GETJSAMPLE(elemptr[7]) - GETJSAMPLE(elemptr[8]); 2214 2215 /* Apply unsigned->signed conversion */ 2216 dataptr[0] = (DCTELEM) 2217 ((tmp10 + tmp11 + tmp12 + tmp13 - 16 * CENTERJSAMPLE) << PASS1_BITS); 2218 dataptr[4] = (DCTELEM) 2219 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.306562965)) + /* c4[16] = c2[8] */ 2220 MULTIPLY(tmp11 - tmp12, FIX_0_541196100), /* c12[16] = c6[8] */ 2221 CONST_BITS-PASS1_BITS); 2222 2223 tmp10 = MULTIPLY(tmp17 - tmp15, FIX(0.275899379)) + /* c14[16] = c7[8] */ 2224 MULTIPLY(tmp14 - tmp16, FIX(1.387039845)); /* c2[16] = c1[8] */ 2225 2226 dataptr[2] = (DCTELEM) 2227 DESCALE(tmp10 + MULTIPLY(tmp15, FIX(1.451774982)) /* c6+c14 */ 2228 + MULTIPLY(tmp16, FIX(2.172734804)), /* c2+c10 */ 2229 CONST_BITS-PASS1_BITS); 2230 dataptr[6] = (DCTELEM) 2231 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(0.211164243)) /* c2-c6 */ 2232 - MULTIPLY(tmp17, FIX(1.061594338)), /* c10+c14 */ 2233 CONST_BITS-PASS1_BITS); 2234 2235 /* Odd part */ 2236 2237 tmp11 = MULTIPLY(tmp0 + tmp1, FIX(1.353318001)) + /* c3 */ 2238 MULTIPLY(tmp6 - tmp7, FIX(0.410524528)); /* c13 */ 2239 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.247225013)) + /* c5 */ 2240 MULTIPLY(tmp5 + tmp7, FIX(0.666655658)); /* c11 */ 2241 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(1.093201867)) + /* c7 */ 2242 MULTIPLY(tmp4 - tmp7, FIX(0.897167586)); /* c9 */ 2243 tmp14 = MULTIPLY(tmp1 + tmp2, FIX(0.138617169)) + /* c15 */ 2244 MULTIPLY(tmp6 - tmp5, FIX(1.407403738)); /* c1 */ 2245 tmp15 = MULTIPLY(tmp1 + tmp3, - FIX(0.666655658)) + /* -c11 */ 2246 MULTIPLY(tmp4 + tmp6, - FIX(1.247225013)); /* -c5 */ 2247 tmp16 = MULTIPLY(tmp2 + tmp3, - FIX(1.353318001)) + /* -c3 */ 2248 MULTIPLY(tmp5 - tmp4, FIX(0.410524528)); /* c13 */ 2249 tmp10 = tmp11 + tmp12 + tmp13 - 2250 MULTIPLY(tmp0, FIX(2.286341144)) + /* c7+c5+c3-c1 */ 2251 MULTIPLY(tmp7, FIX(0.779653625)); /* c15+c13-c11+c9 */ 2252 tmp11 += tmp14 + tmp15 + MULTIPLY(tmp1, FIX(0.071888074)) /* c9-c3-c15+c11 */ 2253 - MULTIPLY(tmp6, FIX(1.663905119)); /* c7+c13+c1-c5 */ 2254 tmp12 += tmp14 + tmp16 - MULTIPLY(tmp2, FIX(1.125726048)) /* c7+c5+c15-c3 */ 2255 + MULTIPLY(tmp5, FIX(1.227391138)); /* c9-c11+c1-c13 */ 2256 tmp13 += tmp15 + tmp16 + MULTIPLY(tmp3, FIX(1.065388962)) /* c15+c3+c11-c7 */ 2257 + MULTIPLY(tmp4, FIX(2.167985692)); /* c1+c13+c5-c9 */ 2258 2259 dataptr[1] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS); 2260 dataptr[3] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS); 2261 dataptr[5] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS); 2262 dataptr[7] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS); 2263 2264 ctr++; 2265 2266 if (ctr != DCTSIZE) { 2267 if (ctr == DCTSIZE * 2) 2268 break; /* Done. */ 2269 dataptr += DCTSIZE; /* advance pointer to next row */ 2270 } else 2271 dataptr = workspace; /* switch pointer to extended workspace */ 2272 } 2273 2274 /* Pass 2: process columns. 2275 * We remove the PASS1_BITS scaling, but leave the results scaled up 2276 * by an overall factor of 8. 2277 * We must also scale the output by (8/16)**2 = 1/2**2. 2278 */ 2279 2280 dataptr = data; 2281 wsptr = workspace; 2282 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2283 /* Even part */ 2284 2285 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*7]; 2286 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*6]; 2287 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*5]; 2288 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*4]; 2289 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*3]; 2290 tmp5 = dataptr[DCTSIZE*5] + wsptr[DCTSIZE*2]; 2291 tmp6 = dataptr[DCTSIZE*6] + wsptr[DCTSIZE*1]; 2292 tmp7 = dataptr[DCTSIZE*7] + wsptr[DCTSIZE*0]; 2293 2294 tmp10 = tmp0 + tmp7; 2295 tmp14 = tmp0 - tmp7; 2296 tmp11 = tmp1 + tmp6; 2297 tmp15 = tmp1 - tmp6; 2298 tmp12 = tmp2 + tmp5; 2299 tmp16 = tmp2 - tmp5; 2300 tmp13 = tmp3 + tmp4; 2301 tmp17 = tmp3 - tmp4; 2302 2303 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*7]; 2304 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*6]; 2305 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*5]; 2306 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*4]; 2307 tmp4 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*3]; 2308 tmp5 = dataptr[DCTSIZE*5] - wsptr[DCTSIZE*2]; 2309 tmp6 = dataptr[DCTSIZE*6] - wsptr[DCTSIZE*1]; 2310 tmp7 = dataptr[DCTSIZE*7] - wsptr[DCTSIZE*0]; 2311 2312 dataptr[DCTSIZE*0] = (DCTELEM) 2313 DESCALE(tmp10 + tmp11 + tmp12 + tmp13, PASS1_BITS+2); 2314 dataptr[DCTSIZE*4] = (DCTELEM) 2315 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.306562965)) + /* c4[16] = c2[8] */ 2316 MULTIPLY(tmp11 - tmp12, FIX_0_541196100), /* c12[16] = c6[8] */ 2317 CONST_BITS+PASS1_BITS+2); 2318 2319 tmp10 = MULTIPLY(tmp17 - tmp15, FIX(0.275899379)) + /* c14[16] = c7[8] */ 2320 MULTIPLY(tmp14 - tmp16, FIX(1.387039845)); /* c2[16] = c1[8] */ 2321 2322 dataptr[DCTSIZE*2] = (DCTELEM) 2323 DESCALE(tmp10 + MULTIPLY(tmp15, FIX(1.451774982)) /* c6+c14 */ 2324 + MULTIPLY(tmp16, FIX(2.172734804)), /* c2+10 */ 2325 CONST_BITS+PASS1_BITS+2); 2326 dataptr[DCTSIZE*6] = (DCTELEM) 2327 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(0.211164243)) /* c2-c6 */ 2328 - MULTIPLY(tmp17, FIX(1.061594338)), /* c10+c14 */ 2329 CONST_BITS+PASS1_BITS+2); 2330 2331 /* Odd part */ 2332 2333 tmp11 = MULTIPLY(tmp0 + tmp1, FIX(1.353318001)) + /* c3 */ 2334 MULTIPLY(tmp6 - tmp7, FIX(0.410524528)); /* c13 */ 2335 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.247225013)) + /* c5 */ 2336 MULTIPLY(tmp5 + tmp7, FIX(0.666655658)); /* c11 */ 2337 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(1.093201867)) + /* c7 */ 2338 MULTIPLY(tmp4 - tmp7, FIX(0.897167586)); /* c9 */ 2339 tmp14 = MULTIPLY(tmp1 + tmp2, FIX(0.138617169)) + /* c15 */ 2340 MULTIPLY(tmp6 - tmp5, FIX(1.407403738)); /* c1 */ 2341 tmp15 = MULTIPLY(tmp1 + tmp3, - FIX(0.666655658)) + /* -c11 */ 2342 MULTIPLY(tmp4 + tmp6, - FIX(1.247225013)); /* -c5 */ 2343 tmp16 = MULTIPLY(tmp2 + tmp3, - FIX(1.353318001)) + /* -c3 */ 2344 MULTIPLY(tmp5 - tmp4, FIX(0.410524528)); /* c13 */ 2345 tmp10 = tmp11 + tmp12 + tmp13 - 2346 MULTIPLY(tmp0, FIX(2.286341144)) + /* c7+c5+c3-c1 */ 2347 MULTIPLY(tmp7, FIX(0.779653625)); /* c15+c13-c11+c9 */ 2348 tmp11 += tmp14 + tmp15 + MULTIPLY(tmp1, FIX(0.071888074)) /* c9-c3-c15+c11 */ 2349 - MULTIPLY(tmp6, FIX(1.663905119)); /* c7+c13+c1-c5 */ 2350 tmp12 += tmp14 + tmp16 - MULTIPLY(tmp2, FIX(1.125726048)) /* c7+c5+c15-c3 */ 2351 + MULTIPLY(tmp5, FIX(1.227391138)); /* c9-c11+c1-c13 */ 2352 tmp13 += tmp15 + tmp16 + MULTIPLY(tmp3, FIX(1.065388962)) /* c15+c3+c11-c7 */ 2353 + MULTIPLY(tmp4, FIX(2.167985692)); /* c1+c13+c5-c9 */ 2354 2355 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp10, CONST_BITS+PASS1_BITS+2); 2356 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp11, CONST_BITS+PASS1_BITS+2); 2357 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12, CONST_BITS+PASS1_BITS+2); 2358 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp13, CONST_BITS+PASS1_BITS+2); 2359 2360 dataptr++; /* advance pointer to next column */ 2361 wsptr++; /* advance pointer to next column */ 2362 } 2363 } 2364 2365 2366 /* 2367 * Perform the forward DCT on a 16x8 sample block. 2368 * 2369 * 16-point FDCT in pass 1 (rows), 8-point in pass 2 (columns). 2370 */ 2371 2372 GLOBAL(void) 2373 jpeg_fdct_16x8 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2374 { 2375 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; 2376 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17; 2377 INT32 z1; 2378 DCTELEM *dataptr; 2379 JSAMPROW elemptr; 2380 int ctr; 2381 SHIFT_TEMPS 2382 2383 /* Pass 1: process rows. */ 2384 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 2385 /* furthermore, we scale the results by 2**PASS1_BITS. */ 2386 /* 16-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/32). */ 2387 2388 dataptr = data; 2389 ctr = 0; 2390 for (ctr = 0; ctr < DCTSIZE; ctr++) { 2391 elemptr = sample_data[ctr] + start_col; 2392 2393 /* Even part */ 2394 2395 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[15]); 2396 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[14]); 2397 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[13]); 2398 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[12]); 2399 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[11]); 2400 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[10]); 2401 tmp6 = GETJSAMPLE(elemptr[6]) + GETJSAMPLE(elemptr[9]); 2402 tmp7 = GETJSAMPLE(elemptr[7]) + GETJSAMPLE(elemptr[8]); 2403 2404 tmp10 = tmp0 + tmp7; 2405 tmp14 = tmp0 - tmp7; 2406 tmp11 = tmp1 + tmp6; 2407 tmp15 = tmp1 - tmp6; 2408 tmp12 = tmp2 + tmp5; 2409 tmp16 = tmp2 - tmp5; 2410 tmp13 = tmp3 + tmp4; 2411 tmp17 = tmp3 - tmp4; 2412 2413 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[15]); 2414 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[14]); 2415 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[13]); 2416 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[12]); 2417 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[11]); 2418 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[10]); 2419 tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[9]); 2420 tmp7 = GETJSAMPLE(elemptr[7]) - GETJSAMPLE(elemptr[8]); 2421 2422 /* Apply unsigned->signed conversion */ 2423 dataptr[0] = (DCTELEM) 2424 ((tmp10 + tmp11 + tmp12 + tmp13 - 16 * CENTERJSAMPLE) << PASS1_BITS); 2425 dataptr[4] = (DCTELEM) 2426 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.306562965)) + /* c4[16] = c2[8] */ 2427 MULTIPLY(tmp11 - tmp12, FIX_0_541196100), /* c12[16] = c6[8] */ 2428 CONST_BITS-PASS1_BITS); 2429 2430 tmp10 = MULTIPLY(tmp17 - tmp15, FIX(0.275899379)) + /* c14[16] = c7[8] */ 2431 MULTIPLY(tmp14 - tmp16, FIX(1.387039845)); /* c2[16] = c1[8] */ 2432 2433 dataptr[2] = (DCTELEM) 2434 DESCALE(tmp10 + MULTIPLY(tmp15, FIX(1.451774982)) /* c6+c14 */ 2435 + MULTIPLY(tmp16, FIX(2.172734804)), /* c2+c10 */ 2436 CONST_BITS-PASS1_BITS); 2437 dataptr[6] = (DCTELEM) 2438 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(0.211164243)) /* c2-c6 */ 2439 - MULTIPLY(tmp17, FIX(1.061594338)), /* c10+c14 */ 2440 CONST_BITS-PASS1_BITS); 2441 2442 /* Odd part */ 2443 2444 tmp11 = MULTIPLY(tmp0 + tmp1, FIX(1.353318001)) + /* c3 */ 2445 MULTIPLY(tmp6 - tmp7, FIX(0.410524528)); /* c13 */ 2446 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.247225013)) + /* c5 */ 2447 MULTIPLY(tmp5 + tmp7, FIX(0.666655658)); /* c11 */ 2448 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(1.093201867)) + /* c7 */ 2449 MULTIPLY(tmp4 - tmp7, FIX(0.897167586)); /* c9 */ 2450 tmp14 = MULTIPLY(tmp1 + tmp2, FIX(0.138617169)) + /* c15 */ 2451 MULTIPLY(tmp6 - tmp5, FIX(1.407403738)); /* c1 */ 2452 tmp15 = MULTIPLY(tmp1 + tmp3, - FIX(0.666655658)) + /* -c11 */ 2453 MULTIPLY(tmp4 + tmp6, - FIX(1.247225013)); /* -c5 */ 2454 tmp16 = MULTIPLY(tmp2 + tmp3, - FIX(1.353318001)) + /* -c3 */ 2455 MULTIPLY(tmp5 - tmp4, FIX(0.410524528)); /* c13 */ 2456 tmp10 = tmp11 + tmp12 + tmp13 - 2457 MULTIPLY(tmp0, FIX(2.286341144)) + /* c7+c5+c3-c1 */ 2458 MULTIPLY(tmp7, FIX(0.779653625)); /* c15+c13-c11+c9 */ 2459 tmp11 += tmp14 + tmp15 + MULTIPLY(tmp1, FIX(0.071888074)) /* c9-c3-c15+c11 */ 2460 - MULTIPLY(tmp6, FIX(1.663905119)); /* c7+c13+c1-c5 */ 2461 tmp12 += tmp14 + tmp16 - MULTIPLY(tmp2, FIX(1.125726048)) /* c7+c5+c15-c3 */ 2462 + MULTIPLY(tmp5, FIX(1.227391138)); /* c9-c11+c1-c13 */ 2463 tmp13 += tmp15 + tmp16 + MULTIPLY(tmp3, FIX(1.065388962)) /* c15+c3+c11-c7 */ 2464 + MULTIPLY(tmp4, FIX(2.167985692)); /* c1+c13+c5-c9 */ 2465 2466 dataptr[1] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS); 2467 dataptr[3] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS); 2468 dataptr[5] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS); 2469 dataptr[7] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS); 2470 2471 dataptr += DCTSIZE; /* advance pointer to next row */ 2472 } 2473 2474 /* Pass 2: process columns. 2475 * We remove the PASS1_BITS scaling, but leave the results scaled up 2476 * by an overall factor of 8. 2477 * We must also scale the output by 8/16 = 1/2. 2478 */ 2479 2480 dataptr = data; 2481 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2482 /* Even part per LL&M figure 1 --- note that published figure is faulty; 2483 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 2484 */ 2485 2486 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; 2487 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; 2488 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; 2489 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 2490 2491 tmp10 = tmp0 + tmp3; 2492 tmp12 = tmp0 - tmp3; 2493 tmp11 = tmp1 + tmp2; 2494 tmp13 = tmp1 - tmp2; 2495 2496 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; 2497 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; 2498 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; 2499 tmp3 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 2500 2501 dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS+1); 2502 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS+1); 2503 241 2504 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 242 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp1 3, FIX_0_765366865),243 CONST_BITS+PASS1_BITS );244 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),245 CONST_BITS+PASS1_BITS );246 2505 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, FIX_0_765366865), 2506 CONST_BITS+PASS1_BITS+1); 2507 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 - MULTIPLY(tmp13, FIX_1_847759065), 2508 CONST_BITS+PASS1_BITS+1); 2509 247 2510 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 248 * cK representscos(K*pi/16).249 * i0..i3 in the paper are tmp 4..tmp7here.2511 * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 2512 * i0..i3 in the paper are tmp0..tmp3 here. 250 2513 */ 251 252 z1 = tmp4 + tmp7;253 z2 = tmp5 + tmp6;254 z3 = tmp4 + tmp6;255 z4 = tmp5 + tmp7;256 z 5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) *c3 */257 258 tmp 4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7)*/259 tmp 5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7)*/260 tmp 6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7)*/261 tmp 7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7)*/262 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3)*/263 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3)*/264 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5)*/265 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3)*/266 267 z3 += z5;268 z4 += z5;269 270 dataptr[DCTSIZE* 7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,271 CONST_BITS+PASS1_BITS );272 dataptr[DCTSIZE* 5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,273 CONST_BITS+PASS1_BITS );274 dataptr[DCTSIZE* 3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,275 CONST_BITS+PASS1_BITS );276 dataptr[DCTSIZE* 1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,277 CONST_BITS+PASS1_BITS );278 2514 2515 tmp10 = tmp0 + tmp3; 2516 tmp11 = tmp1 + tmp2; 2517 tmp12 = tmp0 + tmp2; 2518 tmp13 = tmp1 + tmp3; 2519 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 2520 2521 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 2522 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 2523 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 2524 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 2525 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 2526 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 2527 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 2528 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 2529 2530 tmp12 += z1; 2531 tmp13 += z1; 2532 2533 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0 + tmp10 + tmp12, 2534 CONST_BITS+PASS1_BITS+1); 2535 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1 + tmp11 + tmp13, 2536 CONST_BITS+PASS1_BITS+1); 2537 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2 + tmp11 + tmp12, 2538 CONST_BITS+PASS1_BITS+1); 2539 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp3 + tmp10 + tmp13, 2540 CONST_BITS+PASS1_BITS+1); 2541 279 2542 dataptr++; /* advance pointer to next column */ 280 2543 } 281 2544 } 282 2545 2546 2547 /* 2548 * Perform the forward DCT on a 14x7 sample block. 2549 * 2550 * 14-point FDCT in pass 1 (rows), 7-point in pass 2 (columns). 2551 */ 2552 2553 GLOBAL(void) 2554 jpeg_fdct_14x7 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2555 { 2556 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; 2557 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 2558 INT32 z1, z2, z3; 2559 DCTELEM *dataptr; 2560 JSAMPROW elemptr; 2561 int ctr; 2562 SHIFT_TEMPS 2563 2564 /* Zero bottom row of output coefficient block. */ 2565 MEMZERO(&data[DCTSIZE*7], SIZEOF(DCTELEM) * DCTSIZE); 2566 2567 /* Pass 1: process rows. */ 2568 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 2569 /* furthermore, we scale the results by 2**PASS1_BITS. */ 2570 /* 14-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/28). */ 2571 2572 dataptr = data; 2573 for (ctr = 0; ctr < 7; ctr++) { 2574 elemptr = sample_data[ctr] + start_col; 2575 2576 /* Even part */ 2577 2578 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[13]); 2579 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[12]); 2580 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[11]); 2581 tmp13 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[10]); 2582 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[9]); 2583 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[8]); 2584 tmp6 = GETJSAMPLE(elemptr[6]) + GETJSAMPLE(elemptr[7]); 2585 2586 tmp10 = tmp0 + tmp6; 2587 tmp14 = tmp0 - tmp6; 2588 tmp11 = tmp1 + tmp5; 2589 tmp15 = tmp1 - tmp5; 2590 tmp12 = tmp2 + tmp4; 2591 tmp16 = tmp2 - tmp4; 2592 2593 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[13]); 2594 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[12]); 2595 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[11]); 2596 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[10]); 2597 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[9]); 2598 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[8]); 2599 tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[7]); 2600 2601 /* Apply unsigned->signed conversion */ 2602 dataptr[0] = (DCTELEM) 2603 ((tmp10 + tmp11 + tmp12 + tmp13 - 14 * CENTERJSAMPLE) << PASS1_BITS); 2604 tmp13 += tmp13; 2605 dataptr[4] = (DCTELEM) 2606 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.274162392)) + /* c4 */ 2607 MULTIPLY(tmp11 - tmp13, FIX(0.314692123)) - /* c12 */ 2608 MULTIPLY(tmp12 - tmp13, FIX(0.881747734)), /* c8 */ 2609 CONST_BITS-PASS1_BITS); 2610 2611 tmp10 = MULTIPLY(tmp14 + tmp15, FIX(1.105676686)); /* c6 */ 2612 2613 dataptr[2] = (DCTELEM) 2614 DESCALE(tmp10 + MULTIPLY(tmp14, FIX(0.273079590)) /* c2-c6 */ 2615 + MULTIPLY(tmp16, FIX(0.613604268)), /* c10 */ 2616 CONST_BITS-PASS1_BITS); 2617 dataptr[6] = (DCTELEM) 2618 DESCALE(tmp10 - MULTIPLY(tmp15, FIX(1.719280954)) /* c6+c10 */ 2619 - MULTIPLY(tmp16, FIX(1.378756276)), /* c2 */ 2620 CONST_BITS-PASS1_BITS); 2621 2622 /* Odd part */ 2623 2624 tmp10 = tmp1 + tmp2; 2625 tmp11 = tmp5 - tmp4; 2626 dataptr[7] = (DCTELEM) ((tmp0 - tmp10 + tmp3 - tmp11 - tmp6) << PASS1_BITS); 2627 tmp3 <<= CONST_BITS; 2628 tmp10 = MULTIPLY(tmp10, - FIX(0.158341681)); /* -c13 */ 2629 tmp11 = MULTIPLY(tmp11, FIX(1.405321284)); /* c1 */ 2630 tmp10 += tmp11 - tmp3; 2631 tmp11 = MULTIPLY(tmp0 + tmp2, FIX(1.197448846)) + /* c5 */ 2632 MULTIPLY(tmp4 + tmp6, FIX(0.752406978)); /* c9 */ 2633 dataptr[5] = (DCTELEM) 2634 DESCALE(tmp10 + tmp11 - MULTIPLY(tmp2, FIX(2.373959773)) /* c3+c5-c13 */ 2635 + MULTIPLY(tmp4, FIX(1.119999435)), /* c1+c11-c9 */ 2636 CONST_BITS-PASS1_BITS); 2637 tmp12 = MULTIPLY(tmp0 + tmp1, FIX(1.334852607)) + /* c3 */ 2638 MULTIPLY(tmp5 - tmp6, FIX(0.467085129)); /* c11 */ 2639 dataptr[3] = (DCTELEM) 2640 DESCALE(tmp10 + tmp12 - MULTIPLY(tmp1, FIX(0.424103948)) /* c3-c9-c13 */ 2641 - MULTIPLY(tmp5, FIX(3.069855259)), /* c1+c5+c11 */ 2642 CONST_BITS-PASS1_BITS); 2643 dataptr[1] = (DCTELEM) 2644 DESCALE(tmp11 + tmp12 + tmp3 + tmp6 - 2645 MULTIPLY(tmp0 + tmp6, FIX(1.126980169)), /* c3+c5-c1 */ 2646 CONST_BITS-PASS1_BITS); 2647 2648 dataptr += DCTSIZE; /* advance pointer to next row */ 2649 } 2650 2651 /* Pass 2: process columns. 2652 * We remove the PASS1_BITS scaling, but leave the results scaled up 2653 * by an overall factor of 8. 2654 * We must also scale the output by (8/14)*(8/7) = 32/49, which we 2655 * partially fold into the constant multipliers and final shifting: 2656 * 7-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/14) * 64/49. 2657 */ 2658 2659 dataptr = data; 2660 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2661 /* Even part */ 2662 2663 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*6]; 2664 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*5]; 2665 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*4]; 2666 tmp3 = dataptr[DCTSIZE*3]; 2667 2668 tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*6]; 2669 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*5]; 2670 tmp12 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*4]; 2671 2672 z1 = tmp0 + tmp2; 2673 dataptr[DCTSIZE*0] = (DCTELEM) 2674 DESCALE(MULTIPLY(z1 + tmp1 + tmp3, FIX(1.306122449)), /* 64/49 */ 2675 CONST_BITS+PASS1_BITS+1); 2676 tmp3 += tmp3; 2677 z1 -= tmp3; 2678 z1 -= tmp3; 2679 z1 = MULTIPLY(z1, FIX(0.461784020)); /* (c2+c6-c4)/2 */ 2680 z2 = MULTIPLY(tmp0 - tmp2, FIX(1.202428084)); /* (c2+c4-c6)/2 */ 2681 z3 = MULTIPLY(tmp1 - tmp2, FIX(0.411026446)); /* c6 */ 2682 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + z2 + z3, CONST_BITS+PASS1_BITS+1); 2683 z1 -= z2; 2684 z2 = MULTIPLY(tmp0 - tmp1, FIX(1.151670509)); /* c4 */ 2685 dataptr[DCTSIZE*4] = (DCTELEM) 2686 DESCALE(z2 + z3 - MULTIPLY(tmp1 - tmp3, FIX(0.923568041)), /* c2+c6-c4 */ 2687 CONST_BITS+PASS1_BITS+1); 2688 dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS+PASS1_BITS+1); 2689 2690 /* Odd part */ 2691 2692 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(1.221765677)); /* (c3+c1-c5)/2 */ 2693 tmp2 = MULTIPLY(tmp10 - tmp11, FIX(0.222383464)); /* (c3+c5-c1)/2 */ 2694 tmp0 = tmp1 - tmp2; 2695 tmp1 += tmp2; 2696 tmp2 = MULTIPLY(tmp11 + tmp12, - FIX(1.800824523)); /* -c1 */ 2697 tmp1 += tmp2; 2698 tmp3 = MULTIPLY(tmp10 + tmp12, FIX(0.801442310)); /* c5 */ 2699 tmp0 += tmp3; 2700 tmp2 += tmp3 + MULTIPLY(tmp12, FIX(2.443531355)); /* c3+c1-c5 */ 2701 2702 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp0, CONST_BITS+PASS1_BITS+1); 2703 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp1, CONST_BITS+PASS1_BITS+1); 2704 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp2, CONST_BITS+PASS1_BITS+1); 2705 2706 dataptr++; /* advance pointer to next column */ 2707 } 2708 } 2709 2710 2711 /* 2712 * Perform the forward DCT on a 12x6 sample block. 2713 * 2714 * 12-point FDCT in pass 1 (rows), 6-point in pass 2 (columns). 2715 */ 2716 2717 GLOBAL(void) 2718 jpeg_fdct_12x6 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2719 { 2720 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; 2721 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 2722 DCTELEM *dataptr; 2723 JSAMPROW elemptr; 2724 int ctr; 2725 SHIFT_TEMPS 2726 2727 /* Zero 2 bottom rows of output coefficient block. */ 2728 MEMZERO(&data[DCTSIZE*6], SIZEOF(DCTELEM) * DCTSIZE * 2); 2729 2730 /* Pass 1: process rows. */ 2731 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 2732 /* furthermore, we scale the results by 2**PASS1_BITS. */ 2733 /* 12-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/24). */ 2734 2735 dataptr = data; 2736 for (ctr = 0; ctr < 6; ctr++) { 2737 elemptr = sample_data[ctr] + start_col; 2738 2739 /* Even part */ 2740 2741 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[11]); 2742 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[10]); 2743 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[9]); 2744 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[8]); 2745 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[7]); 2746 tmp5 = GETJSAMPLE(elemptr[5]) + GETJSAMPLE(elemptr[6]); 2747 2748 tmp10 = tmp0 + tmp5; 2749 tmp13 = tmp0 - tmp5; 2750 tmp11 = tmp1 + tmp4; 2751 tmp14 = tmp1 - tmp4; 2752 tmp12 = tmp2 + tmp3; 2753 tmp15 = tmp2 - tmp3; 2754 2755 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[11]); 2756 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[10]); 2757 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[9]); 2758 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[8]); 2759 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[7]); 2760 tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[6]); 2761 2762 /* Apply unsigned->signed conversion */ 2763 dataptr[0] = (DCTELEM) 2764 ((tmp10 + tmp11 + tmp12 - 12 * CENTERJSAMPLE) << PASS1_BITS); 2765 dataptr[6] = (DCTELEM) ((tmp13 - tmp14 - tmp15) << PASS1_BITS); 2766 dataptr[4] = (DCTELEM) 2767 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.224744871)), /* c4 */ 2768 CONST_BITS-PASS1_BITS); 2769 dataptr[2] = (DCTELEM) 2770 DESCALE(tmp14 - tmp15 + MULTIPLY(tmp13 + tmp15, FIX(1.366025404)), /* c2 */ 2771 CONST_BITS-PASS1_BITS); 2772 2773 /* Odd part */ 2774 2775 tmp10 = MULTIPLY(tmp1 + tmp4, FIX_0_541196100); /* c9 */ 2776 tmp14 = tmp10 + MULTIPLY(tmp1, FIX_0_765366865); /* c3-c9 */ 2777 tmp15 = tmp10 - MULTIPLY(tmp4, FIX_1_847759065); /* c3+c9 */ 2778 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.121971054)); /* c5 */ 2779 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(0.860918669)); /* c7 */ 2780 tmp10 = tmp12 + tmp13 + tmp14 - MULTIPLY(tmp0, FIX(0.580774953)) /* c5+c7-c1 */ 2781 + MULTIPLY(tmp5, FIX(0.184591911)); /* c11 */ 2782 tmp11 = MULTIPLY(tmp2 + tmp3, - FIX(0.184591911)); /* -c11 */ 2783 tmp12 += tmp11 - tmp15 - MULTIPLY(tmp2, FIX(2.339493912)) /* c1+c5-c11 */ 2784 + MULTIPLY(tmp5, FIX(0.860918669)); /* c7 */ 2785 tmp13 += tmp11 - tmp14 + MULTIPLY(tmp3, FIX(0.725788011)) /* c1+c11-c7 */ 2786 - MULTIPLY(tmp5, FIX(1.121971054)); /* c5 */ 2787 tmp11 = tmp15 + MULTIPLY(tmp0 - tmp3, FIX(1.306562965)) /* c3 */ 2788 - MULTIPLY(tmp2 + tmp5, FIX_0_541196100); /* c9 */ 2789 2790 dataptr[1] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS); 2791 dataptr[3] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS); 2792 dataptr[5] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS); 2793 dataptr[7] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS); 2794 2795 dataptr += DCTSIZE; /* advance pointer to next row */ 2796 } 2797 2798 /* Pass 2: process columns. 2799 * We remove the PASS1_BITS scaling, but leave the results scaled up 2800 * by an overall factor of 8. 2801 * We must also scale the output by (8/12)*(8/6) = 8/9, which we 2802 * partially fold into the constant multipliers and final shifting: 2803 * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12) * 16/9. 2804 */ 2805 2806 dataptr = data; 2807 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2808 /* Even part */ 2809 2810 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*5]; 2811 tmp11 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*4]; 2812 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*3]; 2813 2814 tmp10 = tmp0 + tmp2; 2815 tmp12 = tmp0 - tmp2; 2816 2817 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*5]; 2818 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*4]; 2819 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*3]; 2820 2821 dataptr[DCTSIZE*0] = (DCTELEM) 2822 DESCALE(MULTIPLY(tmp10 + tmp11, FIX(1.777777778)), /* 16/9 */ 2823 CONST_BITS+PASS1_BITS+1); 2824 dataptr[DCTSIZE*2] = (DCTELEM) 2825 DESCALE(MULTIPLY(tmp12, FIX(2.177324216)), /* c2 */ 2826 CONST_BITS+PASS1_BITS+1); 2827 dataptr[DCTSIZE*4] = (DCTELEM) 2828 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(1.257078722)), /* c4 */ 2829 CONST_BITS+PASS1_BITS+1); 2830 2831 /* Odd part */ 2832 2833 tmp10 = MULTIPLY(tmp0 + tmp2, FIX(0.650711829)); /* c5 */ 2834 2835 dataptr[DCTSIZE*1] = (DCTELEM) 2836 DESCALE(tmp10 + MULTIPLY(tmp0 + tmp1, FIX(1.777777778)), /* 16/9 */ 2837 CONST_BITS+PASS1_BITS+1); 2838 dataptr[DCTSIZE*3] = (DCTELEM) 2839 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp2, FIX(1.777777778)), /* 16/9 */ 2840 CONST_BITS+PASS1_BITS+1); 2841 dataptr[DCTSIZE*5] = (DCTELEM) 2842 DESCALE(tmp10 + MULTIPLY(tmp2 - tmp1, FIX(1.777777778)), /* 16/9 */ 2843 CONST_BITS+PASS1_BITS+1); 2844 2845 dataptr++; /* advance pointer to next column */ 2846 } 2847 } 2848 2849 2850 /* 2851 * Perform the forward DCT on a 10x5 sample block. 2852 * 2853 * 10-point FDCT in pass 1 (rows), 5-point in pass 2 (columns). 2854 */ 2855 2856 GLOBAL(void) 2857 jpeg_fdct_10x5 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2858 { 2859 INT32 tmp0, tmp1, tmp2, tmp3, tmp4; 2860 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 2861 DCTELEM *dataptr; 2862 JSAMPROW elemptr; 2863 int ctr; 2864 SHIFT_TEMPS 2865 2866 /* Zero 3 bottom rows of output coefficient block. */ 2867 MEMZERO(&data[DCTSIZE*5], SIZEOF(DCTELEM) * DCTSIZE * 3); 2868 2869 /* Pass 1: process rows. */ 2870 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 2871 /* furthermore, we scale the results by 2**PASS1_BITS. */ 2872 /* 10-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/20). */ 2873 2874 dataptr = data; 2875 for (ctr = 0; ctr < 5; ctr++) { 2876 elemptr = sample_data[ctr] + start_col; 2877 2878 /* Even part */ 2879 2880 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[9]); 2881 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[8]); 2882 tmp12 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[7]); 2883 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[6]); 2884 tmp4 = GETJSAMPLE(elemptr[4]) + GETJSAMPLE(elemptr[5]); 2885 2886 tmp10 = tmp0 + tmp4; 2887 tmp13 = tmp0 - tmp4; 2888 tmp11 = tmp1 + tmp3; 2889 tmp14 = tmp1 - tmp3; 2890 2891 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[9]); 2892 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[8]); 2893 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[7]); 2894 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[6]); 2895 tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[5]); 2896 2897 /* Apply unsigned->signed conversion */ 2898 dataptr[0] = (DCTELEM) 2899 ((tmp10 + tmp11 + tmp12 - 10 * CENTERJSAMPLE) << PASS1_BITS); 2900 tmp12 += tmp12; 2901 dataptr[4] = (DCTELEM) 2902 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.144122806)) - /* c4 */ 2903 MULTIPLY(tmp11 - tmp12, FIX(0.437016024)), /* c8 */ 2904 CONST_BITS-PASS1_BITS); 2905 tmp10 = MULTIPLY(tmp13 + tmp14, FIX(0.831253876)); /* c6 */ 2906 dataptr[2] = (DCTELEM) 2907 DESCALE(tmp10 + MULTIPLY(tmp13, FIX(0.513743148)), /* c2-c6 */ 2908 CONST_BITS-PASS1_BITS); 2909 dataptr[6] = (DCTELEM) 2910 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(2.176250899)), /* c2+c6 */ 2911 CONST_BITS-PASS1_BITS); 2912 2913 /* Odd part */ 2914 2915 tmp10 = tmp0 + tmp4; 2916 tmp11 = tmp1 - tmp3; 2917 dataptr[5] = (DCTELEM) ((tmp10 - tmp11 - tmp2) << PASS1_BITS); 2918 tmp2 <<= CONST_BITS; 2919 dataptr[1] = (DCTELEM) 2920 DESCALE(MULTIPLY(tmp0, FIX(1.396802247)) + /* c1 */ 2921 MULTIPLY(tmp1, FIX(1.260073511)) + tmp2 + /* c3 */ 2922 MULTIPLY(tmp3, FIX(0.642039522)) + /* c7 */ 2923 MULTIPLY(tmp4, FIX(0.221231742)), /* c9 */ 2924 CONST_BITS-PASS1_BITS); 2925 tmp12 = MULTIPLY(tmp0 - tmp4, FIX(0.951056516)) - /* (c3+c7)/2 */ 2926 MULTIPLY(tmp1 + tmp3, FIX(0.587785252)); /* (c1-c9)/2 */ 2927 tmp13 = MULTIPLY(tmp10 + tmp11, FIX(0.309016994)) + /* (c3-c7)/2 */ 2928 (tmp11 << (CONST_BITS - 1)) - tmp2; 2929 dataptr[3] = (DCTELEM) DESCALE(tmp12 + tmp13, CONST_BITS-PASS1_BITS); 2930 dataptr[7] = (DCTELEM) DESCALE(tmp12 - tmp13, CONST_BITS-PASS1_BITS); 2931 2932 dataptr += DCTSIZE; /* advance pointer to next row */ 2933 } 2934 2935 /* Pass 2: process columns. 2936 * We remove the PASS1_BITS scaling, but leave the results scaled up 2937 * by an overall factor of 8. 2938 * We must also scale the output by (8/10)*(8/5) = 32/25, which we 2939 * fold into the constant multipliers: 2940 * 5-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/10) * 32/25. 2941 */ 2942 2943 dataptr = data; 2944 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 2945 /* Even part */ 2946 2947 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*4]; 2948 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*3]; 2949 tmp2 = dataptr[DCTSIZE*2]; 2950 2951 tmp10 = tmp0 + tmp1; 2952 tmp11 = tmp0 - tmp1; 2953 2954 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*4]; 2955 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*3]; 2956 2957 dataptr[DCTSIZE*0] = (DCTELEM) 2958 DESCALE(MULTIPLY(tmp10 + tmp2, FIX(1.28)), /* 32/25 */ 2959 CONST_BITS+PASS1_BITS); 2960 tmp11 = MULTIPLY(tmp11, FIX(1.011928851)); /* (c2+c4)/2 */ 2961 tmp10 -= tmp2 << 2; 2962 tmp10 = MULTIPLY(tmp10, FIX(0.452548340)); /* (c2-c4)/2 */ 2963 dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp11 + tmp10, CONST_BITS+PASS1_BITS); 2964 dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp11 - tmp10, CONST_BITS+PASS1_BITS); 2965 2966 /* Odd part */ 2967 2968 tmp10 = MULTIPLY(tmp0 + tmp1, FIX(1.064004961)); /* c3 */ 2969 2970 dataptr[DCTSIZE*1] = (DCTELEM) 2971 DESCALE(tmp10 + MULTIPLY(tmp0, FIX(0.657591230)), /* c1-c3 */ 2972 CONST_BITS+PASS1_BITS); 2973 dataptr[DCTSIZE*3] = (DCTELEM) 2974 DESCALE(tmp10 - MULTIPLY(tmp1, FIX(2.785601151)), /* c1+c3 */ 2975 CONST_BITS+PASS1_BITS); 2976 2977 dataptr++; /* advance pointer to next column */ 2978 } 2979 } 2980 2981 2982 /* 2983 * Perform the forward DCT on an 8x4 sample block. 2984 * 2985 * 8-point FDCT in pass 1 (rows), 4-point in pass 2 (columns). 2986 */ 2987 2988 GLOBAL(void) 2989 jpeg_fdct_8x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 2990 { 2991 INT32 tmp0, tmp1, tmp2, tmp3; 2992 INT32 tmp10, tmp11, tmp12, tmp13; 2993 INT32 z1; 2994 DCTELEM *dataptr; 2995 JSAMPROW elemptr; 2996 int ctr; 2997 SHIFT_TEMPS 2998 2999 /* Zero 4 bottom rows of output coefficient block. */ 3000 MEMZERO(&data[DCTSIZE*4], SIZEOF(DCTELEM) * DCTSIZE * 4); 3001 3002 /* Pass 1: process rows. */ 3003 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3004 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3005 /* We must also scale the output by 8/4 = 2, which we add here. */ 3006 3007 dataptr = data; 3008 for (ctr = 0; ctr < 4; ctr++) { 3009 elemptr = sample_data[ctr] + start_col; 3010 3011 /* Even part per LL&M figure 1 --- note that published figure is faulty; 3012 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 3013 */ 3014 3015 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[7]); 3016 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[6]); 3017 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[5]); 3018 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[4]); 3019 3020 tmp10 = tmp0 + tmp3; 3021 tmp12 = tmp0 - tmp3; 3022 tmp11 = tmp1 + tmp2; 3023 tmp13 = tmp1 - tmp2; 3024 3025 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[7]); 3026 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[6]); 3027 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); 3028 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); 3029 3030 /* Apply unsigned->signed conversion */ 3031 dataptr[0] = (DCTELEM) 3032 ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << (PASS1_BITS+1)); 3033 dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << (PASS1_BITS+1)); 3034 3035 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 3036 /* Add fudge factor here for final descale. */ 3037 z1 += ONE << (CONST_BITS-PASS1_BITS-2); 3038 dataptr[2] = (DCTELEM) RIGHT_SHIFT(z1 + MULTIPLY(tmp12, FIX_0_765366865), 3039 CONST_BITS-PASS1_BITS-1); 3040 dataptr[6] = (DCTELEM) RIGHT_SHIFT(z1 - MULTIPLY(tmp13, FIX_1_847759065), 3041 CONST_BITS-PASS1_BITS-1); 3042 3043 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 3044 * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 3045 * i0..i3 in the paper are tmp0..tmp3 here. 3046 */ 3047 3048 tmp10 = tmp0 + tmp3; 3049 tmp11 = tmp1 + tmp2; 3050 tmp12 = tmp0 + tmp2; 3051 tmp13 = tmp1 + tmp3; 3052 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 3053 /* Add fudge factor here for final descale. */ 3054 z1 += ONE << (CONST_BITS-PASS1_BITS-2); 3055 3056 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 3057 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 3058 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 3059 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 3060 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 3061 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 3062 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 3063 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 3064 3065 tmp12 += z1; 3066 tmp13 += z1; 3067 3068 dataptr[1] = (DCTELEM) 3069 RIGHT_SHIFT(tmp0 + tmp10 + tmp12, CONST_BITS-PASS1_BITS-1); 3070 dataptr[3] = (DCTELEM) 3071 RIGHT_SHIFT(tmp1 + tmp11 + tmp13, CONST_BITS-PASS1_BITS-1); 3072 dataptr[5] = (DCTELEM) 3073 RIGHT_SHIFT(tmp2 + tmp11 + tmp12, CONST_BITS-PASS1_BITS-1); 3074 dataptr[7] = (DCTELEM) 3075 RIGHT_SHIFT(tmp3 + tmp10 + tmp13, CONST_BITS-PASS1_BITS-1); 3076 3077 dataptr += DCTSIZE; /* advance pointer to next row */ 3078 } 3079 3080 /* Pass 2: process columns. 3081 * We remove the PASS1_BITS scaling, but leave the results scaled up 3082 * by an overall factor of 8. 3083 * 4-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 3084 */ 3085 3086 dataptr = data; 3087 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 3088 /* Even part */ 3089 3090 /* Add fudge factor here for final descale. */ 3091 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*3] + (ONE << (PASS1_BITS-1)); 3092 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*2]; 3093 3094 tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*3]; 3095 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*2]; 3096 3097 dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp0 + tmp1, PASS1_BITS); 3098 dataptr[DCTSIZE*2] = (DCTELEM) RIGHT_SHIFT(tmp0 - tmp1, PASS1_BITS); 3099 3100 /* Odd part */ 3101 3102 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 3103 /* Add fudge factor here for final descale. */ 3104 tmp0 += ONE << (CONST_BITS+PASS1_BITS-1); 3105 3106 dataptr[DCTSIZE*1] = (DCTELEM) 3107 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 3108 CONST_BITS+PASS1_BITS); 3109 dataptr[DCTSIZE*3] = (DCTELEM) 3110 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 3111 CONST_BITS+PASS1_BITS); 3112 3113 dataptr++; /* advance pointer to next column */ 3114 } 3115 } 3116 3117 3118 /* 3119 * Perform the forward DCT on a 6x3 sample block. 3120 * 3121 * 6-point FDCT in pass 1 (rows), 3-point in pass 2 (columns). 3122 */ 3123 3124 GLOBAL(void) 3125 jpeg_fdct_6x3 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3126 { 3127 INT32 tmp0, tmp1, tmp2; 3128 INT32 tmp10, tmp11, tmp12; 3129 DCTELEM *dataptr; 3130 JSAMPROW elemptr; 3131 int ctr; 3132 SHIFT_TEMPS 3133 3134 /* Pre-zero output coefficient block. */ 3135 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3136 3137 /* Pass 1: process rows. */ 3138 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3139 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3140 /* We scale the results further by 2 as part of output adaption */ 3141 /* scaling for different DCT size. */ 3142 /* 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ 3143 3144 dataptr = data; 3145 for (ctr = 0; ctr < 3; ctr++) { 3146 elemptr = sample_data[ctr] + start_col; 3147 3148 /* Even part */ 3149 3150 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[5]); 3151 tmp11 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[4]); 3152 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[3]); 3153 3154 tmp10 = tmp0 + tmp2; 3155 tmp12 = tmp0 - tmp2; 3156 3157 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[5]); 3158 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); 3159 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); 3160 3161 /* Apply unsigned->signed conversion */ 3162 dataptr[0] = (DCTELEM) 3163 ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << (PASS1_BITS+1)); 3164 dataptr[2] = (DCTELEM) 3165 DESCALE(MULTIPLY(tmp12, FIX(1.224744871)), /* c2 */ 3166 CONST_BITS-PASS1_BITS-1); 3167 dataptr[4] = (DCTELEM) 3168 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(0.707106781)), /* c4 */ 3169 CONST_BITS-PASS1_BITS-1); 3170 3171 /* Odd part */ 3172 3173 tmp10 = DESCALE(MULTIPLY(tmp0 + tmp2, FIX(0.366025404)), /* c5 */ 3174 CONST_BITS-PASS1_BITS-1); 3175 3176 dataptr[1] = (DCTELEM) (tmp10 + ((tmp0 + tmp1) << (PASS1_BITS+1))); 3177 dataptr[3] = (DCTELEM) ((tmp0 - tmp1 - tmp2) << (PASS1_BITS+1)); 3178 dataptr[5] = (DCTELEM) (tmp10 + ((tmp2 - tmp1) << (PASS1_BITS+1))); 3179 3180 dataptr += DCTSIZE; /* advance pointer to next row */ 3181 } 3182 3183 /* Pass 2: process columns. 3184 * We remove the PASS1_BITS scaling, but leave the results scaled up 3185 * by an overall factor of 8. 3186 * We must also scale the output by (8/6)*(8/3) = 32/9, which we partially 3187 * fold into the constant multipliers (other part was done in pass 1): 3188 * 3-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/6) * 16/9. 3189 */ 3190 3191 dataptr = data; 3192 for (ctr = 0; ctr < 6; ctr++) { 3193 /* Even part */ 3194 3195 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*2]; 3196 tmp1 = dataptr[DCTSIZE*1]; 3197 3198 tmp2 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*2]; 3199 3200 dataptr[DCTSIZE*0] = (DCTELEM) 3201 DESCALE(MULTIPLY(tmp0 + tmp1, FIX(1.777777778)), /* 16/9 */ 3202 CONST_BITS+PASS1_BITS); 3203 dataptr[DCTSIZE*2] = (DCTELEM) 3204 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp1, FIX(1.257078722)), /* c2 */ 3205 CONST_BITS+PASS1_BITS); 3206 3207 /* Odd part */ 3208 3209 dataptr[DCTSIZE*1] = (DCTELEM) 3210 DESCALE(MULTIPLY(tmp2, FIX(2.177324216)), /* c1 */ 3211 CONST_BITS+PASS1_BITS); 3212 3213 dataptr++; /* advance pointer to next column */ 3214 } 3215 } 3216 3217 3218 /* 3219 * Perform the forward DCT on a 4x2 sample block. 3220 * 3221 * 4-point FDCT in pass 1 (rows), 2-point in pass 2 (columns). 3222 */ 3223 3224 GLOBAL(void) 3225 jpeg_fdct_4x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3226 { 3227 INT32 tmp0, tmp1; 3228 INT32 tmp10, tmp11; 3229 DCTELEM *dataptr; 3230 JSAMPROW elemptr; 3231 int ctr; 3232 SHIFT_TEMPS 3233 3234 /* Pre-zero output coefficient block. */ 3235 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3236 3237 /* Pass 1: process rows. */ 3238 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3239 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3240 /* We must also scale the output by (8/4)*(8/2) = 2**3, which we add here. */ 3241 /* 4-point FDCT kernel, */ 3242 /* cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. */ 3243 3244 dataptr = data; 3245 for (ctr = 0; ctr < 2; ctr++) { 3246 elemptr = sample_data[ctr] + start_col; 3247 3248 /* Even part */ 3249 3250 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]); 3251 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]); 3252 3253 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); 3254 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); 3255 3256 /* Apply unsigned->signed conversion */ 3257 dataptr[0] = (DCTELEM) 3258 ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+3)); 3259 dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+3)); 3260 3261 /* Odd part */ 3262 3263 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 3264 /* Add fudge factor here for final descale. */ 3265 tmp0 += ONE << (CONST_BITS-PASS1_BITS-4); 3266 3267 dataptr[1] = (DCTELEM) 3268 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 3269 CONST_BITS-PASS1_BITS-3); 3270 dataptr[3] = (DCTELEM) 3271 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 3272 CONST_BITS-PASS1_BITS-3); 3273 3274 dataptr += DCTSIZE; /* advance pointer to next row */ 3275 } 3276 3277 /* Pass 2: process columns. 3278 * We remove the PASS1_BITS scaling, but leave the results scaled up 3279 * by an overall factor of 8. 3280 */ 3281 3282 dataptr = data; 3283 for (ctr = 0; ctr < 4; ctr++) { 3284 /* Even part */ 3285 3286 /* Add fudge factor here for final descale. */ 3287 tmp0 = dataptr[DCTSIZE*0] + (ONE << (PASS1_BITS-1)); 3288 tmp1 = dataptr[DCTSIZE*1]; 3289 3290 dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp0 + tmp1, PASS1_BITS); 3291 3292 /* Odd part */ 3293 3294 dataptr[DCTSIZE*1] = (DCTELEM) RIGHT_SHIFT(tmp0 - tmp1, PASS1_BITS); 3295 3296 dataptr++; /* advance pointer to next column */ 3297 } 3298 } 3299 3300 3301 /* 3302 * Perform the forward DCT on a 2x1 sample block. 3303 * 3304 * 2-point FDCT in pass 1 (rows), 1-point in pass 2 (columns). 3305 */ 3306 3307 GLOBAL(void) 3308 jpeg_fdct_2x1 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3309 { 3310 INT32 tmp0, tmp1; 3311 JSAMPROW elemptr; 3312 3313 /* Pre-zero output coefficient block. */ 3314 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3315 3316 elemptr = sample_data[0] + start_col; 3317 3318 tmp0 = GETJSAMPLE(elemptr[0]); 3319 tmp1 = GETJSAMPLE(elemptr[1]); 3320 3321 /* We leave the results scaled up by an overall factor of 8. 3322 * We must also scale the output by (8/2)*(8/1) = 2**5. 3323 */ 3324 3325 /* Even part */ 3326 /* Apply unsigned->signed conversion */ 3327 data[0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5); 3328 3329 /* Odd part */ 3330 data[1] = (DCTELEM) ((tmp0 - tmp1) << 5); 3331 } 3332 3333 3334 /* 3335 * Perform the forward DCT on an 8x16 sample block. 3336 * 3337 * 8-point FDCT in pass 1 (rows), 16-point in pass 2 (columns). 3338 */ 3339 3340 GLOBAL(void) 3341 jpeg_fdct_8x16 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3342 { 3343 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; 3344 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17; 3345 INT32 z1; 3346 DCTELEM workspace[DCTSIZE2]; 3347 DCTELEM *dataptr; 3348 DCTELEM *wsptr; 3349 JSAMPROW elemptr; 3350 int ctr; 3351 SHIFT_TEMPS 3352 3353 /* Pass 1: process rows. */ 3354 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3355 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3356 3357 dataptr = data; 3358 ctr = 0; 3359 for (;;) { 3360 elemptr = sample_data[ctr] + start_col; 3361 3362 /* Even part per LL&M figure 1 --- note that published figure is faulty; 3363 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 3364 */ 3365 3366 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[7]); 3367 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[6]); 3368 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[5]); 3369 tmp3 = GETJSAMPLE(elemptr[3]) + GETJSAMPLE(elemptr[4]); 3370 3371 tmp10 = tmp0 + tmp3; 3372 tmp12 = tmp0 - tmp3; 3373 tmp11 = tmp1 + tmp2; 3374 tmp13 = tmp1 - tmp2; 3375 3376 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[7]); 3377 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[6]); 3378 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); 3379 tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); 3380 3381 /* Apply unsigned->signed conversion */ 3382 dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << PASS1_BITS); 3383 dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); 3384 3385 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 3386 dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, FIX_0_765366865), 3387 CONST_BITS-PASS1_BITS); 3388 dataptr[6] = (DCTELEM) DESCALE(z1 - MULTIPLY(tmp13, FIX_1_847759065), 3389 CONST_BITS-PASS1_BITS); 3390 3391 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 3392 * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 3393 * i0..i3 in the paper are tmp0..tmp3 here. 3394 */ 3395 3396 tmp10 = tmp0 + tmp3; 3397 tmp11 = tmp1 + tmp2; 3398 tmp12 = tmp0 + tmp2; 3399 tmp13 = tmp1 + tmp3; 3400 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 3401 3402 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 3403 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 3404 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 3405 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 3406 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 3407 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 3408 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 3409 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 3410 3411 tmp12 += z1; 3412 tmp13 += z1; 3413 3414 dataptr[1] = (DCTELEM) DESCALE(tmp0 + tmp10 + tmp12, CONST_BITS-PASS1_BITS); 3415 dataptr[3] = (DCTELEM) DESCALE(tmp1 + tmp11 + tmp13, CONST_BITS-PASS1_BITS); 3416 dataptr[5] = (DCTELEM) DESCALE(tmp2 + tmp11 + tmp12, CONST_BITS-PASS1_BITS); 3417 dataptr[7] = (DCTELEM) DESCALE(tmp3 + tmp10 + tmp13, CONST_BITS-PASS1_BITS); 3418 3419 ctr++; 3420 3421 if (ctr != DCTSIZE) { 3422 if (ctr == DCTSIZE * 2) 3423 break; /* Done. */ 3424 dataptr += DCTSIZE; /* advance pointer to next row */ 3425 } else 3426 dataptr = workspace; /* switch pointer to extended workspace */ 3427 } 3428 3429 /* Pass 2: process columns. 3430 * We remove the PASS1_BITS scaling, but leave the results scaled up 3431 * by an overall factor of 8. 3432 * We must also scale the output by 8/16 = 1/2. 3433 * 16-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/32). 3434 */ 3435 3436 dataptr = data; 3437 wsptr = workspace; 3438 for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 3439 /* Even part */ 3440 3441 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*7]; 3442 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*6]; 3443 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*5]; 3444 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*4]; 3445 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*3]; 3446 tmp5 = dataptr[DCTSIZE*5] + wsptr[DCTSIZE*2]; 3447 tmp6 = dataptr[DCTSIZE*6] + wsptr[DCTSIZE*1]; 3448 tmp7 = dataptr[DCTSIZE*7] + wsptr[DCTSIZE*0]; 3449 3450 tmp10 = tmp0 + tmp7; 3451 tmp14 = tmp0 - tmp7; 3452 tmp11 = tmp1 + tmp6; 3453 tmp15 = tmp1 - tmp6; 3454 tmp12 = tmp2 + tmp5; 3455 tmp16 = tmp2 - tmp5; 3456 tmp13 = tmp3 + tmp4; 3457 tmp17 = tmp3 - tmp4; 3458 3459 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*7]; 3460 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*6]; 3461 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*5]; 3462 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*4]; 3463 tmp4 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*3]; 3464 tmp5 = dataptr[DCTSIZE*5] - wsptr[DCTSIZE*2]; 3465 tmp6 = dataptr[DCTSIZE*6] - wsptr[DCTSIZE*1]; 3466 tmp7 = dataptr[DCTSIZE*7] - wsptr[DCTSIZE*0]; 3467 3468 dataptr[DCTSIZE*0] = (DCTELEM) 3469 DESCALE(tmp10 + tmp11 + tmp12 + tmp13, PASS1_BITS+1); 3470 dataptr[DCTSIZE*4] = (DCTELEM) 3471 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(1.306562965)) + /* c4[16] = c2[8] */ 3472 MULTIPLY(tmp11 - tmp12, FIX_0_541196100), /* c12[16] = c6[8] */ 3473 CONST_BITS+PASS1_BITS+1); 3474 3475 tmp10 = MULTIPLY(tmp17 - tmp15, FIX(0.275899379)) + /* c14[16] = c7[8] */ 3476 MULTIPLY(tmp14 - tmp16, FIX(1.387039845)); /* c2[16] = c1[8] */ 3477 3478 dataptr[DCTSIZE*2] = (DCTELEM) 3479 DESCALE(tmp10 + MULTIPLY(tmp15, FIX(1.451774982)) /* c6+c14 */ 3480 + MULTIPLY(tmp16, FIX(2.172734804)), /* c2+c10 */ 3481 CONST_BITS+PASS1_BITS+1); 3482 dataptr[DCTSIZE*6] = (DCTELEM) 3483 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(0.211164243)) /* c2-c6 */ 3484 - MULTIPLY(tmp17, FIX(1.061594338)), /* c10+c14 */ 3485 CONST_BITS+PASS1_BITS+1); 3486 3487 /* Odd part */ 3488 3489 tmp11 = MULTIPLY(tmp0 + tmp1, FIX(1.353318001)) + /* c3 */ 3490 MULTIPLY(tmp6 - tmp7, FIX(0.410524528)); /* c13 */ 3491 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(1.247225013)) + /* c5 */ 3492 MULTIPLY(tmp5 + tmp7, FIX(0.666655658)); /* c11 */ 3493 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(1.093201867)) + /* c7 */ 3494 MULTIPLY(tmp4 - tmp7, FIX(0.897167586)); /* c9 */ 3495 tmp14 = MULTIPLY(tmp1 + tmp2, FIX(0.138617169)) + /* c15 */ 3496 MULTIPLY(tmp6 - tmp5, FIX(1.407403738)); /* c1 */ 3497 tmp15 = MULTIPLY(tmp1 + tmp3, - FIX(0.666655658)) + /* -c11 */ 3498 MULTIPLY(tmp4 + tmp6, - FIX(1.247225013)); /* -c5 */ 3499 tmp16 = MULTIPLY(tmp2 + tmp3, - FIX(1.353318001)) + /* -c3 */ 3500 MULTIPLY(tmp5 - tmp4, FIX(0.410524528)); /* c13 */ 3501 tmp10 = tmp11 + tmp12 + tmp13 - 3502 MULTIPLY(tmp0, FIX(2.286341144)) + /* c7+c5+c3-c1 */ 3503 MULTIPLY(tmp7, FIX(0.779653625)); /* c15+c13-c11+c9 */ 3504 tmp11 += tmp14 + tmp15 + MULTIPLY(tmp1, FIX(0.071888074)) /* c9-c3-c15+c11 */ 3505 - MULTIPLY(tmp6, FIX(1.663905119)); /* c7+c13+c1-c5 */ 3506 tmp12 += tmp14 + tmp16 - MULTIPLY(tmp2, FIX(1.125726048)) /* c7+c5+c15-c3 */ 3507 + MULTIPLY(tmp5, FIX(1.227391138)); /* c9-c11+c1-c13 */ 3508 tmp13 += tmp15 + tmp16 + MULTIPLY(tmp3, FIX(1.065388962)) /* c15+c3+c11-c7 */ 3509 + MULTIPLY(tmp4, FIX(2.167985692)); /* c1+c13+c5-c9 */ 3510 3511 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp10, CONST_BITS+PASS1_BITS+1); 3512 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp11, CONST_BITS+PASS1_BITS+1); 3513 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12, CONST_BITS+PASS1_BITS+1); 3514 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp13, CONST_BITS+PASS1_BITS+1); 3515 3516 dataptr++; /* advance pointer to next column */ 3517 wsptr++; /* advance pointer to next column */ 3518 } 3519 } 3520 3521 3522 /* 3523 * Perform the forward DCT on a 7x14 sample block. 3524 * 3525 * 7-point FDCT in pass 1 (rows), 14-point in pass 2 (columns). 3526 */ 3527 3528 GLOBAL(void) 3529 jpeg_fdct_7x14 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3530 { 3531 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; 3532 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 3533 INT32 z1, z2, z3; 3534 DCTELEM workspace[8*6]; 3535 DCTELEM *dataptr; 3536 DCTELEM *wsptr; 3537 JSAMPROW elemptr; 3538 int ctr; 3539 SHIFT_TEMPS 3540 3541 /* Pre-zero output coefficient block. */ 3542 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3543 3544 /* Pass 1: process rows. */ 3545 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3546 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3547 /* 7-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/14). */ 3548 3549 dataptr = data; 3550 ctr = 0; 3551 for (;;) { 3552 elemptr = sample_data[ctr] + start_col; 3553 3554 /* Even part */ 3555 3556 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[6]); 3557 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[5]); 3558 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[4]); 3559 tmp3 = GETJSAMPLE(elemptr[3]); 3560 3561 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[6]); 3562 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[5]); 3563 tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[4]); 3564 3565 z1 = tmp0 + tmp2; 3566 /* Apply unsigned->signed conversion */ 3567 dataptr[0] = (DCTELEM) 3568 ((z1 + tmp1 + tmp3 - 7 * CENTERJSAMPLE) << PASS1_BITS); 3569 tmp3 += tmp3; 3570 z1 -= tmp3; 3571 z1 -= tmp3; 3572 z1 = MULTIPLY(z1, FIX(0.353553391)); /* (c2+c6-c4)/2 */ 3573 z2 = MULTIPLY(tmp0 - tmp2, FIX(0.920609002)); /* (c2+c4-c6)/2 */ 3574 z3 = MULTIPLY(tmp1 - tmp2, FIX(0.314692123)); /* c6 */ 3575 dataptr[2] = (DCTELEM) DESCALE(z1 + z2 + z3, CONST_BITS-PASS1_BITS); 3576 z1 -= z2; 3577 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.881747734)); /* c4 */ 3578 dataptr[4] = (DCTELEM) 3579 DESCALE(z2 + z3 - MULTIPLY(tmp1 - tmp3, FIX(0.707106781)), /* c2+c6-c4 */ 3580 CONST_BITS-PASS1_BITS); 3581 dataptr[6] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS-PASS1_BITS); 3582 3583 /* Odd part */ 3584 3585 tmp1 = MULTIPLY(tmp10 + tmp11, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 3586 tmp2 = MULTIPLY(tmp10 - tmp11, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 3587 tmp0 = tmp1 - tmp2; 3588 tmp1 += tmp2; 3589 tmp2 = MULTIPLY(tmp11 + tmp12, - FIX(1.378756276)); /* -c1 */ 3590 tmp1 += tmp2; 3591 tmp3 = MULTIPLY(tmp10 + tmp12, FIX(0.613604268)); /* c5 */ 3592 tmp0 += tmp3; 3593 tmp2 += tmp3 + MULTIPLY(tmp12, FIX(1.870828693)); /* c3+c1-c5 */ 3594 3595 dataptr[1] = (DCTELEM) DESCALE(tmp0, CONST_BITS-PASS1_BITS); 3596 dataptr[3] = (DCTELEM) DESCALE(tmp1, CONST_BITS-PASS1_BITS); 3597 dataptr[5] = (DCTELEM) DESCALE(tmp2, CONST_BITS-PASS1_BITS); 3598 3599 ctr++; 3600 3601 if (ctr != DCTSIZE) { 3602 if (ctr == 14) 3603 break; /* Done. */ 3604 dataptr += DCTSIZE; /* advance pointer to next row */ 3605 } else 3606 dataptr = workspace; /* switch pointer to extended workspace */ 3607 } 3608 3609 /* Pass 2: process columns. 3610 * We remove the PASS1_BITS scaling, but leave the results scaled up 3611 * by an overall factor of 8. 3612 * We must also scale the output by (8/7)*(8/14) = 32/49, which we 3613 * fold into the constant multipliers: 3614 * 14-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/28) * 32/49. 3615 */ 3616 3617 dataptr = data; 3618 wsptr = workspace; 3619 for (ctr = 0; ctr < 7; ctr++) { 3620 /* Even part */ 3621 3622 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*5]; 3623 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*4]; 3624 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*3]; 3625 tmp13 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*2]; 3626 tmp4 = dataptr[DCTSIZE*4] + wsptr[DCTSIZE*1]; 3627 tmp5 = dataptr[DCTSIZE*5] + wsptr[DCTSIZE*0]; 3628 tmp6 = dataptr[DCTSIZE*6] + dataptr[DCTSIZE*7]; 3629 3630 tmp10 = tmp0 + tmp6; 3631 tmp14 = tmp0 - tmp6; 3632 tmp11 = tmp1 + tmp5; 3633 tmp15 = tmp1 - tmp5; 3634 tmp12 = tmp2 + tmp4; 3635 tmp16 = tmp2 - tmp4; 3636 3637 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*5]; 3638 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*4]; 3639 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*3]; 3640 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*2]; 3641 tmp4 = dataptr[DCTSIZE*4] - wsptr[DCTSIZE*1]; 3642 tmp5 = dataptr[DCTSIZE*5] - wsptr[DCTSIZE*0]; 3643 tmp6 = dataptr[DCTSIZE*6] - dataptr[DCTSIZE*7]; 3644 3645 dataptr[DCTSIZE*0] = (DCTELEM) 3646 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12 + tmp13, 3647 FIX(0.653061224)), /* 32/49 */ 3648 CONST_BITS+PASS1_BITS); 3649 tmp13 += tmp13; 3650 dataptr[DCTSIZE*4] = (DCTELEM) 3651 DESCALE(MULTIPLY(tmp10 - tmp13, FIX(0.832106052)) + /* c4 */ 3652 MULTIPLY(tmp11 - tmp13, FIX(0.205513223)) - /* c12 */ 3653 MULTIPLY(tmp12 - tmp13, FIX(0.575835255)), /* c8 */ 3654 CONST_BITS+PASS1_BITS); 3655 3656 tmp10 = MULTIPLY(tmp14 + tmp15, FIX(0.722074570)); /* c6 */ 3657 3658 dataptr[DCTSIZE*2] = (DCTELEM) 3659 DESCALE(tmp10 + MULTIPLY(tmp14, FIX(0.178337691)) /* c2-c6 */ 3660 + MULTIPLY(tmp16, FIX(0.400721155)), /* c10 */ 3661 CONST_BITS+PASS1_BITS); 3662 dataptr[DCTSIZE*6] = (DCTELEM) 3663 DESCALE(tmp10 - MULTIPLY(tmp15, FIX(1.122795725)) /* c6+c10 */ 3664 - MULTIPLY(tmp16, FIX(0.900412262)), /* c2 */ 3665 CONST_BITS+PASS1_BITS); 3666 3667 /* Odd part */ 3668 3669 tmp10 = tmp1 + tmp2; 3670 tmp11 = tmp5 - tmp4; 3671 dataptr[DCTSIZE*7] = (DCTELEM) 3672 DESCALE(MULTIPLY(tmp0 - tmp10 + tmp3 - tmp11 - tmp6, 3673 FIX(0.653061224)), /* 32/49 */ 3674 CONST_BITS+PASS1_BITS); 3675 tmp3 = MULTIPLY(tmp3 , FIX(0.653061224)); /* 32/49 */ 3676 tmp10 = MULTIPLY(tmp10, - FIX(0.103406812)); /* -c13 */ 3677 tmp11 = MULTIPLY(tmp11, FIX(0.917760839)); /* c1 */ 3678 tmp10 += tmp11 - tmp3; 3679 tmp11 = MULTIPLY(tmp0 + tmp2, FIX(0.782007410)) + /* c5 */ 3680 MULTIPLY(tmp4 + tmp6, FIX(0.491367823)); /* c9 */ 3681 dataptr[DCTSIZE*5] = (DCTELEM) 3682 DESCALE(tmp10 + tmp11 - MULTIPLY(tmp2, FIX(1.550341076)) /* c3+c5-c13 */ 3683 + MULTIPLY(tmp4, FIX(0.731428202)), /* c1+c11-c9 */ 3684 CONST_BITS+PASS1_BITS); 3685 tmp12 = MULTIPLY(tmp0 + tmp1, FIX(0.871740478)) + /* c3 */ 3686 MULTIPLY(tmp5 - tmp6, FIX(0.305035186)); /* c11 */ 3687 dataptr[DCTSIZE*3] = (DCTELEM) 3688 DESCALE(tmp10 + tmp12 - MULTIPLY(tmp1, FIX(0.276965844)) /* c3-c9-c13 */ 3689 - MULTIPLY(tmp5, FIX(2.004803435)), /* c1+c5+c11 */ 3690 CONST_BITS+PASS1_BITS); 3691 dataptr[DCTSIZE*1] = (DCTELEM) 3692 DESCALE(tmp11 + tmp12 + tmp3 3693 - MULTIPLY(tmp0, FIX(0.735987049)) /* c3+c5-c1 */ 3694 - MULTIPLY(tmp6, FIX(0.082925825)), /* c9-c11-c13 */ 3695 CONST_BITS+PASS1_BITS); 3696 3697 dataptr++; /* advance pointer to next column */ 3698 wsptr++; /* advance pointer to next column */ 3699 } 3700 } 3701 3702 3703 /* 3704 * Perform the forward DCT on a 6x12 sample block. 3705 * 3706 * 6-point FDCT in pass 1 (rows), 12-point in pass 2 (columns). 3707 */ 3708 3709 GLOBAL(void) 3710 jpeg_fdct_6x12 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3711 { 3712 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; 3713 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 3714 DCTELEM workspace[8*4]; 3715 DCTELEM *dataptr; 3716 DCTELEM *wsptr; 3717 JSAMPROW elemptr; 3718 int ctr; 3719 SHIFT_TEMPS 3720 3721 /* Pre-zero output coefficient block. */ 3722 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3723 3724 /* Pass 1: process rows. */ 3725 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3726 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3727 /* 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12). */ 3728 3729 dataptr = data; 3730 ctr = 0; 3731 for (;;) { 3732 elemptr = sample_data[ctr] + start_col; 3733 3734 /* Even part */ 3735 3736 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[5]); 3737 tmp11 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[4]); 3738 tmp2 = GETJSAMPLE(elemptr[2]) + GETJSAMPLE(elemptr[3]); 3739 3740 tmp10 = tmp0 + tmp2; 3741 tmp12 = tmp0 - tmp2; 3742 3743 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[5]); 3744 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); 3745 tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); 3746 3747 /* Apply unsigned->signed conversion */ 3748 dataptr[0] = (DCTELEM) 3749 ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << PASS1_BITS); 3750 dataptr[2] = (DCTELEM) 3751 DESCALE(MULTIPLY(tmp12, FIX(1.224744871)), /* c2 */ 3752 CONST_BITS-PASS1_BITS); 3753 dataptr[4] = (DCTELEM) 3754 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(0.707106781)), /* c4 */ 3755 CONST_BITS-PASS1_BITS); 3756 3757 /* Odd part */ 3758 3759 tmp10 = DESCALE(MULTIPLY(tmp0 + tmp2, FIX(0.366025404)), /* c5 */ 3760 CONST_BITS-PASS1_BITS); 3761 3762 dataptr[1] = (DCTELEM) (tmp10 + ((tmp0 + tmp1) << PASS1_BITS)); 3763 dataptr[3] = (DCTELEM) ((tmp0 - tmp1 - tmp2) << PASS1_BITS); 3764 dataptr[5] = (DCTELEM) (tmp10 + ((tmp2 - tmp1) << PASS1_BITS)); 3765 3766 ctr++; 3767 3768 if (ctr != DCTSIZE) { 3769 if (ctr == 12) 3770 break; /* Done. */ 3771 dataptr += DCTSIZE; /* advance pointer to next row */ 3772 } else 3773 dataptr = workspace; /* switch pointer to extended workspace */ 3774 } 3775 3776 /* Pass 2: process columns. 3777 * We remove the PASS1_BITS scaling, but leave the results scaled up 3778 * by an overall factor of 8. 3779 * We must also scale the output by (8/6)*(8/12) = 8/9, which we 3780 * fold into the constant multipliers: 3781 * 12-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/24) * 8/9. 3782 */ 3783 3784 dataptr = data; 3785 wsptr = workspace; 3786 for (ctr = 0; ctr < 6; ctr++) { 3787 /* Even part */ 3788 3789 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*3]; 3790 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*2]; 3791 tmp2 = dataptr[DCTSIZE*2] + wsptr[DCTSIZE*1]; 3792 tmp3 = dataptr[DCTSIZE*3] + wsptr[DCTSIZE*0]; 3793 tmp4 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*7]; 3794 tmp5 = dataptr[DCTSIZE*5] + dataptr[DCTSIZE*6]; 3795 3796 tmp10 = tmp0 + tmp5; 3797 tmp13 = tmp0 - tmp5; 3798 tmp11 = tmp1 + tmp4; 3799 tmp14 = tmp1 - tmp4; 3800 tmp12 = tmp2 + tmp3; 3801 tmp15 = tmp2 - tmp3; 3802 3803 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*3]; 3804 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*2]; 3805 tmp2 = dataptr[DCTSIZE*2] - wsptr[DCTSIZE*1]; 3806 tmp3 = dataptr[DCTSIZE*3] - wsptr[DCTSIZE*0]; 3807 tmp4 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*7]; 3808 tmp5 = dataptr[DCTSIZE*5] - dataptr[DCTSIZE*6]; 3809 3810 dataptr[DCTSIZE*0] = (DCTELEM) 3811 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12, FIX(0.888888889)), /* 8/9 */ 3812 CONST_BITS+PASS1_BITS); 3813 dataptr[DCTSIZE*6] = (DCTELEM) 3814 DESCALE(MULTIPLY(tmp13 - tmp14 - tmp15, FIX(0.888888889)), /* 8/9 */ 3815 CONST_BITS+PASS1_BITS); 3816 dataptr[DCTSIZE*4] = (DCTELEM) 3817 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.088662108)), /* c4 */ 3818 CONST_BITS+PASS1_BITS); 3819 dataptr[DCTSIZE*2] = (DCTELEM) 3820 DESCALE(MULTIPLY(tmp14 - tmp15, FIX(0.888888889)) + /* 8/9 */ 3821 MULTIPLY(tmp13 + tmp15, FIX(1.214244803)), /* c2 */ 3822 CONST_BITS+PASS1_BITS); 3823 3824 /* Odd part */ 3825 3826 tmp10 = MULTIPLY(tmp1 + tmp4, FIX(0.481063200)); /* c9 */ 3827 tmp14 = tmp10 + MULTIPLY(tmp1, FIX(0.680326102)); /* c3-c9 */ 3828 tmp15 = tmp10 - MULTIPLY(tmp4, FIX(1.642452502)); /* c3+c9 */ 3829 tmp12 = MULTIPLY(tmp0 + tmp2, FIX(0.997307603)); /* c5 */ 3830 tmp13 = MULTIPLY(tmp0 + tmp3, FIX(0.765261039)); /* c7 */ 3831 tmp10 = tmp12 + tmp13 + tmp14 - MULTIPLY(tmp0, FIX(0.516244403)) /* c5+c7-c1 */ 3832 + MULTIPLY(tmp5, FIX(0.164081699)); /* c11 */ 3833 tmp11 = MULTIPLY(tmp2 + tmp3, - FIX(0.164081699)); /* -c11 */ 3834 tmp12 += tmp11 - tmp15 - MULTIPLY(tmp2, FIX(2.079550144)) /* c1+c5-c11 */ 3835 + MULTIPLY(tmp5, FIX(0.765261039)); /* c7 */ 3836 tmp13 += tmp11 - tmp14 + MULTIPLY(tmp3, FIX(0.645144899)) /* c1+c11-c7 */ 3837 - MULTIPLY(tmp5, FIX(0.997307603)); /* c5 */ 3838 tmp11 = tmp15 + MULTIPLY(tmp0 - tmp3, FIX(1.161389302)) /* c3 */ 3839 - MULTIPLY(tmp2 + tmp5, FIX(0.481063200)); /* c9 */ 3840 3841 dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp10, CONST_BITS+PASS1_BITS); 3842 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp11, CONST_BITS+PASS1_BITS); 3843 dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12, CONST_BITS+PASS1_BITS); 3844 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp13, CONST_BITS+PASS1_BITS); 3845 3846 dataptr++; /* advance pointer to next column */ 3847 wsptr++; /* advance pointer to next column */ 3848 } 3849 } 3850 3851 3852 /* 3853 * Perform the forward DCT on a 5x10 sample block. 3854 * 3855 * 5-point FDCT in pass 1 (rows), 10-point in pass 2 (columns). 3856 */ 3857 3858 GLOBAL(void) 3859 jpeg_fdct_5x10 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 3860 { 3861 INT32 tmp0, tmp1, tmp2, tmp3, tmp4; 3862 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 3863 DCTELEM workspace[8*2]; 3864 DCTELEM *dataptr; 3865 DCTELEM *wsptr; 3866 JSAMPROW elemptr; 3867 int ctr; 3868 SHIFT_TEMPS 3869 3870 /* Pre-zero output coefficient block. */ 3871 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 3872 3873 /* Pass 1: process rows. */ 3874 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 3875 /* furthermore, we scale the results by 2**PASS1_BITS. */ 3876 /* 5-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/10). */ 3877 3878 dataptr = data; 3879 ctr = 0; 3880 for (;;) { 3881 elemptr = sample_data[ctr] + start_col; 3882 3883 /* Even part */ 3884 3885 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[4]); 3886 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[3]); 3887 tmp2 = GETJSAMPLE(elemptr[2]); 3888 3889 tmp10 = tmp0 + tmp1; 3890 tmp11 = tmp0 - tmp1; 3891 3892 tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[4]); 3893 tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[3]); 3894 3895 /* Apply unsigned->signed conversion */ 3896 dataptr[0] = (DCTELEM) 3897 ((tmp10 + tmp2 - 5 * CENTERJSAMPLE) << PASS1_BITS); 3898 tmp11 = MULTIPLY(tmp11, FIX(0.790569415)); /* (c2+c4)/2 */ 3899 tmp10 -= tmp2 << 2; 3900 tmp10 = MULTIPLY(tmp10, FIX(0.353553391)); /* (c2-c4)/2 */ 3901 dataptr[2] = (DCTELEM) DESCALE(tmp11 + tmp10, CONST_BITS-PASS1_BITS); 3902 dataptr[4] = (DCTELEM) DESCALE(tmp11 - tmp10, CONST_BITS-PASS1_BITS); 3903 3904 /* Odd part */ 3905 3906 tmp10 = MULTIPLY(tmp0 + tmp1, FIX(0.831253876)); /* c3 */ 3907 3908 dataptr[1] = (DCTELEM) 3909 DESCALE(tmp10 + MULTIPLY(tmp0, FIX(0.513743148)), /* c1-c3 */ 3910 CONST_BITS-PASS1_BITS); 3911 dataptr[3] = (DCTELEM) 3912 DESCALE(tmp10 - MULTIPLY(tmp1, FIX(2.176250899)), /* c1+c3 */ 3913 CONST_BITS-PASS1_BITS); 3914 3915 ctr++; 3916 3917 if (ctr != DCTSIZE) { 3918 if (ctr == 10) 3919 break; /* Done. */ 3920 dataptr += DCTSIZE; /* advance pointer to next row */ 3921 } else 3922 dataptr = workspace; /* switch pointer to extended workspace */ 3923 } 3924 3925 /* Pass 2: process columns. 3926 * We remove the PASS1_BITS scaling, but leave the results scaled up 3927 * by an overall factor of 8. 3928 * We must also scale the output by (8/5)*(8/10) = 32/25, which we 3929 * fold into the constant multipliers: 3930 * 10-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/20) * 32/25. 3931 */ 3932 3933 dataptr = data; 3934 wsptr = workspace; 3935 for (ctr = 0; ctr < 5; ctr++) { 3936 /* Even part */ 3937 3938 tmp0 = dataptr[DCTSIZE*0] + wsptr[DCTSIZE*1]; 3939 tmp1 = dataptr[DCTSIZE*1] + wsptr[DCTSIZE*0]; 3940 tmp12 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*7]; 3941 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*6]; 3942 tmp4 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*5]; 3943 3944 tmp10 = tmp0 + tmp4; 3945 tmp13 = tmp0 - tmp4; 3946 tmp11 = tmp1 + tmp3; 3947 tmp14 = tmp1 - tmp3; 3948 3949 tmp0 = dataptr[DCTSIZE*0] - wsptr[DCTSIZE*1]; 3950 tmp1 = dataptr[DCTSIZE*1] - wsptr[DCTSIZE*0]; 3951 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*7]; 3952 tmp3 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*6]; 3953 tmp4 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*5]; 3954 3955 dataptr[DCTSIZE*0] = (DCTELEM) 3956 DESCALE(MULTIPLY(tmp10 + tmp11 + tmp12, FIX(1.28)), /* 32/25 */ 3957 CONST_BITS+PASS1_BITS); 3958 tmp12 += tmp12; 3959 dataptr[DCTSIZE*4] = (DCTELEM) 3960 DESCALE(MULTIPLY(tmp10 - tmp12, FIX(1.464477191)) - /* c4 */ 3961 MULTIPLY(tmp11 - tmp12, FIX(0.559380511)), /* c8 */ 3962 CONST_BITS+PASS1_BITS); 3963 tmp10 = MULTIPLY(tmp13 + tmp14, FIX(1.064004961)); /* c6 */ 3964 dataptr[DCTSIZE*2] = (DCTELEM) 3965 DESCALE(tmp10 + MULTIPLY(tmp13, FIX(0.657591230)), /* c2-c6 */ 3966 CONST_BITS+PASS1_BITS); 3967 dataptr[DCTSIZE*6] = (DCTELEM) 3968 DESCALE(tmp10 - MULTIPLY(tmp14, FIX(2.785601151)), /* c2+c6 */ 3969 CONST_BITS+PASS1_BITS); 3970 3971 /* Odd part */ 3972 3973 tmp10 = tmp0 + tmp4; 3974 tmp11 = tmp1 - tmp3; 3975 dataptr[DCTSIZE*5] = (DCTELEM) 3976 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp2, FIX(1.28)), /* 32/25 */ 3977 CONST_BITS+PASS1_BITS); 3978 tmp2 = MULTIPLY(tmp2, FIX(1.28)); /* 32/25 */ 3979 dataptr[DCTSIZE*1] = (DCTELEM) 3980 DESCALE(MULTIPLY(tmp0, FIX(1.787906876)) + /* c1 */ 3981 MULTIPLY(tmp1, FIX(1.612894094)) + tmp2 + /* c3 */ 3982 MULTIPLY(tmp3, FIX(0.821810588)) + /* c7 */ 3983 MULTIPLY(tmp4, FIX(0.283176630)), /* c9 */ 3984 CONST_BITS+PASS1_BITS); 3985 tmp12 = MULTIPLY(tmp0 - tmp4, FIX(1.217352341)) - /* (c3+c7)/2 */ 3986 MULTIPLY(tmp1 + tmp3, FIX(0.752365123)); /* (c1-c9)/2 */ 3987 tmp13 = MULTIPLY(tmp10 + tmp11, FIX(0.395541753)) + /* (c3-c7)/2 */ 3988 MULTIPLY(tmp11, FIX(0.64)) - tmp2; /* 16/25 */ 3989 dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp12 + tmp13, CONST_BITS+PASS1_BITS); 3990 dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp12 - tmp13, CONST_BITS+PASS1_BITS); 3991 3992 dataptr++; /* advance pointer to next column */ 3993 wsptr++; /* advance pointer to next column */ 3994 } 3995 } 3996 3997 3998 /* 3999 * Perform the forward DCT on a 4x8 sample block. 4000 * 4001 * 4-point FDCT in pass 1 (rows), 8-point in pass 2 (columns). 4002 */ 4003 4004 GLOBAL(void) 4005 jpeg_fdct_4x8 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 4006 { 4007 INT32 tmp0, tmp1, tmp2, tmp3; 4008 INT32 tmp10, tmp11, tmp12, tmp13; 4009 INT32 z1; 4010 DCTELEM *dataptr; 4011 JSAMPROW elemptr; 4012 int ctr; 4013 SHIFT_TEMPS 4014 4015 /* Pre-zero output coefficient block. */ 4016 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 4017 4018 /* Pass 1: process rows. */ 4019 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 4020 /* furthermore, we scale the results by 2**PASS1_BITS. */ 4021 /* We must also scale the output by 8/4 = 2, which we add here. */ 4022 /* 4-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). */ 4023 4024 dataptr = data; 4025 for (ctr = 0; ctr < DCTSIZE; ctr++) { 4026 elemptr = sample_data[ctr] + start_col; 4027 4028 /* Even part */ 4029 4030 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]); 4031 tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]); 4032 4033 tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); 4034 tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); 4035 4036 /* Apply unsigned->signed conversion */ 4037 dataptr[0] = (DCTELEM) 4038 ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+1)); 4039 dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+1)); 4040 4041 /* Odd part */ 4042 4043 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 4044 /* Add fudge factor here for final descale. */ 4045 tmp0 += ONE << (CONST_BITS-PASS1_BITS-2); 4046 4047 dataptr[1] = (DCTELEM) 4048 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 4049 CONST_BITS-PASS1_BITS-1); 4050 dataptr[3] = (DCTELEM) 4051 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 4052 CONST_BITS-PASS1_BITS-1); 4053 4054 dataptr += DCTSIZE; /* advance pointer to next row */ 4055 } 4056 4057 /* Pass 2: process columns. 4058 * We remove the PASS1_BITS scaling, but leave the results scaled up 4059 * by an overall factor of 8. 4060 */ 4061 4062 dataptr = data; 4063 for (ctr = 0; ctr < 4; ctr++) { 4064 /* Even part per LL&M figure 1 --- note that published figure is faulty; 4065 * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". 4066 */ 4067 4068 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; 4069 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; 4070 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; 4071 tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 4072 4073 /* Add fudge factor here for final descale. */ 4074 tmp10 = tmp0 + tmp3 + (ONE << (PASS1_BITS-1)); 4075 tmp12 = tmp0 - tmp3; 4076 tmp11 = tmp1 + tmp2; 4077 tmp13 = tmp1 - tmp2; 4078 4079 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; 4080 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; 4081 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; 4082 tmp3 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 4083 4084 dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp10 + tmp11, PASS1_BITS); 4085 dataptr[DCTSIZE*4] = (DCTELEM) RIGHT_SHIFT(tmp10 - tmp11, PASS1_BITS); 4086 4087 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); 4088 /* Add fudge factor here for final descale. */ 4089 z1 += ONE << (CONST_BITS+PASS1_BITS-1); 4090 dataptr[DCTSIZE*2] = (DCTELEM) 4091 RIGHT_SHIFT(z1 + MULTIPLY(tmp12, FIX_0_765366865), CONST_BITS+PASS1_BITS); 4092 dataptr[DCTSIZE*6] = (DCTELEM) 4093 RIGHT_SHIFT(z1 - MULTIPLY(tmp13, FIX_1_847759065), CONST_BITS+PASS1_BITS); 4094 4095 /* Odd part per figure 8 --- note paper omits factor of sqrt(2). 4096 * 8-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 4097 * i0..i3 in the paper are tmp0..tmp3 here. 4098 */ 4099 4100 tmp10 = tmp0 + tmp3; 4101 tmp11 = tmp1 + tmp2; 4102 tmp12 = tmp0 + tmp2; 4103 tmp13 = tmp1 + tmp3; 4104 z1 = MULTIPLY(tmp12 + tmp13, FIX_1_175875602); /* c3 */ 4105 /* Add fudge factor here for final descale. */ 4106 z1 += ONE << (CONST_BITS+PASS1_BITS-1); 4107 4108 tmp0 = MULTIPLY(tmp0, FIX_1_501321110); /* c1+c3-c5-c7 */ 4109 tmp1 = MULTIPLY(tmp1, FIX_3_072711026); /* c1+c3+c5-c7 */ 4110 tmp2 = MULTIPLY(tmp2, FIX_2_053119869); /* c1+c3-c5+c7 */ 4111 tmp3 = MULTIPLY(tmp3, FIX_0_298631336); /* -c1+c3+c5-c7 */ 4112 tmp10 = MULTIPLY(tmp10, - FIX_0_899976223); /* c7-c3 */ 4113 tmp11 = MULTIPLY(tmp11, - FIX_2_562915447); /* -c1-c3 */ 4114 tmp12 = MULTIPLY(tmp12, - FIX_0_390180644); /* c5-c3 */ 4115 tmp13 = MULTIPLY(tmp13, - FIX_1_961570560); /* -c3-c5 */ 4116 4117 tmp12 += z1; 4118 tmp13 += z1; 4119 4120 dataptr[DCTSIZE*1] = (DCTELEM) 4121 RIGHT_SHIFT(tmp0 + tmp10 + tmp12, CONST_BITS+PASS1_BITS); 4122 dataptr[DCTSIZE*3] = (DCTELEM) 4123 RIGHT_SHIFT(tmp1 + tmp11 + tmp13, CONST_BITS+PASS1_BITS); 4124 dataptr[DCTSIZE*5] = (DCTELEM) 4125 RIGHT_SHIFT(tmp2 + tmp11 + tmp12, CONST_BITS+PASS1_BITS); 4126 dataptr[DCTSIZE*7] = (DCTELEM) 4127 RIGHT_SHIFT(tmp3 + tmp10 + tmp13, CONST_BITS+PASS1_BITS); 4128 4129 dataptr++; /* advance pointer to next column */ 4130 } 4131 } 4132 4133 4134 /* 4135 * Perform the forward DCT on a 3x6 sample block. 4136 * 4137 * 3-point FDCT in pass 1 (rows), 6-point in pass 2 (columns). 4138 */ 4139 4140 GLOBAL(void) 4141 jpeg_fdct_3x6 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 4142 { 4143 INT32 tmp0, tmp1, tmp2; 4144 INT32 tmp10, tmp11, tmp12; 4145 DCTELEM *dataptr; 4146 JSAMPROW elemptr; 4147 int ctr; 4148 SHIFT_TEMPS 4149 4150 /* Pre-zero output coefficient block. */ 4151 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 4152 4153 /* Pass 1: process rows. */ 4154 /* Note results are scaled up by sqrt(8) compared to a true DCT; */ 4155 /* furthermore, we scale the results by 2**PASS1_BITS. */ 4156 /* We scale the results further by 2 as part of output adaption */ 4157 /* scaling for different DCT size. */ 4158 /* 3-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/6). */ 4159 4160 dataptr = data; 4161 for (ctr = 0; ctr < 6; ctr++) { 4162 elemptr = sample_data[ctr] + start_col; 4163 4164 /* Even part */ 4165 4166 tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[2]); 4167 tmp1 = GETJSAMPLE(elemptr[1]); 4168 4169 tmp2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[2]); 4170 4171 /* Apply unsigned->signed conversion */ 4172 dataptr[0] = (DCTELEM) 4173 ((tmp0 + tmp1 - 3 * CENTERJSAMPLE) << (PASS1_BITS+1)); 4174 dataptr[2] = (DCTELEM) 4175 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp1, FIX(0.707106781)), /* c2 */ 4176 CONST_BITS-PASS1_BITS-1); 4177 4178 /* Odd part */ 4179 4180 dataptr[1] = (DCTELEM) 4181 DESCALE(MULTIPLY(tmp2, FIX(1.224744871)), /* c1 */ 4182 CONST_BITS-PASS1_BITS-1); 4183 4184 dataptr += DCTSIZE; /* advance pointer to next row */ 4185 } 4186 4187 /* Pass 2: process columns. 4188 * We remove the PASS1_BITS scaling, but leave the results scaled up 4189 * by an overall factor of 8. 4190 * We must also scale the output by (8/6)*(8/3) = 32/9, which we partially 4191 * fold into the constant multipliers (other part was done in pass 1): 4192 * 6-point FDCT kernel, cK represents sqrt(2) * cos(K*pi/12) * 16/9. 4193 */ 4194 4195 dataptr = data; 4196 for (ctr = 0; ctr < 3; ctr++) { 4197 /* Even part */ 4198 4199 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*5]; 4200 tmp11 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*4]; 4201 tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*3]; 4202 4203 tmp10 = tmp0 + tmp2; 4204 tmp12 = tmp0 - tmp2; 4205 4206 tmp0 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*5]; 4207 tmp1 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*4]; 4208 tmp2 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*3]; 4209 4210 dataptr[DCTSIZE*0] = (DCTELEM) 4211 DESCALE(MULTIPLY(tmp10 + tmp11, FIX(1.777777778)), /* 16/9 */ 4212 CONST_BITS+PASS1_BITS); 4213 dataptr[DCTSIZE*2] = (DCTELEM) 4214 DESCALE(MULTIPLY(tmp12, FIX(2.177324216)), /* c2 */ 4215 CONST_BITS+PASS1_BITS); 4216 dataptr[DCTSIZE*4] = (DCTELEM) 4217 DESCALE(MULTIPLY(tmp10 - tmp11 - tmp11, FIX(1.257078722)), /* c4 */ 4218 CONST_BITS+PASS1_BITS); 4219 4220 /* Odd part */ 4221 4222 tmp10 = MULTIPLY(tmp0 + tmp2, FIX(0.650711829)); /* c5 */ 4223 4224 dataptr[DCTSIZE*1] = (DCTELEM) 4225 DESCALE(tmp10 + MULTIPLY(tmp0 + tmp1, FIX(1.777777778)), /* 16/9 */ 4226 CONST_BITS+PASS1_BITS); 4227 dataptr[DCTSIZE*3] = (DCTELEM) 4228 DESCALE(MULTIPLY(tmp0 - tmp1 - tmp2, FIX(1.777777778)), /* 16/9 */ 4229 CONST_BITS+PASS1_BITS); 4230 dataptr[DCTSIZE*5] = (DCTELEM) 4231 DESCALE(tmp10 + MULTIPLY(tmp2 - tmp1, FIX(1.777777778)), /* 16/9 */ 4232 CONST_BITS+PASS1_BITS); 4233 4234 dataptr++; /* advance pointer to next column */ 4235 } 4236 } 4237 4238 4239 /* 4240 * Perform the forward DCT on a 2x4 sample block. 4241 * 4242 * 2-point FDCT in pass 1 (rows), 4-point in pass 2 (columns). 4243 */ 4244 4245 GLOBAL(void) 4246 jpeg_fdct_2x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 4247 { 4248 INT32 tmp0, tmp1; 4249 INT32 tmp10, tmp11; 4250 DCTELEM *dataptr; 4251 JSAMPROW elemptr; 4252 int ctr; 4253 SHIFT_TEMPS 4254 4255 /* Pre-zero output coefficient block. */ 4256 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 4257 4258 /* Pass 1: process rows. */ 4259 /* Note results are scaled up by sqrt(8) compared to a true DCT. */ 4260 /* We must also scale the output by (8/2)*(8/4) = 2**3, which we add here. */ 4261 4262 dataptr = data; 4263 for (ctr = 0; ctr < 4; ctr++) { 4264 elemptr = sample_data[ctr] + start_col; 4265 4266 /* Even part */ 4267 4268 tmp0 = GETJSAMPLE(elemptr[0]); 4269 tmp1 = GETJSAMPLE(elemptr[1]); 4270 4271 /* Apply unsigned->signed conversion */ 4272 dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 3); 4273 4274 /* Odd part */ 4275 4276 dataptr[1] = (DCTELEM) ((tmp0 - tmp1) << 3); 4277 4278 dataptr += DCTSIZE; /* advance pointer to next row */ 4279 } 4280 4281 /* Pass 2: process columns. 4282 * We leave the results scaled up by an overall factor of 8. 4283 * 4-point FDCT kernel, 4284 * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT]. 4285 */ 4286 4287 dataptr = data; 4288 for (ctr = 0; ctr < 2; ctr++) { 4289 /* Even part */ 4290 4291 tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*3]; 4292 tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*2]; 4293 4294 tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*3]; 4295 tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*2]; 4296 4297 dataptr[DCTSIZE*0] = (DCTELEM) (tmp0 + tmp1); 4298 dataptr[DCTSIZE*2] = (DCTELEM) (tmp0 - tmp1); 4299 4300 /* Odd part */ 4301 4302 tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */ 4303 /* Add fudge factor here for final descale. */ 4304 tmp0 += ONE << (CONST_BITS-1); 4305 4306 dataptr[DCTSIZE*1] = (DCTELEM) 4307 RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */ 4308 CONST_BITS); 4309 dataptr[DCTSIZE*3] = (DCTELEM) 4310 RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */ 4311 CONST_BITS); 4312 4313 dataptr++; /* advance pointer to next column */ 4314 } 4315 } 4316 4317 4318 /* 4319 * Perform the forward DCT on a 1x2 sample block. 4320 * 4321 * 1-point FDCT in pass 1 (rows), 2-point in pass 2 (columns). 4322 */ 4323 4324 GLOBAL(void) 4325 jpeg_fdct_1x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) 4326 { 4327 INT32 tmp0, tmp1; 4328 4329 /* Pre-zero output coefficient block. */ 4330 MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); 4331 4332 tmp0 = GETJSAMPLE(sample_data[0][start_col]); 4333 tmp1 = GETJSAMPLE(sample_data[1][start_col]); 4334 4335 /* We leave the results scaled up by an overall factor of 8. 4336 * We must also scale the output by (8/1)*(8/2) = 2**5. 4337 */ 4338 4339 /* Even part */ 4340 /* Apply unsigned->signed conversion */ 4341 data[DCTSIZE*0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5); 4342 4343 /* Odd part */ 4344 data[DCTSIZE*1] = (DCTELEM) ((tmp0 - tmp1) << 5); 4345 } 4346 4347 #endif /* DCT_SCALING_SUPPORTED */ 283 4348 #endif /* DCT_ISLOW_SUPPORTED */ -
trunk/src/3rdparty/libjpeg/jidctint.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1998, Thomas G. Lane. 5 * Modification developed 2002-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 24 25 * multiplication; this allows a very simple and accurate implementation in 25 26 * scaled fixed-point arithmetic, with a minimal number of shifts. 27 * 28 * We also provide IDCT routines with various output sample block sizes for 29 * direct resolution reduction or enlargement and for direct resolving the 30 * common 2x1 and 1x2 subsampling cases without additional resampling: NxN 31 * (N=1...16), 2NxN, and Nx2N (N=1...8) pixels for one 8x8 input DCT block. 32 * 33 * For N<8 we simply take the corresponding low-frequency coefficients of 34 * the 8x8 input DCT block and apply an NxN point IDCT on the sub-block 35 * to yield the downscaled outputs. 36 * This can be seen as direct low-pass downsampling from the DCT domain 37 * point of view rather than the usual spatial domain point of view, 38 * yielding significant computational savings and results at least 39 * as good as common bilinear (averaging) spatial downsampling. 40 * 41 * For N>8 we apply a partial NxN IDCT on the 8 input coefficients as 42 * lower frequencies and higher frequencies assumed to be zero. 43 * It turns out that the computational effort is similar to the 8x8 IDCT 44 * regarding the output size. 45 * Furthermore, the scaling and descaling is the same for all IDCT sizes. 46 * 47 * CAUTION: We rely on the FIX() macro except for the N=1,2,4,8 cases 48 * since there would be too many additional constants to pre-calculate. 26 49 */ 27 50 … … 39 62 40 63 #if DCTSIZE != 8 41 Sorry, this code only copes with 8x8 DCT s. /* deliberate syntax err */64 Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */ 42 65 #endif 43 66 … … 152 175 INT32 tmp0, tmp1, tmp2, tmp3; 153 176 INT32 tmp10, tmp11, tmp12, tmp13; 177 INT32 z1, z2, z3; 178 JCOEFPTR inptr; 179 ISLOW_MULT_TYPE * quantptr; 180 int * wsptr; 181 JSAMPROW outptr; 182 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 183 int ctr; 184 int workspace[DCTSIZE2]; /* buffers data between passes */ 185 SHIFT_TEMPS 186 187 /* Pass 1: process columns from input, store into work array. */ 188 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ 189 /* furthermore, we scale the results by 2**PASS1_BITS. */ 190 191 inptr = coef_block; 192 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 193 wsptr = workspace; 194 for (ctr = DCTSIZE; ctr > 0; ctr--) { 195 /* Due to quantization, we will usually find that many of the input 196 * coefficients are zero, especially the AC terms. We can exploit this 197 * by short-circuiting the IDCT calculation for any column in which all 198 * the AC terms are zero. In that case each output is equal to the 199 * DC coefficient (with scale factor as needed). 200 * With typical images and quantization tables, half or more of the 201 * column DCT calculations can be simplified this way. 202 */ 203 204 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && 205 inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && 206 inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && 207 inptr[DCTSIZE*7] == 0) { 208 /* AC terms all zero */ 209 int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; 210 211 wsptr[DCTSIZE*0] = dcval; 212 wsptr[DCTSIZE*1] = dcval; 213 wsptr[DCTSIZE*2] = dcval; 214 wsptr[DCTSIZE*3] = dcval; 215 wsptr[DCTSIZE*4] = dcval; 216 wsptr[DCTSIZE*5] = dcval; 217 wsptr[DCTSIZE*6] = dcval; 218 wsptr[DCTSIZE*7] = dcval; 219 220 inptr++; /* advance pointers to next column */ 221 quantptr++; 222 wsptr++; 223 continue; 224 } 225 226 /* Even part: reverse the even part of the forward DCT. */ 227 /* The rotator is sqrt(2)*c(-6). */ 228 229 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 230 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 231 232 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 233 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 234 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 235 236 z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 237 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 238 z2 <<= CONST_BITS; 239 z3 <<= CONST_BITS; 240 /* Add fudge factor here for final descale. */ 241 z2 += ONE << (CONST_BITS-PASS1_BITS-1); 242 243 tmp0 = z2 + z3; 244 tmp1 = z2 - z3; 245 246 tmp10 = tmp0 + tmp2; 247 tmp13 = tmp0 - tmp2; 248 tmp11 = tmp1 + tmp3; 249 tmp12 = tmp1 - tmp3; 250 251 /* Odd part per figure 8; the matrix is unitary and hence its 252 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. 253 */ 254 255 tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 256 tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 257 tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 258 tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 259 260 z2 = tmp0 + tmp2; 261 z3 = tmp1 + tmp3; 262 263 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 264 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 265 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 266 z2 += z1; 267 z3 += z1; 268 269 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 270 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 271 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 272 tmp0 += z1 + z2; 273 tmp3 += z1 + z3; 274 275 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 276 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 277 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 278 tmp1 += z1 + z3; 279 tmp2 += z1 + z2; 280 281 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 282 283 wsptr[DCTSIZE*0] = (int) RIGHT_SHIFT(tmp10 + tmp3, CONST_BITS-PASS1_BITS); 284 wsptr[DCTSIZE*7] = (int) RIGHT_SHIFT(tmp10 - tmp3, CONST_BITS-PASS1_BITS); 285 wsptr[DCTSIZE*1] = (int) RIGHT_SHIFT(tmp11 + tmp2, CONST_BITS-PASS1_BITS); 286 wsptr[DCTSIZE*6] = (int) RIGHT_SHIFT(tmp11 - tmp2, CONST_BITS-PASS1_BITS); 287 wsptr[DCTSIZE*2] = (int) RIGHT_SHIFT(tmp12 + tmp1, CONST_BITS-PASS1_BITS); 288 wsptr[DCTSIZE*5] = (int) RIGHT_SHIFT(tmp12 - tmp1, CONST_BITS-PASS1_BITS); 289 wsptr[DCTSIZE*3] = (int) RIGHT_SHIFT(tmp13 + tmp0, CONST_BITS-PASS1_BITS); 290 wsptr[DCTSIZE*4] = (int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS-PASS1_BITS); 291 292 inptr++; /* advance pointers to next column */ 293 quantptr++; 294 wsptr++; 295 } 296 297 /* Pass 2: process rows from work array, store into output array. */ 298 /* Note that we must descale the results by a factor of 8 == 2**3, */ 299 /* and also undo the PASS1_BITS scaling. */ 300 301 wsptr = workspace; 302 for (ctr = 0; ctr < DCTSIZE; ctr++) { 303 outptr = output_buf[ctr] + output_col; 304 /* Rows of zeroes can be exploited in the same way as we did with columns. 305 * However, the column calculation has created many nonzero AC terms, so 306 * the simplification applies less often (typically 5% to 10% of the time). 307 * On machines with very fast multiplication, it's possible that the 308 * test takes more time than it's worth. In that case this section 309 * may be commented out. 310 */ 311 312 #ifndef NO_ZERO_ROW_TEST 313 if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && 314 wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { 315 /* AC terms all zero */ 316 JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) 317 & RANGE_MASK]; 318 319 outptr[0] = dcval; 320 outptr[1] = dcval; 321 outptr[2] = dcval; 322 outptr[3] = dcval; 323 outptr[4] = dcval; 324 outptr[5] = dcval; 325 outptr[6] = dcval; 326 outptr[7] = dcval; 327 328 wsptr += DCTSIZE; /* advance pointer to next row */ 329 continue; 330 } 331 #endif 332 333 /* Even part: reverse the even part of the forward DCT. */ 334 /* The rotator is sqrt(2)*c(-6). */ 335 336 z2 = (INT32) wsptr[2]; 337 z3 = (INT32) wsptr[6]; 338 339 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 340 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 341 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 342 343 /* Add fudge factor here for final descale. */ 344 z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 345 z3 = (INT32) wsptr[4]; 346 347 tmp0 = (z2 + z3) << CONST_BITS; 348 tmp1 = (z2 - z3) << CONST_BITS; 349 350 tmp10 = tmp0 + tmp2; 351 tmp13 = tmp0 - tmp2; 352 tmp11 = tmp1 + tmp3; 353 tmp12 = tmp1 - tmp3; 354 355 /* Odd part per figure 8; the matrix is unitary and hence its 356 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. 357 */ 358 359 tmp0 = (INT32) wsptr[7]; 360 tmp1 = (INT32) wsptr[5]; 361 tmp2 = (INT32) wsptr[3]; 362 tmp3 = (INT32) wsptr[1]; 363 364 z2 = tmp0 + tmp2; 365 z3 = tmp1 + tmp3; 366 367 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 368 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 369 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 370 z2 += z1; 371 z3 += z1; 372 373 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 374 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 375 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 376 tmp0 += z1 + z2; 377 tmp3 += z1 + z3; 378 379 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 380 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 381 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 382 tmp1 += z1 + z3; 383 tmp2 += z1 + z2; 384 385 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 386 387 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp3, 388 CONST_BITS+PASS1_BITS+3) 389 & RANGE_MASK]; 390 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp3, 391 CONST_BITS+PASS1_BITS+3) 392 & RANGE_MASK]; 393 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp2, 394 CONST_BITS+PASS1_BITS+3) 395 & RANGE_MASK]; 396 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp2, 397 CONST_BITS+PASS1_BITS+3) 398 & RANGE_MASK]; 399 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp1, 400 CONST_BITS+PASS1_BITS+3) 401 & RANGE_MASK]; 402 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp1, 403 CONST_BITS+PASS1_BITS+3) 404 & RANGE_MASK]; 405 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp0, 406 CONST_BITS+PASS1_BITS+3) 407 & RANGE_MASK]; 408 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp0, 409 CONST_BITS+PASS1_BITS+3) 410 & RANGE_MASK]; 411 412 wsptr += DCTSIZE; /* advance pointer to next row */ 413 } 414 } 415 416 #ifdef IDCT_SCALING_SUPPORTED 417 418 419 /* 420 * Perform dequantization and inverse DCT on one block of coefficients, 421 * producing a 7x7 output block. 422 * 423 * Optimized algorithm with 12 multiplications in the 1-D kernel. 424 * cK represents sqrt(2) * cos(K*pi/14). 425 */ 426 427 GLOBAL(void) 428 jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 429 JCOEFPTR coef_block, 430 JSAMPARRAY output_buf, JDIMENSION output_col) 431 { 432 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; 433 INT32 z1, z2, z3; 434 JCOEFPTR inptr; 435 ISLOW_MULT_TYPE * quantptr; 436 int * wsptr; 437 JSAMPROW outptr; 438 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 439 int ctr; 440 int workspace[7*7]; /* buffers data between passes */ 441 SHIFT_TEMPS 442 443 /* Pass 1: process columns from input, store into work array. */ 444 445 inptr = coef_block; 446 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 447 wsptr = workspace; 448 for (ctr = 0; ctr < 7; ctr++, inptr++, quantptr++, wsptr++) { 449 /* Even part */ 450 451 tmp13 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 452 tmp13 <<= CONST_BITS; 453 /* Add fudge factor here for final descale. */ 454 tmp13 += ONE << (CONST_BITS-PASS1_BITS-1); 455 456 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 457 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 458 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 459 460 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ 461 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ 462 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6 */ 463 tmp0 = z1 + z3; 464 z2 -= tmp0; 465 tmp0 = MULTIPLY(tmp0, FIX(1.274162392)) + tmp13; /* c2 */ 466 tmp10 += tmp0 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ 467 tmp12 += tmp0 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ 468 tmp13 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ 469 470 /* Odd part */ 471 472 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 473 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 474 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 475 476 tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 477 tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 478 tmp0 = tmp1 - tmp2; 479 tmp1 += tmp2; 480 tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ 481 tmp1 += tmp2; 482 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ 483 tmp0 += z2; 484 tmp2 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ 485 486 /* Final output stage */ 487 488 wsptr[7*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 489 wsptr[7*6] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 490 wsptr[7*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS); 491 wsptr[7*5] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS); 492 wsptr[7*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); 493 wsptr[7*4] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); 494 wsptr[7*3] = (int) RIGHT_SHIFT(tmp13, CONST_BITS-PASS1_BITS); 495 } 496 497 /* Pass 2: process 7 rows from work array, store into output array. */ 498 499 wsptr = workspace; 500 for (ctr = 0; ctr < 7; ctr++) { 501 outptr = output_buf[ctr] + output_col; 502 503 /* Even part */ 504 505 /* Add fudge factor here for final descale. */ 506 tmp13 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 507 tmp13 <<= CONST_BITS; 508 509 z1 = (INT32) wsptr[2]; 510 z2 = (INT32) wsptr[4]; 511 z3 = (INT32) wsptr[6]; 512 513 tmp10 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ 514 tmp12 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ 515 tmp11 = tmp10 + tmp12 + tmp13 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6 */ 516 tmp0 = z1 + z3; 517 z2 -= tmp0; 518 tmp0 = MULTIPLY(tmp0, FIX(1.274162392)) + tmp13; /* c2 */ 519 tmp10 += tmp0 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ 520 tmp12 += tmp0 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ 521 tmp13 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ 522 523 /* Odd part */ 524 525 z1 = (INT32) wsptr[1]; 526 z2 = (INT32) wsptr[3]; 527 z3 = (INT32) wsptr[5]; 528 529 tmp1 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 530 tmp2 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 531 tmp0 = tmp1 - tmp2; 532 tmp1 += tmp2; 533 tmp2 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ 534 tmp1 += tmp2; 535 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ 536 tmp0 += z2; 537 tmp2 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ 538 539 /* Final output stage */ 540 541 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 542 CONST_BITS+PASS1_BITS+3) 543 & RANGE_MASK]; 544 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 545 CONST_BITS+PASS1_BITS+3) 546 & RANGE_MASK]; 547 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, 548 CONST_BITS+PASS1_BITS+3) 549 & RANGE_MASK]; 550 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, 551 CONST_BITS+PASS1_BITS+3) 552 & RANGE_MASK]; 553 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 554 CONST_BITS+PASS1_BITS+3) 555 & RANGE_MASK]; 556 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 557 CONST_BITS+PASS1_BITS+3) 558 & RANGE_MASK]; 559 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13, 560 CONST_BITS+PASS1_BITS+3) 561 & RANGE_MASK]; 562 563 wsptr += 7; /* advance pointer to next row */ 564 } 565 } 566 567 568 /* 569 * Perform dequantization and inverse DCT on one block of coefficients, 570 * producing a reduced-size 6x6 output block. 571 * 572 * Optimized algorithm with 3 multiplications in the 1-D kernel. 573 * cK represents sqrt(2) * cos(K*pi/12). 574 */ 575 576 GLOBAL(void) 577 jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 578 JCOEFPTR coef_block, 579 JSAMPARRAY output_buf, JDIMENSION output_col) 580 { 581 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; 582 INT32 z1, z2, z3; 583 JCOEFPTR inptr; 584 ISLOW_MULT_TYPE * quantptr; 585 int * wsptr; 586 JSAMPROW outptr; 587 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 588 int ctr; 589 int workspace[6*6]; /* buffers data between passes */ 590 SHIFT_TEMPS 591 592 /* Pass 1: process columns from input, store into work array. */ 593 594 inptr = coef_block; 595 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 596 wsptr = workspace; 597 for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) { 598 /* Even part */ 599 600 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 601 tmp0 <<= CONST_BITS; 602 /* Add fudge factor here for final descale. */ 603 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 604 tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 605 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ 606 tmp1 = tmp0 + tmp10; 607 tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS-PASS1_BITS); 608 tmp10 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 609 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ 610 tmp10 = tmp1 + tmp0; 611 tmp12 = tmp1 - tmp0; 612 613 /* Odd part */ 614 615 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 616 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 617 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 618 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 619 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); 620 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); 621 tmp1 = (z1 - z2 - z3) << PASS1_BITS; 622 623 /* Final output stage */ 624 625 wsptr[6*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 626 wsptr[6*5] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 627 wsptr[6*1] = (int) (tmp11 + tmp1); 628 wsptr[6*4] = (int) (tmp11 - tmp1); 629 wsptr[6*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); 630 wsptr[6*3] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); 631 } 632 633 /* Pass 2: process 6 rows from work array, store into output array. */ 634 635 wsptr = workspace; 636 for (ctr = 0; ctr < 6; ctr++) { 637 outptr = output_buf[ctr] + output_col; 638 639 /* Even part */ 640 641 /* Add fudge factor here for final descale. */ 642 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 643 tmp0 <<= CONST_BITS; 644 tmp2 = (INT32) wsptr[4]; 645 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ 646 tmp1 = tmp0 + tmp10; 647 tmp11 = tmp0 - tmp10 - tmp10; 648 tmp10 = (INT32) wsptr[2]; 649 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ 650 tmp10 = tmp1 + tmp0; 651 tmp12 = tmp1 - tmp0; 652 653 /* Odd part */ 654 655 z1 = (INT32) wsptr[1]; 656 z2 = (INT32) wsptr[3]; 657 z3 = (INT32) wsptr[5]; 658 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 659 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); 660 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); 661 tmp1 = (z1 - z2 - z3) << CONST_BITS; 662 663 /* Final output stage */ 664 665 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 666 CONST_BITS+PASS1_BITS+3) 667 & RANGE_MASK]; 668 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 669 CONST_BITS+PASS1_BITS+3) 670 & RANGE_MASK]; 671 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, 672 CONST_BITS+PASS1_BITS+3) 673 & RANGE_MASK]; 674 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, 675 CONST_BITS+PASS1_BITS+3) 676 & RANGE_MASK]; 677 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 678 CONST_BITS+PASS1_BITS+3) 679 & RANGE_MASK]; 680 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 681 CONST_BITS+PASS1_BITS+3) 682 & RANGE_MASK]; 683 684 wsptr += 6; /* advance pointer to next row */ 685 } 686 } 687 688 689 /* 690 * Perform dequantization and inverse DCT on one block of coefficients, 691 * producing a reduced-size 5x5 output block. 692 * 693 * Optimized algorithm with 5 multiplications in the 1-D kernel. 694 * cK represents sqrt(2) * cos(K*pi/10). 695 */ 696 697 GLOBAL(void) 698 jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 699 JCOEFPTR coef_block, 700 JSAMPARRAY output_buf, JDIMENSION output_col) 701 { 702 INT32 tmp0, tmp1, tmp10, tmp11, tmp12; 703 INT32 z1, z2, z3; 704 JCOEFPTR inptr; 705 ISLOW_MULT_TYPE * quantptr; 706 int * wsptr; 707 JSAMPROW outptr; 708 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 709 int ctr; 710 int workspace[5*5]; /* buffers data between passes */ 711 SHIFT_TEMPS 712 713 /* Pass 1: process columns from input, store into work array. */ 714 715 inptr = coef_block; 716 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 717 wsptr = workspace; 718 for (ctr = 0; ctr < 5; ctr++, inptr++, quantptr++, wsptr++) { 719 /* Even part */ 720 721 tmp12 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 722 tmp12 <<= CONST_BITS; 723 /* Add fudge factor here for final descale. */ 724 tmp12 += ONE << (CONST_BITS-PASS1_BITS-1); 725 tmp0 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 726 tmp1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 727 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ 728 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ 729 z3 = tmp12 + z2; 730 tmp10 = z3 + z1; 731 tmp11 = z3 - z1; 732 tmp12 -= z2 << 2; 733 734 /* Odd part */ 735 736 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 737 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 738 739 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ 740 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ 741 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ 742 743 /* Final output stage */ 744 745 wsptr[5*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 746 wsptr[5*4] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 747 wsptr[5*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS); 748 wsptr[5*3] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS); 749 wsptr[5*2] = (int) RIGHT_SHIFT(tmp12, CONST_BITS-PASS1_BITS); 750 } 751 752 /* Pass 2: process 5 rows from work array, store into output array. */ 753 754 wsptr = workspace; 755 for (ctr = 0; ctr < 5; ctr++) { 756 outptr = output_buf[ctr] + output_col; 757 758 /* Even part */ 759 760 /* Add fudge factor here for final descale. */ 761 tmp12 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 762 tmp12 <<= CONST_BITS; 763 tmp0 = (INT32) wsptr[2]; 764 tmp1 = (INT32) wsptr[4]; 765 z1 = MULTIPLY(tmp0 + tmp1, FIX(0.790569415)); /* (c2+c4)/2 */ 766 z2 = MULTIPLY(tmp0 - tmp1, FIX(0.353553391)); /* (c2-c4)/2 */ 767 z3 = tmp12 + z2; 768 tmp10 = z3 + z1; 769 tmp11 = z3 - z1; 770 tmp12 -= z2 << 2; 771 772 /* Odd part */ 773 774 z2 = (INT32) wsptr[1]; 775 z3 = (INT32) wsptr[3]; 776 777 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ 778 tmp0 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ 779 tmp1 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ 780 781 /* Final output stage */ 782 783 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 784 CONST_BITS+PASS1_BITS+3) 785 & RANGE_MASK]; 786 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 787 CONST_BITS+PASS1_BITS+3) 788 & RANGE_MASK]; 789 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, 790 CONST_BITS+PASS1_BITS+3) 791 & RANGE_MASK]; 792 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, 793 CONST_BITS+PASS1_BITS+3) 794 & RANGE_MASK]; 795 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12, 796 CONST_BITS+PASS1_BITS+3) 797 & RANGE_MASK]; 798 799 wsptr += 5; /* advance pointer to next row */ 800 } 801 } 802 803 804 /* 805 * Perform dequantization and inverse DCT on one block of coefficients, 806 * producing a reduced-size 4x4 output block. 807 * 808 * Optimized algorithm with 3 multiplications in the 1-D kernel. 809 * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point IDCT]. 810 */ 811 812 GLOBAL(void) 813 jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 814 JCOEFPTR coef_block, 815 JSAMPARRAY output_buf, JDIMENSION output_col) 816 { 817 INT32 tmp0, tmp2, tmp10, tmp12; 818 INT32 z1, z2, z3; 819 JCOEFPTR inptr; 820 ISLOW_MULT_TYPE * quantptr; 821 int * wsptr; 822 JSAMPROW outptr; 823 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 824 int ctr; 825 int workspace[4*4]; /* buffers data between passes */ 826 SHIFT_TEMPS 827 828 /* Pass 1: process columns from input, store into work array. */ 829 830 inptr = coef_block; 831 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 832 wsptr = workspace; 833 for (ctr = 0; ctr < 4; ctr++, inptr++, quantptr++, wsptr++) { 834 /* Even part */ 835 836 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 837 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 838 839 tmp10 = (tmp0 + tmp2) << PASS1_BITS; 840 tmp12 = (tmp0 - tmp2) << PASS1_BITS; 841 842 /* Odd part */ 843 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 844 845 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 846 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 847 848 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 849 /* Add fudge factor here for final descale. */ 850 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 851 tmp0 = RIGHT_SHIFT(z1 + MULTIPLY(z2, FIX_0_765366865), /* c2-c6 */ 852 CONST_BITS-PASS1_BITS); 853 tmp2 = RIGHT_SHIFT(z1 - MULTIPLY(z3, FIX_1_847759065), /* c2+c6 */ 854 CONST_BITS-PASS1_BITS); 855 856 /* Final output stage */ 857 858 wsptr[4*0] = (int) (tmp10 + tmp0); 859 wsptr[4*3] = (int) (tmp10 - tmp0); 860 wsptr[4*1] = (int) (tmp12 + tmp2); 861 wsptr[4*2] = (int) (tmp12 - tmp2); 862 } 863 864 /* Pass 2: process 4 rows from work array, store into output array. */ 865 866 wsptr = workspace; 867 for (ctr = 0; ctr < 4; ctr++) { 868 outptr = output_buf[ctr] + output_col; 869 870 /* Even part */ 871 872 /* Add fudge factor here for final descale. */ 873 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 874 tmp2 = (INT32) wsptr[2]; 875 876 tmp10 = (tmp0 + tmp2) << CONST_BITS; 877 tmp12 = (tmp0 - tmp2) << CONST_BITS; 878 879 /* Odd part */ 880 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 881 882 z2 = (INT32) wsptr[1]; 883 z3 = (INT32) wsptr[3]; 884 885 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 886 tmp0 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ 887 tmp2 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ 888 889 /* Final output stage */ 890 891 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 892 CONST_BITS+PASS1_BITS+3) 893 & RANGE_MASK]; 894 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 895 CONST_BITS+PASS1_BITS+3) 896 & RANGE_MASK]; 897 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 898 CONST_BITS+PASS1_BITS+3) 899 & RANGE_MASK]; 900 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 901 CONST_BITS+PASS1_BITS+3) 902 & RANGE_MASK]; 903 904 wsptr += 4; /* advance pointer to next row */ 905 } 906 } 907 908 909 /* 910 * Perform dequantization and inverse DCT on one block of coefficients, 911 * producing a reduced-size 3x3 output block. 912 * 913 * Optimized algorithm with 2 multiplications in the 1-D kernel. 914 * cK represents sqrt(2) * cos(K*pi/6). 915 */ 916 917 GLOBAL(void) 918 jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 919 JCOEFPTR coef_block, 920 JSAMPARRAY output_buf, JDIMENSION output_col) 921 { 922 INT32 tmp0, tmp2, tmp10, tmp12; 923 JCOEFPTR inptr; 924 ISLOW_MULT_TYPE * quantptr; 925 int * wsptr; 926 JSAMPROW outptr; 927 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 928 int ctr; 929 int workspace[3*3]; /* buffers data between passes */ 930 SHIFT_TEMPS 931 932 /* Pass 1: process columns from input, store into work array. */ 933 934 inptr = coef_block; 935 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 936 wsptr = workspace; 937 for (ctr = 0; ctr < 3; ctr++, inptr++, quantptr++, wsptr++) { 938 /* Even part */ 939 940 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 941 tmp0 <<= CONST_BITS; 942 /* Add fudge factor here for final descale. */ 943 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 944 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 945 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ 946 tmp10 = tmp0 + tmp12; 947 tmp2 = tmp0 - tmp12 - tmp12; 948 949 /* Odd part */ 950 951 tmp12 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 952 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ 953 954 /* Final output stage */ 955 956 wsptr[3*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 957 wsptr[3*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 958 wsptr[3*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS); 959 } 960 961 /* Pass 2: process 3 rows from work array, store into output array. */ 962 963 wsptr = workspace; 964 for (ctr = 0; ctr < 3; ctr++) { 965 outptr = output_buf[ctr] + output_col; 966 967 /* Even part */ 968 969 /* Add fudge factor here for final descale. */ 970 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 971 tmp0 <<= CONST_BITS; 972 tmp2 = (INT32) wsptr[2]; 973 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ 974 tmp10 = tmp0 + tmp12; 975 tmp2 = tmp0 - tmp12 - tmp12; 976 977 /* Odd part */ 978 979 tmp12 = (INT32) wsptr[1]; 980 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ 981 982 /* Final output stage */ 983 984 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 985 CONST_BITS+PASS1_BITS+3) 986 & RANGE_MASK]; 987 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 988 CONST_BITS+PASS1_BITS+3) 989 & RANGE_MASK]; 990 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2, 991 CONST_BITS+PASS1_BITS+3) 992 & RANGE_MASK]; 993 994 wsptr += 3; /* advance pointer to next row */ 995 } 996 } 997 998 999 /* 1000 * Perform dequantization and inverse DCT on one block of coefficients, 1001 * producing a reduced-size 2x2 output block. 1002 * 1003 * Multiplication-less algorithm. 1004 */ 1005 1006 GLOBAL(void) 1007 jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1008 JCOEFPTR coef_block, 1009 JSAMPARRAY output_buf, JDIMENSION output_col) 1010 { 1011 INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; 1012 ISLOW_MULT_TYPE * quantptr; 1013 JSAMPROW outptr; 1014 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1015 SHIFT_TEMPS 1016 1017 /* Pass 1: process columns from input. */ 1018 1019 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1020 1021 /* Column 0 */ 1022 tmp4 = DEQUANTIZE(coef_block[DCTSIZE*0], quantptr[DCTSIZE*0]); 1023 tmp5 = DEQUANTIZE(coef_block[DCTSIZE*1], quantptr[DCTSIZE*1]); 1024 /* Add fudge factor here for final descale. */ 1025 tmp4 += ONE << 2; 1026 1027 tmp0 = tmp4 + tmp5; 1028 tmp2 = tmp4 - tmp5; 1029 1030 /* Column 1 */ 1031 tmp4 = DEQUANTIZE(coef_block[DCTSIZE*0+1], quantptr[DCTSIZE*0+1]); 1032 tmp5 = DEQUANTIZE(coef_block[DCTSIZE*1+1], quantptr[DCTSIZE*1+1]); 1033 1034 tmp1 = tmp4 + tmp5; 1035 tmp3 = tmp4 - tmp5; 1036 1037 /* Pass 2: process 2 rows, store into output array. */ 1038 1039 /* Row 0 */ 1040 outptr = output_buf[0] + output_col; 1041 1042 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; 1043 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; 1044 1045 /* Row 1 */ 1046 outptr = output_buf[1] + output_col; 1047 1048 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp2 + tmp3, 3) & RANGE_MASK]; 1049 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2 - tmp3, 3) & RANGE_MASK]; 1050 } 1051 1052 1053 /* 1054 * Perform dequantization and inverse DCT on one block of coefficients, 1055 * producing a reduced-size 1x1 output block. 1056 * 1057 * We hardly need an inverse DCT routine for this: just take the 1058 * average pixel value, which is one-eighth of the DC coefficient. 1059 */ 1060 1061 GLOBAL(void) 1062 jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1063 JCOEFPTR coef_block, 1064 JSAMPARRAY output_buf, JDIMENSION output_col) 1065 { 1066 int dcval; 1067 ISLOW_MULT_TYPE * quantptr; 1068 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1069 SHIFT_TEMPS 1070 1071 /* 1x1 is trivial: just take the DC coefficient divided by 8. */ 1072 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1073 dcval = DEQUANTIZE(coef_block[0], quantptr[0]); 1074 dcval = (int) DESCALE((INT32) dcval, 3); 1075 1076 output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; 1077 } 1078 1079 1080 /* 1081 * Perform dequantization and inverse DCT on one block of coefficients, 1082 * producing a 9x9 output block. 1083 * 1084 * Optimized algorithm with 10 multiplications in the 1-D kernel. 1085 * cK represents sqrt(2) * cos(K*pi/18). 1086 */ 1087 1088 GLOBAL(void) 1089 jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1090 JCOEFPTR coef_block, 1091 JSAMPARRAY output_buf, JDIMENSION output_col) 1092 { 1093 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; 1094 INT32 z1, z2, z3, z4; 1095 JCOEFPTR inptr; 1096 ISLOW_MULT_TYPE * quantptr; 1097 int * wsptr; 1098 JSAMPROW outptr; 1099 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1100 int ctr; 1101 int workspace[8*9]; /* buffers data between passes */ 1102 SHIFT_TEMPS 1103 1104 /* Pass 1: process columns from input, store into work array. */ 1105 1106 inptr = coef_block; 1107 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1108 wsptr = workspace; 1109 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 1110 /* Even part */ 1111 1112 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 1113 tmp0 <<= CONST_BITS; 1114 /* Add fudge factor here for final descale. */ 1115 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 1116 1117 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 1118 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 1119 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 1120 1121 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ 1122 tmp1 = tmp0 + tmp3; 1123 tmp2 = tmp0 - tmp3 - tmp3; 1124 1125 tmp0 = MULTIPLY(z1 - z2, FIX(0.707106781)); /* c6 */ 1126 tmp11 = tmp2 + tmp0; 1127 tmp14 = tmp2 - tmp0 - tmp0; 1128 1129 tmp0 = MULTIPLY(z1 + z2, FIX(1.328926049)); /* c2 */ 1130 tmp2 = MULTIPLY(z1, FIX(1.083350441)); /* c4 */ 1131 tmp3 = MULTIPLY(z2, FIX(0.245575608)); /* c8 */ 1132 1133 tmp10 = tmp1 + tmp0 - tmp3; 1134 tmp12 = tmp1 - tmp0 + tmp2; 1135 tmp13 = tmp1 - tmp2 + tmp3; 1136 1137 /* Odd part */ 1138 1139 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 1140 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 1141 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 1142 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 1143 1144 z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */ 1145 1146 tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */ 1147 tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */ 1148 tmp0 = tmp2 + tmp3 - z2; 1149 tmp1 = MULTIPLY(z3 - z4, FIX(1.392728481)); /* c1 */ 1150 tmp2 += z2 - tmp1; 1151 tmp3 += z2 + tmp1; 1152 tmp1 = MULTIPLY(z1 - z3 - z4, FIX(1.224744871)); /* c3 */ 1153 1154 /* Final output stage */ 1155 1156 wsptr[8*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 1157 wsptr[8*8] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 1158 wsptr[8*1] = (int) RIGHT_SHIFT(tmp11 + tmp1, CONST_BITS-PASS1_BITS); 1159 wsptr[8*7] = (int) RIGHT_SHIFT(tmp11 - tmp1, CONST_BITS-PASS1_BITS); 1160 wsptr[8*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); 1161 wsptr[8*6] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); 1162 wsptr[8*3] = (int) RIGHT_SHIFT(tmp13 + tmp3, CONST_BITS-PASS1_BITS); 1163 wsptr[8*5] = (int) RIGHT_SHIFT(tmp13 - tmp3, CONST_BITS-PASS1_BITS); 1164 wsptr[8*4] = (int) RIGHT_SHIFT(tmp14, CONST_BITS-PASS1_BITS); 1165 } 1166 1167 /* Pass 2: process 9 rows from work array, store into output array. */ 1168 1169 wsptr = workspace; 1170 for (ctr = 0; ctr < 9; ctr++) { 1171 outptr = output_buf[ctr] + output_col; 1172 1173 /* Even part */ 1174 1175 /* Add fudge factor here for final descale. */ 1176 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 1177 tmp0 <<= CONST_BITS; 1178 1179 z1 = (INT32) wsptr[2]; 1180 z2 = (INT32) wsptr[4]; 1181 z3 = (INT32) wsptr[6]; 1182 1183 tmp3 = MULTIPLY(z3, FIX(0.707106781)); /* c6 */ 1184 tmp1 = tmp0 + tmp3; 1185 tmp2 = tmp0 - tmp3 - tmp3; 1186 1187 tmp0 = MULTIPLY(z1 - z2, FIX(0.707106781)); /* c6 */ 1188 tmp11 = tmp2 + tmp0; 1189 tmp14 = tmp2 - tmp0 - tmp0; 1190 1191 tmp0 = MULTIPLY(z1 + z2, FIX(1.328926049)); /* c2 */ 1192 tmp2 = MULTIPLY(z1, FIX(1.083350441)); /* c4 */ 1193 tmp3 = MULTIPLY(z2, FIX(0.245575608)); /* c8 */ 1194 1195 tmp10 = tmp1 + tmp0 - tmp3; 1196 tmp12 = tmp1 - tmp0 + tmp2; 1197 tmp13 = tmp1 - tmp2 + tmp3; 1198 1199 /* Odd part */ 1200 1201 z1 = (INT32) wsptr[1]; 1202 z2 = (INT32) wsptr[3]; 1203 z3 = (INT32) wsptr[5]; 1204 z4 = (INT32) wsptr[7]; 1205 1206 z2 = MULTIPLY(z2, - FIX(1.224744871)); /* -c3 */ 1207 1208 tmp2 = MULTIPLY(z1 + z3, FIX(0.909038955)); /* c5 */ 1209 tmp3 = MULTIPLY(z1 + z4, FIX(0.483689525)); /* c7 */ 1210 tmp0 = tmp2 + tmp3 - z2; 1211 tmp1 = MULTIPLY(z3 - z4, FIX(1.392728481)); /* c1 */ 1212 tmp2 += z2 - tmp1; 1213 tmp3 += z2 + tmp1; 1214 tmp1 = MULTIPLY(z1 - z3 - z4, FIX(1.224744871)); /* c3 */ 1215 1216 /* Final output stage */ 1217 1218 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 1219 CONST_BITS+PASS1_BITS+3) 1220 & RANGE_MASK]; 1221 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 1222 CONST_BITS+PASS1_BITS+3) 1223 & RANGE_MASK]; 1224 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, 1225 CONST_BITS+PASS1_BITS+3) 1226 & RANGE_MASK]; 1227 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, 1228 CONST_BITS+PASS1_BITS+3) 1229 & RANGE_MASK]; 1230 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 1231 CONST_BITS+PASS1_BITS+3) 1232 & RANGE_MASK]; 1233 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 1234 CONST_BITS+PASS1_BITS+3) 1235 & RANGE_MASK]; 1236 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp3, 1237 CONST_BITS+PASS1_BITS+3) 1238 & RANGE_MASK]; 1239 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp3, 1240 CONST_BITS+PASS1_BITS+3) 1241 & RANGE_MASK]; 1242 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp14, 1243 CONST_BITS+PASS1_BITS+3) 1244 & RANGE_MASK]; 1245 1246 wsptr += 8; /* advance pointer to next row */ 1247 } 1248 } 1249 1250 1251 /* 1252 * Perform dequantization and inverse DCT on one block of coefficients, 1253 * producing a 10x10 output block. 1254 * 1255 * Optimized algorithm with 12 multiplications in the 1-D kernel. 1256 * cK represents sqrt(2) * cos(K*pi/20). 1257 */ 1258 1259 GLOBAL(void) 1260 jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1261 JCOEFPTR coef_block, 1262 JSAMPARRAY output_buf, JDIMENSION output_col) 1263 { 1264 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 1265 INT32 tmp20, tmp21, tmp22, tmp23, tmp24; 154 1266 INT32 z1, z2, z3, z4, z5; 155 1267 JCOEFPTR inptr; … … 159 1271 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 160 1272 int ctr; 161 int workspace[DCTSIZE2]; /* buffers data between passes */ 1273 int workspace[8*10]; /* buffers data between passes */ 1274 SHIFT_TEMPS 1275 1276 /* Pass 1: process columns from input, store into work array. */ 1277 1278 inptr = coef_block; 1279 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1280 wsptr = workspace; 1281 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 1282 /* Even part */ 1283 1284 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 1285 z3 <<= CONST_BITS; 1286 /* Add fudge factor here for final descale. */ 1287 z3 += ONE << (CONST_BITS-PASS1_BITS-1); 1288 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 1289 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ 1290 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ 1291 tmp10 = z3 + z1; 1292 tmp11 = z3 - z2; 1293 1294 tmp22 = RIGHT_SHIFT(z3 - ((z1 - z2) << 1), /* c0 = (c4-c8)*2 */ 1295 CONST_BITS-PASS1_BITS); 1296 1297 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 1298 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 1299 1300 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ 1301 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ 1302 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ 1303 1304 tmp20 = tmp10 + tmp12; 1305 tmp24 = tmp10 - tmp12; 1306 tmp21 = tmp11 + tmp13; 1307 tmp23 = tmp11 - tmp13; 1308 1309 /* Odd part */ 1310 1311 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 1312 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 1313 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 1314 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 1315 1316 tmp11 = z2 + z4; 1317 tmp13 = z2 - z4; 1318 1319 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ 1320 z5 = z3 << CONST_BITS; 1321 1322 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ 1323 z4 = z5 + tmp12; 1324 1325 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ 1326 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ 1327 1328 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ 1329 z4 = z5 - tmp12 - (tmp13 << (CONST_BITS - 1)); 1330 1331 tmp12 = (z1 - tmp13 - z3) << PASS1_BITS; 1332 1333 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ 1334 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ 1335 1336 /* Final output stage */ 1337 1338 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 1339 wsptr[8*9] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 1340 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 1341 wsptr[8*8] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 1342 wsptr[8*2] = (int) (tmp22 + tmp12); 1343 wsptr[8*7] = (int) (tmp22 - tmp12); 1344 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 1345 wsptr[8*6] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 1346 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 1347 wsptr[8*5] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 1348 } 1349 1350 /* Pass 2: process 10 rows from work array, store into output array. */ 1351 1352 wsptr = workspace; 1353 for (ctr = 0; ctr < 10; ctr++) { 1354 outptr = output_buf[ctr] + output_col; 1355 1356 /* Even part */ 1357 1358 /* Add fudge factor here for final descale. */ 1359 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 1360 z3 <<= CONST_BITS; 1361 z4 = (INT32) wsptr[4]; 1362 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ 1363 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ 1364 tmp10 = z3 + z1; 1365 tmp11 = z3 - z2; 1366 1367 tmp22 = z3 - ((z1 - z2) << 1); /* c0 = (c4-c8)*2 */ 1368 1369 z2 = (INT32) wsptr[2]; 1370 z3 = (INT32) wsptr[6]; 1371 1372 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ 1373 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ 1374 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ 1375 1376 tmp20 = tmp10 + tmp12; 1377 tmp24 = tmp10 - tmp12; 1378 tmp21 = tmp11 + tmp13; 1379 tmp23 = tmp11 - tmp13; 1380 1381 /* Odd part */ 1382 1383 z1 = (INT32) wsptr[1]; 1384 z2 = (INT32) wsptr[3]; 1385 z3 = (INT32) wsptr[5]; 1386 z3 <<= CONST_BITS; 1387 z4 = (INT32) wsptr[7]; 1388 1389 tmp11 = z2 + z4; 1390 tmp13 = z2 - z4; 1391 1392 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ 1393 1394 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ 1395 z4 = z3 + tmp12; 1396 1397 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ 1398 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ 1399 1400 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ 1401 z4 = z3 - tmp12 - (tmp13 << (CONST_BITS - 1)); 1402 1403 tmp12 = ((z1 - tmp13) << CONST_BITS) - z3; 1404 1405 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ 1406 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ 1407 1408 /* Final output stage */ 1409 1410 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 1411 CONST_BITS+PASS1_BITS+3) 1412 & RANGE_MASK]; 1413 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 1414 CONST_BITS+PASS1_BITS+3) 1415 & RANGE_MASK]; 1416 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 1417 CONST_BITS+PASS1_BITS+3) 1418 & RANGE_MASK]; 1419 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 1420 CONST_BITS+PASS1_BITS+3) 1421 & RANGE_MASK]; 1422 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 1423 CONST_BITS+PASS1_BITS+3) 1424 & RANGE_MASK]; 1425 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 1426 CONST_BITS+PASS1_BITS+3) 1427 & RANGE_MASK]; 1428 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 1429 CONST_BITS+PASS1_BITS+3) 1430 & RANGE_MASK]; 1431 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 1432 CONST_BITS+PASS1_BITS+3) 1433 & RANGE_MASK]; 1434 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 1435 CONST_BITS+PASS1_BITS+3) 1436 & RANGE_MASK]; 1437 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 1438 CONST_BITS+PASS1_BITS+3) 1439 & RANGE_MASK]; 1440 1441 wsptr += 8; /* advance pointer to next row */ 1442 } 1443 } 1444 1445 1446 /* 1447 * Perform dequantization and inverse DCT on one block of coefficients, 1448 * producing a 11x11 output block. 1449 * 1450 * Optimized algorithm with 24 multiplications in the 1-D kernel. 1451 * cK represents sqrt(2) * cos(K*pi/22). 1452 */ 1453 1454 GLOBAL(void) 1455 jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1456 JCOEFPTR coef_block, 1457 JSAMPARRAY output_buf, JDIMENSION output_col) 1458 { 1459 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 1460 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; 1461 INT32 z1, z2, z3, z4; 1462 JCOEFPTR inptr; 1463 ISLOW_MULT_TYPE * quantptr; 1464 int * wsptr; 1465 JSAMPROW outptr; 1466 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1467 int ctr; 1468 int workspace[8*11]; /* buffers data between passes */ 1469 SHIFT_TEMPS 1470 1471 /* Pass 1: process columns from input, store into work array. */ 1472 1473 inptr = coef_block; 1474 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1475 wsptr = workspace; 1476 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 1477 /* Even part */ 1478 1479 tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 1480 tmp10 <<= CONST_BITS; 1481 /* Add fudge factor here for final descale. */ 1482 tmp10 += ONE << (CONST_BITS-PASS1_BITS-1); 1483 1484 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 1485 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 1486 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 1487 1488 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ 1489 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ 1490 z4 = z1 + z3; 1491 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ 1492 z4 -= z2; 1493 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ 1494 tmp21 = tmp20 + tmp23 + tmp25 - 1495 MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ 1496 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ 1497 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ 1498 tmp24 += tmp25; 1499 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ 1500 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ 1501 MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ 1502 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ 1503 1504 /* Odd part */ 1505 1506 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 1507 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 1508 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 1509 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 1510 1511 tmp11 = z1 + z2; 1512 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ 1513 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ 1514 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ 1515 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ 1516 tmp10 = tmp11 + tmp12 + tmp13 - 1517 MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ 1518 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ 1519 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ 1520 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ 1521 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ 1522 tmp11 += z1; 1523 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ 1524 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ 1525 MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ 1526 MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ 1527 1528 /* Final output stage */ 1529 1530 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 1531 wsptr[8*10] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 1532 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 1533 wsptr[8*9] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 1534 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 1535 wsptr[8*8] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 1536 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 1537 wsptr[8*7] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 1538 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 1539 wsptr[8*6] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 1540 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25, CONST_BITS-PASS1_BITS); 1541 } 1542 1543 /* Pass 2: process 11 rows from work array, store into output array. */ 1544 1545 wsptr = workspace; 1546 for (ctr = 0; ctr < 11; ctr++) { 1547 outptr = output_buf[ctr] + output_col; 1548 1549 /* Even part */ 1550 1551 /* Add fudge factor here for final descale. */ 1552 tmp10 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 1553 tmp10 <<= CONST_BITS; 1554 1555 z1 = (INT32) wsptr[2]; 1556 z2 = (INT32) wsptr[4]; 1557 z3 = (INT32) wsptr[6]; 1558 1559 tmp20 = MULTIPLY(z2 - z3, FIX(2.546640132)); /* c2+c4 */ 1560 tmp23 = MULTIPLY(z2 - z1, FIX(0.430815045)); /* c2-c6 */ 1561 z4 = z1 + z3; 1562 tmp24 = MULTIPLY(z4, - FIX(1.155664402)); /* -(c2-c10) */ 1563 z4 -= z2; 1564 tmp25 = tmp10 + MULTIPLY(z4, FIX(1.356927976)); /* c2 */ 1565 tmp21 = tmp20 + tmp23 + tmp25 - 1566 MULTIPLY(z2, FIX(1.821790775)); /* c2+c4+c10-c6 */ 1567 tmp20 += tmp25 + MULTIPLY(z3, FIX(2.115825087)); /* c4+c6 */ 1568 tmp23 += tmp25 - MULTIPLY(z1, FIX(1.513598477)); /* c6+c8 */ 1569 tmp24 += tmp25; 1570 tmp22 = tmp24 - MULTIPLY(z3, FIX(0.788749120)); /* c8+c10 */ 1571 tmp24 += MULTIPLY(z2, FIX(1.944413522)) - /* c2+c8 */ 1572 MULTIPLY(z1, FIX(1.390975730)); /* c4+c10 */ 1573 tmp25 = tmp10 - MULTIPLY(z4, FIX(1.414213562)); /* c0 */ 1574 1575 /* Odd part */ 1576 1577 z1 = (INT32) wsptr[1]; 1578 z2 = (INT32) wsptr[3]; 1579 z3 = (INT32) wsptr[5]; 1580 z4 = (INT32) wsptr[7]; 1581 1582 tmp11 = z1 + z2; 1583 tmp14 = MULTIPLY(tmp11 + z3 + z4, FIX(0.398430003)); /* c9 */ 1584 tmp11 = MULTIPLY(tmp11, FIX(0.887983902)); /* c3-c9 */ 1585 tmp12 = MULTIPLY(z1 + z3, FIX(0.670361295)); /* c5-c9 */ 1586 tmp13 = tmp14 + MULTIPLY(z1 + z4, FIX(0.366151574)); /* c7-c9 */ 1587 tmp10 = tmp11 + tmp12 + tmp13 - 1588 MULTIPLY(z1, FIX(0.923107866)); /* c7+c5+c3-c1-2*c9 */ 1589 z1 = tmp14 - MULTIPLY(z2 + z3, FIX(1.163011579)); /* c7+c9 */ 1590 tmp11 += z1 + MULTIPLY(z2, FIX(2.073276588)); /* c1+c7+3*c9-c3 */ 1591 tmp12 += z1 - MULTIPLY(z3, FIX(1.192193623)); /* c3+c5-c7-c9 */ 1592 z1 = MULTIPLY(z2 + z4, - FIX(1.798248910)); /* -(c1+c9) */ 1593 tmp11 += z1; 1594 tmp13 += z1 + MULTIPLY(z4, FIX(2.102458632)); /* c1+c5+c9-c7 */ 1595 tmp14 += MULTIPLY(z2, - FIX(1.467221301)) + /* -(c5+c9) */ 1596 MULTIPLY(z3, FIX(1.001388905)) - /* c1-c9 */ 1597 MULTIPLY(z4, FIX(1.684843907)); /* c3+c9 */ 1598 1599 /* Final output stage */ 1600 1601 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 1602 CONST_BITS+PASS1_BITS+3) 1603 & RANGE_MASK]; 1604 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 1605 CONST_BITS+PASS1_BITS+3) 1606 & RANGE_MASK]; 1607 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 1608 CONST_BITS+PASS1_BITS+3) 1609 & RANGE_MASK]; 1610 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 1611 CONST_BITS+PASS1_BITS+3) 1612 & RANGE_MASK]; 1613 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 1614 CONST_BITS+PASS1_BITS+3) 1615 & RANGE_MASK]; 1616 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 1617 CONST_BITS+PASS1_BITS+3) 1618 & RANGE_MASK]; 1619 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 1620 CONST_BITS+PASS1_BITS+3) 1621 & RANGE_MASK]; 1622 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 1623 CONST_BITS+PASS1_BITS+3) 1624 & RANGE_MASK]; 1625 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 1626 CONST_BITS+PASS1_BITS+3) 1627 & RANGE_MASK]; 1628 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 1629 CONST_BITS+PASS1_BITS+3) 1630 & RANGE_MASK]; 1631 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25, 1632 CONST_BITS+PASS1_BITS+3) 1633 & RANGE_MASK]; 1634 1635 wsptr += 8; /* advance pointer to next row */ 1636 } 1637 } 1638 1639 1640 /* 1641 * Perform dequantization and inverse DCT on one block of coefficients, 1642 * producing a 12x12 output block. 1643 * 1644 * Optimized algorithm with 15 multiplications in the 1-D kernel. 1645 * cK represents sqrt(2) * cos(K*pi/24). 1646 */ 1647 1648 GLOBAL(void) 1649 jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1650 JCOEFPTR coef_block, 1651 JSAMPARRAY output_buf, JDIMENSION output_col) 1652 { 1653 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 1654 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; 1655 INT32 z1, z2, z3, z4; 1656 JCOEFPTR inptr; 1657 ISLOW_MULT_TYPE * quantptr; 1658 int * wsptr; 1659 JSAMPROW outptr; 1660 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1661 int ctr; 1662 int workspace[8*12]; /* buffers data between passes */ 1663 SHIFT_TEMPS 1664 1665 /* Pass 1: process columns from input, store into work array. */ 1666 1667 inptr = coef_block; 1668 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1669 wsptr = workspace; 1670 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 1671 /* Even part */ 1672 1673 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 1674 z3 <<= CONST_BITS; 1675 /* Add fudge factor here for final descale. */ 1676 z3 += ONE << (CONST_BITS-PASS1_BITS-1); 1677 1678 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 1679 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ 1680 1681 tmp10 = z3 + z4; 1682 tmp11 = z3 - z4; 1683 1684 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 1685 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ 1686 z1 <<= CONST_BITS; 1687 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 1688 z2 <<= CONST_BITS; 1689 1690 tmp12 = z1 - z2; 1691 1692 tmp21 = z3 + tmp12; 1693 tmp24 = z3 - tmp12; 1694 1695 tmp12 = z4 + z2; 1696 1697 tmp20 = tmp10 + tmp12; 1698 tmp25 = tmp10 - tmp12; 1699 1700 tmp12 = z4 - z1 - z2; 1701 1702 tmp22 = tmp11 + tmp12; 1703 tmp23 = tmp11 - tmp12; 1704 1705 /* Odd part */ 1706 1707 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 1708 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 1709 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 1710 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 1711 1712 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ 1713 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ 1714 1715 tmp10 = z1 + z3; 1716 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ 1717 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ 1718 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ 1719 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ 1720 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ 1721 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ 1722 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ 1723 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ 1724 1725 z1 -= z4; 1726 z2 -= z3; 1727 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ 1728 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ 1729 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ 1730 1731 /* Final output stage */ 1732 1733 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 1734 wsptr[8*11] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 1735 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 1736 wsptr[8*10] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 1737 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 1738 wsptr[8*9] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 1739 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 1740 wsptr[8*8] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 1741 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 1742 wsptr[8*7] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 1743 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 1744 wsptr[8*6] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 1745 } 1746 1747 /* Pass 2: process 12 rows from work array, store into output array. */ 1748 1749 wsptr = workspace; 1750 for (ctr = 0; ctr < 12; ctr++) { 1751 outptr = output_buf[ctr] + output_col; 1752 1753 /* Even part */ 1754 1755 /* Add fudge factor here for final descale. */ 1756 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 1757 z3 <<= CONST_BITS; 1758 1759 z4 = (INT32) wsptr[4]; 1760 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ 1761 1762 tmp10 = z3 + z4; 1763 tmp11 = z3 - z4; 1764 1765 z1 = (INT32) wsptr[2]; 1766 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ 1767 z1 <<= CONST_BITS; 1768 z2 = (INT32) wsptr[6]; 1769 z2 <<= CONST_BITS; 1770 1771 tmp12 = z1 - z2; 1772 1773 tmp21 = z3 + tmp12; 1774 tmp24 = z3 - tmp12; 1775 1776 tmp12 = z4 + z2; 1777 1778 tmp20 = tmp10 + tmp12; 1779 tmp25 = tmp10 - tmp12; 1780 1781 tmp12 = z4 - z1 - z2; 1782 1783 tmp22 = tmp11 + tmp12; 1784 tmp23 = tmp11 - tmp12; 1785 1786 /* Odd part */ 1787 1788 z1 = (INT32) wsptr[1]; 1789 z2 = (INT32) wsptr[3]; 1790 z3 = (INT32) wsptr[5]; 1791 z4 = (INT32) wsptr[7]; 1792 1793 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ 1794 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ 1795 1796 tmp10 = z1 + z3; 1797 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ 1798 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ 1799 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ 1800 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ 1801 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ 1802 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ 1803 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ 1804 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ 1805 1806 z1 -= z4; 1807 z2 -= z3; 1808 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ 1809 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ 1810 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ 1811 1812 /* Final output stage */ 1813 1814 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 1815 CONST_BITS+PASS1_BITS+3) 1816 & RANGE_MASK]; 1817 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 1818 CONST_BITS+PASS1_BITS+3) 1819 & RANGE_MASK]; 1820 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 1821 CONST_BITS+PASS1_BITS+3) 1822 & RANGE_MASK]; 1823 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 1824 CONST_BITS+PASS1_BITS+3) 1825 & RANGE_MASK]; 1826 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 1827 CONST_BITS+PASS1_BITS+3) 1828 & RANGE_MASK]; 1829 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 1830 CONST_BITS+PASS1_BITS+3) 1831 & RANGE_MASK]; 1832 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 1833 CONST_BITS+PASS1_BITS+3) 1834 & RANGE_MASK]; 1835 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 1836 CONST_BITS+PASS1_BITS+3) 1837 & RANGE_MASK]; 1838 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 1839 CONST_BITS+PASS1_BITS+3) 1840 & RANGE_MASK]; 1841 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 1842 CONST_BITS+PASS1_BITS+3) 1843 & RANGE_MASK]; 1844 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 1845 CONST_BITS+PASS1_BITS+3) 1846 & RANGE_MASK]; 1847 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 1848 CONST_BITS+PASS1_BITS+3) 1849 & RANGE_MASK]; 1850 1851 wsptr += 8; /* advance pointer to next row */ 1852 } 1853 } 1854 1855 1856 /* 1857 * Perform dequantization and inverse DCT on one block of coefficients, 1858 * producing a 13x13 output block. 1859 * 1860 * Optimized algorithm with 29 multiplications in the 1-D kernel. 1861 * cK represents sqrt(2) * cos(K*pi/26). 1862 */ 1863 1864 GLOBAL(void) 1865 jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 1866 JCOEFPTR coef_block, 1867 JSAMPARRAY output_buf, JDIMENSION output_col) 1868 { 1869 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 1870 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; 1871 INT32 z1, z2, z3, z4; 1872 JCOEFPTR inptr; 1873 ISLOW_MULT_TYPE * quantptr; 1874 int * wsptr; 1875 JSAMPROW outptr; 1876 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 1877 int ctr; 1878 int workspace[8*13]; /* buffers data between passes */ 1879 SHIFT_TEMPS 1880 1881 /* Pass 1: process columns from input, store into work array. */ 1882 1883 inptr = coef_block; 1884 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 1885 wsptr = workspace; 1886 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 1887 /* Even part */ 1888 1889 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 1890 z1 <<= CONST_BITS; 1891 /* Add fudge factor here for final descale. */ 1892 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 1893 1894 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 1895 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 1896 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 1897 1898 tmp10 = z3 + z4; 1899 tmp11 = z3 - z4; 1900 1901 tmp12 = MULTIPLY(tmp10, FIX(1.155388986)); /* (c4+c6)/2 */ 1902 tmp13 = MULTIPLY(tmp11, FIX(0.096834934)) + z1; /* (c4-c6)/2 */ 1903 1904 tmp20 = MULTIPLY(z2, FIX(1.373119086)) + tmp12 + tmp13; /* c2 */ 1905 tmp22 = MULTIPLY(z2, FIX(0.501487041)) - tmp12 + tmp13; /* c10 */ 1906 1907 tmp12 = MULTIPLY(tmp10, FIX(0.316450131)); /* (c8-c12)/2 */ 1908 tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */ 1909 1910 tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */ 1911 tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */ 1912 1913 tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */ 1914 tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */ 1915 1916 tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */ 1917 tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */ 1918 1919 tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */ 1920 1921 /* Odd part */ 1922 1923 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 1924 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 1925 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 1926 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 1927 1928 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ 1929 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ 1930 tmp15 = z1 + z4; 1931 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ 1932 tmp10 = tmp11 + tmp12 + tmp13 - 1933 MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ 1934 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ 1935 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ 1936 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ 1937 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ 1938 tmp11 += tmp14; 1939 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ 1940 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ 1941 tmp12 += tmp14; 1942 tmp13 += tmp14; 1943 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ 1944 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ 1945 MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ 1946 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ 1947 tmp14 += z1; 1948 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ 1949 MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ 1950 1951 /* Final output stage */ 1952 1953 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 1954 wsptr[8*12] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 1955 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 1956 wsptr[8*11] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 1957 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 1958 wsptr[8*10] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 1959 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 1960 wsptr[8*9] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 1961 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 1962 wsptr[8*8] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 1963 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 1964 wsptr[8*7] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 1965 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26, CONST_BITS-PASS1_BITS); 1966 } 1967 1968 /* Pass 2: process 13 rows from work array, store into output array. */ 1969 1970 wsptr = workspace; 1971 for (ctr = 0; ctr < 13; ctr++) { 1972 outptr = output_buf[ctr] + output_col; 1973 1974 /* Even part */ 1975 1976 /* Add fudge factor here for final descale. */ 1977 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 1978 z1 <<= CONST_BITS; 1979 1980 z2 = (INT32) wsptr[2]; 1981 z3 = (INT32) wsptr[4]; 1982 z4 = (INT32) wsptr[6]; 1983 1984 tmp10 = z3 + z4; 1985 tmp11 = z3 - z4; 1986 1987 tmp12 = MULTIPLY(tmp10, FIX(1.155388986)); /* (c4+c6)/2 */ 1988 tmp13 = MULTIPLY(tmp11, FIX(0.096834934)) + z1; /* (c4-c6)/2 */ 1989 1990 tmp20 = MULTIPLY(z2, FIX(1.373119086)) + tmp12 + tmp13; /* c2 */ 1991 tmp22 = MULTIPLY(z2, FIX(0.501487041)) - tmp12 + tmp13; /* c10 */ 1992 1993 tmp12 = MULTIPLY(tmp10, FIX(0.316450131)); /* (c8-c12)/2 */ 1994 tmp13 = MULTIPLY(tmp11, FIX(0.486914739)) + z1; /* (c8+c12)/2 */ 1995 1996 tmp21 = MULTIPLY(z2, FIX(1.058554052)) - tmp12 + tmp13; /* c6 */ 1997 tmp25 = MULTIPLY(z2, - FIX(1.252223920)) + tmp12 + tmp13; /* c4 */ 1998 1999 tmp12 = MULTIPLY(tmp10, FIX(0.435816023)); /* (c2-c10)/2 */ 2000 tmp13 = MULTIPLY(tmp11, FIX(0.937303064)) - z1; /* (c2+c10)/2 */ 2001 2002 tmp23 = MULTIPLY(z2, - FIX(0.170464608)) - tmp12 - tmp13; /* c12 */ 2003 tmp24 = MULTIPLY(z2, - FIX(0.803364869)) + tmp12 - tmp13; /* c8 */ 2004 2005 tmp26 = MULTIPLY(tmp11 - z2, FIX(1.414213562)) + z1; /* c0 */ 2006 2007 /* Odd part */ 2008 2009 z1 = (INT32) wsptr[1]; 2010 z2 = (INT32) wsptr[3]; 2011 z3 = (INT32) wsptr[5]; 2012 z4 = (INT32) wsptr[7]; 2013 2014 tmp11 = MULTIPLY(z1 + z2, FIX(1.322312651)); /* c3 */ 2015 tmp12 = MULTIPLY(z1 + z3, FIX(1.163874945)); /* c5 */ 2016 tmp15 = z1 + z4; 2017 tmp13 = MULTIPLY(tmp15, FIX(0.937797057)); /* c7 */ 2018 tmp10 = tmp11 + tmp12 + tmp13 - 2019 MULTIPLY(z1, FIX(2.020082300)); /* c7+c5+c3-c1 */ 2020 tmp14 = MULTIPLY(z2 + z3, - FIX(0.338443458)); /* -c11 */ 2021 tmp11 += tmp14 + MULTIPLY(z2, FIX(0.837223564)); /* c5+c9+c11-c3 */ 2022 tmp12 += tmp14 - MULTIPLY(z3, FIX(1.572116027)); /* c1+c5-c9-c11 */ 2023 tmp14 = MULTIPLY(z2 + z4, - FIX(1.163874945)); /* -c5 */ 2024 tmp11 += tmp14; 2025 tmp13 += tmp14 + MULTIPLY(z4, FIX(2.205608352)); /* c3+c5+c9-c7 */ 2026 tmp14 = MULTIPLY(z3 + z4, - FIX(0.657217813)); /* -c9 */ 2027 tmp12 += tmp14; 2028 tmp13 += tmp14; 2029 tmp15 = MULTIPLY(tmp15, FIX(0.338443458)); /* c11 */ 2030 tmp14 = tmp15 + MULTIPLY(z1, FIX(0.318774355)) - /* c9-c11 */ 2031 MULTIPLY(z2, FIX(0.466105296)); /* c1-c7 */ 2032 z1 = MULTIPLY(z3 - z2, FIX(0.937797057)); /* c7 */ 2033 tmp14 += z1; 2034 tmp15 += z1 + MULTIPLY(z3, FIX(0.384515595)) - /* c3-c7 */ 2035 MULTIPLY(z4, FIX(1.742345811)); /* c1+c11 */ 2036 2037 /* Final output stage */ 2038 2039 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 2040 CONST_BITS+PASS1_BITS+3) 2041 & RANGE_MASK]; 2042 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 2043 CONST_BITS+PASS1_BITS+3) 2044 & RANGE_MASK]; 2045 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 2046 CONST_BITS+PASS1_BITS+3) 2047 & RANGE_MASK]; 2048 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 2049 CONST_BITS+PASS1_BITS+3) 2050 & RANGE_MASK]; 2051 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 2052 CONST_BITS+PASS1_BITS+3) 2053 & RANGE_MASK]; 2054 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 2055 CONST_BITS+PASS1_BITS+3) 2056 & RANGE_MASK]; 2057 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 2058 CONST_BITS+PASS1_BITS+3) 2059 & RANGE_MASK]; 2060 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 2061 CONST_BITS+PASS1_BITS+3) 2062 & RANGE_MASK]; 2063 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 2064 CONST_BITS+PASS1_BITS+3) 2065 & RANGE_MASK]; 2066 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 2067 CONST_BITS+PASS1_BITS+3) 2068 & RANGE_MASK]; 2069 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 2070 CONST_BITS+PASS1_BITS+3) 2071 & RANGE_MASK]; 2072 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 2073 CONST_BITS+PASS1_BITS+3) 2074 & RANGE_MASK]; 2075 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26, 2076 CONST_BITS+PASS1_BITS+3) 2077 & RANGE_MASK]; 2078 2079 wsptr += 8; /* advance pointer to next row */ 2080 } 2081 } 2082 2083 2084 /* 2085 * Perform dequantization and inverse DCT on one block of coefficients, 2086 * producing a 14x14 output block. 2087 * 2088 * Optimized algorithm with 20 multiplications in the 1-D kernel. 2089 * cK represents sqrt(2) * cos(K*pi/28). 2090 */ 2091 2092 GLOBAL(void) 2093 jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 2094 JCOEFPTR coef_block, 2095 JSAMPARRAY output_buf, JDIMENSION output_col) 2096 { 2097 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 2098 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; 2099 INT32 z1, z2, z3, z4; 2100 JCOEFPTR inptr; 2101 ISLOW_MULT_TYPE * quantptr; 2102 int * wsptr; 2103 JSAMPROW outptr; 2104 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 2105 int ctr; 2106 int workspace[8*14]; /* buffers data between passes */ 2107 SHIFT_TEMPS 2108 2109 /* Pass 1: process columns from input, store into work array. */ 2110 2111 inptr = coef_block; 2112 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 2113 wsptr = workspace; 2114 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 2115 /* Even part */ 2116 2117 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 2118 z1 <<= CONST_BITS; 2119 /* Add fudge factor here for final descale. */ 2120 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 2121 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 2122 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ 2123 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ 2124 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ 2125 2126 tmp10 = z1 + z2; 2127 tmp11 = z1 + z3; 2128 tmp12 = z1 - z4; 2129 2130 tmp23 = RIGHT_SHIFT(z1 - ((z2 + z3 - z4) << 1), /* c0 = (c4+c12-c8)*2 */ 2131 CONST_BITS-PASS1_BITS); 2132 2133 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 2134 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 2135 2136 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ 2137 2138 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ 2139 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ 2140 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ 2141 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ 2142 2143 tmp20 = tmp10 + tmp13; 2144 tmp26 = tmp10 - tmp13; 2145 tmp21 = tmp11 + tmp14; 2146 tmp25 = tmp11 - tmp14; 2147 tmp22 = tmp12 + tmp15; 2148 tmp24 = tmp12 - tmp15; 2149 2150 /* Odd part */ 2151 2152 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 2153 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 2154 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 2155 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 2156 tmp13 = z4 << CONST_BITS; 2157 2158 tmp14 = z1 + z3; 2159 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ 2160 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ 2161 tmp10 = tmp11 + tmp12 + tmp13 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ 2162 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ 2163 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ 2164 z1 -= z2; 2165 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - tmp13; /* c11 */ 2166 tmp16 += tmp15; 2167 z1 += z4; 2168 z4 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - tmp13; /* -c13 */ 2169 tmp11 += z4 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ 2170 tmp12 += z4 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ 2171 z4 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ 2172 tmp14 += z4 + tmp13 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ 2173 tmp15 += z4 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ 2174 2175 tmp13 = (z1 - z3) << PASS1_BITS; 2176 2177 /* Final output stage */ 2178 2179 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 2180 wsptr[8*13] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 2181 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 2182 wsptr[8*12] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 2183 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 2184 wsptr[8*11] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 2185 wsptr[8*3] = (int) (tmp23 + tmp13); 2186 wsptr[8*10] = (int) (tmp23 - tmp13); 2187 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 2188 wsptr[8*9] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 2189 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 2190 wsptr[8*8] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 2191 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS); 2192 wsptr[8*7] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS); 2193 } 2194 2195 /* Pass 2: process 14 rows from work array, store into output array. */ 2196 2197 wsptr = workspace; 2198 for (ctr = 0; ctr < 14; ctr++) { 2199 outptr = output_buf[ctr] + output_col; 2200 2201 /* Even part */ 2202 2203 /* Add fudge factor here for final descale. */ 2204 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 2205 z1 <<= CONST_BITS; 2206 z4 = (INT32) wsptr[4]; 2207 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ 2208 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ 2209 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ 2210 2211 tmp10 = z1 + z2; 2212 tmp11 = z1 + z3; 2213 tmp12 = z1 - z4; 2214 2215 tmp23 = z1 - ((z2 + z3 - z4) << 1); /* c0 = (c4+c12-c8)*2 */ 2216 2217 z1 = (INT32) wsptr[2]; 2218 z2 = (INT32) wsptr[6]; 2219 2220 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ 2221 2222 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ 2223 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ 2224 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ 2225 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ 2226 2227 tmp20 = tmp10 + tmp13; 2228 tmp26 = tmp10 - tmp13; 2229 tmp21 = tmp11 + tmp14; 2230 tmp25 = tmp11 - tmp14; 2231 tmp22 = tmp12 + tmp15; 2232 tmp24 = tmp12 - tmp15; 2233 2234 /* Odd part */ 2235 2236 z1 = (INT32) wsptr[1]; 2237 z2 = (INT32) wsptr[3]; 2238 z3 = (INT32) wsptr[5]; 2239 z4 = (INT32) wsptr[7]; 2240 z4 <<= CONST_BITS; 2241 2242 tmp14 = z1 + z3; 2243 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ 2244 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ 2245 tmp10 = tmp11 + tmp12 + z4 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ 2246 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ 2247 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ 2248 z1 -= z2; 2249 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - z4; /* c11 */ 2250 tmp16 += tmp15; 2251 tmp13 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - z4; /* -c13 */ 2252 tmp11 += tmp13 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ 2253 tmp12 += tmp13 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ 2254 tmp13 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ 2255 tmp14 += tmp13 + z4 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ 2256 tmp15 += tmp13 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ 2257 2258 tmp13 = ((z1 - z3) << CONST_BITS) + z4; 2259 2260 /* Final output stage */ 2261 2262 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 2263 CONST_BITS+PASS1_BITS+3) 2264 & RANGE_MASK]; 2265 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 2266 CONST_BITS+PASS1_BITS+3) 2267 & RANGE_MASK]; 2268 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 2269 CONST_BITS+PASS1_BITS+3) 2270 & RANGE_MASK]; 2271 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 2272 CONST_BITS+PASS1_BITS+3) 2273 & RANGE_MASK]; 2274 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 2275 CONST_BITS+PASS1_BITS+3) 2276 & RANGE_MASK]; 2277 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 2278 CONST_BITS+PASS1_BITS+3) 2279 & RANGE_MASK]; 2280 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 2281 CONST_BITS+PASS1_BITS+3) 2282 & RANGE_MASK]; 2283 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 2284 CONST_BITS+PASS1_BITS+3) 2285 & RANGE_MASK]; 2286 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 2287 CONST_BITS+PASS1_BITS+3) 2288 & RANGE_MASK]; 2289 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 2290 CONST_BITS+PASS1_BITS+3) 2291 & RANGE_MASK]; 2292 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 2293 CONST_BITS+PASS1_BITS+3) 2294 & RANGE_MASK]; 2295 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 2296 CONST_BITS+PASS1_BITS+3) 2297 & RANGE_MASK]; 2298 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, 2299 CONST_BITS+PASS1_BITS+3) 2300 & RANGE_MASK]; 2301 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, 2302 CONST_BITS+PASS1_BITS+3) 2303 & RANGE_MASK]; 2304 2305 wsptr += 8; /* advance pointer to next row */ 2306 } 2307 } 2308 2309 2310 /* 2311 * Perform dequantization and inverse DCT on one block of coefficients, 2312 * producing a 15x15 output block. 2313 * 2314 * Optimized algorithm with 22 multiplications in the 1-D kernel. 2315 * cK represents sqrt(2) * cos(K*pi/30). 2316 */ 2317 2318 GLOBAL(void) 2319 jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 2320 JCOEFPTR coef_block, 2321 JSAMPARRAY output_buf, JDIMENSION output_col) 2322 { 2323 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 2324 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; 2325 INT32 z1, z2, z3, z4; 2326 JCOEFPTR inptr; 2327 ISLOW_MULT_TYPE * quantptr; 2328 int * wsptr; 2329 JSAMPROW outptr; 2330 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 2331 int ctr; 2332 int workspace[8*15]; /* buffers data between passes */ 2333 SHIFT_TEMPS 2334 2335 /* Pass 1: process columns from input, store into work array. */ 2336 2337 inptr = coef_block; 2338 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 2339 wsptr = workspace; 2340 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 2341 /* Even part */ 2342 2343 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 2344 z1 <<= CONST_BITS; 2345 /* Add fudge factor here for final descale. */ 2346 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 2347 2348 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 2349 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 2350 z4 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 2351 2352 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ 2353 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ 2354 2355 tmp12 = z1 - tmp10; 2356 tmp13 = z1 + tmp11; 2357 z1 -= (tmp11 - tmp10) << 1; /* c0 = (c6-c12)*2 */ 2358 2359 z4 = z2 - z3; 2360 z3 += z2; 2361 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ 2362 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ 2363 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ 2364 2365 tmp20 = tmp13 + tmp10 + tmp11; 2366 tmp23 = tmp12 - tmp10 + tmp11 + z2; 2367 2368 tmp10 = MULTIPLY(z3, FIX(0.547059574)); /* (c8+c14)/2 */ 2369 tmp11 = MULTIPLY(z4, FIX(0.399234004)); /* (c8-c14)/2 */ 2370 2371 tmp25 = tmp13 - tmp10 - tmp11; 2372 tmp26 = tmp12 + tmp10 - tmp11 - z2; 2373 2374 tmp10 = MULTIPLY(z3, FIX(0.790569415)); /* (c6+c12)/2 */ 2375 tmp11 = MULTIPLY(z4, FIX(0.353553391)); /* (c6-c12)/2 */ 2376 2377 tmp21 = tmp12 + tmp10 + tmp11; 2378 tmp24 = tmp13 - tmp10 + tmp11; 2379 tmp11 += tmp11; 2380 tmp22 = z1 + tmp11; /* c10 = c6-c12 */ 2381 tmp27 = z1 - tmp11 - tmp11; /* c0 = (c6-c12)*2 */ 2382 2383 /* Odd part */ 2384 2385 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 2386 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 2387 z4 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 2388 z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */ 2389 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 2390 2391 tmp13 = z2 - z4; 2392 tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */ 2393 tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */ 2394 tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */ 2395 2396 tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */ 2397 tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */ 2398 z2 = z1 - z4; 2399 tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */ 2400 2401 tmp10 = tmp12 + MULTIPLY(z4, FIX(2.457431844)) - tmp15; /* c1+c7 */ 2402 tmp16 = tmp12 - MULTIPLY(z1, FIX(1.112434820)) + tmp13; /* c1-c13 */ 2403 tmp12 = MULTIPLY(z2, FIX(1.224744871)) - z3; /* c5 */ 2404 z2 = MULTIPLY(z1 + z4, FIX(0.575212477)); /* c11 */ 2405 tmp13 += z2 + MULTIPLY(z1, FIX(0.475753014)) - z3; /* c7-c11 */ 2406 tmp15 += z2 - MULTIPLY(z4, FIX(0.869244010)) + z3; /* c11+c13 */ 2407 2408 /* Final output stage */ 2409 2410 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 2411 wsptr[8*14] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 2412 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 2413 wsptr[8*13] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 2414 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 2415 wsptr[8*12] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 2416 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 2417 wsptr[8*11] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 2418 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 2419 wsptr[8*10] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 2420 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 2421 wsptr[8*9] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 2422 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS); 2423 wsptr[8*8] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS); 2424 wsptr[8*7] = (int) RIGHT_SHIFT(tmp27, CONST_BITS-PASS1_BITS); 2425 } 2426 2427 /* Pass 2: process 15 rows from work array, store into output array. */ 2428 2429 wsptr = workspace; 2430 for (ctr = 0; ctr < 15; ctr++) { 2431 outptr = output_buf[ctr] + output_col; 2432 2433 /* Even part */ 2434 2435 /* Add fudge factor here for final descale. */ 2436 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 2437 z1 <<= CONST_BITS; 2438 2439 z2 = (INT32) wsptr[2]; 2440 z3 = (INT32) wsptr[4]; 2441 z4 = (INT32) wsptr[6]; 2442 2443 tmp10 = MULTIPLY(z4, FIX(0.437016024)); /* c12 */ 2444 tmp11 = MULTIPLY(z4, FIX(1.144122806)); /* c6 */ 2445 2446 tmp12 = z1 - tmp10; 2447 tmp13 = z1 + tmp11; 2448 z1 -= (tmp11 - tmp10) << 1; /* c0 = (c6-c12)*2 */ 2449 2450 z4 = z2 - z3; 2451 z3 += z2; 2452 tmp10 = MULTIPLY(z3, FIX(1.337628990)); /* (c2+c4)/2 */ 2453 tmp11 = MULTIPLY(z4, FIX(0.045680613)); /* (c2-c4)/2 */ 2454 z2 = MULTIPLY(z2, FIX(1.439773946)); /* c4+c14 */ 2455 2456 tmp20 = tmp13 + tmp10 + tmp11; 2457 tmp23 = tmp12 - tmp10 + tmp11 + z2; 2458 2459 tmp10 = MULTIPLY(z3, FIX(0.547059574)); /* (c8+c14)/2 */ 2460 tmp11 = MULTIPLY(z4, FIX(0.399234004)); /* (c8-c14)/2 */ 2461 2462 tmp25 = tmp13 - tmp10 - tmp11; 2463 tmp26 = tmp12 + tmp10 - tmp11 - z2; 2464 2465 tmp10 = MULTIPLY(z3, FIX(0.790569415)); /* (c6+c12)/2 */ 2466 tmp11 = MULTIPLY(z4, FIX(0.353553391)); /* (c6-c12)/2 */ 2467 2468 tmp21 = tmp12 + tmp10 + tmp11; 2469 tmp24 = tmp13 - tmp10 + tmp11; 2470 tmp11 += tmp11; 2471 tmp22 = z1 + tmp11; /* c10 = c6-c12 */ 2472 tmp27 = z1 - tmp11 - tmp11; /* c0 = (c6-c12)*2 */ 2473 2474 /* Odd part */ 2475 2476 z1 = (INT32) wsptr[1]; 2477 z2 = (INT32) wsptr[3]; 2478 z4 = (INT32) wsptr[5]; 2479 z3 = MULTIPLY(z4, FIX(1.224744871)); /* c5 */ 2480 z4 = (INT32) wsptr[7]; 2481 2482 tmp13 = z2 - z4; 2483 tmp15 = MULTIPLY(z1 + tmp13, FIX(0.831253876)); /* c9 */ 2484 tmp11 = tmp15 + MULTIPLY(z1, FIX(0.513743148)); /* c3-c9 */ 2485 tmp14 = tmp15 - MULTIPLY(tmp13, FIX(2.176250899)); /* c3+c9 */ 2486 2487 tmp13 = MULTIPLY(z2, - FIX(0.831253876)); /* -c9 */ 2488 tmp15 = MULTIPLY(z2, - FIX(1.344997024)); /* -c3 */ 2489 z2 = z1 - z4; 2490 tmp12 = z3 + MULTIPLY(z2, FIX(1.406466353)); /* c1 */ 2491 2492 tmp10 = tmp12 + MULTIPLY(z4, FIX(2.457431844)) - tmp15; /* c1+c7 */ 2493 tmp16 = tmp12 - MULTIPLY(z1, FIX(1.112434820)) + tmp13; /* c1-c13 */ 2494 tmp12 = MULTIPLY(z2, FIX(1.224744871)) - z3; /* c5 */ 2495 z2 = MULTIPLY(z1 + z4, FIX(0.575212477)); /* c11 */ 2496 tmp13 += z2 + MULTIPLY(z1, FIX(0.475753014)) - z3; /* c7-c11 */ 2497 tmp15 += z2 - MULTIPLY(z4, FIX(0.869244010)) + z3; /* c11+c13 */ 2498 2499 /* Final output stage */ 2500 2501 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 2502 CONST_BITS+PASS1_BITS+3) 2503 & RANGE_MASK]; 2504 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 2505 CONST_BITS+PASS1_BITS+3) 2506 & RANGE_MASK]; 2507 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 2508 CONST_BITS+PASS1_BITS+3) 2509 & RANGE_MASK]; 2510 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 2511 CONST_BITS+PASS1_BITS+3) 2512 & RANGE_MASK]; 2513 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 2514 CONST_BITS+PASS1_BITS+3) 2515 & RANGE_MASK]; 2516 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 2517 CONST_BITS+PASS1_BITS+3) 2518 & RANGE_MASK]; 2519 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 2520 CONST_BITS+PASS1_BITS+3) 2521 & RANGE_MASK]; 2522 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 2523 CONST_BITS+PASS1_BITS+3) 2524 & RANGE_MASK]; 2525 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 2526 CONST_BITS+PASS1_BITS+3) 2527 & RANGE_MASK]; 2528 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 2529 CONST_BITS+PASS1_BITS+3) 2530 & RANGE_MASK]; 2531 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 2532 CONST_BITS+PASS1_BITS+3) 2533 & RANGE_MASK]; 2534 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 2535 CONST_BITS+PASS1_BITS+3) 2536 & RANGE_MASK]; 2537 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, 2538 CONST_BITS+PASS1_BITS+3) 2539 & RANGE_MASK]; 2540 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, 2541 CONST_BITS+PASS1_BITS+3) 2542 & RANGE_MASK]; 2543 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27, 2544 CONST_BITS+PASS1_BITS+3) 2545 & RANGE_MASK]; 2546 2547 wsptr += 8; /* advance pointer to next row */ 2548 } 2549 } 2550 2551 2552 /* 2553 * Perform dequantization and inverse DCT on one block of coefficients, 2554 * producing a 16x16 output block. 2555 * 2556 * Optimized algorithm with 28 multiplications in the 1-D kernel. 2557 * cK represents sqrt(2) * cos(K*pi/32). 2558 */ 2559 2560 GLOBAL(void) 2561 jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 2562 JCOEFPTR coef_block, 2563 JSAMPARRAY output_buf, JDIMENSION output_col) 2564 { 2565 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; 2566 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; 2567 INT32 z1, z2, z3, z4; 2568 JCOEFPTR inptr; 2569 ISLOW_MULT_TYPE * quantptr; 2570 int * wsptr; 2571 JSAMPROW outptr; 2572 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 2573 int ctr; 2574 int workspace[8*16]; /* buffers data between passes */ 2575 SHIFT_TEMPS 2576 2577 /* Pass 1: process columns from input, store into work array. */ 2578 2579 inptr = coef_block; 2580 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 2581 wsptr = workspace; 2582 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 2583 /* Even part */ 2584 2585 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 2586 tmp0 <<= CONST_BITS; 2587 /* Add fudge factor here for final descale. */ 2588 tmp0 += 1 << (CONST_BITS-PASS1_BITS-1); 2589 2590 z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 2591 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ 2592 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ 2593 2594 tmp10 = tmp0 + tmp1; 2595 tmp11 = tmp0 - tmp1; 2596 tmp12 = tmp0 + tmp2; 2597 tmp13 = tmp0 - tmp2; 2598 2599 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 2600 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 2601 z3 = z1 - z2; 2602 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ 2603 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ 2604 2605 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ 2606 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ 2607 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ 2608 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ 2609 2610 tmp20 = tmp10 + tmp0; 2611 tmp27 = tmp10 - tmp0; 2612 tmp21 = tmp12 + tmp1; 2613 tmp26 = tmp12 - tmp1; 2614 tmp22 = tmp13 + tmp2; 2615 tmp25 = tmp13 - tmp2; 2616 tmp23 = tmp11 + tmp3; 2617 tmp24 = tmp11 - tmp3; 2618 2619 /* Odd part */ 2620 2621 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 2622 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 2623 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 2624 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 2625 2626 tmp11 = z1 + z3; 2627 2628 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ 2629 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ 2630 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ 2631 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ 2632 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ 2633 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ 2634 tmp0 = tmp1 + tmp2 + tmp3 - 2635 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ 2636 tmp13 = tmp10 + tmp11 + tmp12 - 2637 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ 2638 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ 2639 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ 2640 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ 2641 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ 2642 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ 2643 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ 2644 z2 += z4; 2645 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ 2646 tmp1 += z1; 2647 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ 2648 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ 2649 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ 2650 tmp12 += z2; 2651 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ 2652 tmp2 += z2; 2653 tmp3 += z2; 2654 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ 2655 tmp10 += z2; 2656 tmp11 += z2; 2657 2658 /* Final output stage */ 2659 2660 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp0, CONST_BITS-PASS1_BITS); 2661 wsptr[8*15] = (int) RIGHT_SHIFT(tmp20 - tmp0, CONST_BITS-PASS1_BITS); 2662 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp1, CONST_BITS-PASS1_BITS); 2663 wsptr[8*14] = (int) RIGHT_SHIFT(tmp21 - tmp1, CONST_BITS-PASS1_BITS); 2664 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp2, CONST_BITS-PASS1_BITS); 2665 wsptr[8*13] = (int) RIGHT_SHIFT(tmp22 - tmp2, CONST_BITS-PASS1_BITS); 2666 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp3, CONST_BITS-PASS1_BITS); 2667 wsptr[8*12] = (int) RIGHT_SHIFT(tmp23 - tmp3, CONST_BITS-PASS1_BITS); 2668 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp10, CONST_BITS-PASS1_BITS); 2669 wsptr[8*11] = (int) RIGHT_SHIFT(tmp24 - tmp10, CONST_BITS-PASS1_BITS); 2670 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp11, CONST_BITS-PASS1_BITS); 2671 wsptr[8*10] = (int) RIGHT_SHIFT(tmp25 - tmp11, CONST_BITS-PASS1_BITS); 2672 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp12, CONST_BITS-PASS1_BITS); 2673 wsptr[8*9] = (int) RIGHT_SHIFT(tmp26 - tmp12, CONST_BITS-PASS1_BITS); 2674 wsptr[8*7] = (int) RIGHT_SHIFT(tmp27 + tmp13, CONST_BITS-PASS1_BITS); 2675 wsptr[8*8] = (int) RIGHT_SHIFT(tmp27 - tmp13, CONST_BITS-PASS1_BITS); 2676 } 2677 2678 /* Pass 2: process 16 rows from work array, store into output array. */ 2679 2680 wsptr = workspace; 2681 for (ctr = 0; ctr < 16; ctr++) { 2682 outptr = output_buf[ctr] + output_col; 2683 2684 /* Even part */ 2685 2686 /* Add fudge factor here for final descale. */ 2687 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 2688 tmp0 <<= CONST_BITS; 2689 2690 z1 = (INT32) wsptr[4]; 2691 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ 2692 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ 2693 2694 tmp10 = tmp0 + tmp1; 2695 tmp11 = tmp0 - tmp1; 2696 tmp12 = tmp0 + tmp2; 2697 tmp13 = tmp0 - tmp2; 2698 2699 z1 = (INT32) wsptr[2]; 2700 z2 = (INT32) wsptr[6]; 2701 z3 = z1 - z2; 2702 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ 2703 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ 2704 2705 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ 2706 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ 2707 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ 2708 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ 2709 2710 tmp20 = tmp10 + tmp0; 2711 tmp27 = tmp10 - tmp0; 2712 tmp21 = tmp12 + tmp1; 2713 tmp26 = tmp12 - tmp1; 2714 tmp22 = tmp13 + tmp2; 2715 tmp25 = tmp13 - tmp2; 2716 tmp23 = tmp11 + tmp3; 2717 tmp24 = tmp11 - tmp3; 2718 2719 /* Odd part */ 2720 2721 z1 = (INT32) wsptr[1]; 2722 z2 = (INT32) wsptr[3]; 2723 z3 = (INT32) wsptr[5]; 2724 z4 = (INT32) wsptr[7]; 2725 2726 tmp11 = z1 + z3; 2727 2728 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ 2729 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ 2730 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ 2731 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ 2732 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ 2733 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ 2734 tmp0 = tmp1 + tmp2 + tmp3 - 2735 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ 2736 tmp13 = tmp10 + tmp11 + tmp12 - 2737 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ 2738 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ 2739 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ 2740 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ 2741 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ 2742 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ 2743 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ 2744 z2 += z4; 2745 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ 2746 tmp1 += z1; 2747 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ 2748 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ 2749 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ 2750 tmp12 += z2; 2751 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ 2752 tmp2 += z2; 2753 tmp3 += z2; 2754 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ 2755 tmp10 += z2; 2756 tmp11 += z2; 2757 2758 /* Final output stage */ 2759 2760 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0, 2761 CONST_BITS+PASS1_BITS+3) 2762 & RANGE_MASK]; 2763 outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0, 2764 CONST_BITS+PASS1_BITS+3) 2765 & RANGE_MASK]; 2766 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1, 2767 CONST_BITS+PASS1_BITS+3) 2768 & RANGE_MASK]; 2769 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1, 2770 CONST_BITS+PASS1_BITS+3) 2771 & RANGE_MASK]; 2772 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2, 2773 CONST_BITS+PASS1_BITS+3) 2774 & RANGE_MASK]; 2775 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2, 2776 CONST_BITS+PASS1_BITS+3) 2777 & RANGE_MASK]; 2778 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3, 2779 CONST_BITS+PASS1_BITS+3) 2780 & RANGE_MASK]; 2781 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3, 2782 CONST_BITS+PASS1_BITS+3) 2783 & RANGE_MASK]; 2784 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10, 2785 CONST_BITS+PASS1_BITS+3) 2786 & RANGE_MASK]; 2787 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10, 2788 CONST_BITS+PASS1_BITS+3) 2789 & RANGE_MASK]; 2790 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11, 2791 CONST_BITS+PASS1_BITS+3) 2792 & RANGE_MASK]; 2793 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11, 2794 CONST_BITS+PASS1_BITS+3) 2795 & RANGE_MASK]; 2796 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12, 2797 CONST_BITS+PASS1_BITS+3) 2798 & RANGE_MASK]; 2799 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12, 2800 CONST_BITS+PASS1_BITS+3) 2801 & RANGE_MASK]; 2802 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13, 2803 CONST_BITS+PASS1_BITS+3) 2804 & RANGE_MASK]; 2805 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13, 2806 CONST_BITS+PASS1_BITS+3) 2807 & RANGE_MASK]; 2808 2809 wsptr += 8; /* advance pointer to next row */ 2810 } 2811 } 2812 2813 2814 /* 2815 * Perform dequantization and inverse DCT on one block of coefficients, 2816 * producing a 16x8 output block. 2817 * 2818 * 8-point IDCT in pass 1 (columns), 16-point in pass 2 (rows). 2819 */ 2820 2821 GLOBAL(void) 2822 jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 2823 JCOEFPTR coef_block, 2824 JSAMPARRAY output_buf, JDIMENSION output_col) 2825 { 2826 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; 2827 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; 2828 INT32 z1, z2, z3, z4; 2829 JCOEFPTR inptr; 2830 ISLOW_MULT_TYPE * quantptr; 2831 int * wsptr; 2832 JSAMPROW outptr; 2833 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 2834 int ctr; 2835 int workspace[8*8]; /* buffers data between passes */ 162 2836 SHIFT_TEMPS 163 2837 … … 208 2882 209 2883 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 210 tmp2 = z1 + MULTIPLY(z 3, - FIX_1_847759065);211 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);2884 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 2885 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 212 2886 213 2887 z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 214 2888 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 215 216 tmp0 = (z2 + z3) << CONST_BITS; 217 tmp1 = (z2 - z3) << CONST_BITS; 2889 z2 <<= CONST_BITS; 2890 z3 <<= CONST_BITS; 2891 /* Add fudge factor here for final descale. */ 2892 z2 += ONE << (CONST_BITS-PASS1_BITS-1); 2893 2894 tmp0 = z2 + z3; 2895 tmp1 = z2 - z3; 218 2896 219 tmp10 = tmp0 + tmp 3;220 tmp13 = tmp0 - tmp 3;221 tmp11 = tmp1 + tmp 2;222 tmp12 = tmp1 - tmp 2;2897 tmp10 = tmp0 + tmp2; 2898 tmp13 = tmp0 - tmp2; 2899 tmp11 = tmp1 + tmp3; 2900 tmp12 = tmp1 - tmp3; 223 2901 224 2902 /* Odd part per figure 8; the matrix is unitary and hence its … … 231 2909 tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 232 2910 233 z1 = tmp0 + tmp3; 234 z2 = tmp1 + tmp2; 235 z3 = tmp0 + tmp2; 236 z4 = tmp1 + tmp3; 237 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ 238 2911 z2 = tmp0 + tmp2; 2912 z3 = tmp1 + tmp3; 2913 2914 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 2915 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 2916 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 2917 z2 += z1; 2918 z3 += z1; 2919 2920 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 239 2921 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 2922 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 2923 tmp0 += z1 + z2; 2924 tmp3 += z1 + z3; 2925 2926 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 240 2927 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 241 2928 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 242 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 243 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 244 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 245 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 246 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 247 248 z3 += z5; 249 z4 += z5; 250 251 tmp0 += z1 + z3; 252 tmp1 += z2 + z4; 253 tmp2 += z2 + z3; 254 tmp3 += z1 + z4; 2929 tmp1 += z1 + z3; 2930 tmp2 += z1 + z2; 255 2931 256 2932 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 257 2933 258 wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);259 wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);260 wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);261 wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);262 wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);263 wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);264 wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);265 wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);2934 wsptr[DCTSIZE*0] = (int) RIGHT_SHIFT(tmp10 + tmp3, CONST_BITS-PASS1_BITS); 2935 wsptr[DCTSIZE*7] = (int) RIGHT_SHIFT(tmp10 - tmp3, CONST_BITS-PASS1_BITS); 2936 wsptr[DCTSIZE*1] = (int) RIGHT_SHIFT(tmp11 + tmp2, CONST_BITS-PASS1_BITS); 2937 wsptr[DCTSIZE*6] = (int) RIGHT_SHIFT(tmp11 - tmp2, CONST_BITS-PASS1_BITS); 2938 wsptr[DCTSIZE*2] = (int) RIGHT_SHIFT(tmp12 + tmp1, CONST_BITS-PASS1_BITS); 2939 wsptr[DCTSIZE*5] = (int) RIGHT_SHIFT(tmp12 - tmp1, CONST_BITS-PASS1_BITS); 2940 wsptr[DCTSIZE*3] = (int) RIGHT_SHIFT(tmp13 + tmp0, CONST_BITS-PASS1_BITS); 2941 wsptr[DCTSIZE*4] = (int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS-PASS1_BITS); 266 2942 267 2943 inptr++; /* advance pointers to next column */ … … 269 2945 wsptr++; 270 2946 } 2947 2948 /* Pass 2: process 8 rows from work array, store into output array. 2949 * 16-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/32). 2950 */ 2951 wsptr = workspace; 2952 for (ctr = 0; ctr < 8; ctr++) { 2953 outptr = output_buf[ctr] + output_col; 2954 2955 /* Even part */ 2956 2957 /* Add fudge factor here for final descale. */ 2958 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 2959 tmp0 <<= CONST_BITS; 2960 2961 z1 = (INT32) wsptr[4]; 2962 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ 2963 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ 2964 2965 tmp10 = tmp0 + tmp1; 2966 tmp11 = tmp0 - tmp1; 2967 tmp12 = tmp0 + tmp2; 2968 tmp13 = tmp0 - tmp2; 2969 2970 z1 = (INT32) wsptr[2]; 2971 z2 = (INT32) wsptr[6]; 2972 z3 = z1 - z2; 2973 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ 2974 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ 2975 2976 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ 2977 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ 2978 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ 2979 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ 2980 2981 tmp20 = tmp10 + tmp0; 2982 tmp27 = tmp10 - tmp0; 2983 tmp21 = tmp12 + tmp1; 2984 tmp26 = tmp12 - tmp1; 2985 tmp22 = tmp13 + tmp2; 2986 tmp25 = tmp13 - tmp2; 2987 tmp23 = tmp11 + tmp3; 2988 tmp24 = tmp11 - tmp3; 2989 2990 /* Odd part */ 2991 2992 z1 = (INT32) wsptr[1]; 2993 z2 = (INT32) wsptr[3]; 2994 z3 = (INT32) wsptr[5]; 2995 z4 = (INT32) wsptr[7]; 2996 2997 tmp11 = z1 + z3; 2998 2999 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ 3000 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ 3001 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ 3002 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ 3003 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ 3004 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ 3005 tmp0 = tmp1 + tmp2 + tmp3 - 3006 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ 3007 tmp13 = tmp10 + tmp11 + tmp12 - 3008 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ 3009 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ 3010 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ 3011 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ 3012 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ 3013 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ 3014 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ 3015 z2 += z4; 3016 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ 3017 tmp1 += z1; 3018 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ 3019 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ 3020 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ 3021 tmp12 += z2; 3022 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ 3023 tmp2 += z2; 3024 tmp3 += z2; 3025 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ 3026 tmp10 += z2; 3027 tmp11 += z2; 3028 3029 /* Final output stage */ 3030 3031 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp0, 3032 CONST_BITS+PASS1_BITS+3) 3033 & RANGE_MASK]; 3034 outptr[15] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp0, 3035 CONST_BITS+PASS1_BITS+3) 3036 & RANGE_MASK]; 3037 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp1, 3038 CONST_BITS+PASS1_BITS+3) 3039 & RANGE_MASK]; 3040 outptr[14] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp1, 3041 CONST_BITS+PASS1_BITS+3) 3042 & RANGE_MASK]; 3043 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp2, 3044 CONST_BITS+PASS1_BITS+3) 3045 & RANGE_MASK]; 3046 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp2, 3047 CONST_BITS+PASS1_BITS+3) 3048 & RANGE_MASK]; 3049 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp3, 3050 CONST_BITS+PASS1_BITS+3) 3051 & RANGE_MASK]; 3052 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp3, 3053 CONST_BITS+PASS1_BITS+3) 3054 & RANGE_MASK]; 3055 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp10, 3056 CONST_BITS+PASS1_BITS+3) 3057 & RANGE_MASK]; 3058 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp10, 3059 CONST_BITS+PASS1_BITS+3) 3060 & RANGE_MASK]; 3061 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp11, 3062 CONST_BITS+PASS1_BITS+3) 3063 & RANGE_MASK]; 3064 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp11, 3065 CONST_BITS+PASS1_BITS+3) 3066 & RANGE_MASK]; 3067 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp12, 3068 CONST_BITS+PASS1_BITS+3) 3069 & RANGE_MASK]; 3070 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp12, 3071 CONST_BITS+PASS1_BITS+3) 3072 & RANGE_MASK]; 3073 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp27 + tmp13, 3074 CONST_BITS+PASS1_BITS+3) 3075 & RANGE_MASK]; 3076 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp27 - tmp13, 3077 CONST_BITS+PASS1_BITS+3) 3078 & RANGE_MASK]; 3079 3080 wsptr += 8; /* advance pointer to next row */ 3081 } 3082 } 3083 3084 3085 /* 3086 * Perform dequantization and inverse DCT on one block of coefficients, 3087 * producing a 14x7 output block. 3088 * 3089 * 7-point IDCT in pass 1 (columns), 14-point in pass 2 (rows). 3090 */ 3091 3092 GLOBAL(void) 3093 jpeg_idct_14x7 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3094 JCOEFPTR coef_block, 3095 JSAMPARRAY output_buf, JDIMENSION output_col) 3096 { 3097 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 3098 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; 3099 INT32 z1, z2, z3, z4; 3100 JCOEFPTR inptr; 3101 ISLOW_MULT_TYPE * quantptr; 3102 int * wsptr; 3103 JSAMPROW outptr; 3104 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3105 int ctr; 3106 int workspace[8*7]; /* buffers data between passes */ 3107 SHIFT_TEMPS 3108 3109 /* Pass 1: process columns from input, store into work array. 3110 * 7-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/14). 3111 */ 3112 inptr = coef_block; 3113 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3114 wsptr = workspace; 3115 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 3116 /* Even part */ 3117 3118 tmp23 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3119 tmp23 <<= CONST_BITS; 3120 /* Add fudge factor here for final descale. */ 3121 tmp23 += ONE << (CONST_BITS-PASS1_BITS-1); 3122 3123 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 3124 z2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 3125 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 3126 3127 tmp20 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ 3128 tmp22 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ 3129 tmp21 = tmp20 + tmp22 + tmp23 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6 */ 3130 tmp10 = z1 + z3; 3131 z2 -= tmp10; 3132 tmp10 = MULTIPLY(tmp10, FIX(1.274162392)) + tmp23; /* c2 */ 3133 tmp20 += tmp10 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ 3134 tmp22 += tmp10 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ 3135 tmp23 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ 3136 3137 /* Odd part */ 3138 3139 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3140 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 3141 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 3142 3143 tmp11 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 3144 tmp12 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 3145 tmp10 = tmp11 - tmp12; 3146 tmp11 += tmp12; 3147 tmp12 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ 3148 tmp11 += tmp12; 3149 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ 3150 tmp10 += z2; 3151 tmp12 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ 3152 3153 /* Final output stage */ 3154 3155 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 3156 wsptr[8*6] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 3157 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 3158 wsptr[8*5] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 3159 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 3160 wsptr[8*4] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 3161 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23, CONST_BITS-PASS1_BITS); 3162 } 3163 3164 /* Pass 2: process 7 rows from work array, store into output array. 3165 * 14-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/28). 3166 */ 3167 wsptr = workspace; 3168 for (ctr = 0; ctr < 7; ctr++) { 3169 outptr = output_buf[ctr] + output_col; 3170 3171 /* Even part */ 3172 3173 /* Add fudge factor here for final descale. */ 3174 z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 3175 z1 <<= CONST_BITS; 3176 z4 = (INT32) wsptr[4]; 3177 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ 3178 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ 3179 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ 3180 3181 tmp10 = z1 + z2; 3182 tmp11 = z1 + z3; 3183 tmp12 = z1 - z4; 3184 3185 tmp23 = z1 - ((z2 + z3 - z4) << 1); /* c0 = (c4+c12-c8)*2 */ 3186 3187 z1 = (INT32) wsptr[2]; 3188 z2 = (INT32) wsptr[6]; 3189 3190 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ 3191 3192 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ 3193 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ 3194 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ 3195 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ 3196 3197 tmp20 = tmp10 + tmp13; 3198 tmp26 = tmp10 - tmp13; 3199 tmp21 = tmp11 + tmp14; 3200 tmp25 = tmp11 - tmp14; 3201 tmp22 = tmp12 + tmp15; 3202 tmp24 = tmp12 - tmp15; 3203 3204 /* Odd part */ 3205 3206 z1 = (INT32) wsptr[1]; 3207 z2 = (INT32) wsptr[3]; 3208 z3 = (INT32) wsptr[5]; 3209 z4 = (INT32) wsptr[7]; 3210 z4 <<= CONST_BITS; 3211 3212 tmp14 = z1 + z3; 3213 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ 3214 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ 3215 tmp10 = tmp11 + tmp12 + z4 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ 3216 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ 3217 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ 3218 z1 -= z2; 3219 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - z4; /* c11 */ 3220 tmp16 += tmp15; 3221 tmp13 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - z4; /* -c13 */ 3222 tmp11 += tmp13 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ 3223 tmp12 += tmp13 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ 3224 tmp13 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ 3225 tmp14 += tmp13 + z4 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ 3226 tmp15 += tmp13 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ 3227 3228 tmp13 = ((z1 - z3) << CONST_BITS) + z4; 3229 3230 /* Final output stage */ 3231 3232 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 3233 CONST_BITS+PASS1_BITS+3) 3234 & RANGE_MASK]; 3235 outptr[13] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 3236 CONST_BITS+PASS1_BITS+3) 3237 & RANGE_MASK]; 3238 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 3239 CONST_BITS+PASS1_BITS+3) 3240 & RANGE_MASK]; 3241 outptr[12] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 3242 CONST_BITS+PASS1_BITS+3) 3243 & RANGE_MASK]; 3244 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 3245 CONST_BITS+PASS1_BITS+3) 3246 & RANGE_MASK]; 3247 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 3248 CONST_BITS+PASS1_BITS+3) 3249 & RANGE_MASK]; 3250 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 3251 CONST_BITS+PASS1_BITS+3) 3252 & RANGE_MASK]; 3253 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 3254 CONST_BITS+PASS1_BITS+3) 3255 & RANGE_MASK]; 3256 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 3257 CONST_BITS+PASS1_BITS+3) 3258 & RANGE_MASK]; 3259 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 3260 CONST_BITS+PASS1_BITS+3) 3261 & RANGE_MASK]; 3262 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 3263 CONST_BITS+PASS1_BITS+3) 3264 & RANGE_MASK]; 3265 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 3266 CONST_BITS+PASS1_BITS+3) 3267 & RANGE_MASK]; 3268 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp26 + tmp16, 3269 CONST_BITS+PASS1_BITS+3) 3270 & RANGE_MASK]; 3271 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp26 - tmp16, 3272 CONST_BITS+PASS1_BITS+3) 3273 & RANGE_MASK]; 3274 3275 wsptr += 8; /* advance pointer to next row */ 3276 } 3277 } 3278 3279 3280 /* 3281 * Perform dequantization and inverse DCT on one block of coefficients, 3282 * producing a 12x6 output block. 3283 * 3284 * 6-point IDCT in pass 1 (columns), 12-point in pass 2 (rows). 3285 */ 3286 3287 GLOBAL(void) 3288 jpeg_idct_12x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3289 JCOEFPTR coef_block, 3290 JSAMPARRAY output_buf, JDIMENSION output_col) 3291 { 3292 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 3293 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; 3294 INT32 z1, z2, z3, z4; 3295 JCOEFPTR inptr; 3296 ISLOW_MULT_TYPE * quantptr; 3297 int * wsptr; 3298 JSAMPROW outptr; 3299 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3300 int ctr; 3301 int workspace[8*6]; /* buffers data between passes */ 3302 SHIFT_TEMPS 3303 3304 /* Pass 1: process columns from input, store into work array. 3305 * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). 3306 */ 3307 inptr = coef_block; 3308 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3309 wsptr = workspace; 3310 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 3311 /* Even part */ 3312 3313 tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3314 tmp10 <<= CONST_BITS; 3315 /* Add fudge factor here for final descale. */ 3316 tmp10 += ONE << (CONST_BITS-PASS1_BITS-1); 3317 tmp12 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 3318 tmp20 = MULTIPLY(tmp12, FIX(0.707106781)); /* c4 */ 3319 tmp11 = tmp10 + tmp20; 3320 tmp21 = RIGHT_SHIFT(tmp10 - tmp20 - tmp20, CONST_BITS-PASS1_BITS); 3321 tmp20 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 3322 tmp10 = MULTIPLY(tmp20, FIX(1.224744871)); /* c2 */ 3323 tmp20 = tmp11 + tmp10; 3324 tmp22 = tmp11 - tmp10; 3325 3326 /* Odd part */ 3327 3328 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3329 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 3330 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 3331 tmp11 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 3332 tmp10 = tmp11 + ((z1 + z2) << CONST_BITS); 3333 tmp12 = tmp11 + ((z3 - z2) << CONST_BITS); 3334 tmp11 = (z1 - z2 - z3) << PASS1_BITS; 3335 3336 /* Final output stage */ 3337 3338 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 3339 wsptr[8*5] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 3340 wsptr[8*1] = (int) (tmp21 + tmp11); 3341 wsptr[8*4] = (int) (tmp21 - tmp11); 3342 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 3343 wsptr[8*3] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 3344 } 3345 3346 /* Pass 2: process 6 rows from work array, store into output array. 3347 * 12-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/24). 3348 */ 3349 wsptr = workspace; 3350 for (ctr = 0; ctr < 6; ctr++) { 3351 outptr = output_buf[ctr] + output_col; 3352 3353 /* Even part */ 3354 3355 /* Add fudge factor here for final descale. */ 3356 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 3357 z3 <<= CONST_BITS; 3358 3359 z4 = (INT32) wsptr[4]; 3360 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ 3361 3362 tmp10 = z3 + z4; 3363 tmp11 = z3 - z4; 3364 3365 z1 = (INT32) wsptr[2]; 3366 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ 3367 z1 <<= CONST_BITS; 3368 z2 = (INT32) wsptr[6]; 3369 z2 <<= CONST_BITS; 3370 3371 tmp12 = z1 - z2; 3372 3373 tmp21 = z3 + tmp12; 3374 tmp24 = z3 - tmp12; 3375 3376 tmp12 = z4 + z2; 3377 3378 tmp20 = tmp10 + tmp12; 3379 tmp25 = tmp10 - tmp12; 3380 3381 tmp12 = z4 - z1 - z2; 3382 3383 tmp22 = tmp11 + tmp12; 3384 tmp23 = tmp11 - tmp12; 3385 3386 /* Odd part */ 3387 3388 z1 = (INT32) wsptr[1]; 3389 z2 = (INT32) wsptr[3]; 3390 z3 = (INT32) wsptr[5]; 3391 z4 = (INT32) wsptr[7]; 3392 3393 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ 3394 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ 3395 3396 tmp10 = z1 + z3; 3397 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ 3398 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ 3399 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ 3400 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ 3401 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ 3402 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ 3403 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ 3404 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ 3405 3406 z1 -= z4; 3407 z2 -= z3; 3408 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ 3409 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ 3410 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ 3411 3412 /* Final output stage */ 3413 3414 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 3415 CONST_BITS+PASS1_BITS+3) 3416 & RANGE_MASK]; 3417 outptr[11] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 3418 CONST_BITS+PASS1_BITS+3) 3419 & RANGE_MASK]; 3420 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 3421 CONST_BITS+PASS1_BITS+3) 3422 & RANGE_MASK]; 3423 outptr[10] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 3424 CONST_BITS+PASS1_BITS+3) 3425 & RANGE_MASK]; 3426 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 3427 CONST_BITS+PASS1_BITS+3) 3428 & RANGE_MASK]; 3429 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 3430 CONST_BITS+PASS1_BITS+3) 3431 & RANGE_MASK]; 3432 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 3433 CONST_BITS+PASS1_BITS+3) 3434 & RANGE_MASK]; 3435 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 3436 CONST_BITS+PASS1_BITS+3) 3437 & RANGE_MASK]; 3438 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 3439 CONST_BITS+PASS1_BITS+3) 3440 & RANGE_MASK]; 3441 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 3442 CONST_BITS+PASS1_BITS+3) 3443 & RANGE_MASK]; 3444 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp25 + tmp15, 3445 CONST_BITS+PASS1_BITS+3) 3446 & RANGE_MASK]; 3447 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp25 - tmp15, 3448 CONST_BITS+PASS1_BITS+3) 3449 & RANGE_MASK]; 3450 3451 wsptr += 8; /* advance pointer to next row */ 3452 } 3453 } 3454 3455 3456 /* 3457 * Perform dequantization and inverse DCT on one block of coefficients, 3458 * producing a 10x5 output block. 3459 * 3460 * 5-point IDCT in pass 1 (columns), 10-point in pass 2 (rows). 3461 */ 3462 3463 GLOBAL(void) 3464 jpeg_idct_10x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3465 JCOEFPTR coef_block, 3466 JSAMPARRAY output_buf, JDIMENSION output_col) 3467 { 3468 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 3469 INT32 tmp20, tmp21, tmp22, tmp23, tmp24; 3470 INT32 z1, z2, z3, z4; 3471 JCOEFPTR inptr; 3472 ISLOW_MULT_TYPE * quantptr; 3473 int * wsptr; 3474 JSAMPROW outptr; 3475 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3476 int ctr; 3477 int workspace[8*5]; /* buffers data between passes */ 3478 SHIFT_TEMPS 3479 3480 /* Pass 1: process columns from input, store into work array. 3481 * 5-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/10). 3482 */ 3483 inptr = coef_block; 3484 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3485 wsptr = workspace; 3486 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 3487 /* Even part */ 3488 3489 tmp12 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3490 tmp12 <<= CONST_BITS; 3491 /* Add fudge factor here for final descale. */ 3492 tmp12 += ONE << (CONST_BITS-PASS1_BITS-1); 3493 tmp13 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 3494 tmp14 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 3495 z1 = MULTIPLY(tmp13 + tmp14, FIX(0.790569415)); /* (c2+c4)/2 */ 3496 z2 = MULTIPLY(tmp13 - tmp14, FIX(0.353553391)); /* (c2-c4)/2 */ 3497 z3 = tmp12 + z2; 3498 tmp10 = z3 + z1; 3499 tmp11 = z3 - z1; 3500 tmp12 -= z2 << 2; 3501 3502 /* Odd part */ 3503 3504 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3505 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 3506 3507 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ 3508 tmp13 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ 3509 tmp14 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ 3510 3511 /* Final output stage */ 3512 3513 wsptr[8*0] = (int) RIGHT_SHIFT(tmp10 + tmp13, CONST_BITS-PASS1_BITS); 3514 wsptr[8*4] = (int) RIGHT_SHIFT(tmp10 - tmp13, CONST_BITS-PASS1_BITS); 3515 wsptr[8*1] = (int) RIGHT_SHIFT(tmp11 + tmp14, CONST_BITS-PASS1_BITS); 3516 wsptr[8*3] = (int) RIGHT_SHIFT(tmp11 - tmp14, CONST_BITS-PASS1_BITS); 3517 wsptr[8*2] = (int) RIGHT_SHIFT(tmp12, CONST_BITS-PASS1_BITS); 3518 } 3519 3520 /* Pass 2: process 5 rows from work array, store into output array. 3521 * 10-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/20). 3522 */ 3523 wsptr = workspace; 3524 for (ctr = 0; ctr < 5; ctr++) { 3525 outptr = output_buf[ctr] + output_col; 3526 3527 /* Even part */ 3528 3529 /* Add fudge factor here for final descale. */ 3530 z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 3531 z3 <<= CONST_BITS; 3532 z4 = (INT32) wsptr[4]; 3533 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ 3534 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ 3535 tmp10 = z3 + z1; 3536 tmp11 = z3 - z2; 3537 3538 tmp22 = z3 - ((z1 - z2) << 1); /* c0 = (c4-c8)*2 */ 3539 3540 z2 = (INT32) wsptr[2]; 3541 z3 = (INT32) wsptr[6]; 3542 3543 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ 3544 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ 3545 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ 3546 3547 tmp20 = tmp10 + tmp12; 3548 tmp24 = tmp10 - tmp12; 3549 tmp21 = tmp11 + tmp13; 3550 tmp23 = tmp11 - tmp13; 3551 3552 /* Odd part */ 3553 3554 z1 = (INT32) wsptr[1]; 3555 z2 = (INT32) wsptr[3]; 3556 z3 = (INT32) wsptr[5]; 3557 z3 <<= CONST_BITS; 3558 z4 = (INT32) wsptr[7]; 3559 3560 tmp11 = z2 + z4; 3561 tmp13 = z2 - z4; 3562 3563 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ 3564 3565 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ 3566 z4 = z3 + tmp12; 3567 3568 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ 3569 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ 3570 3571 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ 3572 z4 = z3 - tmp12 - (tmp13 << (CONST_BITS - 1)); 3573 3574 tmp12 = ((z1 - tmp13) << CONST_BITS) - z3; 3575 3576 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ 3577 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ 3578 3579 /* Final output stage */ 3580 3581 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 3582 CONST_BITS+PASS1_BITS+3) 3583 & RANGE_MASK]; 3584 outptr[9] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 3585 CONST_BITS+PASS1_BITS+3) 3586 & RANGE_MASK]; 3587 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 3588 CONST_BITS+PASS1_BITS+3) 3589 & RANGE_MASK]; 3590 outptr[8] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 3591 CONST_BITS+PASS1_BITS+3) 3592 & RANGE_MASK]; 3593 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 3594 CONST_BITS+PASS1_BITS+3) 3595 & RANGE_MASK]; 3596 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 3597 CONST_BITS+PASS1_BITS+3) 3598 & RANGE_MASK]; 3599 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23 + tmp13, 3600 CONST_BITS+PASS1_BITS+3) 3601 & RANGE_MASK]; 3602 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp23 - tmp13, 3603 CONST_BITS+PASS1_BITS+3) 3604 & RANGE_MASK]; 3605 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp24 + tmp14, 3606 CONST_BITS+PASS1_BITS+3) 3607 & RANGE_MASK]; 3608 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp24 - tmp14, 3609 CONST_BITS+PASS1_BITS+3) 3610 & RANGE_MASK]; 3611 3612 wsptr += 8; /* advance pointer to next row */ 3613 } 3614 } 3615 3616 3617 /* 3618 * Perform dequantization and inverse DCT on one block of coefficients, 3619 * producing a 8x4 output block. 3620 * 3621 * 4-point IDCT in pass 1 (columns), 8-point in pass 2 (rows). 3622 */ 3623 3624 GLOBAL(void) 3625 jpeg_idct_8x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3626 JCOEFPTR coef_block, 3627 JSAMPARRAY output_buf, JDIMENSION output_col) 3628 { 3629 INT32 tmp0, tmp1, tmp2, tmp3; 3630 INT32 tmp10, tmp11, tmp12, tmp13; 3631 INT32 z1, z2, z3; 3632 JCOEFPTR inptr; 3633 ISLOW_MULT_TYPE * quantptr; 3634 int * wsptr; 3635 JSAMPROW outptr; 3636 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3637 int ctr; 3638 int workspace[8*4]; /* buffers data between passes */ 3639 SHIFT_TEMPS 3640 3641 /* Pass 1: process columns from input, store into work array. 3642 * 4-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 3643 */ 3644 inptr = coef_block; 3645 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3646 wsptr = workspace; 3647 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 3648 /* Even part */ 3649 3650 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3651 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 3652 3653 tmp10 = (tmp0 + tmp2) << PASS1_BITS; 3654 tmp12 = (tmp0 - tmp2) << PASS1_BITS; 3655 3656 /* Odd part */ 3657 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 3658 3659 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3660 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 3661 3662 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 3663 /* Add fudge factor here for final descale. */ 3664 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 3665 tmp0 = RIGHT_SHIFT(z1 + MULTIPLY(z2, FIX_0_765366865), /* c2-c6 */ 3666 CONST_BITS-PASS1_BITS); 3667 tmp2 = RIGHT_SHIFT(z1 - MULTIPLY(z3, FIX_1_847759065), /* c2+c6 */ 3668 CONST_BITS-PASS1_BITS); 3669 3670 /* Final output stage */ 3671 3672 wsptr[8*0] = (int) (tmp10 + tmp0); 3673 wsptr[8*3] = (int) (tmp10 - tmp0); 3674 wsptr[8*1] = (int) (tmp12 + tmp2); 3675 wsptr[8*2] = (int) (tmp12 - tmp2); 3676 } 3677 3678 /* Pass 2: process rows from work array, store into output array. */ 3679 /* Note that we must descale the results by a factor of 8 == 2**3, */ 3680 /* and also undo the PASS1_BITS scaling. */ 3681 3682 wsptr = workspace; 3683 for (ctr = 0; ctr < 4; ctr++) { 3684 outptr = output_buf[ctr] + output_col; 3685 3686 /* Even part: reverse the even part of the forward DCT. */ 3687 /* The rotator is sqrt(2)*c(-6). */ 3688 3689 z2 = (INT32) wsptr[2]; 3690 z3 = (INT32) wsptr[6]; 3691 3692 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 3693 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 3694 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 3695 3696 /* Add fudge factor here for final descale. */ 3697 z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 3698 z3 = (INT32) wsptr[4]; 3699 3700 tmp0 = (z2 + z3) << CONST_BITS; 3701 tmp1 = (z2 - z3) << CONST_BITS; 3702 3703 tmp10 = tmp0 + tmp2; 3704 tmp13 = tmp0 - tmp2; 3705 tmp11 = tmp1 + tmp3; 3706 tmp12 = tmp1 - tmp3; 3707 3708 /* Odd part per figure 8; the matrix is unitary and hence its 3709 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. 3710 */ 3711 3712 tmp0 = (INT32) wsptr[7]; 3713 tmp1 = (INT32) wsptr[5]; 3714 tmp2 = (INT32) wsptr[3]; 3715 tmp3 = (INT32) wsptr[1]; 3716 3717 z2 = tmp0 + tmp2; 3718 z3 = tmp1 + tmp3; 3719 3720 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 3721 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 3722 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 3723 z2 += z1; 3724 z3 += z1; 3725 3726 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 3727 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 3728 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 3729 tmp0 += z1 + z2; 3730 tmp3 += z1 + z3; 3731 3732 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 3733 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 3734 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 3735 tmp1 += z1 + z3; 3736 tmp2 += z1 + z2; 3737 3738 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 3739 3740 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp3, 3741 CONST_BITS+PASS1_BITS+3) 3742 & RANGE_MASK]; 3743 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp3, 3744 CONST_BITS+PASS1_BITS+3) 3745 & RANGE_MASK]; 3746 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp2, 3747 CONST_BITS+PASS1_BITS+3) 3748 & RANGE_MASK]; 3749 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp2, 3750 CONST_BITS+PASS1_BITS+3) 3751 & RANGE_MASK]; 3752 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp1, 3753 CONST_BITS+PASS1_BITS+3) 3754 & RANGE_MASK]; 3755 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp1, 3756 CONST_BITS+PASS1_BITS+3) 3757 & RANGE_MASK]; 3758 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp0, 3759 CONST_BITS+PASS1_BITS+3) 3760 & RANGE_MASK]; 3761 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp0, 3762 CONST_BITS+PASS1_BITS+3) 3763 & RANGE_MASK]; 3764 3765 wsptr += DCTSIZE; /* advance pointer to next row */ 3766 } 3767 } 3768 3769 3770 /* 3771 * Perform dequantization and inverse DCT on one block of coefficients, 3772 * producing a reduced-size 6x3 output block. 3773 * 3774 * 3-point IDCT in pass 1 (columns), 6-point in pass 2 (rows). 3775 */ 3776 3777 GLOBAL(void) 3778 jpeg_idct_6x3 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3779 JCOEFPTR coef_block, 3780 JSAMPARRAY output_buf, JDIMENSION output_col) 3781 { 3782 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; 3783 INT32 z1, z2, z3; 3784 JCOEFPTR inptr; 3785 ISLOW_MULT_TYPE * quantptr; 3786 int * wsptr; 3787 JSAMPROW outptr; 3788 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3789 int ctr; 3790 int workspace[6*3]; /* buffers data between passes */ 3791 SHIFT_TEMPS 3792 3793 /* Pass 1: process columns from input, store into work array. 3794 * 3-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/6). 3795 */ 3796 inptr = coef_block; 3797 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3798 wsptr = workspace; 3799 for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) { 3800 /* Even part */ 3801 3802 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3803 tmp0 <<= CONST_BITS; 3804 /* Add fudge factor here for final descale. */ 3805 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 3806 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 3807 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ 3808 tmp10 = tmp0 + tmp12; 3809 tmp2 = tmp0 - tmp12 - tmp12; 3810 3811 /* Odd part */ 3812 3813 tmp12 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3814 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ 3815 3816 /* Final output stage */ 3817 3818 wsptr[6*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 3819 wsptr[6*2] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 3820 wsptr[6*1] = (int) RIGHT_SHIFT(tmp2, CONST_BITS-PASS1_BITS); 3821 } 3822 3823 /* Pass 2: process 3 rows from work array, store into output array. 3824 * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). 3825 */ 3826 wsptr = workspace; 3827 for (ctr = 0; ctr < 3; ctr++) { 3828 outptr = output_buf[ctr] + output_col; 3829 3830 /* Even part */ 3831 3832 /* Add fudge factor here for final descale. */ 3833 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 3834 tmp0 <<= CONST_BITS; 3835 tmp2 = (INT32) wsptr[4]; 3836 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ 3837 tmp1 = tmp0 + tmp10; 3838 tmp11 = tmp0 - tmp10 - tmp10; 3839 tmp10 = (INT32) wsptr[2]; 3840 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ 3841 tmp10 = tmp1 + tmp0; 3842 tmp12 = tmp1 - tmp0; 3843 3844 /* Odd part */ 3845 3846 z1 = (INT32) wsptr[1]; 3847 z2 = (INT32) wsptr[3]; 3848 z3 = (INT32) wsptr[5]; 3849 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 3850 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); 3851 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); 3852 tmp1 = (z1 - z2 - z3) << CONST_BITS; 3853 3854 /* Final output stage */ 3855 3856 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 3857 CONST_BITS+PASS1_BITS+3) 3858 & RANGE_MASK]; 3859 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 3860 CONST_BITS+PASS1_BITS+3) 3861 & RANGE_MASK]; 3862 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp1, 3863 CONST_BITS+PASS1_BITS+3) 3864 & RANGE_MASK]; 3865 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp1, 3866 CONST_BITS+PASS1_BITS+3) 3867 & RANGE_MASK]; 3868 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 3869 CONST_BITS+PASS1_BITS+3) 3870 & RANGE_MASK]; 3871 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 3872 CONST_BITS+PASS1_BITS+3) 3873 & RANGE_MASK]; 3874 3875 wsptr += 6; /* advance pointer to next row */ 3876 } 3877 } 3878 3879 3880 /* 3881 * Perform dequantization and inverse DCT on one block of coefficients, 3882 * producing a 4x2 output block. 3883 * 3884 * 2-point IDCT in pass 1 (columns), 4-point in pass 2 (rows). 3885 */ 3886 3887 GLOBAL(void) 3888 jpeg_idct_4x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3889 JCOEFPTR coef_block, 3890 JSAMPARRAY output_buf, JDIMENSION output_col) 3891 { 3892 INT32 tmp0, tmp2, tmp10, tmp12; 3893 INT32 z1, z2, z3; 3894 JCOEFPTR inptr; 3895 ISLOW_MULT_TYPE * quantptr; 3896 INT32 * wsptr; 3897 JSAMPROW outptr; 3898 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3899 int ctr; 3900 INT32 workspace[4*2]; /* buffers data between passes */ 3901 SHIFT_TEMPS 3902 3903 /* Pass 1: process columns from input, store into work array. */ 3904 3905 inptr = coef_block; 3906 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3907 wsptr = workspace; 3908 for (ctr = 0; ctr < 4; ctr++, inptr++, quantptr++, wsptr++) { 3909 /* Even part */ 3910 3911 tmp10 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 3912 3913 /* Odd part */ 3914 3915 tmp0 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 3916 3917 /* Final output stage */ 3918 3919 wsptr[4*0] = tmp10 + tmp0; 3920 wsptr[4*1] = tmp10 - tmp0; 3921 } 3922 3923 /* Pass 2: process 2 rows from work array, store into output array. 3924 * 4-point IDCT kernel, 3925 * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point IDCT]. 3926 */ 3927 wsptr = workspace; 3928 for (ctr = 0; ctr < 2; ctr++) { 3929 outptr = output_buf[ctr] + output_col; 3930 3931 /* Even part */ 3932 3933 /* Add fudge factor here for final descale. */ 3934 tmp0 = wsptr[0] + (ONE << 2); 3935 tmp2 = wsptr[2]; 3936 3937 tmp10 = (tmp0 + tmp2) << CONST_BITS; 3938 tmp12 = (tmp0 - tmp2) << CONST_BITS; 3939 3940 /* Odd part */ 3941 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 3942 3943 z2 = wsptr[1]; 3944 z3 = wsptr[3]; 3945 3946 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 3947 tmp0 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ 3948 tmp2 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ 3949 3950 /* Final output stage */ 3951 3952 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 3953 CONST_BITS+3) 3954 & RANGE_MASK]; 3955 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 3956 CONST_BITS+3) 3957 & RANGE_MASK]; 3958 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 3959 CONST_BITS+3) 3960 & RANGE_MASK]; 3961 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 3962 CONST_BITS+3) 3963 & RANGE_MASK]; 3964 3965 wsptr += 4; /* advance pointer to next row */ 3966 } 3967 } 3968 3969 3970 /* 3971 * Perform dequantization and inverse DCT on one block of coefficients, 3972 * producing a 2x1 output block. 3973 * 3974 * 1-point IDCT in pass 1 (columns), 2-point in pass 2 (rows). 3975 */ 3976 3977 GLOBAL(void) 3978 jpeg_idct_2x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 3979 JCOEFPTR coef_block, 3980 JSAMPARRAY output_buf, JDIMENSION output_col) 3981 { 3982 INT32 tmp0, tmp10; 3983 ISLOW_MULT_TYPE * quantptr; 3984 JSAMPROW outptr; 3985 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 3986 SHIFT_TEMPS 3987 3988 /* Pass 1: empty. */ 3989 3990 /* Pass 2: process 1 row from input, store into output array. */ 3991 3992 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 3993 outptr = output_buf[0] + output_col; 3994 3995 /* Even part */ 3996 3997 tmp10 = DEQUANTIZE(coef_block[0], quantptr[0]); 3998 /* Add fudge factor here for final descale. */ 3999 tmp10 += ONE << 2; 4000 4001 /* Odd part */ 4002 4003 tmp0 = DEQUANTIZE(coef_block[1], quantptr[1]); 4004 4005 /* Final output stage */ 4006 4007 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 3) & RANGE_MASK]; 4008 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 3) & RANGE_MASK]; 4009 } 4010 4011 4012 /* 4013 * Perform dequantization and inverse DCT on one block of coefficients, 4014 * producing a 8x16 output block. 4015 * 4016 * 16-point IDCT in pass 1 (columns), 8-point in pass 2 (rows). 4017 */ 4018 4019 GLOBAL(void) 4020 jpeg_idct_8x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4021 JCOEFPTR coef_block, 4022 JSAMPARRAY output_buf, JDIMENSION output_col) 4023 { 4024 INT32 tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; 4025 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; 4026 INT32 z1, z2, z3, z4; 4027 JCOEFPTR inptr; 4028 ISLOW_MULT_TYPE * quantptr; 4029 int * wsptr; 4030 JSAMPROW outptr; 4031 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4032 int ctr; 4033 int workspace[8*16]; /* buffers data between passes */ 4034 SHIFT_TEMPS 4035 4036 /* Pass 1: process columns from input, store into work array. 4037 * 16-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/32). 4038 */ 4039 inptr = coef_block; 4040 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4041 wsptr = workspace; 4042 for (ctr = 0; ctr < 8; ctr++, inptr++, quantptr++, wsptr++) { 4043 /* Even part */ 4044 4045 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4046 tmp0 <<= CONST_BITS; 4047 /* Add fudge factor here for final descale. */ 4048 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 4049 4050 z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4051 tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ 4052 tmp2 = MULTIPLY(z1, FIX_0_541196100); /* c12[16] = c6[8] */ 4053 4054 tmp10 = tmp0 + tmp1; 4055 tmp11 = tmp0 - tmp1; 4056 tmp12 = tmp0 + tmp2; 4057 tmp13 = tmp0 - tmp2; 4058 4059 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4060 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 4061 z3 = z1 - z2; 4062 z4 = MULTIPLY(z3, FIX(0.275899379)); /* c14[16] = c7[8] */ 4063 z3 = MULTIPLY(z3, FIX(1.387039845)); /* c2[16] = c1[8] */ 4064 4065 tmp0 = z3 + MULTIPLY(z2, FIX_2_562915447); /* (c6+c2)[16] = (c3+c1)[8] */ 4066 tmp1 = z4 + MULTIPLY(z1, FIX_0_899976223); /* (c6-c14)[16] = (c3-c7)[8] */ 4067 tmp2 = z3 - MULTIPLY(z1, FIX(0.601344887)); /* (c2-c10)[16] = (c1-c5)[8] */ 4068 tmp3 = z4 - MULTIPLY(z2, FIX(0.509795579)); /* (c10-c14)[16] = (c5-c7)[8] */ 4069 4070 tmp20 = tmp10 + tmp0; 4071 tmp27 = tmp10 - tmp0; 4072 tmp21 = tmp12 + tmp1; 4073 tmp26 = tmp12 - tmp1; 4074 tmp22 = tmp13 + tmp2; 4075 tmp25 = tmp13 - tmp2; 4076 tmp23 = tmp11 + tmp3; 4077 tmp24 = tmp11 - tmp3; 4078 4079 /* Odd part */ 4080 4081 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4082 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4083 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4084 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 4085 4086 tmp11 = z1 + z3; 4087 4088 tmp1 = MULTIPLY(z1 + z2, FIX(1.353318001)); /* c3 */ 4089 tmp2 = MULTIPLY(tmp11, FIX(1.247225013)); /* c5 */ 4090 tmp3 = MULTIPLY(z1 + z4, FIX(1.093201867)); /* c7 */ 4091 tmp10 = MULTIPLY(z1 - z4, FIX(0.897167586)); /* c9 */ 4092 tmp11 = MULTIPLY(tmp11, FIX(0.666655658)); /* c11 */ 4093 tmp12 = MULTIPLY(z1 - z2, FIX(0.410524528)); /* c13 */ 4094 tmp0 = tmp1 + tmp2 + tmp3 - 4095 MULTIPLY(z1, FIX(2.286341144)); /* c7+c5+c3-c1 */ 4096 tmp13 = tmp10 + tmp11 + tmp12 - 4097 MULTIPLY(z1, FIX(1.835730603)); /* c9+c11+c13-c15 */ 4098 z1 = MULTIPLY(z2 + z3, FIX(0.138617169)); /* c15 */ 4099 tmp1 += z1 + MULTIPLY(z2, FIX(0.071888074)); /* c9+c11-c3-c15 */ 4100 tmp2 += z1 - MULTIPLY(z3, FIX(1.125726048)); /* c5+c7+c15-c3 */ 4101 z1 = MULTIPLY(z3 - z2, FIX(1.407403738)); /* c1 */ 4102 tmp11 += z1 - MULTIPLY(z3, FIX(0.766367282)); /* c1+c11-c9-c13 */ 4103 tmp12 += z1 + MULTIPLY(z2, FIX(1.971951411)); /* c1+c5+c13-c7 */ 4104 z2 += z4; 4105 z1 = MULTIPLY(z2, - FIX(0.666655658)); /* -c11 */ 4106 tmp1 += z1; 4107 tmp3 += z1 + MULTIPLY(z4, FIX(1.065388962)); /* c3+c11+c15-c7 */ 4108 z2 = MULTIPLY(z2, - FIX(1.247225013)); /* -c5 */ 4109 tmp10 += z2 + MULTIPLY(z4, FIX(3.141271809)); /* c1+c5+c9-c13 */ 4110 tmp12 += z2; 4111 z2 = MULTIPLY(z3 + z4, - FIX(1.353318001)); /* -c3 */ 4112 tmp2 += z2; 4113 tmp3 += z2; 4114 z2 = MULTIPLY(z4 - z3, FIX(0.410524528)); /* c13 */ 4115 tmp10 += z2; 4116 tmp11 += z2; 4117 4118 /* Final output stage */ 4119 4120 wsptr[8*0] = (int) RIGHT_SHIFT(tmp20 + tmp0, CONST_BITS-PASS1_BITS); 4121 wsptr[8*15] = (int) RIGHT_SHIFT(tmp20 - tmp0, CONST_BITS-PASS1_BITS); 4122 wsptr[8*1] = (int) RIGHT_SHIFT(tmp21 + tmp1, CONST_BITS-PASS1_BITS); 4123 wsptr[8*14] = (int) RIGHT_SHIFT(tmp21 - tmp1, CONST_BITS-PASS1_BITS); 4124 wsptr[8*2] = (int) RIGHT_SHIFT(tmp22 + tmp2, CONST_BITS-PASS1_BITS); 4125 wsptr[8*13] = (int) RIGHT_SHIFT(tmp22 - tmp2, CONST_BITS-PASS1_BITS); 4126 wsptr[8*3] = (int) RIGHT_SHIFT(tmp23 + tmp3, CONST_BITS-PASS1_BITS); 4127 wsptr[8*12] = (int) RIGHT_SHIFT(tmp23 - tmp3, CONST_BITS-PASS1_BITS); 4128 wsptr[8*4] = (int) RIGHT_SHIFT(tmp24 + tmp10, CONST_BITS-PASS1_BITS); 4129 wsptr[8*11] = (int) RIGHT_SHIFT(tmp24 - tmp10, CONST_BITS-PASS1_BITS); 4130 wsptr[8*5] = (int) RIGHT_SHIFT(tmp25 + tmp11, CONST_BITS-PASS1_BITS); 4131 wsptr[8*10] = (int) RIGHT_SHIFT(tmp25 - tmp11, CONST_BITS-PASS1_BITS); 4132 wsptr[8*6] = (int) RIGHT_SHIFT(tmp26 + tmp12, CONST_BITS-PASS1_BITS); 4133 wsptr[8*9] = (int) RIGHT_SHIFT(tmp26 - tmp12, CONST_BITS-PASS1_BITS); 4134 wsptr[8*7] = (int) RIGHT_SHIFT(tmp27 + tmp13, CONST_BITS-PASS1_BITS); 4135 wsptr[8*8] = (int) RIGHT_SHIFT(tmp27 - tmp13, CONST_BITS-PASS1_BITS); 4136 } 271 4137 272 4138 /* Pass 2: process rows from work array, store into output array. */ … … 275 4141 276 4142 wsptr = workspace; 277 for (ctr = 0; ctr < DCTSIZE; ctr++) {4143 for (ctr = 0; ctr < 16; ctr++) { 278 4144 outptr = output_buf[ctr] + output_col; 279 /* Rows of zeroes can be exploited in the same way as we did with columns.280 * However, the column calculation has created many nonzero AC terms, so281 * the simplification applies less often (typically 5% to 10% of the time).282 * On machines with very fast multiplication, it's possible that the283 * test takes more time than it's worth. In that case this section284 * may be commented out.285 */286 287 #ifndef NO_ZERO_ROW_TEST288 if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&289 wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {290 /* AC terms all zero */291 JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)292 & RANGE_MASK];293 294 outptr[0] = dcval;295 outptr[1] = dcval;296 outptr[2] = dcval;297 outptr[3] = dcval;298 outptr[4] = dcval;299 outptr[5] = dcval;300 outptr[6] = dcval;301 outptr[7] = dcval;302 303 wsptr += DCTSIZE; /* advance pointer to next row */304 continue;305 }306 #endif307 4145 308 4146 /* Even part: reverse the even part of the forward DCT. */ … … 313 4151 314 4152 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 315 tmp2 = z1 + MULTIPLY(z 3, - FIX_1_847759065);316 tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);4153 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 4154 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 317 4155 318 tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; 319 tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; 4156 /* Add fudge factor here for final descale. */ 4157 z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4158 z3 = (INT32) wsptr[4]; 320 4159 321 tmp10 = tmp0 + tmp3; 322 tmp13 = tmp0 - tmp3; 323 tmp11 = tmp1 + tmp2; 324 tmp12 = tmp1 - tmp2; 4160 tmp0 = (z2 + z3) << CONST_BITS; 4161 tmp1 = (z2 - z3) << CONST_BITS; 4162 4163 tmp10 = tmp0 + tmp2; 4164 tmp13 = tmp0 - tmp2; 4165 tmp11 = tmp1 + tmp3; 4166 tmp12 = tmp1 - tmp3; 325 4167 326 4168 /* Odd part per figure 8; the matrix is unitary and hence its … … 333 4175 tmp3 = (INT32) wsptr[1]; 334 4176 335 z1 = tmp0 + tmp3; 336 z2 = tmp1 + tmp2; 337 z3 = tmp0 + tmp2; 338 z4 = tmp1 + tmp3; 339 z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ 340 4177 z2 = tmp0 + tmp2; 4178 z3 = tmp1 + tmp3; 4179 4180 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 4181 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 4182 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 4183 z2 += z1; 4184 z3 += z1; 4185 4186 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 341 4187 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 4188 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 4189 tmp0 += z1 + z2; 4190 tmp3 += z1 + z3; 4191 4192 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 342 4193 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 343 4194 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 344 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 345 z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 346 z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 347 z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 348 z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 349 350 z3 += z5; 351 z4 += z5; 352 353 tmp0 += z1 + z3; 354 tmp1 += z2 + z4; 355 tmp2 += z2 + z3; 356 tmp3 += z1 + z4; 4195 tmp1 += z1 + z3; 4196 tmp2 += z1 + z2; 357 4197 358 4198 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 359 4199 360 outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,361 CONST_BITS+PASS1_BITS+3)362 & RANGE_MASK]; 363 outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3,364 CONST_BITS+PASS1_BITS+3)365 & RANGE_MASK]; 366 outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2,367 CONST_BITS+PASS1_BITS+3)368 & RANGE_MASK]; 369 outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2,370 CONST_BITS+PASS1_BITS+3)371 & RANGE_MASK]; 372 outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1,373 CONST_BITS+PASS1_BITS+3)374 & RANGE_MASK]; 375 outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1,376 CONST_BITS+PASS1_BITS+3)377 & RANGE_MASK]; 378 outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0,379 CONST_BITS+PASS1_BITS+3)380 & RANGE_MASK]; 381 outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0,382 CONST_BITS+PASS1_BITS+3)4200 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp3, 4201 CONST_BITS+PASS1_BITS+3) 4202 & RANGE_MASK]; 4203 outptr[7] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp3, 4204 CONST_BITS+PASS1_BITS+3) 4205 & RANGE_MASK]; 4206 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp2, 4207 CONST_BITS+PASS1_BITS+3) 4208 & RANGE_MASK]; 4209 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp2, 4210 CONST_BITS+PASS1_BITS+3) 4211 & RANGE_MASK]; 4212 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp1, 4213 CONST_BITS+PASS1_BITS+3) 4214 & RANGE_MASK]; 4215 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp1, 4216 CONST_BITS+PASS1_BITS+3) 4217 & RANGE_MASK]; 4218 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp13 + tmp0, 4219 CONST_BITS+PASS1_BITS+3) 4220 & RANGE_MASK]; 4221 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp13 - tmp0, 4222 CONST_BITS+PASS1_BITS+3) 383 4223 & RANGE_MASK]; 384 4224 … … 387 4227 } 388 4228 4229 4230 /* 4231 * Perform dequantization and inverse DCT on one block of coefficients, 4232 * producing a 7x14 output block. 4233 * 4234 * 14-point IDCT in pass 1 (columns), 7-point in pass 2 (rows). 4235 */ 4236 4237 GLOBAL(void) 4238 jpeg_idct_7x14 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4239 JCOEFPTR coef_block, 4240 JSAMPARRAY output_buf, JDIMENSION output_col) 4241 { 4242 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; 4243 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; 4244 INT32 z1, z2, z3, z4; 4245 JCOEFPTR inptr; 4246 ISLOW_MULT_TYPE * quantptr; 4247 int * wsptr; 4248 JSAMPROW outptr; 4249 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4250 int ctr; 4251 int workspace[7*14]; /* buffers data between passes */ 4252 SHIFT_TEMPS 4253 4254 /* Pass 1: process columns from input, store into work array. 4255 * 14-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/28). 4256 */ 4257 inptr = coef_block; 4258 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4259 wsptr = workspace; 4260 for (ctr = 0; ctr < 7; ctr++, inptr++, quantptr++, wsptr++) { 4261 /* Even part */ 4262 4263 z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4264 z1 <<= CONST_BITS; 4265 /* Add fudge factor here for final descale. */ 4266 z1 += ONE << (CONST_BITS-PASS1_BITS-1); 4267 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4268 z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ 4269 z3 = MULTIPLY(z4, FIX(0.314692123)); /* c12 */ 4270 z4 = MULTIPLY(z4, FIX(0.881747734)); /* c8 */ 4271 4272 tmp10 = z1 + z2; 4273 tmp11 = z1 + z3; 4274 tmp12 = z1 - z4; 4275 4276 tmp23 = RIGHT_SHIFT(z1 - ((z2 + z3 - z4) << 1), /* c0 = (c4+c12-c8)*2 */ 4277 CONST_BITS-PASS1_BITS); 4278 4279 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4280 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 4281 4282 z3 = MULTIPLY(z1 + z2, FIX(1.105676686)); /* c6 */ 4283 4284 tmp13 = z3 + MULTIPLY(z1, FIX(0.273079590)); /* c2-c6 */ 4285 tmp14 = z3 - MULTIPLY(z2, FIX(1.719280954)); /* c6+c10 */ 4286 tmp15 = MULTIPLY(z1, FIX(0.613604268)) - /* c10 */ 4287 MULTIPLY(z2, FIX(1.378756276)); /* c2 */ 4288 4289 tmp20 = tmp10 + tmp13; 4290 tmp26 = tmp10 - tmp13; 4291 tmp21 = tmp11 + tmp14; 4292 tmp25 = tmp11 - tmp14; 4293 tmp22 = tmp12 + tmp15; 4294 tmp24 = tmp12 - tmp15; 4295 4296 /* Odd part */ 4297 4298 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4299 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4300 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4301 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 4302 tmp13 = z4 << CONST_BITS; 4303 4304 tmp14 = z1 + z3; 4305 tmp11 = MULTIPLY(z1 + z2, FIX(1.334852607)); /* c3 */ 4306 tmp12 = MULTIPLY(tmp14, FIX(1.197448846)); /* c5 */ 4307 tmp10 = tmp11 + tmp12 + tmp13 - MULTIPLY(z1, FIX(1.126980169)); /* c3+c5-c1 */ 4308 tmp14 = MULTIPLY(tmp14, FIX(0.752406978)); /* c9 */ 4309 tmp16 = tmp14 - MULTIPLY(z1, FIX(1.061150426)); /* c9+c11-c13 */ 4310 z1 -= z2; 4311 tmp15 = MULTIPLY(z1, FIX(0.467085129)) - tmp13; /* c11 */ 4312 tmp16 += tmp15; 4313 z1 += z4; 4314 z4 = MULTIPLY(z2 + z3, - FIX(0.158341681)) - tmp13; /* -c13 */ 4315 tmp11 += z4 - MULTIPLY(z2, FIX(0.424103948)); /* c3-c9-c13 */ 4316 tmp12 += z4 - MULTIPLY(z3, FIX(2.373959773)); /* c3+c5-c13 */ 4317 z4 = MULTIPLY(z3 - z2, FIX(1.405321284)); /* c1 */ 4318 tmp14 += z4 + tmp13 - MULTIPLY(z3, FIX(1.6906431334)); /* c1+c9-c11 */ 4319 tmp15 += z4 + MULTIPLY(z2, FIX(0.674957567)); /* c1+c11-c5 */ 4320 4321 tmp13 = (z1 - z3) << PASS1_BITS; 4322 4323 /* Final output stage */ 4324 4325 wsptr[7*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 4326 wsptr[7*13] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 4327 wsptr[7*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 4328 wsptr[7*12] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 4329 wsptr[7*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 4330 wsptr[7*11] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 4331 wsptr[7*3] = (int) (tmp23 + tmp13); 4332 wsptr[7*10] = (int) (tmp23 - tmp13); 4333 wsptr[7*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 4334 wsptr[7*9] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 4335 wsptr[7*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 4336 wsptr[7*8] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 4337 wsptr[7*6] = (int) RIGHT_SHIFT(tmp26 + tmp16, CONST_BITS-PASS1_BITS); 4338 wsptr[7*7] = (int) RIGHT_SHIFT(tmp26 - tmp16, CONST_BITS-PASS1_BITS); 4339 } 4340 4341 /* Pass 2: process 14 rows from work array, store into output array. 4342 * 7-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/14). 4343 */ 4344 wsptr = workspace; 4345 for (ctr = 0; ctr < 14; ctr++) { 4346 outptr = output_buf[ctr] + output_col; 4347 4348 /* Even part */ 4349 4350 /* Add fudge factor here for final descale. */ 4351 tmp23 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4352 tmp23 <<= CONST_BITS; 4353 4354 z1 = (INT32) wsptr[2]; 4355 z2 = (INT32) wsptr[4]; 4356 z3 = (INT32) wsptr[6]; 4357 4358 tmp20 = MULTIPLY(z2 - z3, FIX(0.881747734)); /* c4 */ 4359 tmp22 = MULTIPLY(z1 - z2, FIX(0.314692123)); /* c6 */ 4360 tmp21 = tmp20 + tmp22 + tmp23 - MULTIPLY(z2, FIX(1.841218003)); /* c2+c4-c6 */ 4361 tmp10 = z1 + z3; 4362 z2 -= tmp10; 4363 tmp10 = MULTIPLY(tmp10, FIX(1.274162392)) + tmp23; /* c2 */ 4364 tmp20 += tmp10 - MULTIPLY(z3, FIX(0.077722536)); /* c2-c4-c6 */ 4365 tmp22 += tmp10 - MULTIPLY(z1, FIX(2.470602249)); /* c2+c4+c6 */ 4366 tmp23 += MULTIPLY(z2, FIX(1.414213562)); /* c0 */ 4367 4368 /* Odd part */ 4369 4370 z1 = (INT32) wsptr[1]; 4371 z2 = (INT32) wsptr[3]; 4372 z3 = (INT32) wsptr[5]; 4373 4374 tmp11 = MULTIPLY(z1 + z2, FIX(0.935414347)); /* (c3+c1-c5)/2 */ 4375 tmp12 = MULTIPLY(z1 - z2, FIX(0.170262339)); /* (c3+c5-c1)/2 */ 4376 tmp10 = tmp11 - tmp12; 4377 tmp11 += tmp12; 4378 tmp12 = MULTIPLY(z2 + z3, - FIX(1.378756276)); /* -c1 */ 4379 tmp11 += tmp12; 4380 z2 = MULTIPLY(z1 + z3, FIX(0.613604268)); /* c5 */ 4381 tmp10 += z2; 4382 tmp12 += z2 + MULTIPLY(z3, FIX(1.870828693)); /* c3+c1-c5 */ 4383 4384 /* Final output stage */ 4385 4386 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 4387 CONST_BITS+PASS1_BITS+3) 4388 & RANGE_MASK]; 4389 outptr[6] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 4390 CONST_BITS+PASS1_BITS+3) 4391 & RANGE_MASK]; 4392 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 4393 CONST_BITS+PASS1_BITS+3) 4394 & RANGE_MASK]; 4395 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 4396 CONST_BITS+PASS1_BITS+3) 4397 & RANGE_MASK]; 4398 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 4399 CONST_BITS+PASS1_BITS+3) 4400 & RANGE_MASK]; 4401 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 4402 CONST_BITS+PASS1_BITS+3) 4403 & RANGE_MASK]; 4404 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp23, 4405 CONST_BITS+PASS1_BITS+3) 4406 & RANGE_MASK]; 4407 4408 wsptr += 7; /* advance pointer to next row */ 4409 } 4410 } 4411 4412 4413 /* 4414 * Perform dequantization and inverse DCT on one block of coefficients, 4415 * producing a 6x12 output block. 4416 * 4417 * 12-point IDCT in pass 1 (columns), 6-point in pass 2 (rows). 4418 */ 4419 4420 GLOBAL(void) 4421 jpeg_idct_6x12 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4422 JCOEFPTR coef_block, 4423 JSAMPARRAY output_buf, JDIMENSION output_col) 4424 { 4425 INT32 tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; 4426 INT32 tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; 4427 INT32 z1, z2, z3, z4; 4428 JCOEFPTR inptr; 4429 ISLOW_MULT_TYPE * quantptr; 4430 int * wsptr; 4431 JSAMPROW outptr; 4432 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4433 int ctr; 4434 int workspace[6*12]; /* buffers data between passes */ 4435 SHIFT_TEMPS 4436 4437 /* Pass 1: process columns from input, store into work array. 4438 * 12-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/24). 4439 */ 4440 inptr = coef_block; 4441 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4442 wsptr = workspace; 4443 for (ctr = 0; ctr < 6; ctr++, inptr++, quantptr++, wsptr++) { 4444 /* Even part */ 4445 4446 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4447 z3 <<= CONST_BITS; 4448 /* Add fudge factor here for final descale. */ 4449 z3 += ONE << (CONST_BITS-PASS1_BITS-1); 4450 4451 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4452 z4 = MULTIPLY(z4, FIX(1.224744871)); /* c4 */ 4453 4454 tmp10 = z3 + z4; 4455 tmp11 = z3 - z4; 4456 4457 z1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4458 z4 = MULTIPLY(z1, FIX(1.366025404)); /* c2 */ 4459 z1 <<= CONST_BITS; 4460 z2 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 4461 z2 <<= CONST_BITS; 4462 4463 tmp12 = z1 - z2; 4464 4465 tmp21 = z3 + tmp12; 4466 tmp24 = z3 - tmp12; 4467 4468 tmp12 = z4 + z2; 4469 4470 tmp20 = tmp10 + tmp12; 4471 tmp25 = tmp10 - tmp12; 4472 4473 tmp12 = z4 - z1 - z2; 4474 4475 tmp22 = tmp11 + tmp12; 4476 tmp23 = tmp11 - tmp12; 4477 4478 /* Odd part */ 4479 4480 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4481 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4482 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4483 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 4484 4485 tmp11 = MULTIPLY(z2, FIX(1.306562965)); /* c3 */ 4486 tmp14 = MULTIPLY(z2, - FIX_0_541196100); /* -c9 */ 4487 4488 tmp10 = z1 + z3; 4489 tmp15 = MULTIPLY(tmp10 + z4, FIX(0.860918669)); /* c7 */ 4490 tmp12 = tmp15 + MULTIPLY(tmp10, FIX(0.261052384)); /* c5-c7 */ 4491 tmp10 = tmp12 + tmp11 + MULTIPLY(z1, FIX(0.280143716)); /* c1-c5 */ 4492 tmp13 = MULTIPLY(z3 + z4, - FIX(1.045510580)); /* -(c7+c11) */ 4493 tmp12 += tmp13 + tmp14 - MULTIPLY(z3, FIX(1.478575242)); /* c1+c5-c7-c11 */ 4494 tmp13 += tmp15 - tmp11 + MULTIPLY(z4, FIX(1.586706681)); /* c1+c11 */ 4495 tmp15 += tmp14 - MULTIPLY(z1, FIX(0.676326758)) - /* c7-c11 */ 4496 MULTIPLY(z4, FIX(1.982889723)); /* c5+c7 */ 4497 4498 z1 -= z4; 4499 z2 -= z3; 4500 z3 = MULTIPLY(z1 + z2, FIX_0_541196100); /* c9 */ 4501 tmp11 = z3 + MULTIPLY(z1, FIX_0_765366865); /* c3-c9 */ 4502 tmp14 = z3 - MULTIPLY(z2, FIX_1_847759065); /* c3+c9 */ 4503 4504 /* Final output stage */ 4505 4506 wsptr[6*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 4507 wsptr[6*11] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 4508 wsptr[6*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 4509 wsptr[6*10] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 4510 wsptr[6*2] = (int) RIGHT_SHIFT(tmp22 + tmp12, CONST_BITS-PASS1_BITS); 4511 wsptr[6*9] = (int) RIGHT_SHIFT(tmp22 - tmp12, CONST_BITS-PASS1_BITS); 4512 wsptr[6*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 4513 wsptr[6*8] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 4514 wsptr[6*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 4515 wsptr[6*7] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 4516 wsptr[6*5] = (int) RIGHT_SHIFT(tmp25 + tmp15, CONST_BITS-PASS1_BITS); 4517 wsptr[6*6] = (int) RIGHT_SHIFT(tmp25 - tmp15, CONST_BITS-PASS1_BITS); 4518 } 4519 4520 /* Pass 2: process 12 rows from work array, store into output array. 4521 * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). 4522 */ 4523 wsptr = workspace; 4524 for (ctr = 0; ctr < 12; ctr++) { 4525 outptr = output_buf[ctr] + output_col; 4526 4527 /* Even part */ 4528 4529 /* Add fudge factor here for final descale. */ 4530 tmp10 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4531 tmp10 <<= CONST_BITS; 4532 tmp12 = (INT32) wsptr[4]; 4533 tmp20 = MULTIPLY(tmp12, FIX(0.707106781)); /* c4 */ 4534 tmp11 = tmp10 + tmp20; 4535 tmp21 = tmp10 - tmp20 - tmp20; 4536 tmp20 = (INT32) wsptr[2]; 4537 tmp10 = MULTIPLY(tmp20, FIX(1.224744871)); /* c2 */ 4538 tmp20 = tmp11 + tmp10; 4539 tmp22 = tmp11 - tmp10; 4540 4541 /* Odd part */ 4542 4543 z1 = (INT32) wsptr[1]; 4544 z2 = (INT32) wsptr[3]; 4545 z3 = (INT32) wsptr[5]; 4546 tmp11 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 4547 tmp10 = tmp11 + ((z1 + z2) << CONST_BITS); 4548 tmp12 = tmp11 + ((z3 - z2) << CONST_BITS); 4549 tmp11 = (z1 - z2 - z3) << CONST_BITS; 4550 4551 /* Final output stage */ 4552 4553 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp20 + tmp10, 4554 CONST_BITS+PASS1_BITS+3) 4555 & RANGE_MASK]; 4556 outptr[5] = range_limit[(int) RIGHT_SHIFT(tmp20 - tmp10, 4557 CONST_BITS+PASS1_BITS+3) 4558 & RANGE_MASK]; 4559 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp21 + tmp11, 4560 CONST_BITS+PASS1_BITS+3) 4561 & RANGE_MASK]; 4562 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp21 - tmp11, 4563 CONST_BITS+PASS1_BITS+3) 4564 & RANGE_MASK]; 4565 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp22 + tmp12, 4566 CONST_BITS+PASS1_BITS+3) 4567 & RANGE_MASK]; 4568 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp22 - tmp12, 4569 CONST_BITS+PASS1_BITS+3) 4570 & RANGE_MASK]; 4571 4572 wsptr += 6; /* advance pointer to next row */ 4573 } 4574 } 4575 4576 4577 /* 4578 * Perform dequantization and inverse DCT on one block of coefficients, 4579 * producing a 5x10 output block. 4580 * 4581 * 10-point IDCT in pass 1 (columns), 5-point in pass 2 (rows). 4582 */ 4583 4584 GLOBAL(void) 4585 jpeg_idct_5x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4586 JCOEFPTR coef_block, 4587 JSAMPARRAY output_buf, JDIMENSION output_col) 4588 { 4589 INT32 tmp10, tmp11, tmp12, tmp13, tmp14; 4590 INT32 tmp20, tmp21, tmp22, tmp23, tmp24; 4591 INT32 z1, z2, z3, z4, z5; 4592 JCOEFPTR inptr; 4593 ISLOW_MULT_TYPE * quantptr; 4594 int * wsptr; 4595 JSAMPROW outptr; 4596 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4597 int ctr; 4598 int workspace[5*10]; /* buffers data between passes */ 4599 SHIFT_TEMPS 4600 4601 /* Pass 1: process columns from input, store into work array. 4602 * 10-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/20). 4603 */ 4604 inptr = coef_block; 4605 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4606 wsptr = workspace; 4607 for (ctr = 0; ctr < 5; ctr++, inptr++, quantptr++, wsptr++) { 4608 /* Even part */ 4609 4610 z3 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4611 z3 <<= CONST_BITS; 4612 /* Add fudge factor here for final descale. */ 4613 z3 += ONE << (CONST_BITS-PASS1_BITS-1); 4614 z4 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4615 z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ 4616 z2 = MULTIPLY(z4, FIX(0.437016024)); /* c8 */ 4617 tmp10 = z3 + z1; 4618 tmp11 = z3 - z2; 4619 4620 tmp22 = RIGHT_SHIFT(z3 - ((z1 - z2) << 1), /* c0 = (c4-c8)*2 */ 4621 CONST_BITS-PASS1_BITS); 4622 4623 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4624 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 4625 4626 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c6 */ 4627 tmp12 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c2-c6 */ 4628 tmp13 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c2+c6 */ 4629 4630 tmp20 = tmp10 + tmp12; 4631 tmp24 = tmp10 - tmp12; 4632 tmp21 = tmp11 + tmp13; 4633 tmp23 = tmp11 - tmp13; 4634 4635 /* Odd part */ 4636 4637 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4638 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4639 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4640 z4 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 4641 4642 tmp11 = z2 + z4; 4643 tmp13 = z2 - z4; 4644 4645 tmp12 = MULTIPLY(tmp13, FIX(0.309016994)); /* (c3-c7)/2 */ 4646 z5 = z3 << CONST_BITS; 4647 4648 z2 = MULTIPLY(tmp11, FIX(0.951056516)); /* (c3+c7)/2 */ 4649 z4 = z5 + tmp12; 4650 4651 tmp10 = MULTIPLY(z1, FIX(1.396802247)) + z2 + z4; /* c1 */ 4652 tmp14 = MULTIPLY(z1, FIX(0.221231742)) - z2 + z4; /* c9 */ 4653 4654 z2 = MULTIPLY(tmp11, FIX(0.587785252)); /* (c1-c9)/2 */ 4655 z4 = z5 - tmp12 - (tmp13 << (CONST_BITS - 1)); 4656 4657 tmp12 = (z1 - tmp13 - z3) << PASS1_BITS; 4658 4659 tmp11 = MULTIPLY(z1, FIX(1.260073511)) - z2 - z4; /* c3 */ 4660 tmp13 = MULTIPLY(z1, FIX(0.642039522)) - z2 + z4; /* c7 */ 4661 4662 /* Final output stage */ 4663 4664 wsptr[5*0] = (int) RIGHT_SHIFT(tmp20 + tmp10, CONST_BITS-PASS1_BITS); 4665 wsptr[5*9] = (int) RIGHT_SHIFT(tmp20 - tmp10, CONST_BITS-PASS1_BITS); 4666 wsptr[5*1] = (int) RIGHT_SHIFT(tmp21 + tmp11, CONST_BITS-PASS1_BITS); 4667 wsptr[5*8] = (int) RIGHT_SHIFT(tmp21 - tmp11, CONST_BITS-PASS1_BITS); 4668 wsptr[5*2] = (int) (tmp22 + tmp12); 4669 wsptr[5*7] = (int) (tmp22 - tmp12); 4670 wsptr[5*3] = (int) RIGHT_SHIFT(tmp23 + tmp13, CONST_BITS-PASS1_BITS); 4671 wsptr[5*6] = (int) RIGHT_SHIFT(tmp23 - tmp13, CONST_BITS-PASS1_BITS); 4672 wsptr[5*4] = (int) RIGHT_SHIFT(tmp24 + tmp14, CONST_BITS-PASS1_BITS); 4673 wsptr[5*5] = (int) RIGHT_SHIFT(tmp24 - tmp14, CONST_BITS-PASS1_BITS); 4674 } 4675 4676 /* Pass 2: process 10 rows from work array, store into output array. 4677 * 5-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/10). 4678 */ 4679 wsptr = workspace; 4680 for (ctr = 0; ctr < 10; ctr++) { 4681 outptr = output_buf[ctr] + output_col; 4682 4683 /* Even part */ 4684 4685 /* Add fudge factor here for final descale. */ 4686 tmp12 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4687 tmp12 <<= CONST_BITS; 4688 tmp13 = (INT32) wsptr[2]; 4689 tmp14 = (INT32) wsptr[4]; 4690 z1 = MULTIPLY(tmp13 + tmp14, FIX(0.790569415)); /* (c2+c4)/2 */ 4691 z2 = MULTIPLY(tmp13 - tmp14, FIX(0.353553391)); /* (c2-c4)/2 */ 4692 z3 = tmp12 + z2; 4693 tmp10 = z3 + z1; 4694 tmp11 = z3 - z1; 4695 tmp12 -= z2 << 2; 4696 4697 /* Odd part */ 4698 4699 z2 = (INT32) wsptr[1]; 4700 z3 = (INT32) wsptr[3]; 4701 4702 z1 = MULTIPLY(z2 + z3, FIX(0.831253876)); /* c3 */ 4703 tmp13 = z1 + MULTIPLY(z2, FIX(0.513743148)); /* c1-c3 */ 4704 tmp14 = z1 - MULTIPLY(z3, FIX(2.176250899)); /* c1+c3 */ 4705 4706 /* Final output stage */ 4707 4708 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp13, 4709 CONST_BITS+PASS1_BITS+3) 4710 & RANGE_MASK]; 4711 outptr[4] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp13, 4712 CONST_BITS+PASS1_BITS+3) 4713 & RANGE_MASK]; 4714 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp11 + tmp14, 4715 CONST_BITS+PASS1_BITS+3) 4716 & RANGE_MASK]; 4717 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp11 - tmp14, 4718 CONST_BITS+PASS1_BITS+3) 4719 & RANGE_MASK]; 4720 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12, 4721 CONST_BITS+PASS1_BITS+3) 4722 & RANGE_MASK]; 4723 4724 wsptr += 5; /* advance pointer to next row */ 4725 } 4726 } 4727 4728 4729 /* 4730 * Perform dequantization and inverse DCT on one block of coefficients, 4731 * producing a 4x8 output block. 4732 * 4733 * 8-point IDCT in pass 1 (columns), 4-point in pass 2 (rows). 4734 */ 4735 4736 GLOBAL(void) 4737 jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4738 JCOEFPTR coef_block, 4739 JSAMPARRAY output_buf, JDIMENSION output_col) 4740 { 4741 INT32 tmp0, tmp1, tmp2, tmp3; 4742 INT32 tmp10, tmp11, tmp12, tmp13; 4743 INT32 z1, z2, z3; 4744 JCOEFPTR inptr; 4745 ISLOW_MULT_TYPE * quantptr; 4746 int * wsptr; 4747 JSAMPROW outptr; 4748 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4749 int ctr; 4750 int workspace[4*8]; /* buffers data between passes */ 4751 SHIFT_TEMPS 4752 4753 /* Pass 1: process columns from input, store into work array. */ 4754 /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ 4755 /* furthermore, we scale the results by 2**PASS1_BITS. */ 4756 4757 inptr = coef_block; 4758 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4759 wsptr = workspace; 4760 for (ctr = 4; ctr > 0; ctr--) { 4761 /* Due to quantization, we will usually find that many of the input 4762 * coefficients are zero, especially the AC terms. We can exploit this 4763 * by short-circuiting the IDCT calculation for any column in which all 4764 * the AC terms are zero. In that case each output is equal to the 4765 * DC coefficient (with scale factor as needed). 4766 * With typical images and quantization tables, half or more of the 4767 * column DCT calculations can be simplified this way. 4768 */ 4769 4770 if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && 4771 inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && 4772 inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && 4773 inptr[DCTSIZE*7] == 0) { 4774 /* AC terms all zero */ 4775 int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; 4776 4777 wsptr[4*0] = dcval; 4778 wsptr[4*1] = dcval; 4779 wsptr[4*2] = dcval; 4780 wsptr[4*3] = dcval; 4781 wsptr[4*4] = dcval; 4782 wsptr[4*5] = dcval; 4783 wsptr[4*6] = dcval; 4784 wsptr[4*7] = dcval; 4785 4786 inptr++; /* advance pointers to next column */ 4787 quantptr++; 4788 wsptr++; 4789 continue; 4790 } 4791 4792 /* Even part: reverse the even part of the forward DCT. */ 4793 /* The rotator is sqrt(2)*c(-6). */ 4794 4795 z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4796 z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); 4797 4798 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); 4799 tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); 4800 tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); 4801 4802 z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4803 z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4804 z2 <<= CONST_BITS; 4805 z3 <<= CONST_BITS; 4806 /* Add fudge factor here for final descale. */ 4807 z2 += ONE << (CONST_BITS-PASS1_BITS-1); 4808 4809 tmp0 = z2 + z3; 4810 tmp1 = z2 - z3; 4811 4812 tmp10 = tmp0 + tmp2; 4813 tmp13 = tmp0 - tmp2; 4814 tmp11 = tmp1 + tmp3; 4815 tmp12 = tmp1 - tmp3; 4816 4817 /* Odd part per figure 8; the matrix is unitary and hence its 4818 * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. 4819 */ 4820 4821 tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); 4822 tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4823 tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4824 tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4825 4826 z2 = tmp0 + tmp2; 4827 z3 = tmp1 + tmp3; 4828 4829 z1 = MULTIPLY(z2 + z3, FIX_1_175875602); /* sqrt(2) * c3 */ 4830 z2 = MULTIPLY(z2, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ 4831 z3 = MULTIPLY(z3, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ 4832 z2 += z1; 4833 z3 += z1; 4834 4835 z1 = MULTIPLY(tmp0 + tmp3, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ 4836 tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ 4837 tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ 4838 tmp0 += z1 + z2; 4839 tmp3 += z1 + z3; 4840 4841 z1 = MULTIPLY(tmp1 + tmp2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ 4842 tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ 4843 tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ 4844 tmp1 += z1 + z3; 4845 tmp2 += z1 + z2; 4846 4847 /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ 4848 4849 wsptr[4*0] = (int) RIGHT_SHIFT(tmp10 + tmp3, CONST_BITS-PASS1_BITS); 4850 wsptr[4*7] = (int) RIGHT_SHIFT(tmp10 - tmp3, CONST_BITS-PASS1_BITS); 4851 wsptr[4*1] = (int) RIGHT_SHIFT(tmp11 + tmp2, CONST_BITS-PASS1_BITS); 4852 wsptr[4*6] = (int) RIGHT_SHIFT(tmp11 - tmp2, CONST_BITS-PASS1_BITS); 4853 wsptr[4*2] = (int) RIGHT_SHIFT(tmp12 + tmp1, CONST_BITS-PASS1_BITS); 4854 wsptr[4*5] = (int) RIGHT_SHIFT(tmp12 - tmp1, CONST_BITS-PASS1_BITS); 4855 wsptr[4*3] = (int) RIGHT_SHIFT(tmp13 + tmp0, CONST_BITS-PASS1_BITS); 4856 wsptr[4*4] = (int) RIGHT_SHIFT(tmp13 - tmp0, CONST_BITS-PASS1_BITS); 4857 4858 inptr++; /* advance pointers to next column */ 4859 quantptr++; 4860 wsptr++; 4861 } 4862 4863 /* Pass 2: process 8 rows from work array, store into output array. 4864 * 4-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/16). 4865 */ 4866 wsptr = workspace; 4867 for (ctr = 0; ctr < 8; ctr++) { 4868 outptr = output_buf[ctr] + output_col; 4869 4870 /* Even part */ 4871 4872 /* Add fudge factor here for final descale. */ 4873 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4874 tmp2 = (INT32) wsptr[2]; 4875 4876 tmp10 = (tmp0 + tmp2) << CONST_BITS; 4877 tmp12 = (tmp0 - tmp2) << CONST_BITS; 4878 4879 /* Odd part */ 4880 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 4881 4882 z2 = (INT32) wsptr[1]; 4883 z3 = (INT32) wsptr[3]; 4884 4885 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 4886 tmp0 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ 4887 tmp2 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ 4888 4889 /* Final output stage */ 4890 4891 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 4892 CONST_BITS+PASS1_BITS+3) 4893 & RANGE_MASK]; 4894 outptr[3] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 4895 CONST_BITS+PASS1_BITS+3) 4896 & RANGE_MASK]; 4897 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp12 + tmp2, 4898 CONST_BITS+PASS1_BITS+3) 4899 & RANGE_MASK]; 4900 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp12 - tmp2, 4901 CONST_BITS+PASS1_BITS+3) 4902 & RANGE_MASK]; 4903 4904 wsptr += 4; /* advance pointer to next row */ 4905 } 4906 } 4907 4908 4909 /* 4910 * Perform dequantization and inverse DCT on one block of coefficients, 4911 * producing a reduced-size 3x6 output block. 4912 * 4913 * 6-point IDCT in pass 1 (columns), 3-point in pass 2 (rows). 4914 */ 4915 4916 GLOBAL(void) 4917 jpeg_idct_3x6 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 4918 JCOEFPTR coef_block, 4919 JSAMPARRAY output_buf, JDIMENSION output_col) 4920 { 4921 INT32 tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; 4922 INT32 z1, z2, z3; 4923 JCOEFPTR inptr; 4924 ISLOW_MULT_TYPE * quantptr; 4925 int * wsptr; 4926 JSAMPROW outptr; 4927 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 4928 int ctr; 4929 int workspace[3*6]; /* buffers data between passes */ 4930 SHIFT_TEMPS 4931 4932 /* Pass 1: process columns from input, store into work array. 4933 * 6-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/12). 4934 */ 4935 inptr = coef_block; 4936 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 4937 wsptr = workspace; 4938 for (ctr = 0; ctr < 3; ctr++, inptr++, quantptr++, wsptr++) { 4939 /* Even part */ 4940 4941 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 4942 tmp0 <<= CONST_BITS; 4943 /* Add fudge factor here for final descale. */ 4944 tmp0 += ONE << (CONST_BITS-PASS1_BITS-1); 4945 tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); 4946 tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ 4947 tmp1 = tmp0 + tmp10; 4948 tmp11 = RIGHT_SHIFT(tmp0 - tmp10 - tmp10, CONST_BITS-PASS1_BITS); 4949 tmp10 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 4950 tmp0 = MULTIPLY(tmp10, FIX(1.224744871)); /* c2 */ 4951 tmp10 = tmp1 + tmp0; 4952 tmp12 = tmp1 - tmp0; 4953 4954 /* Odd part */ 4955 4956 z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 4957 z2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 4958 z3 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); 4959 tmp1 = MULTIPLY(z1 + z3, FIX(0.366025404)); /* c5 */ 4960 tmp0 = tmp1 + ((z1 + z2) << CONST_BITS); 4961 tmp2 = tmp1 + ((z3 - z2) << CONST_BITS); 4962 tmp1 = (z1 - z2 - z3) << PASS1_BITS; 4963 4964 /* Final output stage */ 4965 4966 wsptr[3*0] = (int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS-PASS1_BITS); 4967 wsptr[3*5] = (int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS-PASS1_BITS); 4968 wsptr[3*1] = (int) (tmp11 + tmp1); 4969 wsptr[3*4] = (int) (tmp11 - tmp1); 4970 wsptr[3*2] = (int) RIGHT_SHIFT(tmp12 + tmp2, CONST_BITS-PASS1_BITS); 4971 wsptr[3*3] = (int) RIGHT_SHIFT(tmp12 - tmp2, CONST_BITS-PASS1_BITS); 4972 } 4973 4974 /* Pass 2: process 6 rows from work array, store into output array. 4975 * 3-point IDCT kernel, cK represents sqrt(2) * cos(K*pi/6). 4976 */ 4977 wsptr = workspace; 4978 for (ctr = 0; ctr < 6; ctr++) { 4979 outptr = output_buf[ctr] + output_col; 4980 4981 /* Even part */ 4982 4983 /* Add fudge factor here for final descale. */ 4984 tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); 4985 tmp0 <<= CONST_BITS; 4986 tmp2 = (INT32) wsptr[2]; 4987 tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ 4988 tmp10 = tmp0 + tmp12; 4989 tmp2 = tmp0 - tmp12 - tmp12; 4990 4991 /* Odd part */ 4992 4993 tmp12 = (INT32) wsptr[1]; 4994 tmp0 = MULTIPLY(tmp12, FIX(1.224744871)); /* c1 */ 4995 4996 /* Final output stage */ 4997 4998 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 4999 CONST_BITS+PASS1_BITS+3) 5000 & RANGE_MASK]; 5001 outptr[2] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 5002 CONST_BITS+PASS1_BITS+3) 5003 & RANGE_MASK]; 5004 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2, 5005 CONST_BITS+PASS1_BITS+3) 5006 & RANGE_MASK]; 5007 5008 wsptr += 3; /* advance pointer to next row */ 5009 } 5010 } 5011 5012 5013 /* 5014 * Perform dequantization and inverse DCT on one block of coefficients, 5015 * producing a 2x4 output block. 5016 * 5017 * 4-point IDCT in pass 1 (columns), 2-point in pass 2 (rows). 5018 */ 5019 5020 GLOBAL(void) 5021 jpeg_idct_2x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 5022 JCOEFPTR coef_block, 5023 JSAMPARRAY output_buf, JDIMENSION output_col) 5024 { 5025 INT32 tmp0, tmp2, tmp10, tmp12; 5026 INT32 z1, z2, z3; 5027 JCOEFPTR inptr; 5028 ISLOW_MULT_TYPE * quantptr; 5029 INT32 * wsptr; 5030 JSAMPROW outptr; 5031 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 5032 int ctr; 5033 INT32 workspace[2*4]; /* buffers data between passes */ 5034 SHIFT_TEMPS 5035 5036 /* Pass 1: process columns from input, store into work array. 5037 * 4-point IDCT kernel, 5038 * cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point IDCT]. 5039 */ 5040 inptr = coef_block; 5041 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 5042 wsptr = workspace; 5043 for (ctr = 0; ctr < 2; ctr++, inptr++, quantptr++, wsptr++) { 5044 /* Even part */ 5045 5046 tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); 5047 tmp2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); 5048 5049 tmp10 = (tmp0 + tmp2) << CONST_BITS; 5050 tmp12 = (tmp0 - tmp2) << CONST_BITS; 5051 5052 /* Odd part */ 5053 /* Same rotation as in the even part of the 8x8 LL&M IDCT */ 5054 5055 z2 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); 5056 z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); 5057 5058 z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ 5059 tmp0 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ 5060 tmp2 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ 5061 5062 /* Final output stage */ 5063 5064 wsptr[2*0] = tmp10 + tmp0; 5065 wsptr[2*3] = tmp10 - tmp0; 5066 wsptr[2*1] = tmp12 + tmp2; 5067 wsptr[2*2] = tmp12 - tmp2; 5068 } 5069 5070 /* Pass 2: process 4 rows from work array, store into output array. */ 5071 5072 wsptr = workspace; 5073 for (ctr = 0; ctr < 4; ctr++) { 5074 outptr = output_buf[ctr] + output_col; 5075 5076 /* Even part */ 5077 5078 /* Add fudge factor here for final descale. */ 5079 tmp10 = wsptr[0] + (ONE << (CONST_BITS+2)); 5080 5081 /* Odd part */ 5082 5083 tmp0 = wsptr[1]; 5084 5085 /* Final output stage */ 5086 5087 outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, CONST_BITS+3) 5088 & RANGE_MASK]; 5089 outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, CONST_BITS+3) 5090 & RANGE_MASK]; 5091 5092 wsptr += 2; /* advance pointer to next row */ 5093 } 5094 } 5095 5096 5097 /* 5098 * Perform dequantization and inverse DCT on one block of coefficients, 5099 * producing a 1x2 output block. 5100 * 5101 * 2-point IDCT in pass 1 (columns), 1-point in pass 2 (rows). 5102 */ 5103 5104 GLOBAL(void) 5105 jpeg_idct_1x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, 5106 JCOEFPTR coef_block, 5107 JSAMPARRAY output_buf, JDIMENSION output_col) 5108 { 5109 INT32 tmp0, tmp10; 5110 ISLOW_MULT_TYPE * quantptr; 5111 JSAMPLE *range_limit = IDCT_range_limit(cinfo); 5112 SHIFT_TEMPS 5113 5114 /* Process 1 column from input, store into output array. */ 5115 5116 quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; 5117 5118 /* Even part */ 5119 5120 tmp10 = DEQUANTIZE(coef_block[DCTSIZE*0], quantptr[DCTSIZE*0]); 5121 /* Add fudge factor here for final descale. */ 5122 tmp10 += ONE << 2; 5123 5124 /* Odd part */ 5125 5126 tmp0 = DEQUANTIZE(coef_block[DCTSIZE*1], quantptr[DCTSIZE*1]); 5127 5128 /* Final output stage */ 5129 5130 output_buf[0][output_col] = range_limit[(int) RIGHT_SHIFT(tmp10 + tmp0, 3) 5131 & RANGE_MASK]; 5132 output_buf[1][output_col] = range_limit[(int) RIGHT_SHIFT(tmp10 - tmp0, 3) 5133 & RANGE_MASK]; 5134 } 5135 5136 #endif /* IDCT_SCALING_SUPPORTED */ 389 5137 #endif /* DCT_ISLOW_SUPPORTED */ -
trunk/src/3rdparty/libjpeg/jmorecfg.h
r561 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 1997-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 158 159 /* INT32 must hold at least signed 32-bit values. */ 159 160 160 #if !defined(XMD_H) && !defined(VXWORKS) /* X11/xmd.h correctly defines INT32 */ 161 #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ 162 #ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ 163 #ifndef _BASETSD_H /* MinGW is slightly different */ 164 #ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ 165 #ifndef VXWORKS 161 166 typedef long INT32; 167 #endif 168 #endif 169 #endif 170 #endif 162 171 #endif 163 172 … … 181 190 */ 182 191 192 #if defined(VXWORKS) && defined(LOCAL) 193 #undef LOCAL 194 #endif 183 195 /* a function called through method pointers: */ 184 196 #define METHODDEF(type) static type 185 197 /* a function used only in its module: */ 186 #if defined(VXWORKS) && defined(LOCAL)187 # undef LOCAL188 #endif189 198 #define LOCAL(type) static type 190 199 /* a function referenced thru EXTERNs: */ … … 213 222 */ 214 223 224 #ifndef FAR 215 225 #ifdef NEED_FAR_POINTERS 216 226 #define FAR far 217 227 #else 218 228 #define FAR 229 #endif 219 230 #endif 220 231 … … 260 271 */ 261 272 262 /* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */263 264 273 /* Capability options common to encoder and decoder: */ 265 274 … … 273 282 #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 274 283 #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 284 #define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ 275 285 #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ 276 286 /* Note: if you selected 12-bit data precision, it is dangerous to turn off … … 289 299 #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 290 300 #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 301 #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ 291 302 #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ 292 303 #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ 293 #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */294 304 #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ 295 305 #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ -
trunk/src/3rdparty/libjpeg/jpegint.h
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1997, Thomas G. Lane. 5 * Modified 1997-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 100 101 101 102 /* Forward DCT (also controls coefficient quantization) */ 103 typedef JMETHOD(void, forward_DCT_ptr, 104 (j_compress_ptr cinfo, jpeg_component_info * compptr, 105 JSAMPARRAY sample_data, JBLOCKROW coef_blocks, 106 JDIMENSION start_row, JDIMENSION start_col, 107 JDIMENSION num_blocks)); 108 102 109 struct jpeg_forward_dct { 103 110 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); 104 /* perhaps this should be an array??? */ 105 JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, 106 jpeg_component_info * compptr, 107 JSAMPARRAY sample_data, JBLOCKROW coef_blocks, 108 JDIMENSION start_row, JDIMENSION start_col, 109 JDIMENSION num_blocks)); 111 /* It is useful to allow each component to have a separate FDCT method. */ 112 forward_DCT_ptr forward_DCT[MAX_COMPONENTS]; 110 113 }; 111 114 … … 211 214 JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, 212 215 JBLOCKROW *MCU_data)); 213 214 /* This is here to share code between baseline and progressive decoders; */215 /* other modules probably should not use it */216 boolean insufficient_data; /* set TRUE after emitting warning */217 216 }; 218 217 … … 304 303 #define jinit_forward_dct jIFDCT 305 304 #define jinit_huff_encoder jIHEncoder 306 #define jinit_ phuff_encoder jIPHEncoder305 #define jinit_arith_encoder jIAEncoder 307 306 #define jinit_marker_writer jIMWriter 308 307 #define jinit_master_decompress jIDMaster … … 313 312 #define jinit_marker_reader jIMReader 314 313 #define jinit_huff_decoder jIHDecoder 315 #define jinit_ phuff_decoder jIPHDecoder314 #define jinit_arith_decoder jIADecoder 316 315 #define jinit_inverse_dct jIIDCT 317 316 #define jinit_upsampler jIUpsampler … … 328 327 #define jpeg_zigzag_order jZIGTable 329 328 #define jpeg_natural_order jZAGTable 329 #define jpeg_natural_order7 jZAGTable7 330 #define jpeg_natural_order6 jZAGTable6 331 #define jpeg_natural_order5 jZAGTable5 332 #define jpeg_natural_order4 jZAGTable4 333 #define jpeg_natural_order3 jZAGTable3 334 #define jpeg_natural_order2 jZAGTable2 335 #define jpeg_aritab jAriTab 330 336 #endif /* NEED_SHORT_EXTERNAL_NAMES */ 331 337 … … 345 351 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); 346 352 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); 347 EXTERN(void) jinit_ phuff_encoder JPP((j_compress_ptr cinfo));353 EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo)); 348 354 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); 349 355 /* Decompression module initialization routines */ … … 358 364 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); 359 365 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); 360 EXTERN(void) jinit_ phuff_decoder JPP((j_decompress_ptr cinfo));366 EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo)); 361 367 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); 362 368 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); … … 382 388 #endif 383 389 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ 390 extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */ 391 extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */ 392 extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */ 393 extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */ 394 extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */ 395 extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */ 396 397 /* Arithmetic coding probability estimation tables in jaricom.c */ 398 extern const INT32 jpeg_aritab[]; 384 399 385 400 /* Suppress undefined-structure complaints if necessary. */ -
trunk/src/3rdparty/libjpeg/jpeglib.h
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1998, Thomas G. Lane. 5 * Modified 2002-2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 27 28 28 29 30 #ifdef __cplusplus 31 #ifndef DONT_USE_EXTERN_C 32 extern "C" { 33 #endif 34 #endif 35 29 36 /* Version ID for the JPEG library. 30 * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".31 */ 32 33 #define JPEG_LIB_VERSION 62 /* Version 6b*/37 * Might be useful for tests like "#if JPEG_LIB_VERSION >= 80". 38 */ 39 40 #define JPEG_LIB_VERSION 80 /* Version 8.0 */ 34 41 35 42 … … 139 146 JDIMENSION width_in_blocks; 140 147 JDIMENSION height_in_blocks; 141 /* Size of a DCT block in samples . Always DCTSIZE for compression.142 * For decompression this is the size of the output from one DCT block,143 * reflecting any scaling we choose to apply during the IDCT step.144 * Values of 1,2,4,8 are likely to be supported. Note that different145 * components may receive different IDCT scalings.146 */147 int DCT_ scaled_size;148 /* Size of a DCT block in samples, 149 * reflecting any scaling we choose to apply during the DCT step. 150 * Values from 1 to 16 are supported. 151 * Note that different components may receive different DCT scalings. 152 */ 153 int DCT_h_scaled_size; 154 int DCT_v_scaled_size; 148 155 /* The downsampled dimensions are the component's actual, unpadded number 149 * of samples at the main buffer (preprocessing/compression interface) , thus150 * downsampled_width = ceil(image_width * Hi/Hmax)151 * and similarly for height. For decompression, IDCT scaling is included, so152 * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)156 * of samples at the main buffer (preprocessing/compression interface); 157 * DCT scaling is included, so 158 * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE) 159 * and similarly for height. 153 160 */ 154 161 JDIMENSION downsampled_width; /* actual width in samples */ … … 165 172 int MCU_height; /* number of blocks per MCU, vertically */ 166 173 int MCU_blocks; /* MCU_width * MCU_height */ 167 int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */174 int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scaled_size */ 168 175 int last_col_width; /* # of non-dummy blocks across in last MCU */ 169 176 int last_row_height; /* # of non-dummy blocks down in last MCU */ … … 292 299 */ 293 300 301 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ 302 303 JDIMENSION jpeg_width; /* scaled JPEG image width */ 304 JDIMENSION jpeg_height; /* scaled JPEG image height */ 305 /* Dimensions of actual JPEG image that will be written to file, 306 * derived from input dimensions by scaling factors above. 307 * These fields are computed by jpeg_start_compress(). 308 * You can also use jpeg_calc_jpeg_dimensions() to determine these values 309 * in advance of calling jpeg_start_compress(). 310 */ 311 294 312 int data_precision; /* bits of precision in image data */ 295 313 … … 299 317 jpeg_component_info * comp_info; 300 318 /* comp_info[i] describes component that appears i'th in SOF */ 301 319 302 320 JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; 303 /* ptrs to coefficient quantization tables, or NULL if not defined */ 304 321 int q_scale_factor[NUM_QUANT_TBLS]; 322 /* ptrs to coefficient quantization tables, or NULL if not defined, 323 * and corresponding scale factors (percentage, initialized 100). 324 */ 325 305 326 JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; 306 327 JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; 307 328 /* ptrs to Huffman coding tables, or NULL if not defined */ 308 329 309 330 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ 310 331 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ … … 322 343 boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ 323 344 boolean CCIR601_sampling; /* TRUE=first samples are cosited */ 345 boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ 324 346 int smoothing_factor; /* 1..100, or 0 for no input smoothing */ 325 347 J_DCT_METHOD dct_method; /* DCT algorithm selector */ … … 365 387 int max_v_samp_factor; /* largest v_samp_factor */ 366 388 389 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ 390 int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ 391 367 392 JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ 368 393 /* The coefficient controller receives data in units of MCU rows as defined … … 389 414 390 415 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ 416 417 int block_size; /* the basic DCT block size: 1..16 */ 418 const int * natural_order; /* natural-order position array */ 419 int lim_Se; /* min( Se, DCTSIZE2-1 ) */ 391 420 392 421 /* … … 536 565 /* comp_info[i] describes component that appears i'th in SOF */ 537 566 567 boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ 538 568 boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ 539 569 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ … … 576 606 int max_v_samp_factor; /* largest v_samp_factor */ 577 607 578 int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ 608 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ 609 int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ 579 610 580 611 JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ … … 584 615 * interleaved or not. We define an iMCU row as v_samp_factor DCT block 585 616 * rows of each component. Therefore, the IDCT output contains 586 * v_samp_factor*DCT_ scaled_size sample rows of a component per iMCU row.617 * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row. 587 618 */ 588 619 … … 607 638 608 639 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ 640 641 /* These fields are derived from Se of first SOS marker. 642 */ 643 int block_size; /* the basic DCT block size: 1..16 */ 644 const int * natural_order; /* natural-order position array for entropy decode */ 645 int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ 609 646 610 647 /* This field is shared between entropy decoder and marker parser. … … 837 874 #define jpeg_stdio_dest jStdDest 838 875 #define jpeg_stdio_src jStdSrc 876 #define jpeg_mem_dest jMemDest 877 #define jpeg_mem_src jMemSrc 839 878 #define jpeg_set_defaults jSetDefaults 840 879 #define jpeg_set_colorspace jSetColorspace … … 842 881 #define jpeg_set_quality jSetQuality 843 882 #define jpeg_set_linear_quality jSetLQuality 883 #define jpeg_default_qtables jDefQTables 844 884 #define jpeg_add_quant_table jAddQuantTable 845 885 #define jpeg_quality_scaling jQualityScaling … … 851 891 #define jpeg_write_scanlines jWrtScanlines 852 892 #define jpeg_finish_compress jFinCompress 893 #define jpeg_calc_jpeg_dimensions jCjpegDimensions 853 894 #define jpeg_write_raw_data jWrtRawData 854 895 #define jpeg_write_marker jWrtMarker … … 867 908 #define jpeg_new_colormap jNewCMap 868 909 #define jpeg_consume_input jConsumeInput 910 #define jpeg_core_output_dimensions jCoreDimensions 869 911 #define jpeg_calc_output_dimensions jCalcDimensions 870 912 #define jpeg_save_markers jSaveMarkers … … 911 953 EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); 912 954 955 /* Data source and destination managers: memory buffers. */ 956 EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, 957 unsigned char ** outbuffer, 958 unsigned long * outsize)); 959 EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, 960 unsigned char * inbuffer, 961 unsigned long insize)); 962 913 963 /* Default parameter setup for compression */ 914 964 EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); … … 922 972 int scale_factor, 923 973 boolean force_baseline)); 974 EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, 975 boolean force_baseline)); 924 976 EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, 925 977 const unsigned int *basic_table, … … 941 993 EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); 942 994 995 /* Precalculate JPEG dimensions for current compression parameters. */ 996 EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); 997 943 998 /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ 944 999 EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, … … 946 1001 JDIMENSION num_lines)); 947 1002 948 /* Write a special marker. See libjpeg. docconcerning safe usage. */1003 /* Write a special marker. See libjpeg.txt concerning safe usage. */ 949 1004 EXTERN(void) jpeg_write_marker 950 1005 JPP((j_compress_ptr cinfo, int marker, … … 1000 1055 1001 1056 /* Precalculate output dimensions for current decompression parameters. */ 1057 EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); 1002 1058 EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); 1003 1059 … … 1094 1150 #endif 1095 1151 1152 #ifdef __cplusplus 1153 #ifndef DONT_USE_EXTERN_C 1154 } 1155 #endif 1156 #endif 1157 1096 1158 #endif /* JPEGLIB_H */ -
trunk/src/3rdparty/libjpeg/jutils.c
r2 r846 3 3 * 4 4 * Copyright (C) 1991-1996, Thomas G. Lane. 5 * Modified 2009 by Guido Vollbeding. 5 6 * This file is part of the Independent JPEG Group's software. 6 7 * For conditions of distribution and use, see the accompanying README file. … … 64 65 }; 65 66 67 const int jpeg_natural_order7[7*7+16] = { 68 0, 1, 8, 16, 9, 2, 3, 10, 69 17, 24, 32, 25, 18, 11, 4, 5, 70 12, 19, 26, 33, 40, 48, 41, 34, 71 27, 20, 13, 6, 14, 21, 28, 35, 72 42, 49, 50, 43, 36, 29, 22, 30, 73 37, 44, 51, 52, 45, 38, 46, 53, 74 54, 75 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 76 63, 63, 63, 63, 63, 63, 63, 63 77 }; 78 79 const int jpeg_natural_order6[6*6+16] = { 80 0, 1, 8, 16, 9, 2, 3, 10, 81 17, 24, 32, 25, 18, 11, 4, 5, 82 12, 19, 26, 33, 40, 41, 34, 27, 83 20, 13, 21, 28, 35, 42, 43, 36, 84 29, 37, 44, 45, 85 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 86 63, 63, 63, 63, 63, 63, 63, 63 87 }; 88 89 const int jpeg_natural_order5[5*5+16] = { 90 0, 1, 8, 16, 9, 2, 3, 10, 91 17, 24, 32, 25, 18, 11, 4, 12, 92 19, 26, 33, 34, 27, 20, 28, 35, 93 36, 94 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 95 63, 63, 63, 63, 63, 63, 63, 63 96 }; 97 98 const int jpeg_natural_order4[4*4+16] = { 99 0, 1, 8, 16, 9, 2, 3, 10, 100 17, 24, 25, 18, 11, 19, 26, 27, 101 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 102 63, 63, 63, 63, 63, 63, 63, 63 103 }; 104 105 const int jpeg_natural_order3[3*3+16] = { 106 0, 1, 8, 16, 9, 2, 10, 17, 107 18, 108 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 109 63, 63, 63, 63, 63, 63, 63, 63 110 }; 111 112 const int jpeg_natural_order2[2*2+16] = { 113 0, 1, 8, 9, 114 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 115 63, 63, 63, 63, 63, 63, 63, 63 116 }; 117 66 118 67 119 /* -
trunk/src/3rdparty/libjpeg/jversion.h
r2 r846 2 2 * jversion.h 3 3 * 4 * Copyright (C) 1991- 1998, Thomas G. Lane.4 * Copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding. 5 5 * This file is part of the Independent JPEG Group's software. 6 6 * For conditions of distribution and use, see the accompanying README file. … … 10 10 11 11 12 #define JVERSION " 6b 27-Mar-1998"12 #define JVERSION "8 10-Jan-2010" 13 13 14 #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane"14 #define JCOPYRIGHT "Copyright (C) 2010, Thomas G. Lane, Guido Vollbeding" -
trunk/src/3rdparty/libjpeg/makefile.ansi
r2 r846 39 39 40 40 # source files: JPEG library proper 41 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \42 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \43 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \44 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \45 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \46 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \47 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \41 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 42 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 43 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 44 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 45 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 46 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 47 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 48 48 jquant2.c jutils.c jmemmgr.c 49 49 # memmgr back ends: compile only one of these into a working library … … 55 55 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 56 56 # files included by source files 57 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \58 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h57 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 58 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 59 59 # documentation, test, and support files 60 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 61 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 62 coderules.doc filelist.doc change.log 63 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 64 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 65 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 66 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 67 makvms.opt 60 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 61 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 62 coderules.txt filelist.txt change.log 63 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 64 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 65 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 66 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 67 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 68 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 69 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 70 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 71 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 72 makefile.vms makvms.opt 68 73 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 69 74 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 70 75 jconfig.vms 71 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 72 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 76 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 77 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 78 libjpeg.map 73 79 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 74 80 testimgp.jpg … … 76 82 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 77 83 # library object files common to compression and decompression 78 COMOBJECTS= j comapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)84 COMOBJECTS= jaricom.o jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) 79 85 # compression library object files 80 CLIBOBJECTS= jcapimin.o jcapistd.o jc trans.o jcparam.o jdatadst.o jcinit.o \81 j cmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \82 jc sample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \83 jfdct int.o86 CLIBOBJECTS= jcapimin.o jcapistd.o jcarith.o jctrans.o jcparam.o \ 87 jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o \ 88 jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o jfdctfst.o \ 89 jfdctflt.o jfdctint.o 84 90 # decompression library object files 85 DLIBOBJECTS= jdapimin.o jdapistd.o jd trans.o jdatasrc.o jdmaster.o \86 jd input.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \87 jd postct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \88 j dsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o91 DLIBOBJECTS= jdapimin.o jdapistd.o jdarith.o jdtrans.o jdatasrc.o \ 92 jdmaster.o jdinput.o jdmarker.o jdhuff.o jdmainct.o \ 93 jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o \ 94 jidctint.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o 89 95 # These objectfiles are included in libjpeg.a 90 96 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 119 125 $(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS) 120 126 121 jconfig.h: jconfig. doc127 jconfig.h: jconfig.txt 122 128 echo You must prepare a system-dependent jconfig.h file. 123 echo Please read the installation directions in install. doc.129 echo Please read the installation directions in install.txt. 124 130 exit 1 125 131 … … 144 150 145 151 152 jaricom.o: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 146 153 jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 147 154 jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 155 jcarith.o: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 148 156 jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 149 157 jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 150 158 jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 151 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h159 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 152 160 jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 153 161 jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 156 164 jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 157 165 jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 158 jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h159 166 jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 160 167 jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 162 169 jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 163 170 jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 jdarith.o: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 164 172 jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 165 173 jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 167 175 jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 176 jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 169 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h177 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 170 178 jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 179 jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 173 181 jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 182 jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 175 jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h176 183 jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 184 jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 184 191 jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 185 192 jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 186 jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h187 193 jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 188 194 jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.bcc
r2 r846 66 66 67 67 # source files: JPEG library proper 68 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \69 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \70 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \71 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \72 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \73 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \74 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \68 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 69 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 70 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 71 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 72 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 73 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 74 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 75 75 jquant2.c jutils.c jmemmgr.c 76 76 # memmgr back ends: compile only one of these into a working library … … 82 82 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 83 83 # files included by source files 84 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \85 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h84 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 85 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 86 86 # documentation, test, and support files 87 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 88 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 89 coderules.doc filelist.doc change.log 90 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 91 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 92 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 93 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 94 makvms.opt 87 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 88 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 89 coderules.txt filelist.txt change.log 90 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 91 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 92 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 93 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 94 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 95 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 96 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 97 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 98 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 99 makefile.vms makvms.opt 95 100 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 96 101 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 97 102 jconfig.vms 98 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 99 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 103 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 104 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 105 libjpeg.map 100 106 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 101 107 testimgp.jpg … … 103 109 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 104 110 # library object files common to compression and decompression 105 COMOBJECTS= j comapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)111 COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) 106 112 # compression library object files 107 CLIBOBJECTS= jcapimin.obj jcapistd.obj jc trans.obj jcparam.obj jdatadst.obj \108 j cinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \109 jc coefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \113 CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \ 114 jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \ 115 jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \ 110 116 jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj 111 117 # decompression library object files 112 DLIBOBJECTS= jdapimin.obj jdapistd.obj jd trans.obj jdatasrc.obj \113 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jd phuff.obj \114 jd mainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \115 jidct flt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \116 j quant1.obj jquant2.obj jdmerge.obj118 DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \ 119 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \ 120 jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \ 121 jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \ 122 jdmerge.obj 117 123 # These objectfiles are included in libjpeg.lib 118 124 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 130 136 - del libjpeg.lib 131 137 tlib libjpeg.lib /E /C @&&| 132 +jcapimin.obj +jcapistd.obj +jc trans.obj +jcparam.obj +jdatadst.obj &133 +j cinit.obj +jcmaster.obj +jcmarker.obj +jcmainct.obj +jcprepct.obj &134 +jc coefct.obj +jccolor.obj +jcsample.obj +jchuff.obj +jcphuff.obj &138 +jcapimin.obj +jcapistd.obj +jcarith.obj +jctrans.obj +jcparam.obj & 139 +jdatadst.obj +jcinit.obj +jcmaster.obj +jcmarker.obj +jcmainct.obj & 140 +jcprepct.obj +jccoefct.obj +jccolor.obj +jcsample.obj +jchuff.obj & 135 141 +jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj +jfdctint.obj +jdapimin.obj & 136 +jdapistd.obj +jd trans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj &137 +jd marker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj +jdcoefct.obj &142 +jdapistd.obj +jdarith.obj +jdtrans.obj +jdatasrc.obj +jdmaster.obj & 143 +jdinput.obj +jdmarker.obj +jdhuff.obj +jdmainct.obj +jdcoefct.obj & 138 144 +jdpostct.obj +jddctmgr.obj +jidctfst.obj +jidctflt.obj +jidctint.obj & 139 +j idctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj +jquant2.obj &140 +j dmerge.obj +jcomapi.obj +jutils.obj +jerror.obj +jmemmgr.obj &145 +jdsample.obj +jdcolor.obj +jquant1.obj +jquant2.obj +jdmerge.obj & 146 +jaricom.obj +jcomapi.obj +jutils.obj +jerror.obj +jmemmgr.obj & 141 147 $(SYSDEPMEMLIB) 142 148 | … … 171 177 $(CC) $(CFLAGS) -c{ $<} 172 178 173 jconfig.h: jconfig. doc179 jconfig.h: jconfig.txt 174 180 echo You must prepare a system-dependent jconfig.h file. 175 echo Please read the installation directions in install. doc.181 echo Please read the installation directions in install.txt. 176 182 exit 1 177 183 … … 213 219 214 220 221 jaricom.obj: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 215 222 jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 216 223 jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 224 jcarith.obj: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 217 225 jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 218 226 jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 219 227 jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 220 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h228 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 221 229 jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 222 230 jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 225 233 jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 226 234 jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 227 jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h228 235 jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 229 236 jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 231 238 jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 232 239 jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 240 jdarith.obj: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 233 241 jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 234 242 jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 236 244 jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 237 245 jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 238 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h246 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 239 247 jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 240 248 jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 242 250 jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 243 251 jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 244 jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h245 252 jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 246 253 jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 253 260 jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 254 261 jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 255 jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h256 262 jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 257 263 jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.dj
r2 r846 39 39 40 40 # source files: JPEG library proper 41 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \42 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \43 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \44 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \45 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \46 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \47 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \41 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 42 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 43 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 44 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 45 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 46 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 47 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 48 48 jquant2.c jutils.c jmemmgr.c 49 49 # memmgr back ends: compile only one of these into a working library … … 55 55 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 56 56 # files included by source files 57 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \58 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h57 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 58 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 59 59 # documentation, test, and support files 60 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 61 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 62 coderules.doc filelist.doc change.log 63 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 64 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 65 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 66 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 67 makvms.opt 60 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 61 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 62 coderules.txt filelist.txt change.log 63 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 64 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 65 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 66 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 67 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 68 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 69 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 70 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 71 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 72 makefile.vms makvms.opt 68 73 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 69 74 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 70 75 jconfig.vms 71 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 72 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 76 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 77 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 78 libjpeg.map 73 79 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 74 80 testimgp.jpg … … 76 82 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 77 83 # library object files common to compression and decompression 78 COMOBJECTS= j comapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)84 COMOBJECTS= jaricom.o jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) 79 85 # compression library object files 80 CLIBOBJECTS= jcapimin.o jcapistd.o jc trans.o jcparam.o jdatadst.o jcinit.o \81 j cmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \82 jc sample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \83 jfdct int.o86 CLIBOBJECTS= jcapimin.o jcapistd.o jcarith.o jctrans.o jcparam.o \ 87 jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o \ 88 jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o jfdctfst.o \ 89 jfdctflt.o jfdctint.o 84 90 # decompression library object files 85 DLIBOBJECTS= jdapimin.o jdapistd.o jd trans.o jdatasrc.o jdmaster.o \86 jd input.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \87 jd postct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \88 j dsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o91 DLIBOBJECTS= jdapimin.o jdapistd.o jdarith.o jdtrans.o jdatasrc.o \ 92 jdmaster.o jdinput.o jdmarker.o jdhuff.o jdmainct.o \ 93 jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o \ 94 jidctint.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o 89 95 # These objectfiles are included in libjpeg.a 90 96 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 119 125 $(LN) $(LDFLAGS) -o wrjpgcom.exe wrjpgcom.o $(LDLIBS) 120 126 121 jconfig.h: jconfig. doc127 jconfig.h: jconfig.txt 122 128 echo You must prepare a system-dependent jconfig.h file. 123 echo Please read the installation directions in install. doc.129 echo Please read the installation directions in install.txt. 124 130 exit 1 125 131 … … 150 156 151 157 158 jaricom.o: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 152 159 jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 153 160 jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 161 jcarith.o: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 154 162 jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 155 163 jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 156 164 jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 157 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h165 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 158 166 jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 159 167 jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 162 170 jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 163 171 jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 164 jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h165 172 jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 166 173 jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 168 175 jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 169 176 jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 jdarith.o: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 170 178 jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 171 179 jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 173 181 jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 182 jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 175 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h183 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 176 184 jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 185 jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 179 187 jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 180 188 jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 181 jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h182 189 jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 183 190 jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 190 197 jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 191 198 jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 192 jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h193 199 jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 194 200 jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.manx
r2 r846 40 40 41 41 # source files: JPEG library proper 42 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \43 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \44 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \45 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \46 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \47 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \48 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \42 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 43 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 44 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 45 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 46 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 47 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 48 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 49 49 jquant2.c jutils.c jmemmgr.c 50 50 # memmgr back ends: compile only one of these into a working library … … 56 56 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 57 57 # files included by source files 58 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \59 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h58 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 59 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 60 60 # documentation, test, and support files 61 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 62 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 63 coderules.doc filelist.doc change.log 64 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 65 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 66 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 67 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 68 makvms.opt 61 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 62 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 63 coderules.txt filelist.txt change.log 64 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 65 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 66 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 67 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 68 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 69 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 70 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 71 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 72 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 73 makefile.vms makvms.opt 69 74 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 70 75 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 71 76 jconfig.vms 72 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 73 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 77 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 78 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 79 libjpeg.map 74 80 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 75 81 testimgp.jpg … … 77 83 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 78 84 # library object files common to compression and decompression 79 COMOBJECTS= j comapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)85 COMOBJECTS= jaricom.o jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) 80 86 # compression library object files 81 CLIBOBJECTS= jcapimin.o jcapistd.o jc trans.o jcparam.o jdatadst.o jcinit.o \82 j cmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \83 jc sample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \84 jfdct int.o87 CLIBOBJECTS= jcapimin.o jcapistd.o jcarith.o jctrans.o jcparam.o \ 88 jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o \ 89 jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o jfdctfst.o \ 90 jfdctflt.o jfdctint.o 85 91 # decompression library object files 86 DLIBOBJECTS= jdapimin.o jdapistd.o jd trans.o jdatasrc.o jdmaster.o \87 jd input.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \88 jd postct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \89 j dsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o92 DLIBOBJECTS= jdapimin.o jdapistd.o jdarith.o jdtrans.o jdatasrc.o \ 93 jdmaster.o jdinput.o jdmarker.o jdhuff.o jdmainct.o \ 94 jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o \ 95 jidctint.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o 90 96 # These objectfiles are included in libjpeg.lib 91 97 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 119 125 $(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS) 120 126 121 jconfig.h: jconfig. doc127 jconfig.h: jconfig.txt 122 128 echo You must prepare a system-dependent jconfig.h file. 123 echo Please read the installation directions in install. doc.129 echo Please read the installation directions in install.txt. 124 130 exit 1 125 131 … … 144 150 145 151 152 jaricom.o: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 146 153 jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 147 154 jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 155 jcarith.o: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 148 156 jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 149 157 jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 150 158 jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 151 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h159 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 152 160 jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 153 161 jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 156 164 jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 157 165 jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 158 jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h159 166 jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 160 167 jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 162 169 jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 163 170 jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 jdarith.o: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 164 172 jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 165 173 jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 167 175 jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 176 jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 169 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h177 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 170 178 jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 179 jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 173 181 jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 182 jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 175 jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h176 183 jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 184 jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 184 191 jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 185 192 jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 186 jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h187 193 jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 188 194 jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.mc6
r2 r846 28 28 # Put here the object file name for the correct system-dependent memory 29 29 # manager file. For DOS, we recommend jmemdos.c and jmemdosa.asm. 30 # (But not for Windows; see install. docif you use this makefile for Windows.)30 # (But not for Windows; see install.txt if you use this makefile for Windows.) 31 31 SYSDEPMEM= jmemdos.obj jmemdosa.obj 32 32 # SYSDEPMEMLIB must list the same files with "+" signs for the librarian. … … 37 37 38 38 # source files: JPEG library proper 39 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \40 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \41 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \42 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \43 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \44 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \45 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \39 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 40 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 41 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 42 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 43 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 44 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 45 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 46 46 jquant2.c jutils.c jmemmgr.c 47 47 # memmgr back ends: compile only one of these into a working library … … 53 53 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 54 54 # files included by source files 55 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \56 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h55 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 56 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 57 57 # documentation, test, and support files 58 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 59 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 60 coderules.doc filelist.doc change.log 61 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 62 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 63 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 64 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 65 makvms.opt 58 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 59 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 60 coderules.txt filelist.txt change.log 61 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 62 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 63 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 64 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 65 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 66 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 67 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 68 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 69 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 70 makefile.vms makvms.opt 66 71 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 67 72 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 68 73 jconfig.vms 69 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 70 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 74 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 75 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 76 libjpeg.map 71 77 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 72 78 testimgp.jpg … … 74 80 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 75 81 # library object files common to compression and decompression 76 COMOBJECTS= j comapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)82 COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) 77 83 # compression library object files 78 CLIBOBJECTS= jcapimin.obj jcapistd.obj jc trans.obj jcparam.obj jdatadst.obj \79 j cinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \80 jc coefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \84 CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \ 85 jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \ 86 jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \ 81 87 jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj 82 88 # decompression library object files 83 DLIBOBJECTS= jdapimin.obj jdapistd.obj jd trans.obj jdatasrc.obj \84 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jd phuff.obj \85 jd mainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \86 jidct flt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \87 j quant1.obj jquant2.obj jdmerge.obj89 DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \ 90 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \ 91 jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \ 92 jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \ 93 jdmerge.obj 88 94 # These objectfiles are included in libjpeg.lib 89 95 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 111 117 # silly want-to-create-it prompt: 112 118 echo y >>$(RFILE) 113 echo +jcapimin.obj +jcapistd.obj +jc trans.obj +jcparam.obj & >>$(RFILE)114 echo +j datadst.obj +jcinit.obj +jcmaster.obj +jcmarker.obj & >>$(RFILE)115 echo +jcma inct.obj +jcprepct.obj +jccoefct.obj & >>$(RFILE)116 echo +jcco lor.obj +jcsample.obj +jchuff.obj +jcphuff.obj & >>$(RFILE)119 echo +jcapimin.obj +jcapistd.obj +jcarith.obj +jctrans.obj & >>$(RFILE) 120 echo +jcparam.obj +jdatadst.obj +jcinit.obj +jcmaster.obj & >>$(RFILE) 121 echo +jcmarker.obj +jcmainct.obj +jcprepct.obj & >>$(RFILE) 122 echo +jccoefct.obj +jccolor.obj +jcsample.obj +jchuff.obj & >>$(RFILE) 117 123 echo +jcdctmgr.obj +jfdctfst.obj +jfdctflt.obj & >>$(RFILE) 118 124 echo +jfdctint.obj +jdapimin.obj +jdapistd.obj & >>$(RFILE) 119 echo +jd trans.obj +jdatasrc.obj +jdmaster.obj +jdinput.obj & >>$(RFILE)120 echo +jd marker.obj +jdhuff.obj +jdphuff.obj +jdmainct.obj & >>$(RFILE)125 echo +jdarith.obj +jdtrans.obj +jdatasrc.obj +jdmaster.obj & >>$(RFILE) 126 echo +jdinput.obj +jdmarker.obj +jdhuff.obj +jdmainct.obj & >>$(RFILE) 121 127 echo +jdcoefct.obj +jdpostct.obj +jddctmgr.obj & >>$(RFILE) 122 128 echo +jidctfst.obj +jidctflt.obj +jidctint.obj & >>$(RFILE) 123 echo +j idctred.obj +jdsample.obj +jdcolor.obj +jquant1.obj & >>$(RFILE)124 echo +jquant2.obj +jdmerge.obj +j comapi.obj +jutils.obj & >>$(RFILE)125 echo +j error.obj +jmemmgr.obj & >>$(RFILE)129 echo +jdsample.obj +jdcolor.obj +jquant1.obj & >>$(RFILE) 130 echo +jquant2.obj +jdmerge.obj +jaricom.obj +jcomapi.obj & >>$(RFILE) 131 echo +jutils.obj +jerror.obj +jmemmgr.obj & >>$(RFILE) 126 132 echo $(SYSDEPMEMLIB) ; >>$(RFILE) 127 133 … … 146 152 $(CC) -AL -O -W3 wrjpgcom.c 147 153 148 jconfig.h: jconfig. doc154 jconfig.h: jconfig.txt 149 155 echo You must prepare a system-dependent jconfig.h file. 150 echo Please read the installation directions in install. doc.156 echo Please read the installation directions in install.txt. 151 157 exit 1 152 158 … … 177 183 178 184 185 jaricom.obj: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 179 186 jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 180 187 jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 188 jcarith.obj: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 181 189 jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 182 190 jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 183 191 jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 184 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h192 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 185 193 jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 186 194 jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 189 197 jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 190 198 jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 191 jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h192 199 jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 193 200 jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 195 202 jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 196 203 jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 204 jdarith.obj: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 197 205 jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 198 206 jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 200 208 jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 201 209 jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 202 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h210 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 203 211 jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 204 212 jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 206 214 jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 207 215 jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 208 jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h209 216 jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 210 217 jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 217 224 jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 218 225 jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 219 jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h220 226 jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 221 227 jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.mms
r2 r846 26 26 27 27 # source files: JPEG library proper 28 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \29 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \30 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \31 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \32 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \33 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \34 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \28 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 29 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 30 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 31 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 32 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 33 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 34 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 35 35 jquant2.c jutils.c jmemmgr.c 36 36 # memmgr back ends: compile only one of these into a working library … … 42 42 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 43 43 # files included by source files 44 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \45 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h44 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 45 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 46 46 # documentation, test, and support files 47 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 48 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 49 coderules.doc filelist.doc change.log 50 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 51 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 52 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 53 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 54 makvms.opt 47 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 48 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 49 coderules.txt filelist.txt change.log 50 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 51 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 52 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 53 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 54 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 55 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 56 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 57 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 58 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 59 makefile.vms makvms.opt 55 60 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 56 61 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 57 62 jconfig.vms 58 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 59 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 63 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 64 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 65 libjpeg.map 60 66 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 61 67 testimgp.jpg … … 63 69 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 64 70 # library object files common to compression and decompression 65 COMOBJECTS= j comapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)71 COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) 66 72 # compression library object files 67 CLIBOBJECTS= jcapimin.obj jcapistd.obj jc trans.obj jcparam.obj jdatadst.obj \68 j cinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \69 jc coefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \73 CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \ 74 jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \ 75 jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \ 70 76 jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj 71 77 # decompression library object files 72 DLIBOBJECTS= jdapimin.obj jdapistd.obj jd trans.obj jdatasrc.obj \73 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jd phuff.obj \74 jd mainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \75 jidct flt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \76 j quant1.obj jquant2.obj jdmerge.obj78 DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \ 79 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \ 80 jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \ 81 jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \ 82 jdmerge.obj 77 83 # These objectfiles are included in libjpeg.olb 78 84 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 89 95 rdcolmap.obj,cdjpeg.obj 90 96 TROBJLIST= jpegtran.obj,rdswitch.obj,cdjpeg.obj,transupp.obj 91 LIBOBJLIST= j capimin.obj,jcapistd.obj,jctrans.obj,jcparam.obj,jdatadst.obj,\92 jc init.obj,jcmaster.obj,jcmarker.obj,jcmainct.obj,jcprepct.obj,\93 jc coefct.obj,jccolor.obj,jcsample.obj,jchuff.obj,jcphuff.obj,\94 jc dctmgr.obj,jfdctfst.obj,jfdctflt.obj,jfdctint.obj,jdapimin.obj,\95 jdapi std.obj,jdtrans.obj,jdatasrc.obj,jdmaster.obj,jdinput.obj,\96 jdma rker.obj,jdhuff.obj,jdphuff.obj,jdmainct.obj,jdcoefct.obj,\97 jd postct.obj,jddctmgr.obj,jidctfst.obj,jidctflt.obj,jidctint.obj,\98 jidct red.obj,jdsample.obj,jdcolor.obj,jquant1.obj,jquant2.obj,\97 LIBOBJLIST= jaricom.obj,jcapimin.obj,jcapistd.obj,jcarith.obj,jctrans.obj,\ 98 jcparam.obj,jdatadst.obj,jcinit.obj,jcmaster.obj,jcmarker.obj,\ 99 jcmainct.obj,jcprepct.obj,jccoefct.obj,jccolor.obj,jcsample.obj,\ 100 jchuff.obj,jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj,jfdctint.obj,\ 101 jdapimin.obj,jdapistd.obj,jdarith.obj,jdtrans.obj,jdatasrc.obj,\ 102 jdmaster.obj,jdinput.obj,jdmarker.obj,jdhuff.obj,jdmainct.obj,\ 103 jdcoefct.obj,jdpostct.obj,jddctmgr.obj,jidctfst.obj,jidctflt.obj,\ 104 jidctint.obj,jdsample.obj,jdcolor.obj,jquant1.obj,jquant2.obj,\ 99 105 jdmerge.obj,jcomapi.obj,jutils.obj,jerror.obj,jmemmgr.obj,$(SYSDEPMEM) 100 106 … … 148 154 149 155 156 jaricom.obj : jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 150 157 jcapimin.obj : jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 151 158 jcapistd.obj : jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 159 jcarith.obj : jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 152 160 jccoefct.obj : jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 153 161 jccolor.obj : jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 154 162 jcdctmgr.obj : jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 155 jchuff.obj : jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h163 jchuff.obj : jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 156 164 jcinit.obj : jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 157 165 jcmainct.obj : jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 160 168 jcomapi.obj : jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 161 169 jcparam.obj : jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 162 jcphuff.obj : jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h163 170 jcprepct.obj : jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 164 171 jcsample.obj : jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 166 173 jdapimin.obj : jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 167 174 jdapistd.obj : jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 175 jdarith.obj : jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 176 jdatadst.obj : jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 169 177 jdatasrc.obj : jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 171 179 jdcolor.obj : jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 172 180 jddctmgr.obj : jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 173 jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h181 jdhuff.obj : jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 182 jdinput.obj : jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 175 183 jdmainct.obj : jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 177 185 jdmaster.obj : jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 178 186 jdmerge.obj : jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 179 jdphuff.obj : jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h180 187 jdpostct.obj : jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 181 188 jdsample.obj : jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 188 195 jidctfst.obj : jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 189 196 jidctint.obj : jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 190 jidctred.obj : jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h191 197 jquant1.obj : jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 192 198 jquant2.obj : jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.sas
r2 r846 48 48 49 49 # source files: JPEG library proper 50 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \51 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \52 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \53 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \54 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \55 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \56 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \50 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 51 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 52 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 53 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 54 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 55 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 56 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 57 57 jquant2.c jutils.c jmemmgr.c 58 58 # memmgr back ends: compile only one of these into a working library … … 64 64 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 65 65 # files included by source files 66 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \67 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h66 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 67 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 68 68 # documentation, test, and support files 69 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 70 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 71 coderules.doc filelist.doc change.log 72 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 73 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 74 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 75 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 76 makvms.opt 69 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 70 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 71 coderules.txt filelist.txt change.log 72 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 73 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 74 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 75 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 76 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 77 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 78 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 79 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 80 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 81 makefile.vms makvms.opt 77 82 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 78 83 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 79 84 jconfig.vms 80 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 81 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 85 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 86 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 87 libjpeg.map 82 88 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 83 89 testimgp.jpg … … 85 91 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 86 92 # library object files common to compression and decompression 87 COMOBJECTS= j comapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)93 COMOBJECTS= jaricom.o jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) 88 94 # compression library object files 89 CLIBOBJECTS= jcapimin.o jcapistd.o jc trans.o jcparam.o jdatadst.o jcinit.o \90 j cmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \91 jc sample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \92 jfdct int.o95 CLIBOBJECTS= jcapimin.o jcapistd.o jcarith.o jctrans.o jcparam.o \ 96 jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o \ 97 jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o jfdctfst.o \ 98 jfdctflt.o jfdctint.o 93 99 # decompression library object files 94 DLIBOBJECTS= jdapimin.o jdapistd.o jd trans.o jdatasrc.o jdmaster.o \95 jd input.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \96 jd postct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \97 j dsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o100 DLIBOBJECTS= jdapimin.o jdapistd.o jdarith.o jdtrans.o jdatasrc.o \ 101 jdmaster.o jdinput.o jdmarker.o jdhuff.o jdmainct.o \ 102 jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o \ 103 jidctint.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o 98 104 # These objectfiles are included in libjpeg.lib 99 105 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 156 162 < 157 163 158 jconfig.h: jconfig. doc164 jconfig.h: jconfig.txt 159 165 echo You must prepare a system-dependent jconfig.h file. 160 echo Please read the installation directions in install. doc.166 echo Please read the installation directions in install.txt. 161 167 exit 1 162 168 … … 182 188 183 189 190 jaricom.o: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 184 191 jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 185 192 jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 193 jcarith.o: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 186 194 jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 187 195 jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 188 196 jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 189 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h197 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 190 198 jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 191 199 jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 194 202 jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 195 203 jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 196 jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h197 204 jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 198 205 jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 200 207 jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 201 208 jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 209 jdarith.o: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 202 210 jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 203 211 jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 205 213 jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 206 214 jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 207 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h215 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 208 216 jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 209 217 jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 211 219 jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 212 220 jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 213 jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h214 221 jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 215 222 jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 222 229 jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 223 230 jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 224 jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h225 231 jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 226 232 jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.unix
r2 r846 43 43 44 44 # source files: JPEG library proper 45 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \46 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \47 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \48 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \49 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \50 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \51 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \45 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 46 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 47 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 48 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 49 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 50 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 51 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 52 52 jquant2.c jutils.c jmemmgr.c 53 53 # memmgr back ends: compile only one of these into a working library … … 59 59 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 60 60 # files included by source files 61 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \62 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h61 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 62 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 63 63 # documentation, test, and support files 64 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 65 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 66 coderules.doc filelist.doc change.log 67 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 68 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 69 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 70 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 71 makvms.opt 64 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 65 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 66 coderules.txt filelist.txt change.log 67 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 68 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 69 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 70 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 71 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 72 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 73 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 74 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 75 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 76 makefile.vms makvms.opt 72 77 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 73 78 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 74 79 jconfig.vms 75 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 76 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 80 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 81 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 82 libjpeg.map 77 83 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 78 84 testimgp.jpg … … 80 86 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 81 87 # library object files common to compression and decompression 82 COMOBJECTS= j comapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM)88 COMOBJECTS= jaricom.o jcomapi.o jutils.o jerror.o jmemmgr.o $(SYSDEPMEM) 83 89 # compression library object files 84 CLIBOBJECTS= jcapimin.o jcapistd.o jc trans.o jcparam.o jdatadst.o jcinit.o \85 j cmaster.o jcmarker.o jcmainct.o jcprepct.o jccoefct.o jccolor.o \86 jc sample.o jchuff.o jcphuff.o jcdctmgr.o jfdctfst.o jfdctflt.o \87 jfdct int.o90 CLIBOBJECTS= jcapimin.o jcapistd.o jcarith.o jctrans.o jcparam.o \ 91 jdatadst.o jcinit.o jcmaster.o jcmarker.o jcmainct.o jcprepct.o \ 92 jccoefct.o jccolor.o jcsample.o jchuff.o jcdctmgr.o jfdctfst.o \ 93 jfdctflt.o jfdctint.o 88 94 # decompression library object files 89 DLIBOBJECTS= jdapimin.o jdapistd.o jd trans.o jdatasrc.o jdmaster.o \90 jd input.o jdmarker.o jdhuff.o jdphuff.o jdmainct.o jdcoefct.o \91 jd postct.o jddctmgr.o jidctfst.o jidctflt.o jidctint.o jidctred.o \92 j dsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o95 DLIBOBJECTS= jdapimin.o jdapistd.o jdarith.o jdtrans.o jdatasrc.o \ 96 jdmaster.o jdinput.o jdmarker.o jdhuff.o jdmainct.o \ 97 jdcoefct.o jdpostct.o jddctmgr.o jidctfst.o jidctflt.o \ 98 jidctint.o jdsample.o jdcolor.o jquant1.o jquant2.o jdmerge.o 93 99 # These objectfiles are included in libjpeg.a 94 100 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 133 139 $(LN) $(LDFLAGS) -o wrjpgcom wrjpgcom.o $(LDLIBS) 134 140 135 jconfig.h: jconfig. doc141 jconfig.h: jconfig.txt 136 142 echo You must prepare a system-dependent jconfig.h file. 137 echo Please read the installation directions in install. doc.143 echo Please read the installation directions in install.txt. 138 144 exit 1 139 145 … … 158 164 159 165 166 jaricom.o: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 160 167 jcapimin.o: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 161 168 jcapistd.o: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 169 jcarith.o: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 162 170 jccoefct.o: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 163 171 jccolor.o: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 164 172 jcdctmgr.o: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 165 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h173 jchuff.o: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 166 174 jcinit.o: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 167 175 jcmainct.o: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 170 178 jcomapi.o: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 179 jcparam.o: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 172 jcphuff.o: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h173 180 jcprepct.o: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 181 jcsample.o: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 176 183 jdapimin.o: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 184 jdapistd.o: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 185 jdarith.o: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 178 186 jdatadst.o: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 179 187 jdatasrc.o: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 181 189 jdcolor.o: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 182 190 jddctmgr.o: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 183 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h191 jdhuff.o: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 184 192 jdinput.o: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 185 193 jdmainct.o: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 187 195 jdmaster.o: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 188 196 jdmerge.o: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 189 jdphuff.o: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h190 197 jdpostct.o: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 191 198 jdsample.o: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 198 205 jidctfst.o: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 199 206 jidctint.o: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 200 jidctred.o: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h201 207 jquant1.o: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 202 208 jquant2.o: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.vc
r2 r846 36 36 37 37 # source files: JPEG library proper 38 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \39 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \40 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \41 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \42 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \43 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \44 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \38 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c \ 39 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c \ 40 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c \ 41 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c \ 42 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c \ 43 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c \ 44 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \ 45 45 jquant2.c jutils.c jmemmgr.c 46 46 # memmgr back ends: compile only one of these into a working library … … 52 52 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 53 53 # files included by source files 54 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \55 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h54 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h \ 55 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 56 56 # documentation, test, and support files 57 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 58 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc \ 59 coderules.doc filelist.doc change.log 60 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc \ 61 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds \ 62 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st \ 63 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms \ 64 makvms.opt 57 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 \ 58 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt \ 59 coderules.txt filelist.txt change.log 60 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc \ 61 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 \ 62 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 \ 63 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 \ 64 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 \ 65 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 \ 66 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 \ 67 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st \ 68 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms \ 69 makefile.vms makvms.opt 65 70 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat \ 66 71 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas \ 67 72 jconfig.vms 68 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 69 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 73 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 74 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm \ 75 libjpeg.map 70 76 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg \ 71 77 testimgp.jpg … … 73 79 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 74 80 # library object files common to compression and decompression 75 COMOBJECTS= j comapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)81 COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) 76 82 # compression library object files 77 CLIBOBJECTS= jcapimin.obj jcapistd.obj jc trans.obj jcparam.obj jdatadst.obj \78 j cinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj \79 jc coefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj \83 CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj \ 84 jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj \ 85 jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj \ 80 86 jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj 81 87 # decompression library object files 82 DLIBOBJECTS= jdapimin.obj jdapistd.obj jd trans.obj jdatasrc.obj \83 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jd phuff.obj \84 jd mainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj \85 jidct flt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj \86 j quant1.obj jquant2.obj jdmerge.obj88 DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj \ 89 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj \ 90 jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj \ 91 jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj \ 92 jdmerge.obj 87 93 # These objectfiles are included in libjpeg.lib 88 94 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 141 147 142 148 149 jaricom.obj: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 143 150 jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 144 151 jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 152 jcarith.obj: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 145 153 jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 146 154 jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 147 155 jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 148 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h156 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 149 157 jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 150 158 jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 153 161 jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 154 162 jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 155 jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h156 163 jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 157 164 jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 159 166 jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 160 167 jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 jdarith.obj: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 161 169 jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 162 170 jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 164 172 jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 165 173 jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 166 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h174 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 167 175 jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 176 jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 170 178 jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 179 jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 172 jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h173 180 jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 181 jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 181 188 jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 182 189 jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 183 jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h184 190 jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 185 191 jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h -
trunk/src/3rdparty/libjpeg/makefile.vms
r2 r846 27 27 $ DoCompile := CC /NoDebug /Optimize /NoList 28 28 $! 29 $ DoCompile jaricom.c 29 30 $ DoCompile jcapimin.c 30 31 $ DoCompile jcapistd.c 32 $ DoCompile jcarith.c 31 33 $ DoCompile jctrans.c 32 34 $ DoCompile jcparam.c … … 41 43 $ DoCompile jcsample.c 42 44 $ DoCompile jchuff.c 43 $ DoCompile jcphuff.c44 45 $ DoCompile jcdctmgr.c 45 46 $ DoCompile jfdctfst.c … … 48 49 $ DoCompile jdapimin.c 49 50 $ DoCompile jdapistd.c 51 $ DoCompile jdarith.c 50 52 $ DoCompile jdtrans.c 51 53 $ DoCompile jdatasrc.c … … 54 56 $ DoCompile jdmarker.c 55 57 $ DoCompile jdhuff.c 56 $ DoCompile jdphuff.c57 58 $ DoCompile jdmainct.c 58 59 $ DoCompile jdcoefct.c … … 62 63 $ DoCompile jidctflt.c 63 64 $ DoCompile jidctint.c 64 $ DoCompile jidctred.c65 65 $ DoCompile jdsample.c 66 66 $ DoCompile jdcolor.c … … 74 74 $ DoCompile jmemnobs.c 75 75 $! 76 $ Library /Create libjpeg.olb j capimin.obj,jcapistd.obj,jctrans.obj, -77 jc param.obj,jdatadst.obj,jcinit.obj,jcmaster.obj,jcmarker.obj, -78 jcma inct.obj,jcprepct.obj,jccoefct.obj,jccolor.obj,jcsample.obj, -79 jc huff.obj,jcphuff.obj,jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj, -80 jfdct int.obj,jdapimin.obj,jdapistd.obj,jdtrans.obj,jdatasrc.obj, -81 jd master.obj,jdinput.obj,jdmarker.obj,jdhuff.obj,jdphuff.obj, -82 jd mainct.obj,jdcoefct.obj,jdpostct.obj,jddctmgr.obj,jidctfst.obj, -83 jidctf lt.obj,jidctint.obj,jidctred.obj,jdsample.obj,jdcolor.obj, -76 $ Library /Create libjpeg.olb jaricom.obj,jcapimin.obj,jcapistd.obj, - 77 jcarith.obj,jctrans.obj,jcparam.obj,jdatadst.obj,jcinit.obj, - 78 jcmaster.obj,jcmarker.obj,jcmainct.obj,jcprepct.obj,jccoefct.obj, - 79 jccolor.obj,jcsample.obj,jchuff.obj,jcdctmgr.obj,jfdctfst.obj, - 80 jfdctflt.obj,jfdctint.obj,jdapimin.obj,jdapistd.obj,jdarith.obj, - 81 jdtrans.obj,jdatasrc.obj,jdmaster.obj,jdinput.obj,jdmarker.obj, - 82 jdhuff.obj,jdmainct.obj,jdcoefct.obj,jdpostct.obj,jddctmgr.obj, - 83 jidctfst.obj,jidctflt.obj,jidctint.obj,jdsample.obj,jdcolor.obj, - 84 84 jquant1.obj,jquant2.obj,jdmerge.obj,jcomapi.obj,jutils.obj, - 85 85 jerror.obj,jmemmgr.obj,jmemnobs.obj -
trunk/src/3rdparty/libjpeg/makefile.wat
r2 r846 38 38 39 39 # source files: JPEG library proper 40 LIBSOURCES= j capimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c &41 jc init.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c &42 jc phuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c &43 jda tadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c &44 jd input.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c &45 jd postct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c &46 jfdct int.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c &40 LIBSOURCES= jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c & 41 jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c & 42 jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c & 43 jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c & 44 jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c & 45 jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c & 46 jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c & 47 47 jquant2.c jutils.c jmemmgr.c 48 48 # memmgr back ends: compile only one of these into a working library … … 54 54 SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES) 55 55 # files included by source files 56 INCLUDES= j chuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h &57 jpeg int.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h56 INCLUDES= jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h jpegint.h & 57 jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h 58 58 # documentation, test, and support files 59 DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 & 60 wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc & 61 coderules.doc filelist.doc change.log 62 MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc & 63 makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds & 64 makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st & 65 maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms & 66 makvms.opt 59 DOCS= README install.txt usage.txt cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 & 60 wrjpgcom.1 wizard.txt example.c libjpeg.txt structure.txt & 61 coderules.txt filelist.txt change.log 62 MKFILES= configure Makefile.in makefile.ansi makefile.unix makefile.bcc & 63 makefile.mc6 makefile.dj makefile.wat makefile.vc makejdsw.vc6 & 64 makeadsw.vc6 makejdep.vc6 makejdsp.vc6 makejmak.vc6 makecdep.vc6 & 65 makecdsp.vc6 makecmak.vc6 makeddep.vc6 makeddsp.vc6 makedmak.vc6 & 66 maketdep.vc6 maketdsp.vc6 maketmak.vc6 makerdep.vc6 makerdsp.vc6 & 67 makermak.vc6 makewdep.vc6 makewdsp.vc6 makewmak.vc6 makejsln.vc9 & 68 makeasln.vc9 makejvcp.vc9 makecvcp.vc9 makedvcp.vc9 maketvcp.vc9 & 69 makervcp.vc9 makewvcp.vc9 makeproj.mac makcjpeg.st makdjpeg.st & 70 makljpeg.st maktjpeg.st makefile.manx makefile.sas makefile.mms & 71 makefile.vms makvms.opt 67 72 CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat & 68 73 jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas & 69 74 jconfig.vms 70 CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh 71 OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm 75 CONFIGUREFILES= config.guess config.sub install-sh ltmain.sh depcomp missing 76 OTHERFILES= jconfig.txt ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm & 77 libjpeg.map 72 78 TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg & 73 79 testimgp.jpg … … 75 81 $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES) 76 82 # library object files common to compression and decompression 77 COMOBJECTS= j comapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)83 COMOBJECTS= jaricom.obj jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM) 78 84 # compression library object files 79 CLIBOBJECTS= jcapimin.obj jcapistd.obj jc trans.obj jcparam.obj jdatadst.obj &80 j cinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj &81 jc coefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj &85 CLIBOBJECTS= jcapimin.obj jcapistd.obj jcarith.obj jctrans.obj jcparam.obj & 86 jdatadst.obj jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj & 87 jcprepct.obj jccoefct.obj jccolor.obj jcsample.obj jchuff.obj & 82 88 jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj 83 89 # decompression library object files 84 DLIBOBJECTS= jdapimin.obj jdapistd.obj jd trans.obj jdatasrc.obj &85 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jd phuff.obj &86 jd mainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj &87 jidct flt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj &88 j quant1.obj jquant2.obj jdmerge.obj90 DLIBOBJECTS= jdapimin.obj jdapistd.obj jdarith.obj jdtrans.obj jdatasrc.obj & 91 jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdmainct.obj & 92 jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj jidctflt.obj & 93 jidctint.obj jdsample.obj jdcolor.obj jquant1.obj jquant2.obj & 94 jdmerge.obj 89 95 # These objectfiles are included in libjpeg.lib 90 96 LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS) … … 121 127 $(CC) $(CFLAGS) -c $< 122 128 123 jconfig.h: jconfig. doc129 jconfig.h: jconfig.txt 124 130 echo You must prepare a system-dependent jconfig.h file. 125 echo Please read the installation directions in install. doc.131 echo Please read the installation directions in install.txt. 126 132 exit 1 127 133 … … 163 169 164 170 171 jaricom.obj: jaricom.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 165 172 jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 166 173 jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 174 jcarith.obj: jcarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 167 175 jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 168 176 jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 169 177 jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 170 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h178 jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 171 179 jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 172 180 jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 175 183 jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 176 184 jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 177 jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h178 185 jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 179 186 jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 181 188 jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 182 189 jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 190 jdarith.obj: jdarith.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 183 191 jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h 184 192 jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h … … 186 194 jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 187 195 jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 188 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h196 jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 189 197 jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 190 198 jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 192 200 jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 193 201 jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 194 jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h195 202 jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 196 203 jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h … … 203 210 jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 204 211 jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h 205 jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h206 212 jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h 207 213 jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
Note:
See TracChangeset
for help on using the changeset viewer.