├── .github └── workflows │ └── full-check.yml ├── .gitignore ├── CONTRIBUTING.md ├── ChangeLog ├── LICENSE ├── Makefile.am ├── NEWS ├── README.md ├── TODO ├── autogen.sh ├── configure.ac ├── doc ├── LICENSE.golay ├── README.jpeg-diff ├── STIRMARK-README ├── UPDATE-CHECK ├── jpeg-6b-steg-newer.diff └── jpeg-6b-steg.diff ├── man ├── create-man.sh ├── outguess.1 ├── outguess.txt ├── seek_script.1 └── seek_script.txt ├── src ├── Makefile.am ├── arc.c ├── arc.h ├── err.c ├── err.h ├── fourier.c ├── fourier.h ├── golay.c ├── golay.h ├── histogram.c ├── iterator.c ├── iterator.h ├── jpeg-6b-steg │ ├── README │ ├── ansi2knr.1 │ ├── ansi2knr.c │ ├── cderror.h │ ├── cdjpeg.c │ ├── cdjpeg.h │ ├── change.log │ ├── cjpeg.1 │ ├── cjpeg.c │ ├── ckconfig.c │ ├── config.guess │ ├── config.sub │ ├── djpeg.1 │ ├── djpeg.c │ ├── example.c │ ├── install-sh │ ├── install.doc │ ├── jcapimin.c │ ├── jcapistd.c │ ├── jccoefct.c │ ├── jccolor.c │ ├── jcdctmgr.c │ ├── jchuff.c │ ├── jchuff.h │ ├── jcinit.c │ ├── jcmainct.c │ ├── jcmarker.c │ ├── jcmaster.c │ ├── jcomapi.c │ ├── jconfig.bcc │ ├── jconfig.cfg │ ├── jconfig.dj │ ├── jconfig.doc │ ├── jconfig.mac │ ├── jconfig.manx │ ├── jconfig.mc6 │ ├── jconfig.sas │ ├── jconfig.st │ ├── jconfig.vc │ ├── jconfig.vms │ ├── jconfig.wat │ ├── jcparam.c │ ├── jcphuff.c │ ├── jcprepct.c │ ├── jcsample.c │ ├── jctrans.c │ ├── jdapimin.c │ ├── jdapistd.c │ ├── jdatadst.c │ ├── jdatasrc.c │ ├── jdcoefct.c │ ├── jdcolor.c │ ├── jdct.h │ ├── jddctmgr.c │ ├── jdhuff.c │ ├── jdhuff.h │ ├── jdinput.c │ ├── jdmainct.c │ ├── jdmarker.c │ ├── jdmaster.c │ ├── jdmerge.c │ ├── jdphuff.c │ ├── jdpostct.c │ ├── jdsample.c │ ├── jdtrans.c │ ├── jerror.c │ ├── jerror.h │ ├── jfdctflt.c │ ├── jfdctfst.c │ ├── jfdctint.c │ ├── jidctflt.c │ ├── jidctfst.c │ ├── jidctint.c │ ├── jidctred.c │ ├── jinclude.h │ ├── jmemansi.c │ ├── jmemdos.c │ ├── jmemdosa.asm │ ├── jmemmac.c │ ├── jmemmgr.c │ ├── jmemname.c │ ├── jmemnobs.c │ ├── jmemsys.h │ ├── jmorecfg.h │ ├── jpegint.h │ ├── jpeglib.h │ ├── jpegtran.1 │ ├── jpegtran.c │ ├── jquant1.c │ ├── jquant2.c │ ├── jutils.c │ ├── jversion.h │ ├── ltconfig │ ├── ltmain.sh │ ├── makcjpeg.st │ ├── makdjpeg.st │ ├── makeapps.ds │ ├── makefile.ansi │ ├── makefile.bcc │ ├── makefile.cfg │ ├── makefile.dj │ ├── makefile.manx │ ├── makefile.mc6 │ ├── makefile.mms │ ├── makefile.sas │ ├── makefile.unix │ ├── makefile.vc │ ├── makefile.vms │ ├── makefile.wat │ ├── makelib.ds │ ├── makeproj.mac │ ├── makljpeg.st │ ├── maktjpeg.st │ ├── makvms.opt │ ├── rdbmp.c │ ├── rdcolmap.c │ ├── rdgif.c │ ├── rdjpgcom.1 │ ├── rdjpgcom.c │ ├── rdppm.c │ ├── rdrle.c │ ├── rdswitch.c │ ├── rdtarga.c │ ├── transupp.c │ ├── transupp.h │ ├── wrbmp.c │ ├── wrgif.c │ ├── wrjpgcom.1 │ ├── wrjpgcom.c │ ├── wrppm.c │ ├── wrrle.c │ └── wrtarga.c ├── jpg.c ├── jpg.h ├── md5.c ├── md5.h ├── outguess.c ├── outguess.h ├── pnm.c ├── pnm.h └── seek_script └── tests ├── LICENSE ├── Makefile.am ├── embed_extract_jpg.sh ├── embed_extract_pnm.sh ├── embed_extract_ppm.sh ├── message.txt ├── test.jpg ├── test.pnm ├── test.ppm └── test_seek.sh /.github/workflows/full-check.yml: -------------------------------------------------------------------------------- 1 | name: full-check 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: first_build 13 | run: | 14 | ./autogen.sh 15 | ./configure --with-generic-jconfig 16 | make 17 | make clean 18 | make 19 | sudo make install 20 | sudo make uninstall 21 | make distclean 22 | - name: second_build 23 | run: | 24 | ./autogen.sh 25 | ./configure --with-generic-jconfig 26 | make 27 | sudo make install 28 | - name: run_program 29 | run: | 30 | outguess 2>&1 | egrep -A 20 OutGuess 31 | outguess -h 2>&1 | egrep -A 20 OutGuess 32 | - name: test_outguess 33 | run: | 34 | sudo make uninstall 35 | make check 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /histogram 2 | /extract 3 | /Makefile 4 | /config.h 5 | /config.cache 6 | /config.status 7 | /jpeg-6b-steg/jconfig.h 8 | /outguess 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## HOW TO CONTRIBUTE TO OUTGUESS DEVELOPMENT 2 | 3 | OutGuess is available at https://github.com/resurrecting-open-source-projects/outguess 4 | 5 | If you are interested in contribute to OutGuess development, please, follow the 6 | following steps: 7 | 8 | 1. Send a patch that fix an issue or that implement a new feature. 9 | Preferably, you can do a 'pull request'[1] in GitHub. 10 | 11 | [1] https://help.github.com/articles/about-pull-requests 12 | 13 | 2. Ask for join to the OutGuess project in GitHub, if you want to work 14 | officially. Note that this second step is not compulsory. However, 15 | to accept you in project, is needed a minimum previous collaboration. 16 | 17 | 18 | To find issues and bugs to fix, you can check these addresses: 19 | 20 | - https://github.com/resurrecting-open-source-projects/outguess/issues 21 | - https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=outguess 22 | - https://bugs.launchpad.net/ubuntu/+source/outguess/+bugs 23 | - https://apps.fedoraproject.org/packages/outguess/bugs 24 | 25 | -- Eriberto, Fri, 20 Aug 2021 15:26:53 -0300 26 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | OutGuess 0.4 2 | ------------ 3 | 2021-09-02 - Joao Eriberto Mota Filho 4 | 5 | [ Daniel T. Borelli ] 6 | 7 | - Fixed 'Unknown data type' for .pnm files. 8 | 9 | [ Joao Eriberto Mota Filho ] 10 | 11 | - Clarified licensing for src/golay.c. Many thanks to Robert Morelos-Zaragoza. 12 | See details in doc/LICENSE.golay. 13 | - Enabled CI test for .pnm files. 14 | 15 | OutGuess 0.3 16 | ------------ 17 | 2021-08-20 - Joao Eriberto Mota Filho 18 | 19 | [ Joao Eriberto Mota Filho ] 20 | 21 | - Created CI test for GitHub. 22 | - Created CONTRIBUTING file. 23 | - Migrated manpage to txt2man. 24 | - Moved documents to /doc. 25 | - Moved all source code to /src. 26 | - Re-made all installation system from zero. 27 | - Reviewed and updated README file. 28 | 29 | [ Robin Vobruba ] 30 | 31 | - Added option -h. 32 | - Fixed issues with .ppm files. 33 | - Lots of changes and important improvements in source code. 34 | 35 | OutGuess 0.2.2 36 | -------------- 37 | 2019-01-21 - Joao Eriberto Mota Filho 38 | - Using a right compiler to fix cross compiling issues. 39 | See Debian bug #913545 for details. 40 | 41 | OutGuess 0.2.1 42 | -------------- 43 | 2018-11-11 - Joao Eriberto Mota Filho 44 | 45 | [ Joao Eriberto Mota Filho ] 46 | 47 | - Added a NEWS file. 48 | - Fixed an issue in configure.in and allow autoreconf. 49 | - Fixed some GCC warnings. 50 | - Fixed some spelling errors in final binaries. 51 | - Fixed spelling errors in outguess manpage. 52 | - Removed the jpeg-6b-steg/configure file because it have 53 | not a source code. See Debian bug #882538 for details. 54 | - Removed old CVS directories. 55 | 56 | [ Chris Rorvick ] 57 | 58 | - Some fixes from Chris Rorvick's GitHub repository[1]: 59 | * Fixed printf format strings. 60 | * Fixed segfault when encoding PNM images. 61 | * Pass struct size to memset(), not pointer size. 62 | 63 | [1] https://github.com/crorvick/outguess 64 | 65 | [ Debian Project ] 66 | 67 | - Added manpage for seek_script. This manpage was written for Debian Project 68 | by Samuele Giovanni Tonon . 69 | - Changes outguess.c to match outguess-extract. Fix from Debian patch 70 | 10_avoid-direct-changes.patch. Thanks to Samuele Giovanni Tonon 71 | . 72 | - Use an alternative pre-built Makefile. Fix from Debian patch 73 | 60_generate-configure.patch. Thanks to Frédéric Bonnard . 74 | 75 | 76 | OutGuess 0.2 77 | ------------ 78 | 2000-01-20 - Niels Provos 79 | - Use statistical corrections to defend against steganalysis. 80 | 81 | 2000-04-01 - Niels Provos 82 | - A lot of cleanup. 83 | - Use all DCT coefficients for JPG now. This version is not any more 84 | compatible with the previous versions. 85 | 86 | OutGuess 0.13b 87 | -------------- 88 | 1999-08-06 - Niels Provos 89 | - Add additional statistics for analysis purposes. 90 | - Fix a bug that changed bits in searching mode. 91 | 92 | OutGuess 0.13 93 | ------------- 94 | 1999-07-18 - Niels Provos 95 | 96 | - With ECC introduce errors where possible to avoid changing bits 97 | with high detectability. 98 | - Add statistics for changed bits distribution via -t flag 99 | - Give a weight to each bit to indicate its detectability. 100 | 101 | OutGuess 0.12 102 | ------------- 103 | 1999-07-10 - Niels Provos 104 | 105 | - Make the Golay encoding work with tolerating 3 bit errors. 106 | 107 | OutGuess 0.11 108 | ------------- 109 | 1999-07-07 - Niels Provos 110 | 111 | - Via configure allow compilation on other systems than OpenBSD 112 | - Pass a parameter to the destination handler, for JPEG it is the 113 | compression quality, but e.g. for wav or mp3 it could be frequency 114 | and sample rate. 115 | - Output the total number of bits changed for easier batch processing. 116 | - Reduce the number of bit errors allowed in the Golay code from 3 to 117 | 2 per 23-bit block. 118 | 119 | OutGuess 0.1 120 | ------------ 121 | 122 | 1999-07-05 - Niels Provos 123 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 1. Redistributions of source code must retain the above copyright 5 | notice, this list of conditions and the following disclaimer. 6 | 2. Redistributions in binary form must reproduce the above copyright 7 | notice, this list of conditions and the following disclaimer in the 8 | documentation and/or other materials provided with the distribution. 9 | 3. All advertising materials mentioning features or use of this software 10 | must display the following acknowledgement: 11 | This product includes software developed by Niels Provos. 12 | 4. The name of the author may not be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am, was previously Makefile.in (before 2021) 2 | # 3 | # Copyright 2021 Joao Eriberto Mota Filho 4 | # 5 | # This file is under the same license of the outguess. 6 | 7 | AUTOMAKE_OPTIONS = foreign no-dependencies 8 | 9 | SUBDIRS = src tests 10 | 11 | man_MANS = man/outguess.1 man/seek_script.1 12 | 13 | distclean-local: 14 | rm -rf autom4te.cache \ 15 | conf[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9] 16 | rm -f aclocal.m4 compile config.* configure depcomp install-sh \ 17 | Makefile.in missing src/Makefile.in src/jpeg-6b-steg/config.log \ 18 | src/jpeg-6b-steg/config.status src/jpeg-6b-steg/jconfig.h test-driver \ 19 | tests/Makefile.in 20 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | OutGuess 0.3 2 | ------------ 3 | 4 | This version was fully reorganized. All source files were moved to /src, all 5 | documents to /doc, etc. The autotools was fully reimplemented from zero. Some 6 | documents were added and the README was reviewed. Some other improvements were 7 | added. 8 | 9 | -- Joao Eriberto Mota Filho Fri, 10 Aug 2021 18:06:28 -0300 10 | 11 | OutGuess 0.2.1 12 | -------------- 13 | 14 | The project is alive in GitHub. You are welcome to help. 15 | 16 | This version is fully based in 0.2 version. All patches available in Debian 17 | was applied here. Some fixes from Chris Rorvick[1] also are applied. I did 18 | other adjustments too. 19 | 20 | [1] https://github.com/crorvick/outguess 21 | 22 | The jpeg-6b-steg/configure was removed because it have not a source code. See 23 | more details here[2]. It is not a problem because we need static library 24 | libjpeg.a only and we have a alternative Makefile to provide it inside the 25 | same directory. 26 | 27 | [2] https://bugs.debian.org/882538 28 | 29 | -- Joao Eriberto Mota Filho Sun, 11 Nov 2018 19:52:23 -0200 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OutGuess 2 | 3 | #### outguess - universal steganographic tool 4 | 5 | ## What is OutGuess? 6 | 7 | Outguess is a universal steganographic tool that allows the insertion of hidden 8 | information into the redundant bits of data sources. The nature of the data 9 | source is irrelevant to the core of outguess. The program relies on data 10 | specific handlers that will extract redundant bits and write them back after 11 | modification. Currently only the PPM (Portable Pixel Map), PNM (Portable Any 12 | Map), and JPEG image formats are supported, although outguess could use any 13 | kind of data, as long as a handler were provided. 14 | 15 | Steganography is the art and science of hiding that communication is happening. 16 | Classical steganography systems depend on keeping the encoding system secret, 17 | but modern steganography are detectable only if secret information is known, 18 | e.g. a secret key. Because of their invasive nature steganography systems leave 19 | detectable traces within a medium's characteristics. This allows an 20 | eavesdropper to detect media that has been modified, revealing that secret 21 | communication is taking place. Although the secrecy of the information is not 22 | degraded, its hidden nature is revealed, defeating the main purpose of 23 | Steganography. 24 | 25 | For JPEG images, OutGuess preserves statistics based on frequency counts. As a 26 | result, no known statistical test is able to detect the presence of 27 | steganographic content. Before embedding data into an image, the OutGuess 28 | system can determine the maximum message size that can be hidden while still 29 | being able to maintain statistics based on frequency counts. 30 | 31 | OutGuess uses a generic iterator object to select which bits in the data should 32 | be modified. A seed can be used to modify the behavior of the iterator. It is 33 | embedded in the data along with the rest of the message. By altering the seed, 34 | OutGuess tries to find a sequence of bits that minimizes the number of changes 35 | in the data that have to be made. 36 | 37 | A sample output from OutGuess is as follows: 38 | 39 | ``` 40 | Reading dscf0001.jpg.... 41 | JPEG compression quality set to 75 42 | Extracting usable bits: 40059 bits 43 | Correctable message size: 21194 bits, 52.91% 44 | Encoded 'snark.bz2': 14712 bits, 1839 bytes 45 | Finding best embedding... 46 | 0: 7467(50.6%)[50.8%], bias 8137(1.09), saved: -13, total: 18.64% 47 | 1: 7311(49.6%)[49.7%], bias 8079(1.11), saved: 5, total: 18.25% 48 | 4: 7250(49.2%)[49.3%], bias 7906(1.09), saved: 13, total: 18.10% 49 | 59: 7225(49.0%)[49.1%], bias 7889(1.09), saved: 16, total: 18.04% 50 | 59, 7225: Embedding data: 14712 in 40059 51 | Bits embedded: 14744, changed: 7225(49.0%)[49.1%], bias: 7889, tot: 40032, skip: 25288 52 | Foiling statistics: corrections: 2590, failed: 1, offset: 122.585494 +- 239.664983 53 | Total bits changed: 15114 (change 7225 + bias 7889) 54 | Storing bitmap into data... 55 | Writing foil/dscf0001.jpg.... 56 | ``` 57 | 58 | The simple example script `seek_script` uses OutGuess to select an image that 59 | fits the data we want to hide the best, yielding the lowest number of changed 60 | bits. Because we do not care about the actual content of the cover data we 61 | send, this is a very viable approach. 62 | 63 | Additionally, OutGuess allows to hide multiple messages in the data. Thus, it 64 | also provides plausible deniability. It keeps track of the bits that have been 65 | modified previously and locks them. A `(23,12,7)` Golay code is used for error 66 | correction to tolerate collisions on locked bits. Artificial errors are 67 | introduced to avoid modifying bits that have a high bias. 68 | 69 | Currently OutGuess can insert only two different messages. This is an 70 | experimental feature. 71 | 72 | ## Help this project ## 73 | 74 | OutGuess needs your help. **If you are a programmer** and want to help a nice 75 | project, this is your opportunity. 76 | 77 | The original OutGuess went unmaintained; the source of the last version, 0.2, 78 | was [imported from Debian](https://snapshot.debian.org/package/outguess/) or other 79 | repositories of the Internet. After, patches from Debian and elsewhere were 80 | applied to create the 0.2.1 release. The details of each release are registered 81 | in the [ChangeLog](ChangeLog) file. Now, OutGuess is maintained by volunteers 82 | under [Resurrecting Open Source 83 | Projects](https://github.com/resurrecting-open-source-projects). 84 | 85 | If you are interested in helping OutGuess, read the [CONTRIBUTING.md](CONTRIBUTING.md) file. 86 | 87 | ## Building 88 | 89 | ### Prepare the `jpeg-6b-steg` library 90 | 91 | To do so, you need to choose (and potentially edit) an appropriate `jconfig.h` 92 | file. To get an idea which one you might want, have a look at their header 93 | comments. 94 | 95 | You might do so like this (POSIX only): 96 | 97 | ``` 98 | head -n 1 src/jpeg-6b-steg/jconfig.* 99 | ``` 100 | 101 | The default one is `jconfig.cfg`. You may use it like this: 102 | 103 | ``` 104 | cd jpeg-6b-steg 105 | ln -s jconfig.cfg jconfig.h 106 | cd .. 107 | ``` 108 | 109 | However, in OutGuess 0.3 or newer, there is the option `--with-generic-jconfig` 110 | that will use `jconfig.cfg` automatically. See the *Build and install OutGuess* 111 | section below. 112 | 113 | ### Build and install OutGuess 114 | 115 | OutGuess has only been tested on OpenBSD, Linux, Solaris and AIX. 116 | 117 | If you manually edited `jconfig.h`, you must use the following command 118 | sequence: 119 | 120 | ``` 121 | ./autogen.sh 122 | ./configure 123 | make 124 | make install 125 | ``` 126 | 127 | Otherwise, if you prefer to use `jconfig.cfg` content as default for 128 | `jconfig.h`, without a manual action, you can use the following sequence: 129 | 130 | ``` 131 | ./autogen.sh 132 | ./configure --with-generic-jconfig 133 | make 134 | make install 135 | ``` 136 | 137 | ## Embedded modified JPEG library 138 | 139 | OutGuess needs a modified version of the JPEG library. Currently, the original 140 | lib (without changes) is available at https://www.ijg.org/files/. The tarball 141 | name for version 6b is `jpegsrc.v6b.tar.gz` (or `jpegsr6b.zip`). 142 | 143 | There is a complete document about the JPEG in 144 | `src/jpeg--steg/install.doc` in OutGuess source code (this is plain 145 | text, not a traditional 146 | *.doc*). 147 | 148 | The .diff file used to modify the original JPEG library is available at `/doc` 149 | in OutGuess source code. 150 | 151 | ## Acknowledgments 152 | 153 | OutGuess uses code from the following projects. 154 | Attributions can also be found in the sources. 155 | 156 | * Markus Kuhn's Stirmark software, 157 | see [doc/STIRMARK-README](STIRMARK-README) 158 | * the Independent JPEG Group's JPEG software, 159 | see [src/jpeg-6b-steg/README](src/jpeg-6b-steg/README) 160 | * the Arc4 random number generator for OpenBSD, (C) 1996 by 161 | David Mazieres 162 | * free MD5 code by Colin Plumb 163 | 164 | For determining the redundant bits out of a JPEG image, 165 | the `jpeg-jsteg-v4` patches by Derek Upham were helpful. 166 | 167 | Special thanks to: 168 | 169 | * Robert Morelos-Zaragoza , author of golay.c, 170 | that gently agreed to change its licensing to BSD. 171 | * Dug Song for helping with the original configure file, 172 | * Andrew Reiter for testing on Solaris. 173 | 174 | ## Author ## 175 | 176 | OutGuess was originally developed by Niels Provos , 177 | under the BSD software license. It is completely free for any use including 178 | commercial. 179 | 180 | Currently, source code is maintained by volunteers. Newer versions are 181 | available at https://github.com/resurrecting-open-source-projects/outguess 182 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/resurrecting-open-source-projects/outguess/24810e14327c2bbeedeaadd3e24491f2a4425c02/TODO -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # autogen.sh with clean option 4 | # Copyright 2016-2021 Joao Eriberto Mota Filho 5 | # 6 | # This file is under BSD-3-Clause license. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 3. Neither the name of the authors nor the names of its contributors 17 | # may be used to endorse or promote products derived from this software 18 | # without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 | # SUCH DAMAGE. 31 | 32 | 33 | # Use clean option 34 | if [ "$1" = "clean" -a ! -e Makefile ] 35 | then 36 | echo "Vanishing the code" 37 | rm -rf aclocal.m4 autom4te.cache compile confdefs.h config.* configure \ 38 | depcomp install-sh Makefile.in missing src/Makefile.in test-driver \ 39 | tests/Makefile.in 40 | exit 0 41 | fi 42 | 43 | # Do not use clean option 44 | if [ "$1" = "clean" -a -e Makefile ] 45 | then 46 | echo "I can not clean. Use '$ make distclean'." 47 | exit 0 48 | fi 49 | 50 | # Do autoreconf 51 | autoreconf -i \ 52 | && { echo " "; \ 53 | echo "Done. You can use the 'clean' option to vanish the source code."; \ 54 | echo "Example of use: $ ./autogen clean"; \ 55 | } \ 56 | || { echo "We have a problem..."; exit 1; } 57 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl Copyright ? dugsong@monkey.org and provos@citi.umich.edu 2 | dnl Copyright 2016-2021 Joao Eriberto Mota Filho 3 | dnl 4 | dnl This file is under the same license of the outguess. 5 | 6 | AC_PREREQ([2.69]) 7 | AC_INIT([outguess],[0.4],[https://github.com/resurrecting-open-source-projects/outguess/issues]) 8 | AC_CONFIG_SRCDIR([src/golay.h]) 9 | AC_CONFIG_HEADERS([config.h]) 10 | AM_INIT_AUTOMAKE 11 | 12 | # Checks for programs. 13 | AC_PROG_CXX 14 | AC_PROG_CC 15 | AC_PROG_CPP 16 | AC_PROG_INSTALL 17 | AC_PROG_MAKE_SET 18 | AC_PROG_RANLIB 19 | 20 | # Check for jconfig.h in jpeg dir 21 | jpegdir="src/jpeg-6b-steg" 22 | 23 | AC_ARG_WITH([generic-jconfig], 24 | [Use a default jconfig.h in src/{jpegdir}], 25 | AC_CONFIG_COMMANDS([jconfig.h], [cd $jpegdir; cp jconfig.cfg jconfig.h], [jpegdir=$jpegdir]), 26 | AC_CHECK_FILE([$jpegdir]/jconfig.h, [], 27 | AC_MSG_ERROR(m4_normalize([Could not find jconfig.h in [$jpegdir]/. 28 | Please provide a jconfig.h file or pass --with-generic-jconfig 29 | to `configure' command to use a generic file. 30 | See [$jpegdir]/install.doc for details.])))) 31 | 32 | # Checks for header files. 33 | AC_CHECK_HEADERS([fcntl.h malloc.h netinet/in.h stddef.h stdlib.h string.h strings.h unistd.h]) 34 | 35 | # Checks for typedefs, structures, and compiler characteristics. 36 | AC_TYPE_SIZE_T 37 | 38 | # Checks for library functions. 39 | AC_FUNC_MALLOC 40 | AC_FUNC_MMAP 41 | AC_FUNC_REALLOC 42 | AC_CHECK_FUNCS([memmove memset munmap sqrt strcasecmp strchr strerror strrchr]) 43 | 44 | AC_SUBST(MD5MISS) 45 | AC_SUBST(ERRMISS) 46 | 47 | dnl Check if we need to compile md5 48 | needmd5=no 49 | needincmiss=no 50 | AC_CHECK_FUNCS(MD5Update, , [needmd5=yes; needincmiss=yes]) 51 | if test $needmd5 = yes; then 52 | MD5MISS="true" 53 | fi 54 | AM_CONDITIONAL([MD5MISS], [test x$MD5MISS = xtrue]) 55 | 56 | dnl Check if there is err() 57 | neederr=no 58 | AC_CHECK_FUNCS(warnx, , [neederr=yes]) 59 | if test $neederr = yes; then 60 | ERRMISS="true" 61 | fi 62 | AM_CONDITIONAL([ERRMISS], [test x$ERRMISS = xtrue]) 63 | 64 | AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile]) 65 | AC_OUTPUT 66 | -------------------------------------------------------------------------------- /doc/LICENSE.golay: -------------------------------------------------------------------------------- 1 | golay.c was developed by Robert Morelos-Zaragoza in 1994. 2 | 3 | The original licensing of golay.c was: 4 | 5 | This computer program is free for non-commercial purposes. 6 | You may implement this program for any non-commercial application. You may 7 | also implement this program for commercial purposes, provided that you 8 | obtain my written permission. Any modification of this program is covered 9 | by this copyright. 10 | 11 | == Copyright 1994 Robert Morelos-Zaragoza. All rights reserved. == 12 | 13 | Considering the modern times, Robert gently agreed to change the licensing to 14 | BSD. This agreement was sent via email message on 26 Aug 2021 to me (Eriberto). 15 | 16 | Thanks Robert! 17 | -------------------------------------------------------------------------------- /doc/README.jpeg-diff: -------------------------------------------------------------------------------- 1 | The diff file for original JPEG library 2 | --------------------------------------- 3 | 4 | There are two files in /doc directory: 5 | 6 | - jpeg-6b-steg.diff: the original diff file used in the first version of 7 | OutGuess. 8 | 9 | - jpeg-6b-steg-newer.diff: the most recent diff file to make the original JPEG 10 | library compliant with OutGuess. After this change, the JPEG was renamed in 11 | OutGuess to jpeg--steg. 12 | 13 | The JPEG library (without changes) is available at https://www.ijg.org/files/. 14 | The tarball name for version 6b is jpegsrc.v6b.tar.gz (or jpegsr6b.zip). 15 | 16 | To apply the diff used by OutGuess to original JPEG library, you must use the 17 | patch command: 18 | 19 | cp jpeg-6b-steg-newer.diff 20 | cd 21 | patch -p1 < jpeg-6b-steg-newer.diff 22 | 23 | -- Joao Eriberto Mota Filho Fri, 20 Aug 2021 14:14:53 -0300 24 | -------------------------------------------------------------------------------- /doc/UPDATE-CHECK: -------------------------------------------------------------------------------- 1 | When updating, change the following files (if needed): 2 | 3 | - Update rights 4 | - Update changeLog 5 | - Check for spelling errors in ChangeLog, manpage and README. 6 | - Update man/create-man.sh (DATE, version) 7 | - Generate a new manpage. 8 | - Check final manpage with man command. 9 | - Updated or check README 10 | - configure.ac (VERSION) 11 | - src/outguess.c: char version[] (VERSION and date) 12 | - Test in Debian Sid 13 | -------------------------------------------------------------------------------- /doc/jpeg-6b-steg-newer.diff: -------------------------------------------------------------------------------- 1 | diff --git a/jcdctmgr.c b/jcdctmgr.c 2 | index 61fa79b..fc36edf 100644 3 | --- a/jcdctmgr.c 4 | +++ b/jcdctmgr.c 5 | @@ -40,6 +41,7 @@ typedef struct { 6 | 7 | typedef my_fdct_controller * my_fdct_ptr; 8 | 9 | +short steg_use_bit (unsigned short temp); 10 | 11 | /* 12 | * Initialize for a processing pass. 13 | @@ -257,7 +259,7 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, 14 | temp += qval>>1; /* for rounding */ 15 | DIVIDE_BY(temp, qval); 16 | } 17 | - output_ptr[i] = (JCOEF) temp; 18 | + output_ptr[i] = steg_use_bit(temp); 19 | } 20 | } 21 | } 22 | diff --git a/jdcoefct.c b/jdcoefct.c 23 | index 4938d20..95e8263 100644 24 | --- a/jdcoefct.c 25 | +++ b/jdcoefct.c 26 | @@ -74,6 +75,7 @@ METHODDEF(int) decompress_smooth_data 27 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); 28 | #endif 29 | 30 | +short steg_use_bit (unsigned short temp); 31 | 32 | LOCAL(void) 33 | start_iMCU_row (j_decompress_ptr cinfo) 34 | @@ -194,6 +196,13 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) 35 | yoffset+yindex < compptr->last_row_height) { 36 | output_col = start_col; 37 | for (xindex = 0; xindex < useful_width; xindex++) { 38 | + { 39 | + /* Retrieve LSB from DCT coefficient */ 40 | + JBLOCKROW block = coef->MCU_buffer[blkn + xindex]; 41 | + int k; 42 | + for (k = 0; k < DCTSIZE2; k++) 43 | + steg_use_bit((JCOEF) (*block)[k]); 44 | + } 45 | (*inverse_DCT) (cinfo, compptr, 46 | (JCOEFPTR) coef->MCU_buffer[blkn+xindex], 47 | output_ptr, output_col); 48 | -------------------------------------------------------------------------------- /doc/jpeg-6b-steg.diff: -------------------------------------------------------------------------------- 1 | You need the source distribution for the JPEG 6b libraries, to 2 | be found at ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz, 3 | and the apply this patch and compile libjpeg.a. 4 | 5 | diff -ur jpeg-6b/jcdctmgr.c jpeg-6b-steg/jcdctmgr.c 6 | --- jpeg-6b/jcdctmgr.c Sat Jan 13 14:15:12 1996 7 | +++ jpeg-6b-steg/jcdctmgr.c Mon Jul 5 12:41:27 1999 8 | @@ -257,7 +257,7 @@ 9 | temp += qval>>1; /* for rounding */ 10 | DIVIDE_BY(temp, qval); 11 | } 12 | - output_ptr[i] = (JCOEF) temp; 13 | + output_ptr[i] = (JCOEF) i ? steg_use_bit(temp) : temp; 14 | } 15 | } 16 | } 17 | diff -ur jpeg-6b/jdhuff.c jpeg-6b-steg/jdhuff.c 18 | --- jpeg-6b/jdhuff.c Mon Oct 20 20:51:10 1997 19 | +++ jpeg-6b-steg/jdhuff.c Tue Jul 6 05:31:42 1999 20 | @@ -590,6 +590,8 @@ 21 | k += 15; 22 | } 23 | } 24 | + for (k = 1; k < DCTSIZE2; k++) 25 | + steg_use_bit((JCOEF) (*block)[k]); 26 | 27 | } else { 28 | 29 | -------------------------------------------------------------------------------- /man/create-man.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2015-2020 Joao Eriberto Mota Filho 4 | # Create a manpage using txt2man command. Version 2.0, 2020-06-19. 5 | # This file is part of txt2man package for Debian. 6 | # This script can be used under BSD-3-Clause license. 7 | 8 | #-------------------------------------------------------- 9 | # Don't change the following lines 10 | TEST=$(txt2man -h 2> /dev/null) 11 | [ "$TEST" ] || { echo -e "\nYou need to install txt2man, from https://github.com/mvertes/txt2man.\n"; exit 1; } 12 | 13 | function create-man { 14 | txt2man -d "$T2M_DATE" -t $T2M_NAME -r $T2M_NAME-$T2M_VERSION -s $T2M_LEVEL -v "$T2M_DESC" $T2M_NAME.txt > $T2M_NAME.$T2M_LEVEL 15 | } 16 | #-------------------------------------------------------- 17 | 18 | # Put here all data for your first manpage (in T2M lines) 19 | T2M_DATE="02 Sep 2021" 20 | T2M_NAME=outguess 21 | T2M_VERSION=0.4 22 | T2M_LEVEL=1 23 | T2M_DESC="universal steganographic tool " 24 | create-man 25 | 26 | # Put here all data for your second manpage 27 | T2M_NAME=seek_script 28 | T2M_DESC="script using OutGuess to find an image that yields the best embedding" 29 | create-man 30 | -------------------------------------------------------------------------------- /man/outguess.1: -------------------------------------------------------------------------------- 1 | .\" Text automatically generated by txt2man 2 | .TH outguess 1 "02 Sep 2021" "outguess-0.4" "universal steganographic tool " 3 | .SH NAME 4 | \fBoutguess \fP- universal steganographic tool 5 | \fB 6 | .SH SYNOPSIS 7 | .nf 8 | .fam C 9 | \fBoutguess\fP [\fIOPTIONS\fP] \fIinputfile\fP \fIoutputfile\fP 10 | 11 | .fam T 12 | .fi 13 | .fam T 14 | .fi 15 | .SH DESCRIPTION 16 | OutGuess is a universal steganographic tool that allows the insertion of 17 | hidden information into the redundant bits of data sources. The nature of the 18 | data source is irrelevant to the core of OutGuess. The program relies on data 19 | specific handlers that will extract redundant bits and write them back after 20 | modification. Currently only the PPM, PNM, and JPEG image formats are 21 | supported, although OutGuess could use any kind of data, as long as a handler 22 | were provided. 23 | .PP 24 | OutGuess uses a generic iterator object to select which bits in the data 25 | should be modified. A seed can be used to modify the behavior of the iterator. 26 | It is embedded in the data along with the rest of the message. By altering the 27 | seed, OutGuess tries to find a sequence of bits that minimizes the number of 28 | changes in the data that have to be made. 29 | .PP 30 | A bias is introduced that favors the modification of bits that were extracted 31 | from a high value, and tries to avoid the modification of bits that were 32 | extracted from a low value. 33 | .PP 34 | Additionally, OutGuess allows for the hiding of two distinct messages in the 35 | data, thus providing plausible deniability. It keeps track of the bits that 36 | have been modified previously and locks them. A (23,12,7) Golay code is used 37 | for error correction to tolerate collisions on locked bits. Artificial errors 38 | are introduced to avoid modifying bits that have a high bias. 39 | .SH OPTIONS 40 | The following command line options, when specified as capital letters, 41 | indicate options for the second message. 42 | .TP 43 | .B 44 | \fB-F\fP [+-] 45 | Specifies that OutGuess should preserve statistics based on 46 | frequency counts. As a result, no statistical test that is 47 | based on frequency counts will be able to detect 48 | steganographic content. This option is set as on by default. 49 | .TP 50 | .B 51 | \fB-kK\fP 52 | Specify the secret key used to encrypt and hide the message in 53 | the provided data. 54 | .TP 55 | .B 56 | \fB-dD\fP 57 | Specify the filename containing a message to be hidden in the 58 | data. 59 | .TP 60 | .B 61 | \fB-sS\fP 62 | Specify the initial seed the iterator object uses for selecting 63 | bits in the redundant data. If no upper limit is specified, the 64 | iterator will use this seed without searching for a more 65 | optimal embedding. 66 | .TP 67 | .B 68 | \fB-iI\fP 69 | Specify the upper limit for finding an optimal iterator seed. 70 | The maximum value for the limit is 65535. 71 | .TP 72 | .B 73 | \fB-eE\fP 74 | Use error correction for data encoding and decoding. 75 | .PP 76 | Other options that apply to the general execution of OutGuess: 77 | .TP 78 | .B 79 | \fB-r\fP 80 | Retrieve a message from a data object. If this option is not 81 | specified, OutGuess will embed messages. 82 | .TP 83 | .B 84 | \fB-x\fP 85 | If the second key does not create an iterator object that is 86 | successful in embedding the data, the program will derive up to 87 | specified number of new keys. 88 | .TP 89 | .B 90 | \fB-p\fP param 91 | Passes a string as parameter to the destination data handler. 92 | For the JPEG image format, this is the compression quality, it 93 | can take values between 75 and 100. The higher the quality the 94 | more bits to hide a message in the data are available. 95 | .TP 96 | .B 97 | \fB-m\fP 98 | Mark pixels that have been modified. 99 | .TP 100 | .B 101 | \fB-t\fP 102 | Collect statistics about redundant bit usage. Repeated use 103 | increases output level. 104 | .TP 105 | .B 106 | \fB-h\fP 107 | Print a usage help text and exit. 108 | .PP 109 | For embedding messages, you need to specify a source and a destination 110 | filename. OutGuess determines the data format by the filename extension. If no 111 | filenames are specified OutGuess operates as a filter and assumes the PPM data 112 | format. 113 | .SH EXAMPLES 114 | To embed the message hidden.txt into the monkey.jpg image: 115 | .PP 116 | .nf 117 | .fam C 118 | $ outguess -k "my secret pass phrase" -d hidden.txt monkey.jpg out.jpg 119 | 120 | .fam T 121 | .fi 122 | And in the other direction: 123 | .PP 124 | .nf 125 | .fam C 126 | $ outguess -k "my secret pass phrase" -r out.jpg message.txt 127 | 128 | .fam T 129 | .fi 130 | will retrieve the hidden message from the image. 131 | .PP 132 | If you want to embed a second message, use: 133 | .PP 134 | .nf 135 | .fam C 136 | $ outguess -k "secret1" -d hide1.txt -E -K "secret2" -D hide2.txt monkey.jpg out.jpg 137 | 138 | .fam T 139 | .fi 140 | OutGuess will first embed hide1.txt and then hide2.txt on top of it, using 141 | error correcting codes. The second message hide2.txt can be retrieved with 142 | .PP 143 | .nf 144 | .fam C 145 | $ outguess -k "secret2" -e -r out.jpg message.txt 146 | 147 | .fam T 148 | .fi 149 | .SH SEE ALSO 150 | \fBcjpeg\fP(1), \fBdjpeg\fP(1), \fBpnm\fP(5), \fBseek_script\fP(1), \fBstirmark\fP(1) 151 | .SH AUTHOR 152 | OutGuess was originally developed by Niels Provos and 153 | is maintained by some people. 154 | .PP 155 | Currently, source code and newer versions are available at 156 | https://github.com/resurrecting-open-source-projects/\fBoutguess\fP 157 | -------------------------------------------------------------------------------- /man/outguess.txt: -------------------------------------------------------------------------------- 1 | NAME 2 | outguess - universal steganographic tool 3 | 4 | SYNOPSIS 5 | outguess [OPTIONS] inputfile outputfile 6 | 7 | DESCRIPTION 8 | OutGuess is a universal steganographic tool that allows the insertion of 9 | hidden information into the redundant bits of data sources. The nature of the 10 | data source is irrelevant to the core of OutGuess. The program relies on data 11 | specific handlers that will extract redundant bits and write them back after 12 | modification. Currently only the PPM, PNM, and JPEG image formats are 13 | supported, although OutGuess could use any kind of data, as long as a handler 14 | were provided. 15 | 16 | OutGuess uses a generic iterator object to select which bits in the data 17 | should be modified. A seed can be used to modify the behavior of the iterator. 18 | It is embedded in the data along with the rest of the message. By altering the 19 | seed, OutGuess tries to find a sequence of bits that minimizes the number of 20 | changes in the data that have to be made. 21 | 22 | A bias is introduced that favors the modification of bits that were extracted 23 | from a high value, and tries to avoid the modification of bits that were 24 | extracted from a low value. 25 | 26 | Additionally, OutGuess allows for the hiding of two distinct messages in the 27 | data, thus providing plausible deniability. It keeps track of the bits that 28 | have been modified previously and locks them. A (23,12,7) Golay code is used 29 | for error correction to tolerate collisions on locked bits. Artificial errors 30 | are introduced to avoid modifying bits that have a high bias. 31 | 32 | OPTIONS 33 | The following command line options, when specified as capital letters, 34 | indicate options for the second message. 35 | 36 | -F [+-] Specifies that OutGuess should preserve statistics based on 37 | frequency counts. As a result, no statistical test that is 38 | based on frequency counts will be able to detect 39 | steganographic content. This option is set as on by default. 40 | -kK Specify the secret key used to encrypt and hide the message in 41 | the provided data. 42 | -dD Specify the filename containing a message to be hidden in the 43 | data. 44 | -sS Specify the initial seed the iterator object uses for selecting 45 | bits in the redundant data. If no upper limit is specified, the 46 | iterator will use this seed without searching for a more 47 | optimal embedding. 48 | -iI Specify the upper limit for finding an optimal iterator seed. 49 | The maximum value for the limit is 65535. 50 | -eE Use error correction for data encoding and decoding. 51 | 52 | Other options that apply to the general execution of OutGuess: 53 | 54 | -r Retrieve a message from a data object. If this option is not 55 | specified, OutGuess will embed messages. 56 | -x If the second key does not create an iterator object that is 57 | successful in embedding the data, the program will derive up to 58 | specified number of new keys. 59 | -p param Passes a string as parameter to the destination data handler. 60 | For the JPEG image format, this is the compression quality, it 61 | can take values between 75 and 100. The higher the quality the 62 | more bits to hide a message in the data are available. 63 | -m Mark pixels that have been modified. 64 | -t Collect statistics about redundant bit usage. Repeated use 65 | increases output level. 66 | -h Print a usage help text and exit. 67 | 68 | For embedding messages, you need to specify a source and a destination 69 | filename. OutGuess determines the data format by the filename extension. If no 70 | filenames are specified OutGuess operates as a filter and assumes the PPM data 71 | format. 72 | 73 | EXAMPLES 74 | To embed the message hidden.txt into the monkey.jpg image: 75 | 76 | $ outguess -k "my secret pass phrase" -d hidden.txt monkey.jpg out.jpg 77 | 78 | And in the other direction: 79 | 80 | $ outguess -k "my secret pass phrase" -r out.jpg message.txt 81 | 82 | will retrieve the hidden message from the image. 83 | 84 | If you want to embed a second message, use: 85 | 86 | $ outguess -k "secret1" -d hide1.txt -E -K "secret2" -D hide2.txt monkey.jpg out.jpg 87 | 88 | OutGuess will first embed hide1.txt and then hide2.txt on top of it, using 89 | error correcting codes. The second message hide2.txt can be retrieved with 90 | 91 | $ outguess -k "secret2" -e -r out.jpg message.txt 92 | 93 | SEE ALSO 94 | cjpeg(1), djpeg(1), pnm(5), seek_script(1), stirmark(1) 95 | 96 | AUTHOR 97 | OutGuess was originally developed by Niels Provos and 98 | is maintained by some people. 99 | 100 | Currently, source code and newer versions are available at 101 | https://github.com/resurrecting-open-source-projects/outguess 102 | -------------------------------------------------------------------------------- /man/seek_script.1: -------------------------------------------------------------------------------- 1 | .\" Text automatically generated by txt2man 2 | .TH seek_script 1 "02 Sep 2021" "seek_script-0.4" "script using OutGuess to find an image that yields the best embedding" 3 | .SH NAME 4 | \fBseek_script \fP- script using OutGuess to find an image that yields the best embedding 5 | \fB 6 | .SH SYNOPSIS 7 | .nf 8 | .fam C 9 | \fBseek_script\fP [\fIparam\fP \fIfor\fP \fIoutguess\fP] 10 | 11 | .fam T 12 | .fi 13 | .fam T 14 | .fi 15 | .SH DESCRIPTION 16 | The \fBseek_script\fP scans the current directory to find the best JPEG file in 17 | which hide the message that resides in /tmp/fortune. At the end, the script 18 | will print the best and the worst JPEG file in which to put the message. 19 | .SH LIMITATIONS 20 | \fBseek_script\fP works only \fIfor\fP JPEG images. 21 | .SH FILES 22 | .TP 23 | .B 24 | /tmp/fortune 25 | File containing the message to be used by OutGuess after the 26 | test. 27 | .SH SEE ALSO 28 | \fBoutguess\fP(1) 29 | .SH ACKNOWLEDGEMENTS 30 | This product includes software developed by Ian F. Darwin and others. 31 | .SH AUTHOR 32 | The \fBseek_script\fP utility is part of OutGuess. OutGuess was originally developed 33 | by Niels Provos and is maintained by some people. 34 | .PP 35 | This manual page was written by Samuele Giovanni Tonon \fIfor\fP 36 | the Debian Project (but may be used by others). 37 | .PP 38 | Currently, source code and newer versions are available at 39 | https://github.com/resurrecting-open-source-projects/\fIoutguess\fP 40 | -------------------------------------------------------------------------------- /man/seek_script.txt: -------------------------------------------------------------------------------- 1 | NAME 2 | seek_script - script using OutGuess to find an image that yields the best embedding 3 | 4 | SYNOPSIS 5 | seek_script [param for outguess] 6 | 7 | DESCRIPTION 8 | The seek_script scans the current directory to find the best JPEG file in 9 | which hide the message that resides in /tmp/fortune. At the end, the script 10 | will print the best and the worst JPEG file in which to put the message. 11 | 12 | LIMITATIONS 13 | seek_script works only for JPEG images. 14 | 15 | FILES 16 | /tmp/fortune File containing the message to be used by OutGuess after the 17 | test. 18 | 19 | SEE ALSO 20 | outguess(1) 21 | 22 | ACKNOWLEDGEMENTS 23 | This product includes software developed by Ian F. Darwin and others. 24 | 25 | AUTHOR 26 | The seek_script utility is part of OutGuess. OutGuess was originally developed 27 | by Niels Provos and is maintained by some people. 28 | 29 | This manual page was written by Samuele Giovanni Tonon for 30 | the Debian Project (but may be used by others). 31 | 32 | Currently, source code and newer versions are available at 33 | https://github.com/resurrecting-open-source-projects/outguess 34 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am, was previously Makefile.in (before 2021) 2 | # 3 | # Copyright 1999 Niels Provos 4 | # Copyright 2018 Frédéric Bonnard 5 | # Copyright 2019 Helmut Grohne 6 | # Copyright 2021 Joao Eriberto Mota Filho 7 | # 8 | # This file is under the same license of the outguess. 9 | 10 | ./jpeg-6b-steg/libjpeg.a: 11 | $(MAKE) -C ./jpeg-6b-steg -f makefile.ansi 'CC=$(CC)' CFLAGS+=-DHAVE_STDC_HEADERS libjpeg.a 12 | 13 | bin_PROGRAMS = outguess histogram 14 | 15 | outguess_DEPENDENCIES = ./jpeg-6b-steg/libjpeg.a 16 | 17 | outguess_SOURCES = outguess.c \ 18 | golay.c golay.h \ 19 | arc.c arc.h \ 20 | pnm.c pnm.h \ 21 | jpg.c jpg.h \ 22 | iterator.c iterator.h 23 | 24 | if MD5MISS 25 | outguess_SOURCES += md5.c md5.h 26 | endif 27 | 28 | if ERRMISS 29 | outguess_SOURCES += err.c err.h 30 | endif 31 | 32 | outguess_LDADD = jpeg-6b-steg/libjpeg.a -lm 33 | 34 | histogram_SOURCES = histogram.c 35 | 36 | # Install seek_script 37 | dist_bin_SCRIPTS = seek_script 38 | 39 | CLEANFILES = jpeg-6b-steg/*.o jpeg-6b-steg/libjpeg.a 40 | 41 | distclean-local: 42 | rm -f src/jpeg-6b-steg/config.log src/jpeg-6b-steg/config.status \ 43 | src/jpeg-6b-steg/jconfig.h 44 | -------------------------------------------------------------------------------- /src/arc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999 Niels Provos 3 | * Copyright 2016 Joao Eriberto Mota Filho 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. All advertising materials mentioning features or use of this software 15 | * must display the following acknowledgement: 16 | * This product includes software developed by Niels Provos. 17 | * 4. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* 33 | * Arc4 random number generator for OpenBSD. 34 | * Copyright 1996 David Mazieres . 35 | * 36 | * Modification and redistribution in source and binary forms is 37 | * permitted provided that due credit is given to the author and the 38 | * OpenBSD project (for instance by leaving this copyright notice 39 | * intact). 40 | */ 41 | 42 | #include 43 | #include 44 | 45 | #include "config.h" 46 | #include 47 | 48 | #include "arc.h" 49 | 50 | /* 51 | * An arc4 stream generator is used for encryption and pseudo-random 52 | * numbers. 53 | */ 54 | 55 | void 56 | arc4_init(struct arc4_stream *as) 57 | { 58 | int n; 59 | 60 | for (n = 0; n < 256; n++) 61 | as->s[n] = n; 62 | as->i = 0; 63 | as->j = 0; 64 | } 65 | 66 | u_int8_t 67 | arc4_getbyte(struct arc4_stream *as) 68 | { 69 | u_int8_t si, sj; 70 | 71 | as->i = (as->i + 1); 72 | si = as->s[as->i]; 73 | as->j = (as->j + si); 74 | sj = as->s[as->j]; 75 | as->s[as->i] = sj; 76 | as->s[as->j] = si; 77 | return (as->s[(si + sj) & 0xff]); 78 | } 79 | 80 | u_int32_t 81 | arc4_getword(as) 82 | struct arc4_stream *as; 83 | { 84 | u_int32_t val; 85 | val = arc4_getbyte(as) << 24; 86 | val |= arc4_getbyte(as) << 16; 87 | val |= arc4_getbyte(as) << 8; 88 | val |= arc4_getbyte(as); 89 | return val; 90 | } 91 | 92 | void 93 | arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen) 94 | { 95 | int n; 96 | u_int8_t si; 97 | 98 | as->i--; 99 | for (n = 0; n < 256; n++) { 100 | as->i = (as->i + 1); 101 | si = as->s[as->i]; 102 | as->j = (as->j + si + dat[n % datlen]); 103 | as->s[as->i] = as->s[as->j]; 104 | as->s[as->j] = si; 105 | } 106 | } 107 | 108 | void 109 | arc4_initkey(struct arc4_stream *as, char *type, u_char *key, int keylen) 110 | { 111 | MD5_CTX ctx; 112 | u_char digest[16]; 113 | 114 | /* Bah, we want bcrypt */ 115 | MD5Init(&ctx); 116 | MD5Update(&ctx, type, strlen(type)); 117 | MD5Update(&ctx, key, keylen); 118 | MD5Final(digest, &ctx); 119 | 120 | arc4_init(as); 121 | arc4_addrandom(as, digest, 16); 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/arc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* 32 | * Arc4 random number generator for OpenBSD. 33 | * Copyright 1996 David Mazieres . 34 | * 35 | * Modification and redistribution in source and binary forms is 36 | * permitted provided that due credit is given to the author and the 37 | * OpenBSD project (for instance by leaving this copyright notice 38 | * intact). 39 | */ 40 | 41 | #ifndef _ARC_H 42 | #define _ARC_H 43 | 44 | struct arc4_stream { 45 | u_int8_t i; 46 | u_int8_t j; 47 | u_int8_t s[256]; 48 | }; 49 | 50 | /* Key stream */ 51 | 52 | void arc4_init(struct arc4_stream *as); 53 | u_int8_t arc4_getbyte(struct arc4_stream *as); 54 | u_int32_t arc4_getword(struct arc4_stream *as); 55 | void arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen); 56 | void arc4_initkey(struct arc4_stream *as, char *type, u_char *key, int keylen); 57 | 58 | #endif /* _ARC_H */ 59 | -------------------------------------------------------------------------------- /src/err.c: -------------------------------------------------------------------------------- 1 | /* 2 | * err.c 3 | * 4 | * Adapted from OpenBSD libc *err* *warn* code. 5 | * 6 | * Copyright 2000 Dug Song 7 | * 8 | * Copyright 1993 9 | * The Regents of the University of California. All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 1. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 3. All advertising materials mentioning features or use of this software 20 | * must display the following acknowledgement: 21 | * This product includes software developed by the University of 22 | * California, Berkeley and its contributors. 23 | * 4. Neither the name of the University nor the names of its contributors 24 | * may be used to endorse or promote products derived from this software 25 | * without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 | * SUCH DAMAGE. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | void 47 | err(int eval, const char *fmt, ...) 48 | { 49 | va_list ap; 50 | 51 | va_start(ap, fmt); 52 | if (fmt != NULL) { 53 | (void)vfprintf(stderr, fmt, ap); 54 | (void)fprintf(stderr, ": "); 55 | } 56 | va_end(ap); 57 | (void)fprintf(stderr, "%s\n", strerror(errno)); 58 | exit(eval); 59 | } 60 | 61 | void 62 | warn(const char *fmt, ...) 63 | { 64 | va_list ap; 65 | 66 | va_start(ap, fmt); 67 | if (fmt != NULL) { 68 | (void)vfprintf(stderr, fmt, ap); 69 | (void)fprintf(stderr, ": "); 70 | } 71 | va_end(ap); 72 | (void)fprintf(stderr, "%s\n", strerror(errno)); 73 | } 74 | 75 | void 76 | errx(int eval, const char *fmt, ...) 77 | { 78 | va_list ap; 79 | 80 | va_start(ap, fmt); 81 | if (fmt != NULL) 82 | (void)vfprintf(stderr, fmt, ap); 83 | (void)fprintf(stderr, "\n"); 84 | va_end(ap); 85 | exit(eval); 86 | } 87 | 88 | void 89 | warnx(const char *fmt, ...) 90 | { 91 | va_list ap; 92 | 93 | va_start(ap, fmt); 94 | if (fmt != NULL) 95 | (void)vfprintf(stderr, fmt, ap); 96 | (void)fprintf(stderr, "\n"); 97 | va_end(ap); 98 | } 99 | 100 | -------------------------------------------------------------------------------- /src/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * err.h 3 | * 4 | * Adapted from OpenBSD libc *err* *warn* code. 5 | * 6 | * Copyright 2000 Dug Song 7 | * 8 | * Copyright 1993 9 | * The Regents of the University of California. All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 1. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 3. All advertising materials mentioning features or use of this software 20 | * must display the following acknowledgement: 21 | * This product includes software developed by the University of 22 | * California, Berkeley and its contributors. 23 | * 4. Neither the name of the University nor the names of its contributors 24 | * may be used to endorse or promote products derived from this software 25 | * without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 | * SUCH DAMAGE. 38 | * 39 | * @(#)err.h 8.1 (Berkeley) 6/2/93 40 | */ 41 | 42 | #ifndef _ERR_H_ 43 | #define _ERR_H_ 44 | 45 | void err(int eval, const char *fmt, ...); 46 | void warn(const char *fmt, ...); 47 | void errx(int eval, const char *fmt, ...); 48 | void warnx(const char *fmt, ...); 49 | 50 | #endif /* !_ERR_H_ */ 51 | -------------------------------------------------------------------------------- /src/fourier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2000 Niels Provos 3 | * Copyright 2020 Robin Vobruba 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. All advertising materials mentioning features or use of this software 15 | * must display the following acknowledgement: 16 | * This product includes software developed by Niels Provos. 17 | * 4. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #include 33 | #include "fourier.h" 34 | 35 | /* if depth > 1 */ 36 | int 37 | split_colors(u_char **pred, u_char **pgreen, u_char **pblue, 38 | u_char *img, 39 | int xdim, int ydim, int depth) 40 | { 41 | int i, j; 42 | u_char *red, *green, *blue; 43 | 44 | /* Split to red - blue */ 45 | red = checkedmalloc(ydim*xdim); 46 | green = checkedmalloc(ydim*xdim); 47 | blue = checkedmalloc(ydim*xdim); 48 | 49 | for (i = 0; i < ydim; i++) { 50 | for (j = 0; j < xdim; j++) { 51 | red[j + xdim*i] = img[0 + depth*(j + xdim*i)]; 52 | green[j + xdim*i] = img[1 + depth*(j + xdim*i)]; 53 | blue[j + xdim*i] = img[2 + depth*(j + xdim*i)]; 54 | } 55 | } 56 | 57 | *pred = red; 58 | *pgreen = green; 59 | *pblue = blue; 60 | 61 | return 1; 62 | } 63 | 64 | void 65 | fft_image(int xdim, int ydim, int depth, u_char *img) 66 | { 67 | int i,j; 68 | u_char *red, *green, *blue; 69 | fftw_complex *c, *d, *e; 70 | double maxre, maxim, maxmod; 71 | 72 | split_colors(&red, &green, &blue, img, xdim, ydim, depth); 73 | 74 | maxre = maxim = maxmod = 0; 75 | c = fft_transform(xdim, ydim, red, &maxre, &maxim, &maxmod); 76 | d = fft_transform(xdim, ydim, green, &maxre, &maxim, &maxmod); 77 | e = fft_transform(xdim, ydim, blue, &maxre, &maxim, &maxmod); 78 | fft_visible(xdim, ydim, c, red, maxre, maxim, maxmod); 79 | free(c); 80 | fft_visible(xdim, ydim, d, green, maxre, maxim, maxmod); 81 | free(d); 82 | fft_visible(xdim, ydim, e, blue, maxre, maxim, maxmod); 83 | free(e); 84 | 85 | for (i = 0; i < ydim; i++) { 86 | for (j = 0; j < xdim; j++) { 87 | img[0 + depth*(j + xdim*i)] = red[j + xdim*i]; 88 | img[1 + depth*(j + xdim*i)] = green[j + xdim*i]; 89 | img[2 + depth*(j + xdim*i)] = blue[j + xdim*i]; 90 | } 91 | } 92 | 93 | free(red); free(green); free(blue); 94 | } 95 | 96 | void 97 | fft_visible(int xdim, int ydim, fftw_complex *c, u_char *img, 98 | double maxre, double maxim, double maxmod) 99 | { 100 | int i, j, ind; 101 | double contrast, scale, factor, total, val; 102 | 103 | contrast = exp((-100.5) * log(xdim*ydim) / 256); 104 | factor = - 255.0; 105 | total = 0; 106 | scale = factor / log1p(maxmod * contrast * contrast); 107 | 108 | printf("Visible: max (%f/%f/%f), contrast: %f, scale: %f\n", 109 | maxre, maxim, maxmod, contrast, scale); 110 | 111 | for (i = 0; i < xdim ; i++) 112 | for (j = 0; j < ydim; j++) { 113 | ind = j*xdim + i; 114 | val = total - scale*log1p(contrast*contrast* 115 | (c[ind].re*c[ind].re + 116 | c[ind].im*c[ind].im)); 117 | img[ind] = val; 118 | } 119 | } 120 | 121 | fftw_complex * 122 | fft_transform(int xdim, int ydim, unsigned char *data, 123 | double *mre, double *mim, double *mmod) 124 | { 125 | rfftwnd_plan p; 126 | int i,j, ind, di; 127 | double maxre, maxim, maxmod, val; 128 | fftw_complex *a; 129 | 130 | fprintf(stderr, "Starting complex 2d FFT\n"); 131 | 132 | a = checkedmalloc(xdim * ydim * sizeof(fftw_complex)); 133 | 134 | p = fftw2d_create_plan(ydim, xdim, FFTW_FORWARD, 135 | FFTW_ESTIMATE | FFTW_IN_PLACE); 136 | 137 | di = 1; 138 | for (j = 0; j < ydim; j++) { 139 | int dj = di; 140 | for (i = 0; i < xdim ; i++) { 141 | ind = i + j * xdim; 142 | a[ind].re = data[ind] * dj; 143 | a[ind].im = 0.0; 144 | dj = -dj; 145 | } 146 | di = -di; 147 | } 148 | 149 | fftwnd_one(p, a, NULL); 150 | 151 | maxim = *mim; 152 | maxre = *mre; 153 | maxmod = *mmod; 154 | for (i = 0; i < xdim ; i++) 155 | for (j = 0; j < ydim; j++) { 156 | ind = j*xdim + i; 157 | 158 | /* Update Stats */ 159 | if (fabs(a[ind].re) > maxre) maxre = fabs(a[ind].re); 160 | if (fabs(a[ind].im) > maxim) maxim = fabs(a[ind].im); 161 | val = a[ind].re * a[ind].re + a[ind].im * a[ind].im; 162 | if (val > maxmod) maxmod = val; 163 | } 164 | *mim = maxim; 165 | *mre = maxre; 166 | *mmod = maxmod; 167 | 168 | fftwnd_destroy_plan(p); 169 | 170 | return a; 171 | } 172 | 173 | void 174 | fft_filter(int xdim, int ydim, fftw_complex *data) 175 | { 176 | int i, j, ind; 177 | double val; 178 | 179 | fprintf(stderr, "Starting complex filtering\n"); 180 | 181 | for (j = 0; j < ydim; j++) { 182 | for (i = 0; i < xdim ; i++) { 183 | ind = i + j * xdim; 184 | val = sqrt((xdim/2-i)*(xdim/2-i) + 185 | (ydim/2-j)*(ydim/2-j)); 186 | if (val > 15) { 187 | data[ind].re = 2*data[ind].re; 188 | data[ind].im = 2*data[ind].im; 189 | } else { 190 | data[ind].re = 0.2*data[ind].re; 191 | data[ind].im = 0.2*data[ind].im; 192 | } 193 | } 194 | } 195 | } 196 | 197 | u_char * 198 | fft_transform_back(int xdim, int ydim, fftw_complex *data) 199 | { 200 | rfftwnd_plan p; 201 | int i,j, ind; 202 | fftw_real dj, val; 203 | u_char *a; 204 | 205 | fprintf(stderr, "Starting complex 2d FFT-back\n"); 206 | 207 | a = checkedmalloc(xdim * ydim * sizeof(u_char)); 208 | 209 | p = fftw2d_create_plan(ydim, xdim, FFTW_BACKWARD, 210 | FFTW_ESTIMATE | FFTW_IN_PLACE); 211 | 212 | fftwnd_one(p, data, NULL); 213 | 214 | dj = (xdim * ydim); 215 | for (j = 0; j < ydim; j++) { 216 | for (i = 0; i < xdim ; i++) { 217 | ind = i + j * xdim; 218 | val = sqrt(data[ind].re * data[ind].re + 219 | data[ind].im * data[ind].im)/dj; 220 | a[ind] = val; 221 | } 222 | } 223 | 224 | return a; 225 | } 226 | -------------------------------------------------------------------------------- /src/fourier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2000 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _FOURIER_H 32 | #define _FOURIER_H 33 | 34 | int split_colors(u_char **pred, u_char **pgreen, u_char **pblue, 35 | u_char *img, int xdim, int ydim, int depth); 36 | 37 | void fft_visible(int xdim, int ydim, fftw_complex *c, u_char *img, 38 | double maxre, double maxim, double maxmod); 39 | fftw_complex *fft_transform(int xdim, int ydim, unsigned char *data, 40 | double *mre, double *mim, double *mmod); 41 | void fft_filter(int xdim, int ydim, fftw_complex *data); 42 | u_char *fft_transform_back(int xdim, int ydim, fftw_complex *data); 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /src/golay.h: -------------------------------------------------------------------------------- 1 | /* Golay 3-bit error correction */ 2 | extern long encoding_table[4096]; 3 | extern long decoding_table[2048]; 4 | 5 | void init_golay(void); 6 | long get_syndrome(long pattern); 7 | 8 | #define ENCODE(x) encoding_table[x] 9 | #define DECODE(x) ((x) ^ decoding_table[get_syndrome(x)]) 10 | 11 | #define TDECODE(x,off) (x)[0] 12 | 13 | #define DATAMASK 0x000fff 14 | #define CODEMASK 0x7fffff 15 | 16 | #define DATABITS 12 17 | #define CODEBITS 23 18 | #define ERRORBITS 3 19 | -------------------------------------------------------------------------------- /src/histogram.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "config.h" 9 | #include "outguess.h" 10 | 11 | char *progname; 12 | 13 | void 14 | usage(void) 15 | { 16 | 17 | fprintf(stderr, "%s: \n", progname); 18 | } 19 | 20 | void 21 | histogram_simple(u_char *data, int bits) 22 | { 23 | int i; 24 | int one = 0, zero = 0; 25 | 26 | for (i = 0; i < bits; i++) 27 | if (TEST_BIT(data, i)) 28 | one++; 29 | else 30 | zero++; 31 | 32 | fprintf(stdout, "Bits: %6d\n", bits); 33 | fprintf(stdout, "One: %6d, %f\n", one, (float)one/bits); 34 | fprintf(stdout, "Zero: %6d, %f\n", zero, (float)zero/bits); 35 | } 36 | 37 | #define MAXRUNLEN 25 38 | 39 | void 40 | histogram_runlen(u_char *data, int bits) 41 | { 42 | int buckets[MAXRUNLEN]; 43 | int what, count, i; 44 | 45 | memset(buckets, 0, sizeof(buckets)); 46 | what = TEST_BIT(data, 0); 47 | count = 1; 48 | for (i = 1; i < bits; i++) { 49 | if (TEST_BIT(data, i) != what) { 50 | if (count >= MAXRUNLEN) 51 | count = MAXRUNLEN - 1; 52 | buckets[count]++; 53 | 54 | what = TEST_BIT(data, i); 55 | count = 1; 56 | } else 57 | count++; 58 | } 59 | if (count >= MAXRUNLEN) 60 | count = MAXRUNLEN - 1; 61 | buckets[count]++; 62 | 63 | for (i = 1; i < MAXRUNLEN; i++) { 64 | fprintf(stdout, "%3d: %6d, %f\n", 65 | i, buckets[i], (float)buckets[i]/bits); 66 | } 67 | } 68 | 69 | int 70 | main(int argc, char *argv[]) 71 | { 72 | FILE *fin; 73 | char *data; 74 | int bits, bytes, res; 75 | 76 | progname = argv[0]; 77 | 78 | argv++; 79 | argc--; 80 | 81 | if (argc != 1) { 82 | usage(); 83 | exit(1); 84 | } 85 | 86 | if ((fin = fopen(argv[0], "r")) == NULL) 87 | err(1, "fopen"); 88 | 89 | if ((res = fread(&bits, sizeof(int), 1, fin)) != 1) 90 | err(1, "fread(1): %d", res); 91 | 92 | bits = ntohl(bits); 93 | bytes = (bits + 7) / 8; 94 | if ((data = malloc(bytes)) == NULL) 95 | err(1, "malloc"); 96 | 97 | if ((res = fread(data, sizeof(char), bytes, fin)) != bytes) 98 | err(1, "fread(2): %d", res); 99 | 100 | histogram_simple(data, bits); 101 | histogram_runlen(data, bits); 102 | 103 | exit(0); 104 | } 105 | -------------------------------------------------------------------------------- /src/iterator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2001 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | 33 | #include "config.h" 34 | 35 | #include "outguess.h" 36 | #include "arc.h" 37 | #include "iterator.h" 38 | 39 | /* Initalize the iterator */ 40 | 41 | void 42 | iterator_init(iterator *iter, bitmap *bitmap, u_char *key, u_int klen) 43 | { 44 | iter->skipmod = INIT_SKIPMOD; 45 | 46 | arc4_initkey(&iter->as, "Seeding", key, klen); 47 | 48 | iter->off = arc4_getword(&iter->as) % iter->skipmod; 49 | } 50 | 51 | /* The next bit in the bitmap we should embed data into */ 52 | 53 | int 54 | iterator_next(iterator *iter, bitmap *bitmap) 55 | { 56 | iter->off += (arc4_getword(&iter->as) % iter->skipmod) + 1; 57 | 58 | return iter->off; 59 | } 60 | 61 | void 62 | iterator_seed(iterator *iter, bitmap *bitmap, u_int16_t seed) 63 | { 64 | u_int8_t reseed[2]; 65 | 66 | reseed[0] = seed; 67 | reseed[1] = seed >> 8; 68 | 69 | arc4_addrandom(&iter->as, reseed, 2); 70 | } 71 | 72 | void 73 | iterator_adapt(iterator *iter, bitmap *bitmap, int datalen) 74 | { 75 | iter->skipmod = SKIPADJ(bitmap->bits, bitmap->bits - iter->off) * 76 | (bitmap->bits - iter->off)/(8 * datalen); 77 | } 78 | -------------------------------------------------------------------------------- /src/iterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2001 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _ITERATOR_H 32 | #define _ITERATOR_H 33 | 34 | #define INIT_SKIPMOD 32 35 | #define DEFAULT_ITER 256 36 | 37 | /* Slowly fade skip out at the end of the picture */ 38 | #define SKIPADJ(x,y) ((y) > (x)/32 ? 2 : 2 - ((x/32) - (y))/(float)(x/32)) 39 | 40 | /* 41 | * The generic iterator 42 | */ 43 | 44 | typedef struct _iterator { 45 | struct arc4_stream as; 46 | u_int32_t skipmod; 47 | int off; /* Current bit position */ 48 | } iterator; 49 | 50 | struct _bitmap; 51 | 52 | void iterator_init(iterator *, struct _bitmap *, u_char *key, u_int klen); 53 | int iterator_next(iterator *, struct _bitmap *); 54 | 55 | #define ITERATOR_CURRENT(x) (x)->off 56 | 57 | void iterator_seed(iterator *, struct _bitmap *, u_int16_t); 58 | void iterator_adapt(iterator *, struct _bitmap *, int); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/ansi2knr.1: -------------------------------------------------------------------------------- 1 | .TH ANSI2KNR 1 "19 Jan 1996" 2 | .SH NAME 3 | ansi2knr \- convert ANSI C to Kernighan & Ritchie C 4 | .SH SYNOPSIS 5 | .I ansi2knr 6 | [--varargs] input_file [output_file] 7 | .SH DESCRIPTION 8 | If no output_file is supplied, output goes to stdout. 9 | .br 10 | There are no error messages. 11 | .sp 12 | .I ansi2knr 13 | recognizes function definitions by seeing a non-keyword identifier at the left 14 | margin, followed by a left parenthesis, with a right parenthesis as the last 15 | character on the line, and with a left brace as the first token on the 16 | following line (ignoring possible intervening comments). It will recognize a 17 | multi-line header provided that no intervening line ends with a left or right 18 | brace or a semicolon. These algorithms ignore whitespace and comments, except 19 | that the function name must be the first thing on the line. 20 | .sp 21 | The following constructs will confuse it: 22 | .br 23 | - Any other construct that starts at the left margin and follows the 24 | above syntax (such as a macro or function call). 25 | .br 26 | - Some macros that tinker with the syntax of the function header. 27 | .sp 28 | The --varargs switch is obsolete, and is recognized only for 29 | backwards compatibility. The present version of 30 | .I ansi2knr 31 | will always attempt to convert a ... argument to va_alist and va_dcl. 32 | .SH AUTHOR 33 | L. Peter Deutsch wrote the original ansi2knr and 34 | continues to maintain the current version; most of the code in the current 35 | version is his work. ansi2knr also includes contributions by Francois 36 | Pinard and Jim Avera . 37 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/cderror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cderror.h 3 | * 4 | * Copyright (C) 1994-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file defines the error and message codes for the cjpeg/djpeg 9 | * applications. These strings are not needed as part of the JPEG library 10 | * proper. 11 | * Edit this file to add new codes, or to translate the message strings to 12 | * some other language. 13 | */ 14 | 15 | /* 16 | * To define the enum list of message codes, include this file without 17 | * defining macro JMESSAGE. To create a message string table, include it 18 | * again with a suitable JMESSAGE definition (see jerror.c for an example). 19 | */ 20 | #ifndef JMESSAGE 21 | #ifndef CDERROR_H 22 | #define CDERROR_H 23 | /* First time through, define the enum list */ 24 | #define JMAKE_ENUM_LIST 25 | #else 26 | /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ 27 | #define JMESSAGE(code,string) 28 | #endif /* CDERROR_H */ 29 | #endif /* JMESSAGE */ 30 | 31 | #ifdef JMAKE_ENUM_LIST 32 | 33 | typedef enum { 34 | 35 | #define JMESSAGE(code,string) code , 36 | 37 | #endif /* JMAKE_ENUM_LIST */ 38 | 39 | JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ 40 | 41 | #ifdef BMP_SUPPORTED 42 | JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") 43 | JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") 44 | JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") 45 | JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") 46 | JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") 47 | JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") 48 | JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") 49 | JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") 50 | JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") 51 | JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") 52 | JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") 53 | #endif /* BMP_SUPPORTED */ 54 | 55 | #ifdef GIF_SUPPORTED 56 | JMESSAGE(JERR_GIF_BUG, "GIF output got confused") 57 | JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") 58 | JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") 59 | JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") 60 | JMESSAGE(JERR_GIF_NOT, "Not a GIF file") 61 | JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") 62 | JMESSAGE(JTRC_GIF_BADVERSION, 63 | "Warning: unexpected GIF version number '%c%c%c'") 64 | JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") 65 | JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") 66 | JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") 67 | JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") 68 | JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") 69 | JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") 70 | #endif /* GIF_SUPPORTED */ 71 | 72 | #ifdef PPM_SUPPORTED 73 | JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") 74 | JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") 75 | JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") 76 | JMESSAGE(JTRC_PGM, "%ux%u PGM image") 77 | JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") 78 | JMESSAGE(JTRC_PPM, "%ux%u PPM image") 79 | JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") 80 | #endif /* PPM_SUPPORTED */ 81 | 82 | #ifdef RLE_SUPPORTED 83 | JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") 84 | JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") 85 | JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") 86 | JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") 87 | JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") 88 | JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") 89 | JMESSAGE(JERR_RLE_NOT, "Not an RLE file") 90 | JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") 91 | JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") 92 | JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") 93 | JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") 94 | JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") 95 | JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") 96 | JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") 97 | #endif /* RLE_SUPPORTED */ 98 | 99 | #ifdef TARGA_SUPPORTED 100 | JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") 101 | JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") 102 | JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") 103 | JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") 104 | JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") 105 | JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") 106 | #else 107 | JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") 108 | #endif /* TARGA_SUPPORTED */ 109 | 110 | JMESSAGE(JERR_BAD_CMAP_FILE, 111 | "Color map file is invalid or of unsupported format") 112 | JMESSAGE(JERR_TOO_MANY_COLORS, 113 | "Output file format cannot handle %d colormap entries") 114 | JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") 115 | #ifdef TARGA_SUPPORTED 116 | JMESSAGE(JERR_UNKNOWN_FORMAT, 117 | "Unrecognized input file format --- perhaps you need -targa") 118 | #else 119 | JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") 120 | #endif 121 | JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") 122 | 123 | #ifdef JMAKE_ENUM_LIST 124 | 125 | JMSG_LASTADDONCODE 126 | } ADDON_MESSAGE_CODE; 127 | 128 | #undef JMAKE_ENUM_LIST 129 | #endif /* JMAKE_ENUM_LIST */ 130 | 131 | /* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ 132 | #undef JMESSAGE 133 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/cdjpeg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * cdjpeg.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains common support routines used by the IJG application 9 | * programs (cjpeg, djpeg, jpegtran). 10 | */ 11 | 12 | #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ 13 | #include /* to declare isupper(), tolower() */ 14 | #ifdef NEED_SIGNAL_CATCHER 15 | #include /* to declare signal() */ 16 | #endif 17 | #ifdef USE_SETMODE 18 | #include /* to declare setmode()'s parameter macros */ 19 | /* If you have setmode() but not , just delete this line: */ 20 | #include /* to declare setmode() */ 21 | #endif 22 | 23 | 24 | /* 25 | * Signal catcher to ensure that temporary files are removed before aborting. 26 | * NB: for Amiga Manx C this is actually a global routine named _abort(); 27 | * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... 28 | */ 29 | 30 | #ifdef NEED_SIGNAL_CATCHER 31 | 32 | static j_common_ptr sig_cinfo; 33 | 34 | void /* must be global for Manx C */ 35 | signal_catcher (int signum) 36 | { 37 | if (sig_cinfo != NULL) { 38 | if (sig_cinfo->err != NULL) /* turn off trace output */ 39 | sig_cinfo->err->trace_level = 0; 40 | jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ 41 | } 42 | exit(EXIT_FAILURE); 43 | } 44 | 45 | 46 | GLOBAL(void) 47 | enable_signal_catcher (j_common_ptr cinfo) 48 | { 49 | sig_cinfo = cinfo; 50 | #ifdef SIGINT /* not all systems have SIGINT */ 51 | signal(SIGINT, signal_catcher); 52 | #endif 53 | #ifdef SIGTERM /* not all systems have SIGTERM */ 54 | signal(SIGTERM, signal_catcher); 55 | #endif 56 | } 57 | 58 | #endif 59 | 60 | 61 | /* 62 | * Optional progress monitor: display a percent-done figure on stderr. 63 | */ 64 | 65 | #ifdef PROGRESS_REPORT 66 | 67 | METHODDEF(void) 68 | progress_monitor (j_common_ptr cinfo) 69 | { 70 | cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; 71 | int total_passes = prog->pub.total_passes + prog->total_extra_passes; 72 | int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); 73 | 74 | if (percent_done != prog->percent_done) { 75 | prog->percent_done = percent_done; 76 | if (total_passes > 1) { 77 | fprintf(stderr, "\rPass %d/%d: %3d%% ", 78 | prog->pub.completed_passes + prog->completed_extra_passes + 1, 79 | total_passes, percent_done); 80 | } else { 81 | fprintf(stderr, "\r %3d%% ", percent_done); 82 | } 83 | fflush(stderr); 84 | } 85 | } 86 | 87 | 88 | GLOBAL(void) 89 | start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) 90 | { 91 | /* Enable progress display, unless trace output is on */ 92 | if (cinfo->err->trace_level == 0) { 93 | progress->pub.progress_monitor = progress_monitor; 94 | progress->completed_extra_passes = 0; 95 | progress->total_extra_passes = 0; 96 | progress->percent_done = -1; 97 | cinfo->progress = &progress->pub; 98 | } 99 | } 100 | 101 | 102 | GLOBAL(void) 103 | end_progress_monitor (j_common_ptr cinfo) 104 | { 105 | /* Clear away progress display */ 106 | if (cinfo->err->trace_level == 0) { 107 | fprintf(stderr, "\r \r"); 108 | fflush(stderr); 109 | } 110 | } 111 | 112 | #endif 113 | 114 | 115 | /* 116 | * Case-insensitive matching of possibly-abbreviated keyword switches. 117 | * keyword is the constant keyword (must be lower case already), 118 | * minchars is length of minimum legal abbreviation. 119 | */ 120 | 121 | GLOBAL(boolean) 122 | keymatch (char * arg, const char * keyword, int minchars) 123 | { 124 | register int ca, ck; 125 | register int nmatched = 0; 126 | 127 | while ((ca = *arg++) != '\0') { 128 | if ((ck = *keyword++) == '\0') 129 | return FALSE; /* arg longer than keyword, no good */ 130 | if (isupper(ca)) /* force arg to lcase (assume ck is already) */ 131 | ca = tolower(ca); 132 | if (ca != ck) 133 | return FALSE; /* no good */ 134 | nmatched++; /* count matched characters */ 135 | } 136 | /* reached end of argument; fail if it's too short for unique abbrev */ 137 | if (nmatched < minchars) 138 | return FALSE; 139 | return TRUE; /* A-OK */ 140 | } 141 | 142 | 143 | /* 144 | * Routines to establish binary I/O mode for stdin and stdout. 145 | * Non-Unix systems often require some hacking to get out of text mode. 146 | */ 147 | 148 | GLOBAL(FILE *) 149 | read_stdin (void) 150 | { 151 | FILE * input_file = stdin; 152 | 153 | #ifdef USE_SETMODE /* need to hack file mode? */ 154 | setmode(fileno(stdin), O_BINARY); 155 | #endif 156 | #ifdef USE_FDOPEN /* need to re-open in binary mode? */ 157 | if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { 158 | fprintf(stderr, "Cannot reopen stdin\n"); 159 | exit(EXIT_FAILURE); 160 | } 161 | #endif 162 | return input_file; 163 | } 164 | 165 | 166 | GLOBAL(FILE *) 167 | write_stdout (void) 168 | { 169 | FILE * output_file = stdout; 170 | 171 | #ifdef USE_SETMODE /* need to hack file mode? */ 172 | setmode(fileno(stdout), O_BINARY); 173 | #endif 174 | #ifdef USE_FDOPEN /* need to re-open in binary mode? */ 175 | if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { 176 | fprintf(stderr, "Cannot reopen stdout\n"); 177 | exit(EXIT_FAILURE); 178 | } 179 | #endif 180 | return output_file; 181 | } 182 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/cdjpeg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cdjpeg.h 3 | * 4 | * Copyright (C) 1994-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains common declarations for the sample applications 9 | * cjpeg and djpeg. It is NOT used by the core JPEG library. 10 | */ 11 | 12 | #define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ 13 | #define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ 14 | #include "jinclude.h" 15 | #include "jpeglib.h" 16 | #include "jerror.h" /* get library error codes too */ 17 | #include "cderror.h" /* get application-specific error codes */ 18 | 19 | 20 | /* 21 | * Object interface for cjpeg's source file decoding modules 22 | */ 23 | 24 | typedef struct cjpeg_source_struct * cjpeg_source_ptr; 25 | 26 | struct cjpeg_source_struct { 27 | JMETHOD(void, start_input, (j_compress_ptr cinfo, 28 | cjpeg_source_ptr sinfo)); 29 | JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, 30 | cjpeg_source_ptr sinfo)); 31 | JMETHOD(void, finish_input, (j_compress_ptr cinfo, 32 | cjpeg_source_ptr sinfo)); 33 | 34 | FILE *input_file; 35 | 36 | JSAMPARRAY buffer; 37 | JDIMENSION buffer_height; 38 | }; 39 | 40 | 41 | /* 42 | * Object interface for djpeg's output file encoding modules 43 | */ 44 | 45 | typedef struct djpeg_dest_struct * djpeg_dest_ptr; 46 | 47 | struct djpeg_dest_struct { 48 | /* start_output is called after jpeg_start_decompress finishes. 49 | * The color map will be ready at this time, if one is needed. 50 | */ 51 | JMETHOD(void, start_output, (j_decompress_ptr cinfo, 52 | djpeg_dest_ptr dinfo)); 53 | /* Emit the specified number of pixel rows from the buffer. */ 54 | JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, 55 | djpeg_dest_ptr dinfo, 56 | JDIMENSION rows_supplied)); 57 | /* Finish up at the end of the image. */ 58 | JMETHOD(void, finish_output, (j_decompress_ptr cinfo, 59 | djpeg_dest_ptr dinfo)); 60 | 61 | /* Target file spec; filled in by djpeg.c after object is created. */ 62 | FILE * output_file; 63 | 64 | /* Output pixel-row buffer. Created by module init or start_output. 65 | * Width is cinfo->output_width * cinfo->output_components; 66 | * height is buffer_height. 67 | */ 68 | JSAMPARRAY buffer; 69 | JDIMENSION buffer_height; 70 | }; 71 | 72 | 73 | /* 74 | * cjpeg/djpeg may need to perform extra passes to convert to or from 75 | * the source/destination file format. The JPEG library does not know 76 | * about these passes, but we'd like them to be counted by the progress 77 | * monitor. We use an expanded progress monitor object to hold the 78 | * additional pass count. 79 | */ 80 | 81 | struct cdjpeg_progress_mgr { 82 | struct jpeg_progress_mgr pub; /* fields known to JPEG library */ 83 | int completed_extra_passes; /* extra passes completed */ 84 | int total_extra_passes; /* total extra */ 85 | /* last printed percentage stored here to avoid multiple printouts */ 86 | int percent_done; 87 | }; 88 | 89 | typedef struct cdjpeg_progress_mgr * cd_progress_ptr; 90 | 91 | 92 | /* Short forms of external names for systems with brain-damaged linkers. */ 93 | 94 | #ifdef NEED_SHORT_EXTERNAL_NAMES 95 | #define jinit_read_bmp jIRdBMP 96 | #define jinit_write_bmp jIWrBMP 97 | #define jinit_read_gif jIRdGIF 98 | #define jinit_write_gif jIWrGIF 99 | #define jinit_read_ppm jIRdPPM 100 | #define jinit_write_ppm jIWrPPM 101 | #define jinit_read_rle jIRdRLE 102 | #define jinit_write_rle jIWrRLE 103 | #define jinit_read_targa jIRdTarga 104 | #define jinit_write_targa jIWrTarga 105 | #define read_quant_tables RdQTables 106 | #define read_scan_script RdScnScript 107 | #define set_quant_slots SetQSlots 108 | #define set_sample_factors SetSFacts 109 | #define read_color_map RdCMap 110 | #define enable_signal_catcher EnSigCatcher 111 | #define start_progress_monitor StProgMon 112 | #define end_progress_monitor EnProgMon 113 | #define read_stdin RdStdin 114 | #define write_stdout WrStdout 115 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 116 | 117 | /* Module selection routines for I/O modules. */ 118 | 119 | EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); 120 | EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, 121 | boolean is_os2)); 122 | EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); 123 | EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); 124 | EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); 125 | EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); 126 | EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); 127 | EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); 128 | EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); 129 | EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); 130 | 131 | /* cjpeg support routines (in rdswitch.c) */ 132 | 133 | EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, 134 | int scale_factor, boolean force_baseline)); 135 | EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); 136 | EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); 137 | EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); 138 | 139 | /* djpeg support routines (in rdcolmap.c) */ 140 | 141 | EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); 142 | 143 | /* common support routines (in cdjpeg.c) */ 144 | 145 | EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); 146 | EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, 147 | cd_progress_ptr progress)); 148 | EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); 149 | EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); 150 | EXTERN(FILE *) read_stdin JPP((void)); 151 | EXTERN(FILE *) write_stdout JPP((void)); 152 | 153 | /* miscellaneous useful macros */ 154 | 155 | #ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ 156 | #define READ_BINARY "r" 157 | #define WRITE_BINARY "w" 158 | #else 159 | #ifdef VMS /* VMS is very nonstandard */ 160 | #define READ_BINARY "rb", "ctx=stm" 161 | #define WRITE_BINARY "wb", "ctx=stm" 162 | #else /* standard ANSI-compliant case */ 163 | #define READ_BINARY "rb" 164 | #define WRITE_BINARY "wb" 165 | #endif 166 | #endif 167 | 168 | #ifndef EXIT_FAILURE /* define exit() codes if not provided */ 169 | #define EXIT_FAILURE 1 170 | #endif 171 | #ifndef EXIT_SUCCESS 172 | #ifdef VMS 173 | #define EXIT_SUCCESS 1 /* VMS is very nonstandard */ 174 | #else 175 | #define EXIT_SUCCESS 0 176 | #endif 177 | #endif 178 | #ifndef EXIT_WARNING 179 | #ifdef VMS 180 | #define EXIT_WARNING 1 /* VMS is very nonstandard */ 181 | #else 182 | #define EXIT_WARNING 2 183 | #endif 184 | #endif 185 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5 (mit/util/scripts/install.sh). 5 | # 6 | # Copyright 1991 by the Massachusetts Institute of Technology 7 | # 8 | # Permission to use, copy, modify, distribute, and sell this software and its 9 | # documentation for any purpose is hereby granted without fee, provided that 10 | # the above copyright notice appear in all copies and that both that 11 | # copyright notice and this permission notice appear in supporting 12 | # documentation, and that the name of M.I.T. not be used in advertising or 13 | # publicity pertaining to distribution of the software without specific, 14 | # written prior permission. M.I.T. makes no representations about the 15 | # suitability of this software for any purpose. It is provided "as is" 16 | # without express or implied warranty. 17 | # 18 | # Calling this script install-sh is preferred over install.sh, to prevent 19 | # `make' implicit rules from creating a file called install from it 20 | # when there is no Makefile. 21 | # 22 | # This script is compatible with the BSD install script, but was written 23 | # from scratch. It can only install one file at a time, a restriction 24 | # shared with many OS's install programs. 25 | 26 | 27 | # set DOITPROG to echo to test this script 28 | 29 | # Don't use :- since 4.3BSD and earlier shells don't like it. 30 | doit="${DOITPROG-}" 31 | 32 | 33 | # put in absolute paths if you don't have them in your path; or use env. vars. 34 | 35 | mvprog="${MVPROG-mv}" 36 | cpprog="${CPPROG-cp}" 37 | chmodprog="${CHMODPROG-chmod}" 38 | chownprog="${CHOWNPROG-chown}" 39 | chgrpprog="${CHGRPPROG-chgrp}" 40 | stripprog="${STRIPPROG-strip}" 41 | rmprog="${RMPROG-rm}" 42 | mkdirprog="${MKDIRPROG-mkdir}" 43 | 44 | transformbasename="" 45 | transform_arg="" 46 | instcmd="$mvprog" 47 | chmodcmd="$chmodprog 0755" 48 | chowncmd="" 49 | chgrpcmd="" 50 | stripcmd="" 51 | rmcmd="$rmprog -f" 52 | mvcmd="$mvprog" 53 | src="" 54 | dst="" 55 | dir_arg="" 56 | 57 | while [ x"$1" != x ]; do 58 | case $1 in 59 | -c) instcmd="$cpprog" 60 | shift 61 | continue;; 62 | 63 | -d) dir_arg=true 64 | shift 65 | continue;; 66 | 67 | -m) chmodcmd="$chmodprog $2" 68 | shift 69 | shift 70 | continue;; 71 | 72 | -o) chowncmd="$chownprog $2" 73 | shift 74 | shift 75 | continue;; 76 | 77 | -g) chgrpcmd="$chgrpprog $2" 78 | shift 79 | shift 80 | continue;; 81 | 82 | -s) stripcmd="$stripprog" 83 | shift 84 | continue;; 85 | 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 87 | shift 88 | continue;; 89 | 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 91 | shift 92 | continue;; 93 | 94 | *) if [ x"$src" = x ] 95 | then 96 | src=$1 97 | else 98 | # this colon is to work around a 386BSD /bin/sh bug 99 | : 100 | dst=$1 101 | fi 102 | shift 103 | continue;; 104 | esac 105 | done 106 | 107 | if [ x"$src" = x ] 108 | then 109 | echo "install: no input file specified" 110 | exit 1 111 | else 112 | true 113 | fi 114 | 115 | if [ x"$dir_arg" != x ]; then 116 | dst=$src 117 | src="" 118 | 119 | if [ -d $dst ]; then 120 | instcmd=: 121 | else 122 | instcmd=mkdir 123 | fi 124 | else 125 | 126 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 127 | # might cause directories to be created, which would be especially bad 128 | # if $src (and thus $dsttmp) contains '*'. 129 | 130 | if [ -f $src -o -d $src ] 131 | then 132 | true 133 | else 134 | echo "install: $src does not exist" 135 | exit 1 136 | fi 137 | 138 | if [ x"$dst" = x ] 139 | then 140 | echo "install: no destination specified" 141 | exit 1 142 | else 143 | true 144 | fi 145 | 146 | # If destination is a directory, append the input filename; if your system 147 | # does not like double slashes in filenames, you may need to add some logic 148 | 149 | if [ -d $dst ] 150 | then 151 | dst="$dst"/`basename $src` 152 | else 153 | true 154 | fi 155 | fi 156 | 157 | ## this sed command emulates the dirname command 158 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 159 | 160 | # Make sure that the destination directory exists. 161 | # this part is taken from Noah Friedman's mkinstalldirs script 162 | 163 | # Skip lots of stat calls in the usual case. 164 | if [ ! -d "$dstdir" ]; then 165 | defaultIFS=' 166 | ' 167 | IFS="${IFS-${defaultIFS}}" 168 | 169 | oIFS="${IFS}" 170 | # Some sh's can't handle IFS=/ for some reason. 171 | IFS='%' 172 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` 173 | IFS="${oIFS}" 174 | 175 | pathcomp='' 176 | 177 | while [ $# -ne 0 ] ; do 178 | pathcomp="${pathcomp}${1}" 179 | shift 180 | 181 | if [ ! -d "${pathcomp}" ] ; 182 | then 183 | $mkdirprog "${pathcomp}" 184 | else 185 | true 186 | fi 187 | 188 | pathcomp="${pathcomp}/" 189 | done 190 | fi 191 | 192 | if [ x"$dir_arg" != x ] 193 | then 194 | $doit $instcmd $dst && 195 | 196 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && 197 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && 198 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && 199 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi 200 | else 201 | 202 | # If we're going to rename the final executable, determine the name now. 203 | 204 | if [ x"$transformarg" = x ] 205 | then 206 | dstfile=`basename $dst` 207 | else 208 | dstfile=`basename $dst $transformbasename | 209 | sed $transformarg`$transformbasename 210 | fi 211 | 212 | # don't allow the sed command to completely eliminate the filename 213 | 214 | if [ x"$dstfile" = x ] 215 | then 216 | dstfile=`basename $dst` 217 | else 218 | true 219 | fi 220 | 221 | # Make a temp file name in the proper directory. 222 | 223 | dsttmp=$dstdir/#inst.$$# 224 | 225 | # Move or copy the file name to the temp name 226 | 227 | $doit $instcmd $src $dsttmp && 228 | 229 | trap "rm -f ${dsttmp}" 0 && 230 | 231 | # and set any options; do chmod last to preserve setuid bits 232 | 233 | # If any of these fail, we abort the whole thing. If we want to 234 | # ignore errors from any of these, just make sure not to ignore 235 | # errors from the above "$doit $instcmd $src $dsttmp" command. 236 | 237 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && 238 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && 239 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && 240 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && 241 | 242 | # Now rename the file to the real destination. 243 | 244 | $doit $rmcmd -f $dstdir/$dstfile && 245 | $doit $mvcmd $dsttmp $dstdir/$dstfile 246 | 247 | fi && 248 | 249 | 250 | exit 0 251 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jcapistd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcapistd.c 3 | * 4 | * Copyright (C) 1994-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains application interface code for the compression half 9 | * of the JPEG library. These are the "standard" API routines that are 10 | * used in the normal full-compression case. They are not used by a 11 | * transcoding-only application. Note that if an application links in 12 | * jpeg_start_compress, it will end up linking in the entire compressor. 13 | * We thus must separate this file from jcapimin.c to avoid linking the 14 | * whole compression library into a transcoder. 15 | */ 16 | 17 | #define JPEG_INTERNALS 18 | #include "jinclude.h" 19 | #include "jpeglib.h" 20 | 21 | 22 | /* 23 | * Compression initialization. 24 | * Before calling this, all parameters and a data destination must be set up. 25 | * 26 | * We require a write_all_tables parameter as a failsafe check when writing 27 | * multiple datastreams from the same compression object. Since prior runs 28 | * will have left all the tables marked sent_table=TRUE, a subsequent run 29 | * would emit an abbreviated stream (no tables) by default. This may be what 30 | * is wanted, but for safety's sake it should not be the default behavior: 31 | * programmers should have to make a deliberate choice to emit abbreviated 32 | * images. Therefore the documentation and examples should encourage people 33 | * to pass write_all_tables=TRUE; then it will take active thought to do the 34 | * wrong thing. 35 | */ 36 | 37 | GLOBAL(void) 38 | jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) 39 | { 40 | if (cinfo->global_state != CSTATE_START) 41 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 42 | 43 | if (write_all_tables) 44 | jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ 45 | 46 | /* (Re)initialize error mgr and destination modules */ 47 | (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); 48 | (*cinfo->dest->init_destination) (cinfo); 49 | /* Perform master selection of active modules */ 50 | jinit_compress_master(cinfo); 51 | /* Set up for the first pass */ 52 | (*cinfo->master->prepare_for_pass) (cinfo); 53 | /* Ready for application to drive first pass through jpeg_write_scanlines 54 | * or jpeg_write_raw_data. 55 | */ 56 | cinfo->next_scanline = 0; 57 | cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING); 58 | } 59 | 60 | 61 | /* 62 | * Write some scanlines of data to the JPEG compressor. 63 | * 64 | * The return value will be the number of lines actually written. 65 | * This should be less than the supplied num_lines only in case that 66 | * the data destination module has requested suspension of the compressor, 67 | * or if more than image_height scanlines are passed in. 68 | * 69 | * Note: we warn about excess calls to jpeg_write_scanlines() since 70 | * this likely signals an application programmer error. However, 71 | * excess scanlines passed in the last valid call are *silently* ignored, 72 | * so that the application need not adjust num_lines for end-of-image 73 | * when using a multiple-scanline buffer. 74 | */ 75 | 76 | GLOBAL(JDIMENSION) 77 | jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, 78 | JDIMENSION num_lines) 79 | { 80 | JDIMENSION row_ctr, rows_left; 81 | 82 | if (cinfo->global_state != CSTATE_SCANNING) 83 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 84 | if (cinfo->next_scanline >= cinfo->image_height) 85 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); 86 | 87 | /* Call progress monitor hook if present */ 88 | if (cinfo->progress != NULL) { 89 | cinfo->progress->pass_counter = (long) cinfo->next_scanline; 90 | cinfo->progress->pass_limit = (long) cinfo->image_height; 91 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 92 | } 93 | 94 | /* Give master control module another chance if this is first call to 95 | * jpeg_write_scanlines. This lets output of the frame/scan headers be 96 | * delayed so that application can write COM, etc, markers between 97 | * jpeg_start_compress and jpeg_write_scanlines. 98 | */ 99 | if (cinfo->master->call_pass_startup) 100 | (*cinfo->master->pass_startup) (cinfo); 101 | 102 | /* Ignore any extra scanlines at bottom of image. */ 103 | rows_left = cinfo->image_height - cinfo->next_scanline; 104 | if (num_lines > rows_left) 105 | num_lines = rows_left; 106 | 107 | row_ctr = 0; 108 | (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); 109 | cinfo->next_scanline += row_ctr; 110 | return row_ctr; 111 | } 112 | 113 | 114 | /* 115 | * Alternate entry point to write raw data. 116 | * Processes exactly one iMCU row per call, unless suspended. 117 | */ 118 | 119 | GLOBAL(JDIMENSION) 120 | jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, 121 | JDIMENSION num_lines) 122 | { 123 | JDIMENSION lines_per_iMCU_row; 124 | 125 | if (cinfo->global_state != CSTATE_RAW_OK) 126 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 127 | if (cinfo->next_scanline >= cinfo->image_height) { 128 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); 129 | return 0; 130 | } 131 | 132 | /* Call progress monitor hook if present */ 133 | if (cinfo->progress != NULL) { 134 | cinfo->progress->pass_counter = (long) cinfo->next_scanline; 135 | cinfo->progress->pass_limit = (long) cinfo->image_height; 136 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 137 | } 138 | 139 | /* Give master control module another chance if this is first call to 140 | * jpeg_write_raw_data. This lets output of the frame/scan headers be 141 | * delayed so that application can write COM, etc, markers between 142 | * jpeg_start_compress and jpeg_write_raw_data. 143 | */ 144 | if (cinfo->master->call_pass_startup) 145 | (*cinfo->master->pass_startup) (cinfo); 146 | 147 | /* Verify that at least one iMCU row has been passed. */ 148 | lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE; 149 | if (num_lines < lines_per_iMCU_row) 150 | ERREXIT(cinfo, JERR_BUFFER_SIZE); 151 | 152 | /* Directly compress the row. */ 153 | if (! (*cinfo->coef->compress_data) (cinfo, data)) { 154 | /* If compressor did not consume the whole row, suspend processing. */ 155 | return 0; 156 | } 157 | 158 | /* OK, we processed one iMCU row. */ 159 | cinfo->next_scanline += lines_per_iMCU_row; 160 | return lines_per_iMCU_row; 161 | } 162 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jchuff.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jchuff.h 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for Huffman entropy encoding routines 9 | * that are shared between the sequential encoder (jchuff.c) and the 10 | * progressive encoder (jcphuff.c). No other modules need to see these. 11 | */ 12 | 13 | /* The legal range of a DCT coefficient is 14 | * -1024 .. +1023 for 8-bit data; 15 | * -16384 .. +16383 for 12-bit data. 16 | * Hence the magnitude should always fit in 10 or 14 bits respectively. 17 | */ 18 | 19 | #if BITS_IN_JSAMPLE == 8 20 | #define MAX_COEF_BITS 10 21 | #else 22 | #define MAX_COEF_BITS 14 23 | #endif 24 | 25 | /* Derived data constructed for each Huffman table */ 26 | 27 | typedef struct { 28 | unsigned int ehufco[256]; /* code for each symbol */ 29 | char ehufsi[256]; /* length of code for each symbol */ 30 | /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 31 | } c_derived_tbl; 32 | 33 | /* Short forms of external names for systems with brain-damaged linkers. */ 34 | 35 | #ifdef NEED_SHORT_EXTERNAL_NAMES 36 | #define jpeg_make_c_derived_tbl jMkCDerived 37 | #define jpeg_gen_optimal_table jGenOptTbl 38 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 39 | 40 | /* Expand a Huffman table definition into the derived format */ 41 | EXTERN(void) jpeg_make_c_derived_tbl 42 | JPP((j_compress_ptr cinfo, boolean isDC, int tblno, 43 | c_derived_tbl ** pdtbl)); 44 | 45 | /* Generate an optimal table definition given the specified counts */ 46 | EXTERN(void) jpeg_gen_optimal_table 47 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); 48 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jcinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcinit.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains initialization logic for the JPEG compressor. 9 | * This routine is in charge of selecting the modules to be executed and 10 | * making an initialization call to each one. 11 | * 12 | * Logically, this code belongs in jcmaster.c. It's split out because 13 | * linking this routine implies linking the entire compression library. 14 | * For a transcoding-only application, we want to be able to use jcmaster.c 15 | * without linking in the whole library. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | 22 | 23 | /* 24 | * Master selection of compression modules. 25 | * This is done once at the start of processing an image. We determine 26 | * which modules will be used and give them appropriate initialization calls. 27 | */ 28 | 29 | GLOBAL(void) 30 | jinit_compress_master (j_compress_ptr cinfo) 31 | { 32 | /* Initialize master control (includes parameter checking/processing) */ 33 | jinit_c_master_control(cinfo, FALSE /* full compression */); 34 | 35 | /* Preprocessing */ 36 | if (! cinfo->raw_data_in) { 37 | jinit_color_converter(cinfo); 38 | jinit_downsampler(cinfo); 39 | jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 40 | } 41 | /* Forward DCT */ 42 | jinit_forward_dct(cinfo); 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); 55 | } 56 | 57 | /* Need a full-image coefficient buffer in any multi-pass mode. */ 58 | jinit_c_coef_controller(cinfo, 59 | (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); 60 | jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 61 | 62 | jinit_marker_writer(cinfo); 63 | 64 | /* We can now tell the memory manager to allocate virtual arrays. */ 65 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 66 | 67 | /* Write the datastream header (SOI) immediately. 68 | * Frame and scan headers are postponed till later. 69 | * This lets application insert special markers after the SOI. 70 | */ 71 | (*cinfo->marker->write_file_header) (cinfo); 72 | } 73 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jcomapi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcomapi.c 3 | * 4 | * Copyright (C) 1994-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains application interface routines that are used for both 9 | * compression and decompression. 10 | */ 11 | 12 | #define JPEG_INTERNALS 13 | #include "jinclude.h" 14 | #include "jpeglib.h" 15 | 16 | 17 | /* 18 | * Abort processing of a JPEG compression or decompression operation, 19 | * but don't destroy the object itself. 20 | * 21 | * For this, we merely clean up all the nonpermanent memory pools. 22 | * Note that temp files (virtual arrays) are not allowed to belong to 23 | * the permanent pool, so we will be able to close all temp files here. 24 | * Closing a data source or destination, if necessary, is the application's 25 | * responsibility. 26 | */ 27 | 28 | GLOBAL(void) 29 | jpeg_abort (j_common_ptr cinfo) 30 | { 31 | int pool; 32 | 33 | /* Do nothing if called on a not-initialized or destroyed JPEG object. */ 34 | if (cinfo->mem == NULL) 35 | return; 36 | 37 | /* Releasing pools in reverse order might help avoid fragmentation 38 | * with some (brain-damaged) malloc libraries. 39 | */ 40 | for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { 41 | (*cinfo->mem->free_pool) (cinfo, pool); 42 | } 43 | 44 | /* Reset overall state for possible reuse of object */ 45 | if (cinfo->is_decompressor) { 46 | cinfo->global_state = DSTATE_START; 47 | /* Try to keep application from accessing now-deleted marker list. 48 | * A bit kludgy to do it here, but this is the most central place. 49 | */ 50 | ((j_decompress_ptr) cinfo)->marker_list = NULL; 51 | } else { 52 | cinfo->global_state = CSTATE_START; 53 | } 54 | } 55 | 56 | 57 | /* 58 | * Destruction of a JPEG object. 59 | * 60 | * Everything gets deallocated except the master jpeg_compress_struct itself 61 | * and the error manager struct. Both of these are supplied by the application 62 | * and must be freed, if necessary, by the application. (Often they are on 63 | * the stack and so don't need to be freed anyway.) 64 | * Closing a data source or destination, if necessary, is the application's 65 | * responsibility. 66 | */ 67 | 68 | GLOBAL(void) 69 | jpeg_destroy (j_common_ptr cinfo) 70 | { 71 | /* We need only tell the memory manager to release everything. */ 72 | /* NB: mem pointer is NULL if memory mgr failed to initialize. */ 73 | if (cinfo->mem != NULL) 74 | (*cinfo->mem->self_destruct) (cinfo); 75 | cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ 76 | cinfo->global_state = 0; /* mark it destroyed */ 77 | } 78 | 79 | 80 | /* 81 | * Convenience routines for allocating quantization and Huffman tables. 82 | * (Would jutils.c be a more reasonable place to put these?) 83 | */ 84 | 85 | GLOBAL(JQUANT_TBL *) 86 | jpeg_alloc_quant_table (j_common_ptr cinfo) 87 | { 88 | JQUANT_TBL *tbl; 89 | 90 | tbl = (JQUANT_TBL *) 91 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); 92 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 93 | return tbl; 94 | } 95 | 96 | 97 | GLOBAL(JHUFF_TBL *) 98 | jpeg_alloc_huff_table (j_common_ptr cinfo) 99 | { 100 | JHUFF_TBL *tbl; 101 | 102 | tbl = (JHUFF_TBL *) 103 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); 104 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 105 | return tbl; 106 | } 107 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.bcc: -------------------------------------------------------------------------------- 1 | /* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #ifdef __MSDOS__ 15 | #define NEED_FAR_POINTERS /* for small or medium memory model */ 16 | #endif 17 | #undef NEED_SHORT_EXTERNAL_NAMES 18 | #undef INCOMPLETE_TYPES_BROKEN /* this assumes you have -w-stu in CFLAGS */ 19 | 20 | #ifdef JPEG_INTERNALS 21 | 22 | #undef RIGHT_SHIFT_IS_UNSIGNED 23 | 24 | #ifdef __MSDOS__ 25 | #define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ 26 | #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ 27 | #define USE_FMEM /* Borland has _fmemcpy() and _fmemset() */ 28 | #endif 29 | 30 | #endif /* JPEG_INTERNALS */ 31 | 32 | #ifdef JPEG_CJPEG_DJPEG 33 | 34 | #define BMP_SUPPORTED /* BMP image file format */ 35 | #define GIF_SUPPORTED /* GIF image file format */ 36 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 37 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 38 | #define TARGA_SUPPORTED /* Targa image file format */ 39 | 40 | #define TWO_FILE_COMMANDLINE 41 | #define USE_SETMODE /* Borland has setmode() */ 42 | #ifdef __MSDOS__ 43 | #define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ 44 | #endif 45 | #undef DONT_USE_B_MODE 46 | #undef PROGRESS_REPORT /* optional */ 47 | 48 | #endif /* JPEG_CJPEG_DJPEG */ 49 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.cfg: -------------------------------------------------------------------------------- 1 | /* jconfig.cfg --- source file edited by configure script */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #undef HAVE_PROTOTYPES 5 | #undef HAVE_UNSIGNED_CHAR 6 | #undef HAVE_UNSIGNED_SHORT 7 | #undef void 8 | #undef const 9 | #undef CHAR_IS_UNSIGNED 10 | #undef HAVE_STDDEF_H 11 | #undef HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | /* Define this if you get warnings about undefined structures. */ 17 | #undef INCOMPLETE_TYPES_BROKEN 18 | 19 | #ifdef JPEG_INTERNALS 20 | 21 | #undef RIGHT_SHIFT_IS_UNSIGNED 22 | #undef INLINE 23 | /* These are for configuring the JPEG memory manager. */ 24 | #undef DEFAULT_MAX_MEM 25 | #undef NO_MKTEMP 26 | 27 | #endif /* JPEG_INTERNALS */ 28 | 29 | #ifdef JPEG_CJPEG_DJPEG 30 | 31 | #define BMP_SUPPORTED /* BMP image file format */ 32 | #define GIF_SUPPORTED /* GIF image file format */ 33 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 34 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 35 | #define TARGA_SUPPORTED /* Targa image file format */ 36 | 37 | #undef TWO_FILE_COMMANDLINE 38 | #undef NEED_SIGNAL_CATCHER 39 | #undef DONT_USE_B_MODE 40 | 41 | /* Define this if you want percent-done progress reports from cjpeg/djpeg. */ 42 | #undef PROGRESS_REPORT 43 | 44 | #endif /* JPEG_CJPEG_DJPEG */ 45 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.dj: -------------------------------------------------------------------------------- 1 | /* jconfig.dj --- jconfig.h for DJGPP (Delorie's GNU C port) on MS-DOS. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS /* DJGPP uses flat 32-bit addressing */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #endif /* JPEG_INTERNALS */ 23 | 24 | #ifdef JPEG_CJPEG_DJPEG 25 | 26 | #define BMP_SUPPORTED /* BMP image file format */ 27 | #define GIF_SUPPORTED /* GIF image file format */ 28 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 29 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 30 | #define TARGA_SUPPORTED /* Targa image file format */ 31 | 32 | #undef TWO_FILE_COMMANDLINE /* optional */ 33 | #define USE_SETMODE /* Needed to make one-file style work in DJGPP */ 34 | #undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ 35 | #undef DONT_USE_B_MODE 36 | #undef PROGRESS_REPORT /* optional */ 37 | 38 | #endif /* JPEG_CJPEG_DJPEG */ 39 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/resurrecting-open-source-projects/outguess/24810e14327c2bbeedeaadd3e24491f2a4425c02/src/jpeg-6b-steg/jconfig.doc -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.mac: -------------------------------------------------------------------------------- 1 | /* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #define USE_MAC_MEMMGR /* Define this if you use jmemmac.c */ 23 | 24 | #define ALIGN_TYPE long /* Needed for 680x0 Macs */ 25 | 26 | #endif /* JPEG_INTERNALS */ 27 | 28 | #ifdef JPEG_CJPEG_DJPEG 29 | 30 | #define BMP_SUPPORTED /* BMP image file format */ 31 | #define GIF_SUPPORTED /* GIF image file format */ 32 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 33 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 34 | #define TARGA_SUPPORTED /* Targa image file format */ 35 | 36 | #define USE_CCOMMAND /* Command line reader for Macintosh */ 37 | #define TWO_FILE_COMMANDLINE /* Binary I/O thru stdin/stdout doesn't work */ 38 | 39 | #undef NEED_SIGNAL_CATCHER 40 | #undef DONT_USE_B_MODE 41 | #undef PROGRESS_REPORT /* optional */ 42 | 43 | #endif /* JPEG_CJPEG_DJPEG */ 44 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.manx: -------------------------------------------------------------------------------- 1 | /* jconfig.manx --- jconfig.h for Amiga systems using Manx Aztec C ver 5.x. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ 23 | 24 | #define SHORTxSHORT_32 /* produces better DCT code with Aztec C */ 25 | 26 | #endif /* JPEG_INTERNALS */ 27 | 28 | #ifdef JPEG_CJPEG_DJPEG 29 | 30 | #define BMP_SUPPORTED /* BMP image file format */ 31 | #define GIF_SUPPORTED /* GIF image file format */ 32 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 33 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 34 | #define TARGA_SUPPORTED /* Targa image file format */ 35 | 36 | #define TWO_FILE_COMMANDLINE 37 | #define NEED_SIGNAL_CATCHER 38 | #undef DONT_USE_B_MODE 39 | #undef PROGRESS_REPORT /* optional */ 40 | 41 | #define signal_catcher _abort /* hack for Aztec C naming requirements */ 42 | 43 | #endif /* JPEG_CJPEG_DJPEG */ 44 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.mc6: -------------------------------------------------------------------------------- 1 | /* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #define NEED_FAR_POINTERS /* for small or medium memory model */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ 23 | 24 | #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ 25 | 26 | #define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */ 27 | 28 | #define NEED_FHEAPMIN /* far heap management routines are broken */ 29 | 30 | #define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */ 31 | /* Note: the above define is known to improve the code with Microsoft C 6.00A. 32 | * I do not know whether it is good for later compiler versions. 33 | * Please report any info on this point to jpeg-info@uunet.uu.net. 34 | */ 35 | 36 | #endif /* JPEG_INTERNALS */ 37 | 38 | #ifdef JPEG_CJPEG_DJPEG 39 | 40 | #define BMP_SUPPORTED /* BMP image file format */ 41 | #define GIF_SUPPORTED /* GIF image file format */ 42 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 43 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 44 | #define TARGA_SUPPORTED /* Targa image file format */ 45 | 46 | #define TWO_FILE_COMMANDLINE 47 | #define USE_SETMODE /* Microsoft has setmode() */ 48 | #define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ 49 | #undef DONT_USE_B_MODE 50 | #undef PROGRESS_REPORT /* optional */ 51 | 52 | #endif /* JPEG_CJPEG_DJPEG */ 53 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.sas: -------------------------------------------------------------------------------- 1 | /* jconfig.sas --- jconfig.h for Amiga systems using SAS C 6.0 and up. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #define TEMP_DIRECTORY "JPEGTMP:" /* recommended setting for Amiga */ 23 | 24 | #define NO_MKTEMP /* SAS C doesn't have mktemp() */ 25 | 26 | #define SHORTxSHORT_32 /* produces better DCT code with SAS C */ 27 | 28 | #endif /* JPEG_INTERNALS */ 29 | 30 | #ifdef JPEG_CJPEG_DJPEG 31 | 32 | #define BMP_SUPPORTED /* BMP image file format */ 33 | #define GIF_SUPPORTED /* GIF image file format */ 34 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 35 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 36 | #define TARGA_SUPPORTED /* Targa image file format */ 37 | 38 | #define TWO_FILE_COMMANDLINE 39 | #define NEED_SIGNAL_CATCHER 40 | #undef DONT_USE_B_MODE 41 | #undef PROGRESS_REPORT /* optional */ 42 | 43 | #endif /* JPEG_CJPEG_DJPEG */ 44 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.st: -------------------------------------------------------------------------------- 1 | /* jconfig.st --- jconfig.h for Atari ST/STE/TT using Pure C or Turbo C. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #define INCOMPLETE_TYPES_BROKEN /* suppress undefined-structure warnings */ 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #define ALIGN_TYPE long /* apparently double is a weird size? */ 23 | 24 | #endif /* JPEG_INTERNALS */ 25 | 26 | #ifdef JPEG_CJPEG_DJPEG 27 | 28 | #define BMP_SUPPORTED /* BMP image file format */ 29 | #define GIF_SUPPORTED /* GIF image file format */ 30 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 31 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 32 | #define TARGA_SUPPORTED /* Targa image file format */ 33 | 34 | #define TWO_FILE_COMMANDLINE /* optional -- undef if you like Unix style */ 35 | /* Note: if you undef TWO_FILE_COMMANDLINE, you may need to define 36 | * USE_SETMODE. Some Atari compilers require it, some do not. 37 | */ 38 | #define NEED_SIGNAL_CATCHER /* needed if you use jmemname.c */ 39 | #undef DONT_USE_B_MODE 40 | #undef PROGRESS_REPORT /* optional */ 41 | 42 | #endif /* JPEG_CJPEG_DJPEG */ 43 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.vc: -------------------------------------------------------------------------------- 1 | /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 19 | #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ 20 | typedef unsigned char boolean; 21 | #endif 22 | #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 23 | 24 | 25 | #ifdef JPEG_INTERNALS 26 | 27 | #undef RIGHT_SHIFT_IS_UNSIGNED 28 | 29 | #endif /* JPEG_INTERNALS */ 30 | 31 | #ifdef JPEG_CJPEG_DJPEG 32 | 33 | #define BMP_SUPPORTED /* BMP image file format */ 34 | #define GIF_SUPPORTED /* GIF image file format */ 35 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 36 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 37 | #define TARGA_SUPPORTED /* Targa image file format */ 38 | 39 | #define TWO_FILE_COMMANDLINE /* optional */ 40 | #define USE_SETMODE /* Microsoft has setmode() */ 41 | #undef NEED_SIGNAL_CATCHER 42 | #undef DONT_USE_B_MODE 43 | #undef PROGRESS_REPORT /* optional */ 44 | 45 | #endif /* JPEG_CJPEG_DJPEG */ 46 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.vms: -------------------------------------------------------------------------------- 1 | /* jconfig.vms --- jconfig.h for use on Digital VMS. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #endif /* JPEG_INTERNALS */ 23 | 24 | #ifdef JPEG_CJPEG_DJPEG 25 | 26 | #define BMP_SUPPORTED /* BMP image file format */ 27 | #define GIF_SUPPORTED /* GIF image file format */ 28 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 29 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 30 | #define TARGA_SUPPORTED /* Targa image file format */ 31 | 32 | #define TWO_FILE_COMMANDLINE /* Needed on VMS */ 33 | #undef NEED_SIGNAL_CATCHER 34 | #undef DONT_USE_B_MODE 35 | #undef PROGRESS_REPORT /* optional */ 36 | 37 | #endif /* JPEG_CJPEG_DJPEG */ 38 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jconfig.wat: -------------------------------------------------------------------------------- 1 | /* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #define CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS /* Watcom uses flat 32-bit addressing */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #endif /* JPEG_INTERNALS */ 23 | 24 | #ifdef JPEG_CJPEG_DJPEG 25 | 26 | #define BMP_SUPPORTED /* BMP image file format */ 27 | #define GIF_SUPPORTED /* GIF image file format */ 28 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 29 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 30 | #define TARGA_SUPPORTED /* Targa image file format */ 31 | 32 | #undef TWO_FILE_COMMANDLINE /* optional */ 33 | #define USE_SETMODE /* Needed to make one-file style work in Watcom */ 34 | #undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */ 35 | #undef DONT_USE_B_MODE 36 | #undef PROGRESS_REPORT /* optional */ 37 | 38 | #endif /* JPEG_CJPEG_DJPEG */ 39 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jdatadst.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jdatadst.c 3 | * 4 | * Copyright (C) 1994-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains compression data destination routines for the case of 9 | * emitting JPEG data to a file (or any stdio stream). While these routines 10 | * are sufficient for most applications, some will want to use a different 11 | * destination manager. 12 | * IMPORTANT: we assume that fwrite() will correctly transcribe an array of 13 | * JOCTETs into 8-bit-wide elements on external storage. If char is wider 14 | * than 8 bits on your machine, you may need to do some tweaking. 15 | */ 16 | 17 | /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ 18 | #include "jinclude.h" 19 | #include "jpeglib.h" 20 | #include "jerror.h" 21 | 22 | 23 | /* Expanded data destination object for stdio output */ 24 | 25 | typedef struct { 26 | struct jpeg_destination_mgr pub; /* public fields */ 27 | 28 | FILE * outfile; /* target stream */ 29 | JOCTET * buffer; /* start of buffer */ 30 | } my_destination_mgr; 31 | 32 | typedef my_destination_mgr * my_dest_ptr; 33 | 34 | #define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ 35 | 36 | 37 | /* 38 | * Initialize destination --- called by jpeg_start_compress 39 | * before any data is actually written. 40 | */ 41 | 42 | METHODDEF(void) 43 | init_destination (j_compress_ptr cinfo) 44 | { 45 | my_dest_ptr dest = (my_dest_ptr) cinfo->dest; 46 | 47 | /* Allocate the output buffer --- it will be released when done with image */ 48 | dest->buffer = (JOCTET *) 49 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 50 | OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); 51 | 52 | dest->pub.next_output_byte = dest->buffer; 53 | dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; 54 | } 55 | 56 | 57 | /* 58 | * Empty the output buffer --- called whenever buffer fills up. 59 | * 60 | * In typical applications, this should write the entire output buffer 61 | * (ignoring the current state of next_output_byte & free_in_buffer), 62 | * reset the pointer & count to the start of the buffer, and return TRUE 63 | * indicating that the buffer has been dumped. 64 | * 65 | * In applications that need to be able to suspend compression due to output 66 | * overrun, a FALSE return indicates that the buffer cannot be emptied now. 67 | * In this situation, the compressor will return to its caller (possibly with 68 | * an indication that it has not accepted all the supplied scanlines). The 69 | * application should resume compression after it has made more room in the 70 | * output buffer. Note that there are substantial restrictions on the use of 71 | * suspension --- see the documentation. 72 | * 73 | * When suspending, the compressor will back up to a convenient restart point 74 | * (typically the start of the current MCU). next_output_byte & free_in_buffer 75 | * indicate where the restart point will be if the current call returns FALSE. 76 | * Data beyond this point will be regenerated after resumption, so do not 77 | * write it out when emptying the buffer externally. 78 | */ 79 | 80 | METHODDEF(boolean) 81 | empty_output_buffer (j_compress_ptr cinfo) 82 | { 83 | my_dest_ptr dest = (my_dest_ptr) cinfo->dest; 84 | 85 | if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != 86 | (size_t) OUTPUT_BUF_SIZE) 87 | ERREXIT(cinfo, JERR_FILE_WRITE); 88 | 89 | dest->pub.next_output_byte = dest->buffer; 90 | dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; 91 | 92 | return TRUE; 93 | } 94 | 95 | 96 | /* 97 | * Terminate destination --- called by jpeg_finish_compress 98 | * after all data has been written. Usually needs to flush buffer. 99 | * 100 | * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding 101 | * application must deal with any cleanup that should happen even 102 | * for error exit. 103 | */ 104 | 105 | METHODDEF(void) 106 | term_destination (j_compress_ptr cinfo) 107 | { 108 | my_dest_ptr dest = (my_dest_ptr) cinfo->dest; 109 | size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; 110 | 111 | /* Write any data remaining in the buffer */ 112 | if (datacount > 0) { 113 | if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount) 114 | ERREXIT(cinfo, JERR_FILE_WRITE); 115 | } 116 | fflush(dest->outfile); 117 | /* Make sure we wrote the output file OK */ 118 | if (ferror(dest->outfile)) 119 | ERREXIT(cinfo, JERR_FILE_WRITE); 120 | } 121 | 122 | 123 | /* 124 | * Prepare for output to a stdio stream. 125 | * The caller must have already opened the stream, and is responsible 126 | * for closing it after finishing compression. 127 | */ 128 | 129 | GLOBAL(void) 130 | jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) 131 | { 132 | my_dest_ptr dest; 133 | 134 | /* The destination object is made permanent so that multiple JPEG images 135 | * can be written to the same file without re-executing jpeg_stdio_dest. 136 | * This makes it dangerous to use this manager and a different destination 137 | * manager serially with the same JPEG object, because their private object 138 | * sizes may be different. Caveat programmer. 139 | */ 140 | if (cinfo->dest == NULL) { /* first time for this JPEG object? */ 141 | cinfo->dest = (struct jpeg_destination_mgr *) 142 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 143 | SIZEOF(my_destination_mgr)); 144 | } 145 | 146 | dest = (my_dest_ptr) cinfo->dest; 147 | dest->pub.init_destination = init_destination; 148 | dest->pub.empty_output_buffer = empty_output_buffer; 149 | dest->pub.term_destination = term_destination; 150 | dest->outfile = outfile; 151 | } 152 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jdct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jdct.h 3 | * 4 | * Copyright (C) 1994-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This include file contains common declarations for the forward and 9 | * inverse DCT modules. These declarations are private to the DCT managers 10 | * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. 11 | * The individual DCT algorithms are kept in separate files to ease 12 | * machine-dependent tuning (e.g., assembly coding). 13 | */ 14 | 15 | 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). 22 | * The DCT outputs are returned scaled up by a factor of 8; they therefore 23 | * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This 24 | * convention improves accuracy in integer implementations and saves some 25 | * work in floating-point ones. 26 | * Quantization of the output coefficients is done by jcdctmgr.c. 27 | */ 28 | 29 | #if BITS_IN_JSAMPLE == 8 30 | typedef int DCTELEM; /* 16 or 32 bits is fine */ 31 | #else 32 | typedef INT32 DCTELEM; /* must have 32 bits */ 33 | #endif 34 | 35 | typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); 36 | typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); 37 | 38 | 39 | /* 40 | * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer 41 | * to an output sample array. The routine must dequantize the input data as 42 | * well as perform the IDCT; for dequantization, it uses the multiplier table 43 | * pointed to by compptr->dct_table. The output data is to be placed into the 44 | * sample array starting at a specified column. (Any row offset needed will 45 | * be applied to the array pointer before it is passed to the IDCT code.) 46 | * Note that the number of samples emitted by the IDCT routine is 47 | * DCT_scaled_size * DCT_scaled_size. 48 | */ 49 | 50 | /* typedef inverse_DCT_method_ptr is declared in jpegint.h */ 51 | 52 | /* 53 | * Each IDCT routine has its own ideas about the best dct_table element type. 54 | */ 55 | 56 | typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ 57 | #if BITS_IN_JSAMPLE == 8 58 | typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ 59 | #define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ 60 | #else 61 | typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ 62 | #define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ 63 | #endif 64 | typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ 65 | 66 | 67 | /* 68 | * Each IDCT routine is responsible for range-limiting its results and 69 | * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could 70 | * be quite far out of range if the input data is corrupt, so a bulletproof 71 | * range-limiting step is required. We use a mask-and-table-lookup method 72 | * to do the combined operations quickly. See the comments with 73 | * prepare_range_limit_table (in jdmaster.c) for more info. 74 | */ 75 | 76 | #define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) 77 | 78 | #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ 79 | 80 | 81 | /* Short forms of external names for systems with brain-damaged linkers. */ 82 | 83 | #ifdef NEED_SHORT_EXTERNAL_NAMES 84 | #define jpeg_fdct_islow jFDislow 85 | #define jpeg_fdct_ifast jFDifast 86 | #define jpeg_fdct_float jFDfloat 87 | #define jpeg_idct_islow jRDislow 88 | #define jpeg_idct_ifast jRDifast 89 | #define jpeg_idct_float jRDfloat 90 | #define jpeg_idct_4x4 jRD4x4 91 | #define jpeg_idct_2x2 jRD2x2 92 | #define jpeg_idct_1x1 jRD1x1 93 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 94 | 95 | /* Extern declarations for the forward and inverse DCT routines. */ 96 | 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)); 100 | 101 | EXTERN(void) jpeg_idct_islow 102 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 103 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 104 | EXTERN(void) jpeg_idct_ifast 105 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 106 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 107 | EXTERN(void) jpeg_idct_float 108 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 109 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 110 | EXTERN(void) jpeg_idct_4x4 111 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 112 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 113 | EXTERN(void) jpeg_idct_2x2 114 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 115 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 116 | EXTERN(void) jpeg_idct_1x1 117 | JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, 118 | JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); 119 | 120 | 121 | /* 122 | * Macros for handling fixed-point arithmetic; these are used by many 123 | * but not all of the DCT/IDCT modules. 124 | * 125 | * All values are expected to be of type INT32. 126 | * Fractional constants are scaled left by CONST_BITS bits. 127 | * CONST_BITS is defined within each module using these macros, 128 | * and may differ from one module to the next. 129 | */ 130 | 131 | #define ONE ((INT32) 1) 132 | #define CONST_SCALE (ONE << CONST_BITS) 133 | 134 | /* Convert a positive real constant to an integer scaled by CONST_SCALE. 135 | * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, 136 | * thus causing a lot of useless floating-point operations at run time. 137 | */ 138 | 139 | #define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) 140 | 141 | /* Descale and correctly round an INT32 value that's scaled by N bits. 142 | * We assume RIGHT_SHIFT rounds towards minus infinity, so adding 143 | * the fudge factor is correct for either sign of X. 144 | */ 145 | 146 | #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) 147 | 148 | /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. 149 | * This macro is used only when the two inputs will actually be no more than 150 | * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a 151 | * full 32x32 multiply. This provides a useful speedup on many machines. 152 | * Unfortunately there is no way to specify a 16x16->32 multiply portably 153 | * in C, but some C compilers will do the right thing if you provide the 154 | * correct combination of casts. 155 | */ 156 | 157 | #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ 158 | #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) 159 | #endif 160 | #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ 161 | #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const))) 162 | #endif 163 | 164 | #ifndef MULTIPLY16C16 /* default definition */ 165 | #define MULTIPLY16C16(var,const) ((var) * (const)) 166 | #endif 167 | 168 | /* Same except both inputs are variables. */ 169 | 170 | #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ 171 | #define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) 172 | #endif 173 | 174 | #ifndef MULTIPLY16V16 /* default definition */ 175 | #define MULTIPLY16V16(var1,var2) ((var1) * (var2)) 176 | #endif 177 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jdtrans.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jdtrans.c 3 | * 4 | * Copyright (C) 1995-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains library routines for transcoding decompression, 9 | * that is, reading raw DCT coefficient arrays from an input JPEG file. 10 | * The routines in jdapimin.c will also be needed by a transcoder. 11 | */ 12 | 13 | #define JPEG_INTERNALS 14 | #include "jinclude.h" 15 | #include "jpeglib.h" 16 | 17 | 18 | /* Forward declarations */ 19 | LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); 20 | 21 | 22 | /* 23 | * Read the coefficient arrays from a JPEG file. 24 | * jpeg_read_header must be completed before calling this. 25 | * 26 | * The entire image is read into a set of virtual coefficient-block arrays, 27 | * one per component. The return value is a pointer to the array of 28 | * virtual-array descriptors. These can be manipulated directly via the 29 | * JPEG memory manager, or handed off to jpeg_write_coefficients(). 30 | * To release the memory occupied by the virtual arrays, call 31 | * jpeg_finish_decompress() when done with the data. 32 | * 33 | * An alternative usage is to simply obtain access to the coefficient arrays 34 | * during a buffered-image-mode decompression operation. This is allowed 35 | * after any jpeg_finish_output() call. The arrays can be accessed until 36 | * jpeg_finish_decompress() is called. (Note that any call to the library 37 | * may reposition the arrays, so don't rely on access_virt_barray() results 38 | * to stay valid across library calls.) 39 | * 40 | * Returns NULL if suspended. This case need be checked only if 41 | * a suspending data source is used. 42 | */ 43 | 44 | GLOBAL(jvirt_barray_ptr *) 45 | jpeg_read_coefficients (j_decompress_ptr cinfo) 46 | { 47 | if (cinfo->global_state == DSTATE_READY) { 48 | /* First call: initialize active modules */ 49 | transdecode_master_selection(cinfo); 50 | cinfo->global_state = DSTATE_RDCOEFS; 51 | } 52 | if (cinfo->global_state == DSTATE_RDCOEFS) { 53 | /* Absorb whole file into the coef buffer */ 54 | for (;;) { 55 | int retcode; 56 | /* Call progress monitor hook if present */ 57 | if (cinfo->progress != NULL) 58 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 59 | /* Absorb some more input */ 60 | retcode = (*cinfo->inputctl->consume_input) (cinfo); 61 | if (retcode == JPEG_SUSPENDED) 62 | return NULL; 63 | if (retcode == JPEG_REACHED_EOI) 64 | break; 65 | /* Advance progress counter if appropriate */ 66 | if (cinfo->progress != NULL && 67 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { 68 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { 69 | /* startup underestimated number of scans; ratchet up one scan */ 70 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; 71 | } 72 | } 73 | } 74 | /* Set state so that jpeg_finish_decompress does the right thing */ 75 | cinfo->global_state = DSTATE_STOPPING; 76 | } 77 | /* At this point we should be in state DSTATE_STOPPING if being used 78 | * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access 79 | * to the coefficients during a full buffered-image-mode decompression. 80 | */ 81 | if ((cinfo->global_state == DSTATE_STOPPING || 82 | cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { 83 | return cinfo->coef->coef_arrays; 84 | } 85 | /* Oops, improper usage */ 86 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 87 | return NULL; /* keep compiler happy */ 88 | } 89 | 90 | 91 | /* 92 | * Master selection of decompression modules for transcoding. 93 | * This substitutes for jdmaster.c's initialization of the full decompressor. 94 | */ 95 | 96 | LOCAL(void) 97 | transdecode_master_selection (j_decompress_ptr cinfo) 98 | { 99 | /* This is effectively a buffered-image operation. */ 100 | cinfo->buffered_image = TRUE; 101 | 102 | /* 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); 114 | } 115 | 116 | /* Always get a full-image coefficient buffer. */ 117 | jinit_d_coef_controller(cinfo, TRUE); 118 | 119 | /* We can now tell the memory manager to allocate virtual arrays. */ 120 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 121 | 122 | /* Initialize input side of decompressor to consume first scan. */ 123 | (*cinfo->inputctl->start_input_pass) (cinfo); 124 | 125 | /* Initialize progress monitoring. */ 126 | if (cinfo->progress != NULL) { 127 | int nscans; 128 | /* Estimate number of scans to set pass_limit. */ 129 | if (cinfo->progressive_mode) { 130 | /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ 131 | nscans = 2 + 3 * cinfo->num_components; 132 | } else if (cinfo->inputctl->has_multiple_scans) { 133 | /* For a nonprogressive multiscan file, estimate 1 scan per component. */ 134 | nscans = cinfo->num_components; 135 | } else { 136 | nscans = 1; 137 | } 138 | cinfo->progress->pass_counter = 0L; 139 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; 140 | cinfo->progress->completed_passes = 0; 141 | cinfo->progress->total_passes = 1; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jfdctflt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jfdctflt.c 3 | * 4 | * Copyright (C) 1994-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains a floating-point implementation of the 9 | * forward DCT (Discrete Cosine Transform). 10 | * 11 | * This implementation should be more accurate than either of the integer 12 | * DCT implementations. However, it may not give the same results on all 13 | * machines because of differences in roundoff behavior. Speed will depend 14 | * on the hardware's floating point capacity. 15 | * 16 | * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT 17 | * on each column. Direct algorithms are also available, but they are 18 | * much more complex and seem not to be any faster when reduced to code. 19 | * 20 | * This implementation is based on Arai, Agui, and Nakajima's algorithm for 21 | * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in 22 | * Japanese, but the algorithm is described in the Pennebaker & Mitchell 23 | * JPEG textbook (see REFERENCES section in file README). The following code 24 | * is based directly on figure 4-8 in P&M. 25 | * While an 8-point DCT cannot be done in less than 11 multiplies, it is 26 | * possible to arrange the computation so that many of the multiplies are 27 | * simple scalings of the final outputs. These multiplies can then be 28 | * folded into the multiplications or divisions by the JPEG quantization 29 | * table entries. The AA&N method leaves only 5 multiplies and 29 adds 30 | * to be done in the DCT itself. 31 | * The primary disadvantage of this method is that with a fixed-point 32 | * implementation, accuracy is lost due to imprecise representation of the 33 | * scaled quantization values. However, that problem does not arise if 34 | * we use floating point arithmetic. 35 | */ 36 | 37 | #define JPEG_INTERNALS 38 | #include "jinclude.h" 39 | #include "jpeglib.h" 40 | #include "jdct.h" /* Private declarations for DCT subsystem */ 41 | 42 | #ifdef DCT_FLOAT_SUPPORTED 43 | 44 | 45 | /* 46 | * This module is specialized to the case DCTSIZE = 8. 47 | */ 48 | 49 | #if DCTSIZE != 8 50 | Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ 51 | #endif 52 | 53 | 54 | /* 55 | * Perform the forward DCT on one block of samples. 56 | */ 57 | 58 | GLOBAL(void) 59 | jpeg_fdct_float (FAST_FLOAT * data) 60 | { 61 | FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; 62 | FAST_FLOAT tmp10, tmp11, tmp12, tmp13; 63 | FAST_FLOAT z1, z2, z3, z4, z5, z11, z13; 64 | FAST_FLOAT *dataptr; 65 | int ctr; 66 | 67 | /* Pass 1: process rows. */ 68 | 69 | 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 | 80 | /* Even part */ 81 | 82 | tmp10 = tmp0 + tmp3; /* phase 2 */ 83 | tmp13 = tmp0 - tmp3; 84 | tmp11 = tmp1 + tmp2; 85 | tmp12 = tmp1 - tmp2; 86 | 87 | dataptr[0] = tmp10 + tmp11; /* phase 3 */ 88 | dataptr[4] = tmp10 - tmp11; 89 | 90 | z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ 91 | dataptr[2] = tmp13 + z1; /* phase 5 */ 92 | dataptr[6] = tmp13 - z1; 93 | 94 | /* Odd part */ 95 | 96 | tmp10 = tmp4 + tmp5; /* phase 2 */ 97 | tmp11 = tmp5 + tmp6; 98 | tmp12 = tmp6 + tmp7; 99 | 100 | /* The rotator is modified from fig 4-8 to avoid extra negations. */ 101 | z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ 102 | z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ 103 | z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ 104 | z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ 105 | 106 | z11 = tmp7 + z3; /* phase 5 */ 107 | z13 = tmp7 - z3; 108 | 109 | dataptr[5] = z13 + z2; /* phase 6 */ 110 | dataptr[3] = z13 - z2; 111 | dataptr[1] = z11 + z4; 112 | dataptr[7] = z11 - z4; 113 | 114 | dataptr += DCTSIZE; /* advance pointer to next row */ 115 | } 116 | 117 | /* Pass 2: process columns. */ 118 | 119 | dataptr = data; 120 | for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { 121 | tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; 122 | tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; 123 | tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; 124 | tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; 125 | tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; 126 | tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; 127 | tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; 128 | tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; 129 | 130 | /* Even part */ 131 | 132 | tmp10 = tmp0 + tmp3; /* phase 2 */ 133 | tmp13 = tmp0 - tmp3; 134 | tmp11 = tmp1 + tmp2; 135 | tmp12 = tmp1 - tmp2; 136 | 137 | dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ 138 | dataptr[DCTSIZE*4] = tmp10 - tmp11; 139 | 140 | z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ 141 | dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ 142 | dataptr[DCTSIZE*6] = tmp13 - z1; 143 | 144 | /* Odd part */ 145 | 146 | tmp10 = tmp4 + tmp5; /* phase 2 */ 147 | tmp11 = tmp5 + tmp6; 148 | tmp12 = tmp6 + tmp7; 149 | 150 | /* The rotator is modified from fig 4-8 to avoid extra negations. */ 151 | z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ 152 | z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ 153 | z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ 154 | z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ 155 | 156 | z11 = tmp7 + z3; /* phase 5 */ 157 | z13 = tmp7 - z3; 158 | 159 | dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ 160 | dataptr[DCTSIZE*3] = z13 - z2; 161 | dataptr[DCTSIZE*1] = z11 + z4; 162 | dataptr[DCTSIZE*7] = z11 - z4; 163 | 164 | dataptr++; /* advance pointer to next column */ 165 | } 166 | } 167 | 168 | #endif /* DCT_FLOAT_SUPPORTED */ 169 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jinclude.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jinclude.h 3 | * 4 | * Copyright (C) 1991-1994, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file exists to provide a single place to fix any problems with 9 | * including the wrong system include files. (Common problems are taken 10 | * care of by the standard jconfig symbols, but on really weird systems 11 | * you may have to edit this file.) 12 | * 13 | * NOTE: this file is NOT intended to be included by applications using the 14 | * JPEG library. Most applications need only include jpeglib.h. 15 | */ 16 | 17 | 18 | /* Include auto-config file to find out which system include files we need. */ 19 | 20 | #include "jconfig.h" /* auto configuration options */ 21 | #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ 22 | 23 | /* 24 | * We need the NULL macro and size_t typedef. 25 | * On an ANSI-conforming system it is sufficient to include . 26 | * Otherwise, we get them from or ; we may have to 27 | * pull in as well. 28 | * Note that the core JPEG library does not require ; 29 | * only the default error handler and data source/destination modules do. 30 | * But we must pull it in because of the references to FILE in jpeglib.h. 31 | * You can remove those references if you want to compile without . 32 | */ 33 | 34 | #ifdef HAVE_STDDEF_H 35 | #include 36 | #endif 37 | 38 | #ifdef HAVE_STDLIB_H 39 | #include 40 | #endif 41 | 42 | #ifdef NEED_SYS_TYPES_H 43 | #include 44 | #endif 45 | 46 | #include 47 | 48 | /* 49 | * We need memory copying and zeroing functions, plus strncpy(). 50 | * ANSI and System V implementations declare these in . 51 | * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). 52 | * Some systems may declare memset and memcpy in . 53 | * 54 | * NOTE: we assume the size parameters to these functions are of type size_t. 55 | * Change the casts in these macros if not! 56 | */ 57 | 58 | #ifdef NEED_BSD_STRINGS 59 | 60 | #include 61 | #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) 62 | #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) 63 | 64 | #else /* not BSD, assume ANSI/SysV string lib */ 65 | 66 | #include 67 | #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) 68 | #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) 69 | 70 | #endif 71 | 72 | /* 73 | * In ANSI C, and indeed any rational implementation, size_t is also the 74 | * type returned by sizeof(). However, it seems there are some irrational 75 | * implementations out there, in which sizeof() returns an int even though 76 | * size_t is defined as long or unsigned long. To ensure consistent results 77 | * we always use this SIZEOF() macro in place of using sizeof() directly. 78 | */ 79 | 80 | #define SIZEOF(object) ((size_t) sizeof(object)) 81 | 82 | /* 83 | * The modules that use fread() and fwrite() always invoke them through 84 | * these macros. On some systems you may need to twiddle the argument casts. 85 | * CAUTION: argument order is different from underlying functions! 86 | */ 87 | 88 | #define JFREAD(file,buf,sizeofbuf) \ 89 | ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 90 | #define JFWRITE(file,buf,sizeofbuf) \ 91 | ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 92 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jmemansi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jmemansi.c 3 | * 4 | * Copyright (C) 1992-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file provides a simple generic implementation of the system- 9 | * dependent portion of the JPEG memory manager. This implementation 10 | * assumes that you have the ANSI-standard library routine tmpfile(). 11 | * Also, the problem of determining the amount of memory available 12 | * is shoved onto the user. 13 | */ 14 | 15 | #define JPEG_INTERNALS 16 | #include "jinclude.h" 17 | #include "jpeglib.h" 18 | #include "jmemsys.h" /* import the system-dependent declarations */ 19 | 20 | #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ 21 | extern void * malloc JPP((size_t size)); 22 | extern void free JPP((void *ptr)); 23 | #endif 24 | 25 | #ifndef SEEK_SET /* pre-ANSI systems may not define this; */ 26 | #define SEEK_SET 0 /* if not, assume 0 is correct */ 27 | #endif 28 | 29 | 30 | /* 31 | * Memory allocation and freeing are controlled by the regular library 32 | * routines malloc() and free(). 33 | */ 34 | 35 | GLOBAL(void *) 36 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) 37 | { 38 | return (void *) malloc(sizeofobject); 39 | } 40 | 41 | GLOBAL(void) 42 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) 43 | { 44 | free(object); 45 | } 46 | 47 | 48 | /* 49 | * "Large" objects are treated the same as "small" ones. 50 | * NB: although we include FAR keywords in the routine declarations, 51 | * this file won't actually work in 80x86 small/medium model; at least, 52 | * you probably won't be able to process useful-size images in only 64KB. 53 | */ 54 | 55 | GLOBAL(void FAR *) 56 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) 57 | { 58 | return (void FAR *) malloc(sizeofobject); 59 | } 60 | 61 | GLOBAL(void) 62 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) 63 | { 64 | free(object); 65 | } 66 | 67 | 68 | /* 69 | * This routine computes the total memory space available for allocation. 70 | * It's impossible to do this in a portable way; our current solution is 71 | * to make the user tell us (with a default value set at compile time). 72 | * If you can actually get the available space, it's a good idea to subtract 73 | * a slop factor of 5% or so. 74 | */ 75 | 76 | #ifndef DEFAULT_MAX_MEM /* so can override from makefile */ 77 | #define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */ 78 | #endif 79 | 80 | GLOBAL(long) 81 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, 82 | long max_bytes_needed, long already_allocated) 83 | { 84 | return cinfo->mem->max_memory_to_use - already_allocated; 85 | } 86 | 87 | 88 | /* 89 | * Backing store (temporary file) management. 90 | * Backing store objects are only used when the value returned by 91 | * jpeg_mem_available is less than the total space needed. You can dispense 92 | * with these routines if you have plenty of virtual memory; see jmemnobs.c. 93 | */ 94 | 95 | 96 | METHODDEF(void) 97 | read_backing_store (j_common_ptr cinfo, backing_store_ptr info, 98 | void FAR * buffer_address, 99 | long file_offset, long byte_count) 100 | { 101 | if (fseek(info->temp_file, file_offset, SEEK_SET)) 102 | ERREXIT(cinfo, JERR_TFILE_SEEK); 103 | if (JFREAD(info->temp_file, buffer_address, byte_count) 104 | != (size_t) byte_count) 105 | ERREXIT(cinfo, JERR_TFILE_READ); 106 | } 107 | 108 | 109 | METHODDEF(void) 110 | write_backing_store (j_common_ptr cinfo, backing_store_ptr info, 111 | void FAR * buffer_address, 112 | long file_offset, long byte_count) 113 | { 114 | if (fseek(info->temp_file, file_offset, SEEK_SET)) 115 | ERREXIT(cinfo, JERR_TFILE_SEEK); 116 | if (JFWRITE(info->temp_file, buffer_address, byte_count) 117 | != (size_t) byte_count) 118 | ERREXIT(cinfo, JERR_TFILE_WRITE); 119 | } 120 | 121 | 122 | METHODDEF(void) 123 | close_backing_store (j_common_ptr cinfo, backing_store_ptr info) 124 | { 125 | fclose(info->temp_file); 126 | /* Since this implementation uses tmpfile() to create the file, 127 | * no explicit file deletion is needed. 128 | */ 129 | } 130 | 131 | 132 | /* 133 | * Initial opening of a backing-store object. 134 | * 135 | * This version uses tmpfile(), which constructs a suitable file name 136 | * behind the scenes. We don't have to use info->temp_name[] at all; 137 | * indeed, we can't even find out the actual name of the temp file. 138 | */ 139 | 140 | GLOBAL(void) 141 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, 142 | long total_bytes_needed) 143 | { 144 | if ((info->temp_file = tmpfile()) == NULL) 145 | ERREXITS(cinfo, JERR_TFILE_CREATE, ""); 146 | info->read_backing_store = read_backing_store; 147 | info->write_backing_store = write_backing_store; 148 | info->close_backing_store = close_backing_store; 149 | } 150 | 151 | 152 | /* 153 | * These routines take care of any system-dependent initialization and 154 | * cleanup required. 155 | */ 156 | 157 | GLOBAL(long) 158 | jpeg_mem_init (j_common_ptr cinfo) 159 | { 160 | return DEFAULT_MAX_MEM; /* default for max_memory_to_use */ 161 | } 162 | 163 | GLOBAL(void) 164 | jpeg_mem_term (j_common_ptr cinfo) 165 | { 166 | /* no work */ 167 | } 168 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jmemnobs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jmemnobs.c 3 | * 4 | * Copyright (C) 1992-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file provides a really simple implementation of the system- 9 | * dependent portion of the JPEG memory manager. This implementation 10 | * assumes that no backing-store files are needed: all required space 11 | * can be obtained from malloc(). 12 | * This is very portable in the sense that it'll compile on almost anything, 13 | * but you'd better have lots of main memory (or virtual memory) if you want 14 | * to process big images. 15 | * Note that the max_memory_to_use option is ignored by this implementation. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | #include "jmemsys.h" /* import the system-dependent declarations */ 22 | 23 | #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ 24 | extern void * malloc JPP((size_t size)); 25 | extern void free JPP((void *ptr)); 26 | #endif 27 | 28 | 29 | /* 30 | * Memory allocation and freeing are controlled by the regular library 31 | * routines malloc() and free(). 32 | */ 33 | 34 | GLOBAL(void *) 35 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) 36 | { 37 | return (void *) malloc(sizeofobject); 38 | } 39 | 40 | GLOBAL(void) 41 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) 42 | { 43 | free(object); 44 | } 45 | 46 | 47 | /* 48 | * "Large" objects are treated the same as "small" ones. 49 | * NB: although we include FAR keywords in the routine declarations, 50 | * this file won't actually work in 80x86 small/medium model; at least, 51 | * you probably won't be able to process useful-size images in only 64KB. 52 | */ 53 | 54 | GLOBAL(void FAR *) 55 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) 56 | { 57 | return (void FAR *) malloc(sizeofobject); 58 | } 59 | 60 | GLOBAL(void) 61 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) 62 | { 63 | free(object); 64 | } 65 | 66 | 67 | /* 68 | * This routine computes the total memory space available for allocation. 69 | * Here we always say, "we got all you want bud!" 70 | */ 71 | 72 | GLOBAL(long) 73 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, 74 | long max_bytes_needed, long already_allocated) 75 | { 76 | return max_bytes_needed; 77 | } 78 | 79 | 80 | /* 81 | * Backing store (temporary file) management. 82 | * Since jpeg_mem_available always promised the moon, 83 | * this should never be called and we can just error out. 84 | */ 85 | 86 | GLOBAL(void) 87 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, 88 | long total_bytes_needed) 89 | { 90 | ERREXIT(cinfo, JERR_NO_BACKING_STORE); 91 | } 92 | 93 | 94 | /* 95 | * These routines take care of any system-dependent initialization and 96 | * cleanup required. Here, there isn't any. 97 | */ 98 | 99 | GLOBAL(long) 100 | jpeg_mem_init (j_common_ptr cinfo) 101 | { 102 | return 0; /* just set max_memory_to_use to 0 */ 103 | } 104 | 105 | GLOBAL(void) 106 | jpeg_mem_term (j_common_ptr cinfo) 107 | { 108 | /* no work */ 109 | } 110 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jutils.c 3 | * 4 | * Copyright (C) 1991-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains tables and miscellaneous utility routines needed 9 | * for both compression and decompression. 10 | * Note we prefix all global names with "j" to minimize conflicts with 11 | * a surrounding application. 12 | */ 13 | 14 | #define JPEG_INTERNALS 15 | #include "jinclude.h" 16 | #include "jpeglib.h" 17 | 18 | 19 | /* 20 | * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element 21 | * of a DCT block read in natural order (left to right, top to bottom). 22 | */ 23 | 24 | #if 0 /* This table is not actually needed in v6a */ 25 | 26 | const int jpeg_zigzag_order[DCTSIZE2] = { 27 | 0, 1, 5, 6, 14, 15, 27, 28, 28 | 2, 4, 7, 13, 16, 26, 29, 42, 29 | 3, 8, 12, 17, 25, 30, 41, 43, 30 | 9, 11, 18, 24, 31, 40, 44, 53, 31 | 10, 19, 23, 32, 39, 45, 52, 54, 32 | 20, 22, 33, 38, 46, 51, 55, 60, 33 | 21, 34, 37, 47, 50, 56, 59, 61, 34 | 35, 36, 48, 49, 57, 58, 62, 63 35 | }; 36 | 37 | #endif 38 | 39 | /* 40 | * jpeg_natural_order[i] is the natural-order position of the i'th element 41 | * of zigzag order. 42 | * 43 | * When reading corrupted data, the Huffman decoders could attempt 44 | * to reference an entry beyond the end of this array (if the decoded 45 | * zero run length reaches past the end of the block). To prevent 46 | * wild stores without adding an inner-loop test, we put some extra 47 | * "63"s after the real entries. This will cause the extra coefficient 48 | * to be stored in location 63 of the block, not somewhere random. 49 | * The worst case would be a run-length of 15, which means we need 16 50 | * fake entries. 51 | */ 52 | 53 | const int jpeg_natural_order[DCTSIZE2+16] = { 54 | 0, 1, 8, 16, 9, 2, 3, 10, 55 | 17, 24, 32, 25, 18, 11, 4, 5, 56 | 12, 19, 26, 33, 40, 48, 41, 34, 57 | 27, 20, 13, 6, 7, 14, 21, 28, 58 | 35, 42, 49, 56, 57, 50, 43, 36, 59 | 29, 22, 15, 23, 30, 37, 44, 51, 60 | 58, 59, 52, 45, 38, 31, 39, 46, 61 | 53, 60, 61, 54, 47, 55, 62, 63, 62 | 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ 63 | 63, 63, 63, 63, 63, 63, 63, 63 64 | }; 65 | 66 | 67 | /* 68 | * Arithmetic utilities 69 | */ 70 | 71 | GLOBAL(long) 72 | jdiv_round_up (long a, long b) 73 | /* Compute a/b rounded up to next integer, ie, ceil(a/b) */ 74 | /* Assumes a >= 0, b > 0 */ 75 | { 76 | return (a + b - 1L) / b; 77 | } 78 | 79 | 80 | GLOBAL(long) 81 | jround_up (long a, long b) 82 | /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ 83 | /* Assumes a >= 0, b > 0 */ 84 | { 85 | a += b - 1L; 86 | return a - (a % b); 87 | } 88 | 89 | 90 | /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays 91 | * and coefficient-block arrays. This won't work on 80x86 because the arrays 92 | * are FAR and we're assuming a small-pointer memory model. However, some 93 | * DOS compilers provide far-pointer versions of memcpy() and memset() even 94 | * in the small-model libraries. These will be used if USE_FMEM is defined. 95 | * Otherwise, the routines below do it the hard way. (The performance cost 96 | * is not all that great, because these routines aren't very heavily used.) 97 | */ 98 | 99 | #ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ 100 | #define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) 101 | #define FMEMZERO(target,size) MEMZERO(target,size) 102 | #else /* 80x86 case, define if we can */ 103 | #ifdef USE_FMEM 104 | #define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) 105 | #define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) 106 | #endif 107 | #endif 108 | 109 | 110 | GLOBAL(void) 111 | jcopy_sample_rows (JSAMPARRAY input_array, int source_row, 112 | JSAMPARRAY output_array, int dest_row, 113 | int num_rows, JDIMENSION num_cols) 114 | /* Copy some rows of samples from one place to another. 115 | * num_rows rows are copied from input_array[source_row++] 116 | * to output_array[dest_row++]; these areas may overlap for duplication. 117 | * The source and destination arrays must be at least as wide as num_cols. 118 | */ 119 | { 120 | register JSAMPROW inptr, outptr; 121 | #ifdef FMEMCOPY 122 | register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); 123 | #else 124 | register JDIMENSION count; 125 | #endif 126 | register int row; 127 | 128 | input_array += source_row; 129 | output_array += dest_row; 130 | 131 | for (row = num_rows; row > 0; row--) { 132 | inptr = *input_array++; 133 | outptr = *output_array++; 134 | #ifdef FMEMCOPY 135 | FMEMCOPY(outptr, inptr, count); 136 | #else 137 | for (count = num_cols; count > 0; count--) 138 | *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ 139 | #endif 140 | } 141 | } 142 | 143 | 144 | GLOBAL(void) 145 | jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, 146 | JDIMENSION num_blocks) 147 | /* Copy a row of coefficient blocks from one place to another. */ 148 | { 149 | #ifdef FMEMCOPY 150 | FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); 151 | #else 152 | register JCOEFPTR inptr, outptr; 153 | register long count; 154 | 155 | inptr = (JCOEFPTR) input_row; 156 | outptr = (JCOEFPTR) output_row; 157 | for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) { 158 | *outptr++ = *inptr++; 159 | } 160 | #endif 161 | } 162 | 163 | 164 | GLOBAL(void) 165 | jzero_far (void FAR * target, size_t bytestozero) 166 | /* Zero out a chunk of FAR memory. */ 167 | /* This might be sample-array data, block-array data, or alloc_large data. */ 168 | { 169 | #ifdef FMEMZERO 170 | FMEMZERO(target, bytestozero); 171 | #else 172 | register char FAR * ptr = (char FAR *) target; 173 | register size_t count; 174 | 175 | for (count = bytestozero; count > 0; count--) { 176 | *ptr++ = 0; 177 | } 178 | #endif 179 | } 180 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/makcjpeg.st: -------------------------------------------------------------------------------- 1 | ; Project file for Independent JPEG Group's software 2 | ; 3 | ; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. 4 | ; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), 5 | ; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), 6 | ; and Guido Vollbeding (guivol@esc.de). 7 | ; 8 | ; To use this file, rename it to cjpeg.prj. 9 | ; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." 10 | ; Read installation instructions before trying to make the program! 11 | ; 12 | ; 13 | ; * * * Output file * * * 14 | cjpeg.ttp 15 | ; 16 | ; * * * COMPILER OPTIONS * * * 17 | .C[-P] ; absolute calls 18 | .C[-M] ; and no string merging, folks 19 | .C[-w-cln] ; no "constant is long" warnings 20 | .C[-w-par] ; no "parameter xxxx unused" 21 | .C[-w-rch] ; no "unreachable code" 22 | .C[-wsig] ; warn if significant digits may be lost 23 | = 24 | ; * * * * List of modules * * * * 25 | pcstart.o 26 | cjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h) 27 | cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 28 | rdswitch.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 29 | rdppm.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 30 | rdgif.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 31 | rdtarga.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 32 | rdbmp.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 33 | rdrle.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 34 | libjpeg.lib ; built by libjpeg.prj 35 | pcfltlib.lib ; floating point library 36 | ; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED 37 | pcstdlib.lib ; standard library 38 | pcextlib.lib ; extended library 39 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/makdjpeg.st: -------------------------------------------------------------------------------- 1 | ; Project file for Independent JPEG Group's software 2 | ; 3 | ; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. 4 | ; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), 5 | ; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), 6 | ; and Guido Vollbeding (guivol@esc.de). 7 | ; 8 | ; To use this file, rename it to djpeg.prj. 9 | ; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." 10 | ; Read installation instructions before trying to make the program! 11 | ; 12 | ; 13 | ; * * * Output file * * * 14 | djpeg.ttp 15 | ; 16 | ; * * * COMPILER OPTIONS * * * 17 | .C[-P] ; absolute calls 18 | .C[-M] ; and no string merging, folks 19 | .C[-w-cln] ; no "constant is long" warnings 20 | .C[-w-par] ; no "parameter xxxx unused" 21 | .C[-w-rch] ; no "unreachable code" 22 | .C[-wsig] ; warn if significant digits may be lost 23 | = 24 | ; * * * * List of modules * * * * 25 | pcstart.o 26 | djpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,jversion.h) 27 | cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 28 | rdcolmap.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 29 | wrppm.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 30 | wrgif.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 31 | wrtarga.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 32 | wrbmp.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 33 | wrrle.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 34 | libjpeg.lib ; built by libjpeg.prj 35 | pcfltlib.lib ; floating point library 36 | ; the float library can be omitted if you've turned off DCT_FLOAT_SUPPORTED 37 | pcstdlib.lib ; standard library 38 | pcextlib.lib ; extended library 39 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/makefile.vms: -------------------------------------------------------------------------------- 1 | $! Makefile for Independent JPEG Group's software 2 | $! 3 | $! This is a command procedure for Digital VMS systems that do not have MMS. 4 | $! It builds the JPEG software by brute force, recompiling everything whether 5 | $! or not it is necessary. It then runs the basic self-test. 6 | $! Thanks to Rick Dyson (dyson@iowasp.physics.uiowa.edu) 7 | $! and Tim Bell (tbell@netcom.com) for their help. 8 | $! 9 | $! Read installation instructions before running this!! 10 | $! 11 | $ If F$Mode () .eqs. "INTERACTIVE" 12 | $ Then 13 | $ VERIFY = F$Verify (0) 14 | $ Else 15 | $ VERIFY = F$Verify (1) 16 | $ EndIf 17 | $ On Control_Y Then GoTo End 18 | $ On Error Then GoTo End 19 | $ 20 | $ If F$GetSyi ("HW_MODEL") .gt. 1023 21 | $ Then 22 | $ OPT = "" 23 | $ Else 24 | $ OPT = ",Sys$Disk:[]makvms.opt/Option" 25 | $ EndIf 26 | $ 27 | $ DoCompile := CC /NoDebug /Optimize /NoList 28 | $! 29 | $ DoCompile jcapimin.c 30 | $ DoCompile jcapistd.c 31 | $ DoCompile jctrans.c 32 | $ DoCompile jcparam.c 33 | $ DoCompile jdatadst.c 34 | $ DoCompile jcinit.c 35 | $ DoCompile jcmaster.c 36 | $ DoCompile jcmarker.c 37 | $ DoCompile jcmainct.c 38 | $ DoCompile jcprepct.c 39 | $ DoCompile jccoefct.c 40 | $ DoCompile jccolor.c 41 | $ DoCompile jcsample.c 42 | $ DoCompile jchuff.c 43 | $ DoCompile jcphuff.c 44 | $ DoCompile jcdctmgr.c 45 | $ DoCompile jfdctfst.c 46 | $ DoCompile jfdctflt.c 47 | $ DoCompile jfdctint.c 48 | $ DoCompile jdapimin.c 49 | $ DoCompile jdapistd.c 50 | $ DoCompile jdtrans.c 51 | $ DoCompile jdatasrc.c 52 | $ DoCompile jdmaster.c 53 | $ DoCompile jdinput.c 54 | $ DoCompile jdmarker.c 55 | $ DoCompile jdhuff.c 56 | $ DoCompile jdphuff.c 57 | $ DoCompile jdmainct.c 58 | $ DoCompile jdcoefct.c 59 | $ DoCompile jdpostct.c 60 | $ DoCompile jddctmgr.c 61 | $ DoCompile jidctfst.c 62 | $ DoCompile jidctflt.c 63 | $ DoCompile jidctint.c 64 | $ DoCompile jidctred.c 65 | $ DoCompile jdsample.c 66 | $ DoCompile jdcolor.c 67 | $ DoCompile jquant1.c 68 | $ DoCompile jquant2.c 69 | $ DoCompile jdmerge.c 70 | $ DoCompile jcomapi.c 71 | $ DoCompile jutils.c 72 | $ DoCompile jerror.c 73 | $ DoCompile jmemmgr.c 74 | $ DoCompile jmemnobs.c 75 | $! 76 | $ Library /Create libjpeg.olb jcapimin.obj,jcapistd.obj,jctrans.obj, - 77 | jcparam.obj,jdatadst.obj,jcinit.obj,jcmaster.obj,jcmarker.obj, - 78 | jcmainct.obj,jcprepct.obj,jccoefct.obj,jccolor.obj,jcsample.obj, - 79 | jchuff.obj,jcphuff.obj,jcdctmgr.obj,jfdctfst.obj,jfdctflt.obj, - 80 | jfdctint.obj,jdapimin.obj,jdapistd.obj,jdtrans.obj,jdatasrc.obj, - 81 | jdmaster.obj,jdinput.obj,jdmarker.obj,jdhuff.obj,jdphuff.obj, - 82 | jdmainct.obj,jdcoefct.obj,jdpostct.obj,jddctmgr.obj,jidctfst.obj, - 83 | jidctflt.obj,jidctint.obj,jidctred.obj,jdsample.obj,jdcolor.obj, - 84 | jquant1.obj,jquant2.obj,jdmerge.obj,jcomapi.obj,jutils.obj, - 85 | jerror.obj,jmemmgr.obj,jmemnobs.obj 86 | $! 87 | $ DoCompile cjpeg.c 88 | $ DoCompile rdppm.c 89 | $ DoCompile rdgif.c 90 | $ DoCompile rdtarga.c 91 | $ DoCompile rdrle.c 92 | $ DoCompile rdbmp.c 93 | $ DoCompile rdswitch.c 94 | $ DoCompile cdjpeg.c 95 | $! 96 | $ Link /NoMap /Executable = cjpeg.exe cjpeg.obj,rdppm.obj,rdgif.obj, - 97 | rdtarga.obj,rdrle.obj,rdbmp.obj,rdswitch.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' 98 | $! 99 | $ DoCompile djpeg.c 100 | $ DoCompile wrppm.c 101 | $ DoCompile wrgif.c 102 | $ DoCompile wrtarga.c 103 | $ DoCompile wrrle.c 104 | $ DoCompile wrbmp.c 105 | $ DoCompile rdcolmap.c 106 | $ DoCompile cdjpeg.c 107 | $! 108 | $ Link /NoMap /Executable = djpeg.exe djpeg.obj,wrppm.obj,wrgif.obj, - 109 | wrtarga.obj,wrrle.obj,wrbmp.obj,rdcolmap.obj,cdjpeg.obj,libjpeg.olb/Library'OPT' 110 | $! 111 | $ DoCompile jpegtran.c 112 | $ DoCompile rdswitch.c 113 | $ DoCompile cdjpeg.c 114 | $ DoCompile transupp.c 115 | $! 116 | $ Link /NoMap /Executable = jpegtran.exe jpegtran.obj,rdswitch.obj, - 117 | cdjpeg.obj,transupp.obj,libjpeg.olb/Library'OPT' 118 | $! 119 | $ DoCompile rdjpgcom.c 120 | $ Link /NoMap /Executable = rdjpgcom.exe rdjpgcom.obj'OPT' 121 | $! 122 | $ DoCompile wrjpgcom.c 123 | $ Link /NoMap /Executable = wrjpgcom.exe wrjpgcom.obj'OPT' 124 | $! 125 | $! Run the self-test 126 | $! 127 | $ mcr sys$disk:[]djpeg -dct int -ppm -outfile testout.ppm testorig.jpg 128 | $ mcr sys$disk:[]djpeg -dct int -bmp -colors 256 -outfile testout.bmp testorig.jpg 129 | $ mcr sys$disk:[]cjpeg -dct int -outfile testout.jpg testimg.ppm 130 | $ mcr sys$disk:[]djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg 131 | $ mcr sys$disk:[]cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm 132 | $ mcr sys$disk:[]jpegtran -outfile testoutt.jpg testprog.jpg 133 | $ Backup /Compare/Log testimg.ppm testout.ppm 134 | $ Backup /Compare/Log testimg.bmp testout.bmp 135 | $ Backup /Compare/Log testimg.jpg testout.jpg 136 | $ Backup /Compare/Log testimg.ppm testoutp.ppm 137 | $ Backup /Compare/Log testimgp.jpg testoutp.jpg 138 | $ Backup /Compare/Log testorig.jpg testoutt.jpg 139 | $! 140 | $End: 141 | $ If Verify Then Set Verify 142 | $ Exit 143 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/makljpeg.st: -------------------------------------------------------------------------------- 1 | ; Project file for Independent JPEG Group's software 2 | ; 3 | ; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. 4 | ; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), 5 | ; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), 6 | ; and Guido Vollbeding (guivol@esc.de). 7 | ; 8 | ; To use this file, rename it to libjpeg.prj. 9 | ; Read installation instructions before trying to make the program! 10 | ; 11 | ; 12 | ; * * * Output file * * * 13 | libjpeg.lib 14 | ; 15 | ; * * * COMPILER OPTIONS * * * 16 | .C[-P] ; absolute calls 17 | .C[-M] ; and no string merging, folks 18 | .C[-w-cln] ; no "constant is long" warnings 19 | .C[-w-par] ; no "parameter xxxx unused" 20 | .C[-w-rch] ; no "unreachable code" 21 | .C[-wsig] ; warn if significant digits may be lost 22 | .L[-J] ; link new Obj-format (so we get a library) 23 | = 24 | ; * * * * List of modules * * * * 25 | jcapimin.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 26 | jcapistd.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 27 | jccoefct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 28 | jccolor.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 29 | jcdctmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 30 | jchuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h) 31 | jcinit.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 32 | jcmainct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 33 | jcmarker.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 34 | jcmaster.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 35 | jcomapi.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 36 | jcparam.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 37 | jcphuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jchuff.h) 38 | jcprepct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 39 | jcsample.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 40 | jctrans.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 41 | jdapimin.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 42 | jdapistd.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 43 | jdatadst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h) 44 | jdatasrc.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h) 45 | jdcoefct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 46 | jdcolor.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 47 | jddctmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 48 | jdhuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h) 49 | jdinput.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 50 | jdmainct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 51 | jdmarker.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 52 | jdmaster.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 53 | jdmerge.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 54 | jdphuff.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdhuff.h) 55 | jdpostct.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 56 | jdsample.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 57 | jdtrans.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 58 | jerror.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jversion.h,jerror.h) 59 | jfdctflt.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 60 | jfdctfst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 61 | jfdctint.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 62 | jidctflt.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 63 | jidctfst.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 64 | jidctint.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 65 | jidctred.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jdct.h) 66 | jquant1.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 67 | jquant2.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 68 | jutils.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h) 69 | jmemmgr.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h) 70 | jmemansi.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,jmemsys.h) 71 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/maktjpeg.st: -------------------------------------------------------------------------------- 1 | ; Project file for Independent JPEG Group's software 2 | ; 3 | ; This project file is for Atari ST/STE/TT systems using Pure C or Turbo C. 4 | ; Thanks to Frank Moehle (Frank.Moehle@arbi.informatik.uni-oldenburg.de), 5 | ; Dr. B. Setzepfandt (bernd@gina.uni-muenster.de), 6 | ; and Guido Vollbeding (guivol@esc.de). 7 | ; 8 | ; To use this file, rename it to jpegtran.prj. 9 | ; If you are using Turbo C, change filenames beginning with "pc..." to "tc..." 10 | ; Read installation instructions before trying to make the program! 11 | ; 12 | ; 13 | ; * * * Output file * * * 14 | jpegtran.ttp 15 | ; 16 | ; * * * COMPILER OPTIONS * * * 17 | .C[-P] ; absolute calls 18 | .C[-M] ; and no string merging, folks 19 | .C[-w-cln] ; no "constant is long" warnings 20 | .C[-w-par] ; no "parameter xxxx unused" 21 | .C[-w-rch] ; no "unreachable code" 22 | .C[-wsig] ; warn if significant digits may be lost 23 | = 24 | ; * * * * List of modules * * * * 25 | pcstart.o 26 | jpegtran.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h,transupp.h,jversion.h) 27 | cdjpeg.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 28 | rdswitch.c (cdjpeg.h,jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jerror.h,cderror.h) 29 | transupp.c (jinclude.h,jconfig.h,jpeglib.h,jmorecfg.h,jpegint.h,jerror.h,transupp.h) 30 | libjpeg.lib ; built by libjpeg.prj 31 | pcstdlib.lib ; standard library 32 | pcextlib.lib ; extended library 33 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/makvms.opt: -------------------------------------------------------------------------------- 1 | ! A pointer to the VAX/VMS C Run-Time Shareable Library. 2 | ! This file is needed by makefile.mms and makefile.vms, 3 | ! but only for the older VAX C compiler. DEC C does not need it. 4 | Sys$Library:VAXCRTL.EXE /Share 5 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/rdgif.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rdgif.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains routines to read input images in GIF format. 9 | * 10 | ***************************************************************************** 11 | * NOTE: to avoid entanglements with Unisys' patent on LZW compression, * 12 | * the ability to read GIF files has been removed from the IJG distribution. * 13 | * Sorry about that. * 14 | ***************************************************************************** 15 | * 16 | * We are required to state that 17 | * "The Graphics Interchange Format(c) is the Copyright property of 18 | * CompuServe Incorporated. GIF(sm) is a Service Mark property of 19 | * CompuServe Incorporated." 20 | */ 21 | 22 | #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ 23 | 24 | #ifdef GIF_SUPPORTED 25 | 26 | /* 27 | * The module selection routine for GIF format input. 28 | */ 29 | 30 | GLOBAL(cjpeg_source_ptr) 31 | jinit_read_gif (j_compress_ptr cinfo) 32 | { 33 | fprintf(stderr, "GIF input is unsupported for legal reasons. Sorry.\n"); 34 | exit(EXIT_FAILURE); 35 | return NULL; /* keep compiler happy */ 36 | } 37 | 38 | #endif /* GIF_SUPPORTED */ 39 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/rdjpgcom.1: -------------------------------------------------------------------------------- 1 | .TH RDJPGCOM 1 "11 October 1997" 2 | .SH NAME 3 | rdjpgcom \- display text comments from a JPEG file 4 | .SH SYNOPSIS 5 | .B rdjpgcom 6 | [ 7 | .B \-verbose 8 | ] 9 | [ 10 | .I filename 11 | ] 12 | .LP 13 | .SH DESCRIPTION 14 | .LP 15 | .B rdjpgcom 16 | reads the named JPEG/JFIF file, or the standard input if no file is named, 17 | and prints any text comments found in the file on the standard output. 18 | .PP 19 | The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. 20 | Although the standard doesn't actually define what COM blocks are for, they 21 | are widely used to hold user-supplied text strings. This lets you add 22 | annotations, titles, index terms, etc to your JPEG files, and later retrieve 23 | them as text. COM blocks do not interfere with the image stored in the JPEG 24 | file. The maximum size of a COM block is 64K, but you can have as many of 25 | them as you like in one JPEG file. 26 | .SH OPTIONS 27 | .TP 28 | .B \-verbose 29 | Causes 30 | .B rdjpgcom 31 | to also display the JPEG image dimensions. 32 | .PP 33 | Switch names may be abbreviated, and are not case sensitive. 34 | .SH HINTS 35 | .B rdjpgcom 36 | does not depend on the IJG JPEG library. Its source code is intended as an 37 | illustration of the minimum amount of code required to parse a JPEG file 38 | header correctly. 39 | .PP 40 | In 41 | .B \-verbose 42 | mode, 43 | .B rdjpgcom 44 | will also attempt to print the contents of any "APP12" markers as text. 45 | Some digital cameras produce APP12 markers containing useful textual 46 | information. If you like, you can modify the source code to print 47 | other APPn marker types as well. 48 | .SH SEE ALSO 49 | .BR cjpeg (1), 50 | .BR djpeg (1), 51 | .BR jpegtran (1), 52 | .BR wrjpgcom (1) 53 | .SH AUTHOR 54 | Independent JPEG Group 55 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/transupp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * transupp.h 3 | * 4 | * Copyright (C) 1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for image transformation routines and 9 | * other utility code used by the jpegtran sample application. These are 10 | * NOT part of the core JPEG library. But we keep these routines separate 11 | * from jpegtran.c to ease the task of maintaining jpegtran-like programs 12 | * that have other user interfaces. 13 | * 14 | * NOTE: all the routines declared here have very specific requirements 15 | * about when they are to be executed during the reading and writing of the 16 | * source and destination files. See the comments in transupp.c, or see 17 | * jpegtran.c for an example of correct usage. 18 | */ 19 | 20 | /* If you happen not to want the image transform support, disable it here */ 21 | #ifndef TRANSFORMS_SUPPORTED 22 | #define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */ 23 | #endif 24 | 25 | /* Short forms of external names for systems with brain-damaged linkers. */ 26 | 27 | #ifdef NEED_SHORT_EXTERNAL_NAMES 28 | #define jtransform_request_workspace jTrRequest 29 | #define jtransform_adjust_parameters jTrAdjust 30 | #define jtransform_execute_transformation jTrExec 31 | #define jcopy_markers_setup jCMrkSetup 32 | #define jcopy_markers_execute jCMrkExec 33 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 34 | 35 | 36 | /* 37 | * Codes for supported types of image transformations. 38 | */ 39 | 40 | typedef enum { 41 | JXFORM_NONE, /* no transformation */ 42 | JXFORM_FLIP_H, /* horizontal flip */ 43 | JXFORM_FLIP_V, /* vertical flip */ 44 | JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */ 45 | JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ 46 | JXFORM_ROT_90, /* 90-degree clockwise rotation */ 47 | JXFORM_ROT_180, /* 180-degree rotation */ 48 | JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ 49 | } JXFORM_CODE; 50 | 51 | /* 52 | * Although rotating and flipping data expressed as DCT coefficients is not 53 | * hard, there is an asymmetry in the JPEG format specification for images 54 | * whose dimensions aren't multiples of the iMCU size. The right and bottom 55 | * image edges are padded out to the next iMCU boundary with junk data; but 56 | * no padding is possible at the top and left edges. If we were to flip 57 | * the whole image including the pad data, then pad garbage would become 58 | * visible at the top and/or left, and real pixels would disappear into the 59 | * pad margins --- perhaps permanently, since encoders & decoders may not 60 | * bother to preserve DCT blocks that appear to be completely outside the 61 | * nominal image area. So, we have to exclude any partial iMCUs from the 62 | * basic transformation. 63 | * 64 | * Transpose is the only transformation that can handle partial iMCUs at the 65 | * right and bottom edges completely cleanly. flip_h can flip partial iMCUs 66 | * at the bottom, but leaves any partial iMCUs at the right edge untouched. 67 | * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched. 68 | * The other transforms are defined as combinations of these basic transforms 69 | * and process edge blocks in a way that preserves the equivalence. 70 | * 71 | * The "trim" option causes untransformable partial iMCUs to be dropped; 72 | * this is not strictly lossless, but it usually gives the best-looking 73 | * result for odd-size images. Note that when this option is active, 74 | * the expected mathematical equivalences between the transforms may not hold. 75 | * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim 76 | * followed by -rot 180 -trim trims both edges.) 77 | * 78 | * We also offer a "force to grayscale" option, which simply discards the 79 | * chrominance channels of a YCbCr image. This is lossless in the sense that 80 | * the luminance channel is preserved exactly. It's not the same kind of 81 | * thing as the rotate/flip transformations, but it's convenient to handle it 82 | * as part of this package, mainly because the transformation routines have to 83 | * be aware of the option to know how many components to work on. 84 | */ 85 | 86 | typedef struct { 87 | /* Options: set by caller */ 88 | JXFORM_CODE transform; /* image transform operator */ 89 | boolean trim; /* if TRUE, trim partial MCUs as needed */ 90 | boolean force_grayscale; /* if TRUE, convert color image to grayscale */ 91 | 92 | /* Internal workspace: caller should not touch these */ 93 | int num_components; /* # of components in workspace */ 94 | jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ 95 | } jpeg_transform_info; 96 | 97 | 98 | #if TRANSFORMS_SUPPORTED 99 | 100 | /* Request any required workspace */ 101 | EXTERN(void) jtransform_request_workspace 102 | JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); 103 | /* Adjust output image parameters */ 104 | EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters 105 | JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, 106 | jvirt_barray_ptr *src_coef_arrays, 107 | jpeg_transform_info *info)); 108 | /* Execute the actual transformation, if any */ 109 | EXTERN(void) jtransform_execute_transformation 110 | JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, 111 | jvirt_barray_ptr *src_coef_arrays, 112 | jpeg_transform_info *info)); 113 | 114 | #endif /* TRANSFORMS_SUPPORTED */ 115 | 116 | 117 | /* 118 | * Support for copying optional markers from source to destination file. 119 | */ 120 | 121 | typedef enum { 122 | JCOPYOPT_NONE, /* copy no optional markers */ 123 | JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ 124 | JCOPYOPT_ALL /* copy all optional markers */ 125 | } JCOPY_OPTION; 126 | 127 | #define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ 128 | 129 | /* Setup decompression object to save desired markers in memory */ 130 | EXTERN(void) jcopy_markers_setup 131 | JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); 132 | /* Copy markers saved in the given source object to the destination object */ 133 | EXTERN(void) jcopy_markers_execute 134 | JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, 135 | JCOPY_OPTION option)); 136 | -------------------------------------------------------------------------------- /src/jpeg-6b-steg/wrjpgcom.1: -------------------------------------------------------------------------------- 1 | .TH WRJPGCOM 1 "15 June 1995" 2 | .SH NAME 3 | wrjpgcom \- insert text comments into a JPEG file 4 | .SH SYNOPSIS 5 | .B wrjpgcom 6 | [ 7 | .B \-replace 8 | ] 9 | [ 10 | .BI \-comment " text" 11 | ] 12 | [ 13 | .BI \-cfile " name" 14 | ] 15 | [ 16 | .I filename 17 | ] 18 | .LP 19 | .SH DESCRIPTION 20 | .LP 21 | .B wrjpgcom 22 | reads the named JPEG/JFIF file, or the standard input if no file is named, 23 | and generates a new JPEG/JFIF file on standard output. A comment block is 24 | added to the file. 25 | .PP 26 | The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. 27 | Although the standard doesn't actually define what COM blocks are for, they 28 | are widely used to hold user-supplied text strings. This lets you add 29 | annotations, titles, index terms, etc to your JPEG files, and later retrieve 30 | them as text. COM blocks do not interfere with the image stored in the JPEG 31 | file. The maximum size of a COM block is 64K, but you can have as many of 32 | them as you like in one JPEG file. 33 | .PP 34 | .B wrjpgcom 35 | adds a COM block, containing text you provide, to a JPEG file. 36 | Ordinarily, the COM block is added after any existing COM blocks; but you 37 | can delete the old COM blocks if you wish. 38 | .SH OPTIONS 39 | Switch names may be abbreviated, and are not case sensitive. 40 | .TP 41 | .B \-replace 42 | Delete any existing COM blocks from the file. 43 | .TP 44 | .BI \-comment " text" 45 | Supply text for new COM block on command line. 46 | .TP 47 | .BI \-cfile " name" 48 | Read text for new COM block from named file. 49 | .PP 50 | If you have only one line of comment text to add, you can provide it on the 51 | command line with 52 | .BR \-comment . 53 | The comment text must be surrounded with quotes so that it is treated as a 54 | single argument. Longer comments can be read from a text file. 55 | .PP 56 | If you give neither 57 | .B \-comment 58 | nor 59 | .BR \-cfile , 60 | then 61 | .B wrjpgcom 62 | will read the comment text from standard input. (In this case an input image 63 | file name MUST be supplied, so that the source JPEG file comes from somewhere 64 | else.) You can enter multiple lines, up to 64KB worth. Type an end-of-file 65 | indicator (usually control-D) to terminate the comment text entry. 66 | .PP 67 | .B wrjpgcom 68 | will not add a COM block if the provided comment string is empty. Therefore 69 | \fB\-replace \-comment ""\fR can be used to delete all COM blocks from a file. 70 | .SH EXAMPLES 71 | .LP 72 | Add a short comment to in.jpg, producing out.jpg: 73 | .IP 74 | .B wrjpgcom \-c 75 | \fI"View of my back yard" in.jpg 76 | .B > 77 | .I out.jpg 78 | .PP 79 | Attach a long comment previously stored in comment.txt: 80 | .IP 81 | .B wrjpgcom 82 | .I in.jpg 83 | .B < 84 | .I comment.txt 85 | .B > 86 | .I out.jpg 87 | .PP 88 | or equivalently 89 | .IP 90 | .B wrjpgcom 91 | .B -cfile 92 | .I comment.txt 93 | .B < 94 | .I in.jpg 95 | .B > 96 | .I out.jpg 97 | .SH SEE ALSO 98 | .BR cjpeg (1), 99 | .BR djpeg (1), 100 | .BR jpegtran (1), 101 | .BR rdjpgcom (1) 102 | .SH AUTHOR 103 | Independent JPEG Group 104 | -------------------------------------------------------------------------------- /src/jpg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _JPG_H 32 | #define _JPG_H 33 | 34 | #define JPG_THRES_MAX 0x25 35 | #define JPG_THRES_LOW 0x04 36 | #define JPG_THRES_MIN 0x03 37 | 38 | void init_JPEG_handler(char *parameters); 39 | 40 | int preserve_jpg(bitmap *, int); 41 | 42 | void write_JPEG_file (FILE *outfile, image *image); 43 | image *read_JPEG_file (FILE *infile); 44 | 45 | void bitmap_from_jpg(bitmap *bitmap, image *image, int flags); 46 | void bitmap_to_jpg(image *image, bitmap *bitmap, int flags); 47 | 48 | bitmap *compress_JPEG(image *image); 49 | 50 | extern handler jpg_handler; 51 | 52 | #define JPEG_READING 0 53 | #define JPEG_WRITING 1 54 | 55 | #endif /* _JPG_H */ 56 | 57 | -------------------------------------------------------------------------------- /src/md5.h: -------------------------------------------------------------------------------- 1 | /* See md5.c for explanation and copyright information. */ 2 | 3 | #ifndef MD5_H 4 | #define MD5_H 5 | 6 | /* Unlike previous versions of this code, uint32 need not be exactly 7 | 32 bits, merely 32 bits or more. Choosing a data type which is 32 8 | bits instead of 64 is not important; speed is considerably more 9 | important. ANSI guarantees that "unsigned long" will be big enough, 10 | and always using it seems to have few disadvantages. */ 11 | typedef unsigned long uint32; 12 | 13 | struct MD5Context { 14 | uint32 buf[4]; 15 | uint32 bits[2]; 16 | unsigned char in[64]; 17 | }; 18 | 19 | void MD5Init(struct MD5Context *context); 20 | void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); 21 | void MD5Final(unsigned char digest[16], struct MD5Context *context); 22 | void MD5Transform(uint32 buf[4], const unsigned char in[64]); 23 | 24 | /* 25 | * This is needed to make RSAREF happy on some MS-DOS compilers. 26 | */ 27 | typedef struct MD5Context MD5_CTX; 28 | 29 | #endif /* !MD5_H */ 30 | -------------------------------------------------------------------------------- /src/outguess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2001 Niels Provos 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Niels Provos. 16 | * 4. The name of the author may not be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _OUTGUESS_H 32 | #define _OUTGUESS_H 33 | 34 | #include "arc.h" 35 | 36 | #define BITSHIFT 0 /* which bit in the byte the data is in */ 37 | 38 | #define MAX_DEPTH 3 /* maximum number of bytes per pixel */ 39 | #define MAX_SEEK 1024 /* maximum number of pixels for foil stats */ 40 | 41 | #define STEG_EMBED 0x01 42 | #define STEG_MARK 0x02 43 | #define STEG_ERROR 0x08 44 | 45 | #define STEG_RETRIEVE 0x10 46 | 47 | #define STEG_STATS 0x20 48 | 49 | extern int steg_stat; 50 | 51 | /* 52 | * The generic bitmap structure. An object is passed in and an object 53 | * dependant function extracts all bits that can be modified to embed 54 | * data into a bitmap structure. This allows the embedding be independant 55 | * of the carrier data. 56 | */ 57 | 58 | typedef struct _bitmap { 59 | u_char *bitmap; /* the bitmap */ 60 | u_char *locked; /* bits that may not be modified */ 61 | u_char *metalock; /* bits that have been used for foil */ 62 | char *detect; /* relative detectability of changes */ 63 | char *data; /* data associated with the bit */ 64 | int bytes; /* allocated bytes */ 65 | int bits; /* number of bits in here */ 66 | 67 | /* function to call for preserve stats */ 68 | int (*preserve)(struct _bitmap *, int); 69 | size_t maxcorrect; 70 | } bitmap; 71 | 72 | #define STEG_ERR_HEADER 1 73 | #define STEG_ERR_BODY 2 74 | #define STEG_ERR_PERM 3 /* error independant of seed */ 75 | 76 | typedef struct _stegres { 77 | int error; /* Errors during steg embed */ 78 | int changed; /* Number of changed bits in data */ 79 | int bias; /* Accumulated bias of changed bits */ 80 | } stegres; 81 | 82 | typedef struct _config { 83 | int flags; 84 | int siter; 85 | int siterstart; 86 | } config; 87 | 88 | #define TEST_BIT(x,y) ((x)[(y) / 8] & (1 << ((y) & 7))) 89 | #define WRITE_BIT(x,y,what) ((x)[(y) / 8] = ((x)[(y) / 8] & \ 90 | ~(1 << ((y) & 7))) | ((what) << ((y) & 7))) 91 | 92 | #define SWAP(x,y) do {int n = x; x = y; y = n;} while(0); 93 | 94 | void *checkedmalloc(size_t n); 95 | 96 | u_char *encode_data(u_char *, int *, struct arc4_stream *, int); 97 | u_char *decode_data(u_char *, int *, struct arc4_stream *, int); 98 | 99 | struct _iterator; 100 | 101 | stegres steg_embed(bitmap *bitmap, struct _iterator *iter, 102 | struct arc4_stream *as, u_char *data, u_int datalen, 103 | u_int16_t seed, int embed); 104 | u_int32_t steg_retrbyte(bitmap *bitmap, int bits, struct _iterator *iter); 105 | 106 | char *steg_retrieve(int *len, bitmap *bitmap, struct _iterator *iter, 107 | struct arc4_stream *as, int); 108 | 109 | void mmap_file(char *name, u_char **data, int *size); 110 | void munmap_file(u_char *data, int len); 111 | 112 | #endif /* _OUTGUESS_H */ 113 | -------------------------------------------------------------------------------- /src/pnm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2001 Niels Provos 3 | * Copyright 2021 Daniel T. Borelli 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. All advertising materials mentioning features or use of this software 15 | * must display the following acknowledgement: 16 | * This product includes software developed by Niels Provos. 17 | * 4. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* 33 | * Handling functions for the PNM image format. 34 | */ 35 | 36 | #ifndef _PNM_H 37 | #define _PNM_H 38 | 39 | #define PNM_THRES_MAX 0xf0 40 | #define PNM_THRES_MIN 0x10 41 | 42 | /* 43 | * This is our raw data object, also used to create JPG or other 44 | * encoded output. 45 | */ 46 | 47 | typedef struct _image { 48 | int x, y, depth, max; 49 | u_char *img; 50 | bitmap *bitmap; 51 | int flags; 52 | } image; 53 | 54 | typedef struct _handler { 55 | char *extension; /* Extension name */ 56 | char *extension_alternative; /* Extension name */ 57 | void (*init)(char *); 58 | image *(*read)(FILE *); 59 | void (*write)(FILE *, image *); 60 | void (*get_bitmap)(bitmap *, image *, int); 61 | void (*put_bitmap)(image *, bitmap *, int); 62 | int (*preserve)(bitmap *, int); 63 | } handler; 64 | 65 | extern handler pnm_handler; 66 | 67 | void skip_white(FILE *f); 68 | 69 | void init_pnm(char *); 70 | 71 | int preserve_pnm(bitmap *, int); 72 | 73 | void bitmap_to_pnm(image *img, bitmap *bitmap, int flags); 74 | void bitmap_from_pnm(bitmap *bitmap, image *image, int flags); 75 | 76 | image *read_pnm(FILE *fin); 77 | void write_pnm(FILE *fout, image *image); 78 | 79 | void free_pnm(image *image); 80 | 81 | #endif /* _PNM_H */ 82 | -------------------------------------------------------------------------------- /src/seek_script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # A very simple script using OutGuess to find an image that yields 3 | # the best embedding. 4 | # Copyright 1999 Niels Provos 5 | FILES=*.jpg 6 | MESSAGE=/tmp/fortune 7 | TMPNAME="out.$$.jpg" 8 | OUTPUT="out.jpg" 9 | ARGS="-d $MESSAGE" 10 | OUTGUESS="outguess" 11 | BEST=0 12 | WORST=0 13 | NAME="no name" 14 | 15 | if [ ! -f "$MESSAGE" ] ; then 16 | echo "The file $MESSAGE does not exist" 17 | exit 18 | fi 19 | 20 | for name in $FILES 21 | do 22 | echo -n "$name " 23 | RESULT=`$OUTGUESS $ARGS $name $TMPNAME 2>&1 | grep "^Total" | awk '{print $4}'` 24 | if [ -z "$RESULT" ] ; then 25 | rm $TMPNAME 26 | echo "not possible to embed data" 27 | continue; 28 | else 29 | echo "Bits changed $RESULT" 30 | fi 31 | if [ $WORST -eq 0 -o $RESULT -gt $WORST ] ; then 32 | WORST=$RESULT 33 | fi 34 | if [ $BEST -eq 0 -o $RESULT -lt $BEST ] ; then 35 | BEST=$RESULT 36 | NAME=$name 37 | mv $TMPNAME $OUTPUT 38 | echo NEW best image: $name 39 | else 40 | rm $TMPNAME 41 | fi 42 | done 43 | 44 | echo "Best data object was $NAME with $BEST. Worst result was $WORST." 45 | -------------------------------------------------------------------------------- /tests/LICENSE: -------------------------------------------------------------------------------- 1 | Name: test.jpg 2 | Original Name: 35919345532_eaac4f152e_q.jpg 3 | Source: https://www.flickr.com/photos/152442938@N03/35919345532 4 | Reference: https://search.creativecommons.org/photos/e199c2fb-01be-4c76-a832-a1bd0486429b 5 | Copyright: None (Public Domain) 6 | License: CC0 1.0 (Creative Commons Public Domain Dedication) 7 | License text: https://creativecommons.org/publicdomain/zero/1.0/ 8 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | TESTS = embed_extract_jpg.sh \ 2 | embed_extract_pnm.sh \ 3 | embed_extract_ppm.sh \ 4 | test_seek.sh 5 | 6 | CLEANFILES = test-with-message.jpg \ 7 | test-with-message.pnm \ 8 | test-with-message.ppm 9 | 10 | distclean-local: 11 | rm -f out.jpg 12 | -------------------------------------------------------------------------------- /tests/embed_extract_jpg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Joao Eriberto Mota Filho 4 | # 5 | # This file is under BSD-3-Clause license. 6 | 7 | # Write message 8 | echo -e "\nEmbedding a message..." 9 | ../src/outguess -k "secret-key-001" -d message.txt test.jpg test-with-message.jpg 10 | 11 | # Retrieve message 12 | echo -e "\nExtracting a message..." 13 | ../src/outguess -k "secret-key-001" -r test-with-message.jpg text-jpg.txt 14 | cat text-jpg.txt | grep "inside of the image" || { echo ERROR; exit 1; } 15 | 16 | # Remove files 17 | rm -f test-with-message.jpg text-jpg.txt 18 | -------------------------------------------------------------------------------- /tests/embed_extract_pnm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Joao Eriberto Mota Filho 4 | # 5 | # This file is under BSD-3-Clause license. 6 | 7 | # Write message 8 | echo -e "\nEmbedding a message..." 9 | ../src/outguess -k "secret-key-001" -d message.txt test.pnm test-with-message.pnm 10 | 11 | # Retrieve message 12 | echo -e "\nExtracting a message..." 13 | ../src/outguess -k "secret-key-001" -r test-with-message.pnm text-pnm.txt 14 | cat text-pnm.txt | grep "inside of the image" || { echo ERROR; exit 1; } 15 | 16 | # Remove files 17 | rm -f test-with-message.pnm text-pnm.txt 18 | -------------------------------------------------------------------------------- /tests/embed_extract_ppm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Joao Eriberto Mota Filho 4 | # 5 | # This file is under BSD-3-Clause license. 6 | 7 | # Write message 8 | echo -e "\nEmbedding a message..." 9 | ../src/outguess -k "secret-key-001" -d message.txt test.ppm test-with-message.ppm 10 | 11 | # Retrieve message 12 | echo -e "\nExtracting a message..." 13 | ../src/outguess -k "secret-key-001" -r test-with-message.ppm text-ppm.txt 14 | cat text-ppm.txt | grep "inside of the image" || { echo ERROR; exit 1; } 15 | 16 | # Remove files 17 | rm -f test-with-message.ppm text-ppm.txt 18 | -------------------------------------------------------------------------------- /tests/message.txt: -------------------------------------------------------------------------------- 1 | Message to put inside of the image. 2 | 3 | Bye! 4 | 5 | -------------------------------------------------------------------------------- /tests/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/resurrecting-open-source-projects/outguess/24810e14327c2bbeedeaadd3e24491f2a4425c02/tests/test.jpg -------------------------------------------------------------------------------- /tests/test.pnm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/resurrecting-open-source-projects/outguess/24810e14327c2bbeedeaadd3e24491f2a4425c02/tests/test.pnm -------------------------------------------------------------------------------- /tests/test.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/resurrecting-open-source-projects/outguess/24810e14327c2bbeedeaadd3e24491f2a4425c02/tests/test.ppm -------------------------------------------------------------------------------- /tests/test_seek.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2021 Joao Eriberto Mota Filho 4 | # 5 | # This file is under BSD-3-Clause license. 6 | # 7 | # This is a test for the seek_script 8 | 9 | echo "This is my test" > /tmp/fortune 10 | 11 | ../src/seek_script | grep "Best data" || { echo ERROR; exit 1; } 12 | --------------------------------------------------------------------------------