├── .gitignore ├── Makefile ├── Makefile.template ├── Makefile_Settings.clang ├── Makefile_Settings.gcc ├── README ├── README.history ├── README.license.gpl ├── README.license.itu ├── README.md ├── autoconfig.h.in ├── automakefile.in ├── boxes ├── Makefile ├── alphabox.cpp ├── alphabox.hpp ├── box.cpp ├── box.hpp ├── checksumbox.cpp ├── checksumbox.hpp ├── colortrafobox.cpp ├── colortrafobox.hpp ├── databox.cpp ├── databox.hpp ├── dctbox.cpp ├── dctbox.hpp ├── filetypebox.cpp ├── filetypebox.hpp ├── floattonemappingbox.cpp ├── floattonemappingbox.hpp ├── floattransformationbox.cpp ├── floattransformationbox.hpp ├── inversetonemappingbox.cpp ├── inversetonemappingbox.hpp ├── lineartransformationbox.cpp ├── lineartransformationbox.hpp ├── matrixbox.cpp ├── matrixbox.hpp ├── mergingspecbox.cpp ├── mergingspecbox.hpp ├── namespace.cpp ├── namespace.hpp ├── nonlineartrafobox.cpp ├── nonlineartrafobox.hpp ├── outputconversionbox.cpp ├── outputconversionbox.hpp ├── parametrictonemappingbox.cpp ├── parametrictonemappingbox.hpp ├── refinementspecbox.cpp ├── refinementspecbox.hpp ├── superbox.cpp ├── superbox.hpp ├── tonemapperbox.cpp └── tonemapperbox.hpp ├── cmd ├── Makefile ├── bitmaphook.cpp ├── bitmaphook.hpp ├── defaulttmoc.cpp ├── defaulttmoc.hpp ├── encodea.cpp ├── encodea.hpp ├── encodeb.cpp ├── encodeb.hpp ├── encodec.cpp ├── encodec.hpp ├── filehook.cpp ├── filehook.hpp ├── iohelpers.cpp ├── iohelpers.hpp ├── main.cpp ├── main.hpp ├── reconstruct.cpp ├── reconstruct.hpp ├── tmo.cpp └── tmo.hpp ├── codestream ├── Makefile ├── aclosslessscan.cpp ├── aclosslessscan.hpp ├── acrefinementscan.cpp ├── acrefinementscan.hpp ├── acsequentialscan.cpp ├── acsequentialscan.hpp ├── decoder.cpp ├── decoder.hpp ├── encoder.cpp ├── encoder.hpp ├── entropyparser.cpp ├── entropyparser.hpp ├── image.cpp ├── image.hpp ├── jpeglsscan.cpp ├── jpeglsscan.hpp ├── lineinterleavedlsscan.cpp ├── lineinterleavedlsscan.hpp ├── losslessscan.cpp ├── losslessscan.hpp ├── predictivescan.cpp ├── predictivescan.hpp ├── predictor.cpp ├── predictor.hpp ├── predictorbase.cpp ├── predictorbase.hpp ├── rectanglerequest.cpp ├── rectanglerequest.hpp ├── refinementscan.cpp ├── refinementscan.hpp ├── sampleinterleavedlsscan.cpp ├── sampleinterleavedlsscan.hpp ├── sequentialscan.cpp ├── sequentialscan.hpp ├── singlecomponentlsscan.cpp ├── singlecomponentlsscan.hpp ├── tables.cpp └── tables.hpp ├── coding ├── Makefile ├── actemplate.cpp ├── actemplate.hpp ├── arithmetictemplate.cpp ├── arithmetictemplate.hpp ├── arthdeco.cpp ├── arthdeco.hpp ├── blockrow.cpp ├── blockrow.hpp ├── decodertemplate.cpp ├── decodertemplate.hpp ├── huffmancoder.cpp ├── huffmancoder.hpp ├── huffmandecoder.cpp ├── huffmandecoder.hpp ├── huffmanstatistics.cpp ├── huffmanstatistics.hpp ├── huffmantemplate.cpp ├── huffmantemplate.hpp ├── qmcoder.cpp ├── qmcoder.hpp ├── quantizedrow.cpp └── quantizedrow.hpp ├── colortrafo ├── Makefile ├── colortrafo.cpp ├── colortrafo.hpp ├── colortransformerfactory.cpp ├── colortransformerfactory.hpp ├── floattrafo.cpp ├── floattrafo.hpp ├── integertrafo.cpp ├── integertrafo.hpp ├── lslosslesstrafo.cpp ├── lslosslesstrafo.hpp ├── multiplicationtrafo.cpp ├── multiplicationtrafo.hpp ├── trivialtrafo.cpp ├── trivialtrafo.hpp ├── ycbcrtrafo.cpp └── ycbcrtrafo.hpp ├── config.h ├── configure ├── configure.in ├── control ├── Makefile ├── bitmapctrl.cpp ├── bitmapctrl.hpp ├── blockbitmaprequester.cpp ├── blockbitmaprequester.hpp ├── blockbuffer.cpp ├── blockbuffer.hpp ├── blockctrl.cpp ├── blockctrl.hpp ├── blocklineadapter.cpp ├── blocklineadapter.hpp ├── bufferctrl.cpp ├── bufferctrl.hpp ├── hierarchicalbitmaprequester.cpp ├── hierarchicalbitmaprequester.hpp ├── lineadapter.cpp ├── lineadapter.hpp ├── linebitmaprequester.cpp ├── linebitmaprequester.hpp ├── linebuffer.cpp ├── linebuffer.hpp ├── linelineadapter.cpp ├── linelineadapter.hpp ├── linemerger.cpp ├── linemerger.hpp ├── residualblockhelper.cpp ├── residualblockhelper.hpp ├── residualbuffer.cpp └── residualbuffer.hpp ├── cptosvn ├── cutheader.pl ├── dct ├── Makefile ├── dct.cpp ├── dct.hpp ├── deringing.cpp ├── deringing.hpp ├── idct.cpp ├── idct.hpp ├── liftingdct.cpp └── liftingdct.hpp ├── doxyconfig ├── doxyfilter.py ├── interface ├── Makefile ├── bitmaphook.cpp ├── bitmaphook.hpp ├── hooks.cpp ├── hooks.hpp ├── imagebitmap.cpp ├── imagebitmap.hpp ├── jpeg.cpp ├── jpeg.hpp ├── jpgtypes.cpp ├── jpgtypes.hpp ├── parameters.cpp ├── parameters.hpp ├── tagitem.cpp ├── tagitem.hpp ├── types.cpp └── types.hpp ├── io ├── Makefile ├── bitstream.cpp ├── bitstream.hpp ├── bytestream.cpp ├── bytestream.hpp ├── checksumadapter.cpp ├── checksumadapter.hpp ├── decoderstream.cpp ├── decoderstream.hpp ├── iostream.cpp ├── iostream.hpp ├── memorystream.cpp ├── memorystream.hpp ├── randomaccessstream.cpp ├── randomaccessstream.hpp ├── staticstream.cpp └── staticstream.hpp ├── marker ├── Makefile ├── actable.cpp ├── actable.hpp ├── adobemarker.cpp ├── adobemarker.hpp ├── component.cpp ├── component.hpp ├── exifmarker.cpp ├── exifmarker.hpp ├── frame.cpp ├── frame.hpp ├── huffmantable.cpp ├── huffmantable.hpp ├── jfifmarker.cpp ├── jfifmarker.hpp ├── lscolortrafo.cpp ├── lscolortrafo.hpp ├── quantization.cpp ├── quantization.hpp ├── quantizationtable.cpp ├── quantizationtable.hpp ├── restartintervalmarker.cpp ├── restartintervalmarker.hpp ├── scan.cpp ├── scan.hpp ├── scantypes.cpp ├── scantypes.hpp ├── thresholds.cpp └── thresholds.hpp ├── newheader ├── std ├── Makefile ├── assert.cpp ├── assert.hpp ├── ctype.cpp ├── ctype.hpp ├── errno.cpp ├── errno.hpp ├── math.cpp ├── math.hpp ├── setjmp.cpp ├── setjmp.hpp ├── stdarg.cpp ├── stdarg.hpp ├── stddef.cpp ├── stddef.hpp ├── stdio.cpp ├── stdio.hpp ├── stdlib.cpp ├── stdlib.hpp ├── string.cpp ├── string.hpp ├── unistd.cpp └── unistd.hpp ├── tools ├── Makefile ├── checksum.cpp ├── checksum.hpp ├── debug.cpp ├── debug.hpp ├── environment.cpp ├── environment.hpp ├── line.cpp ├── line.hpp ├── numerics.cpp ├── numerics.hpp ├── priorityqueue.cpp ├── priorityqueue.hpp ├── rectangle.cpp ├── rectangle.hpp ├── traits.cpp └── traits.hpp ├── upsampling ├── Makefile ├── cositedupsampler.cpp ├── cositedupsampler.hpp ├── downsampler.cpp ├── downsampler.hpp ├── downsamplerbase.cpp ├── downsamplerbase.hpp ├── interdownsampler.cpp ├── interdownsampler.hpp ├── upsampler.cpp ├── upsampler.hpp ├── upsamplerbase.cpp └── upsamplerbase.hpp ├── vs10.0 └── jpeg │ ├── jpeg.sln │ ├── jpeg │ └── jpeg.vcxproj │ ├── jpegdll │ ├── jpegdll.cpp │ ├── jpegdll.rc │ ├── jpegdll.vcxproj │ ├── resource.h │ └── tagitemdll.cpp │ └── jpeglib │ └── jpeglib.vcxproj ├── vs12.0 └── jpeg │ ├── jpeg.sln │ ├── jpeg │ └── jpeg.vcxproj │ ├── jpegdll │ ├── jpegdll.cpp │ ├── jpegdll.rc │ ├── jpegdll.vcxproj │ ├── resource.h │ └── tagitemdll.cpp │ └── jpeglib │ └── jpeglib.vcxproj └── vs15.0 └── jpeg ├── jpeg.sln ├── jpeg └── jpeg.vcxproj ├── jpegdll ├── jpegdll.cpp ├── jpegdll.rc ├── jpegdll.vcxproj ├── resource.h └── tagitemdll.cpp └── jpeglib └── jpeglib.vcxproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | 9 | # Compiled Static libraries 10 | *.lai 11 | *.la 12 | *.a 13 | 14 | # configure artifacts 15 | autoconfig.h 16 | automakefile 17 | config.log 18 | config.status 19 | 20 | # make artifacts 21 | autom4te.cache 22 | jpeg 23 | *.list 24 | *.d 25 | 26 | # CVS repositories 27 | CVS 28 | 29 | # Left over images 30 | *.jpg 31 | *.jls 32 | *.ppm 33 | *.pgm 34 | *.pfm 35 | *.out 36 | 37 | # core dumps 38 | core 39 | 40 | # Editor temporaries 41 | *~ 42 | -------------------------------------------------------------------------------- /Makefile_Settings.clang: -------------------------------------------------------------------------------- 1 | #! make 2 | ## 3 | ## Specific GCC project settings. 4 | ## 5 | ## $Id: Makefile_Settings.clang,v 1.2 2016/10/28 13:58:49 thor Exp $ 6 | ## 7 | 8 | CXX = $(COMPILER_CMD) 9 | DEFINES = 10 | CC = $(CXX) 11 | MAKEOBJS = -x c++ -c 12 | CFLAGS = $(BITSIZE) -Wall -W -Wunused -Wpointer-arith -pedantic -Wcast-qual -Wwrite-strings -Wno-long-long -Wredundant-decls -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -fno-exceptions -Wno-char-subscripts $(INCLUDEOPTS) $(DEFINES) $(ADDOPTS) $(CPU) $(TUNE) 13 | OPTIMIZER = -O3 -DDEBUG_LEVEL=0 -DCHECK_LEVEL=0 -funroll-loops -fstrict-aliasing -Wno-redundant-decls -ffast-math #-mfpmath=387 #-maccumulate-outgoing-args -minline-all-stringops -fno-rtti 14 | #-fschedule-insns # These give "register spill" errors. 15 | #-fschedule-insns2 #-fomit-frame-pointer breaks exception handling for 3.2 16 | # 387 legacy FPU code is faster than SSE for gcc. Wierd. 17 | # -Wconversion is unusable for gcc 4.3 and above. 18 | # 19 | # Additional tuning of the template generation by means of -frepo or the like did not at all change the 20 | # size of the final executable. Thus, it's not done. 21 | # 22 | PROFILER = -O3 -pg -ggdb3 -pg -fno-omit-frame-pointer #-fno-inline 23 | LDPROF = -pg 24 | DEBUGGER = -ggdb3 -fno-omit-frame-pointer -fno-inline -DDEBUG_LEVEL=2 -DCHECK_LEVEL=3 25 | VERBOSE = -ggdb3 -fno-inline -DDEBUG_LEVEL=3 -DCHECK_LEVEL=3 26 | DEBUGINFO = -ggdb3 -fno-omit-frame-pointer -fno-inline 27 | TOASM = -S -fverbose-asm #-fno-unroll-loops 28 | DBLIBS = #-lefence # does also break exception handling 29 | LD = $(CXX) 30 | LDFLAGS = $(BITSIZE) 31 | LDLIBS = -lc -lm $(EXTRA_LIBS) #gcc_s required for long division/multiplication on 32bit 32 | PROFGEN = $(OPTIMIZER) -fprofile-arcs 33 | PROFUSE = $(OPTIMIZER) -fbranch-probabilities 34 | COVERAGE = -ftest-coverage -fprofile-arcs 35 | LDCOVERAGE = -lgcov -fprofile-arcs 36 | -------------------------------------------------------------------------------- /Makefile_Settings.gcc: -------------------------------------------------------------------------------- 1 | #! make 2 | ## 3 | ## Specific GCC project settings. 4 | ## 5 | ## $Id: Makefile_Settings.gcc,v 1.5 2020/04/08 10:05:29 thor Exp $ 6 | ## 7 | 8 | CXX = $(COMPILER_CMD) 9 | DEFINES = 10 | CC = $(CXX) 11 | MAKEOBJS = -x c++ -c 12 | CFLAGS = $(BITSIZE) -Wall -W -Wunused -Wpointer-arith -pedantic -Wcast-qual -Wwrite-strings -Wno-long-long -Wredundant-decls -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -fno-exceptions -Wno-char-subscripts -Wno-shift-negative-value $(INCLUDEOPTS) $(DEFINES) $(ADDOPTS) $(WARNOPTS) $(CPU) $(TUNE) 13 | OPTIMIZER = -O3 -DDEBUG_LEVEL=0 -DCHECK_LEVEL=0 -funroll-loops -fstrict-aliasing -Wno-redundant-decls -ffast-math #-mfpmath=387 #-maccumulate-outgoing-args -minline-all-stringops -fno-rtti 14 | #-fschedule-insns # These give "register spill" errors. 15 | #-fschedule-insns2 #-fomit-frame-pointer breaks exception handling for 3.2 16 | # 387 legacy FPU code is faster than SSE for gcc. Wierd. 17 | # -Wconversion is unusable for gcc 4.3 and above. 18 | # 19 | # Additional tuning of the template generation by means of -frepo or the like did not at all change the 20 | # size of the final executable. Thus, it's not done. 21 | # 22 | PROFILER = -O3 -pg -ggdb3 -pg -fno-omit-frame-pointer #-fno-inline 23 | LDPROF = -pg 24 | DEBUGGER = -ggdb3 -fno-omit-frame-pointer -fno-inline -DDEBUG_LEVEL=2 -DCHECK_LEVEL=3 25 | VERBOSE = -ggdb3 -fno-inline -DDEBUG_LEVEL=3 -DCHECK_LEVEL=3 26 | DEBUGINFO = -ggdb3 -fno-omit-frame-pointer -fno-inline 27 | TOASM = -S -fverbose-asm #-fno-unroll-loops 28 | DBLIBS = #-lefence # does also break exception handling 29 | LD = $(CXX) 30 | LDFLAGS = $(BITSIZE) 31 | LDLIBS = -lc -lm $(EXTRA_LIBS) #gcc_s required for long division/multiplication on 32bit 32 | PROFGEN = $(OPTIMIZER) -fprofile-arcs 33 | PROFUSE = $(OPTIMIZER) -fbranch-probabilities 34 | COVERAGE = -ftest-coverage -fprofile-arcs 35 | LDCOVERAGE = -lgcov -fprofile-arcs 36 | -------------------------------------------------------------------------------- /README.license.itu: -------------------------------------------------------------------------------- 1 | Accusoft (hereinafter the "Software Copyright Holder") holds or has the right 2 | to license copyright with respect to the accompanying software 3 | (hereinafter the "Software"). 4 | 5 | Copyright License for Evaluation and Testing The Software Copyright 6 | Holder hereby grants, to any implementer of this ITU Recommendation | 7 | ISO/IEC International Standard, an irrevocable, non-exclusive, worldwide, 8 | royalty-free, sub-licensable copyright licence to prepare derivative 9 | works of (including translations, adaptations, alterations), the 10 | Software and reproduce, display, distribute and execute the Software 11 | and derivative works thereof, for the following limited purposes: 12 | 13 | (i) to evaluate the Software and any derivative works thereof for 14 | inclusion in its implementation of this ITU Recommendation | ISO/IEC 15 | International Standard, and 16 | 17 | (ii) to determine whether its implementation conforms with this ITU 18 | Recommendation | ISO/IEC International Standard, and 19 | 20 | (iii) non-commercial redistribution for research and other activities 21 | towards further development and enhancement of ITU Recommendations | 22 | ISO/IEC International Standards. 23 | 24 | The Software Copyright Holder represents and warrants that, to the best of its 25 | knowledge, it has the necessary copyright rights to license the Software 26 | pursuant to the terms and conditions set forth in this option. 27 | 28 | No patent licence is granted, nor is a patent licensing commitment made, by 29 | implication, estoppel or otherwise. 30 | 31 | Disclaimer: Other than as expressly provided herein, 32 | (1) the Software is provided "AS IS" WITH NO WARRANTIES, EXPRESS OR IMPLIED, 33 | INCLUDING BUT NOT LIMITED TO, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR 34 | A PARTICULAR PURPOSE AND NON-INFRINGMENT OF INTELLECTUAL PROPERTY RIGHTS and 35 | (2) neither the Software Copyright Holder (or its affiliates) nor the ITU 36 | shall be held liable in any event for any damages whatsoever (including, 37 | without limitation, damages for loss of profits, business interruption, 38 | loss of information, or any other pecuniary loss) arising out of or related 39 | to the use of or inability to use the Software. 40 | 41 | 42 | RAND Copyright Licensing Commitment: 43 | 44 | IN THE EVENT YOU WISH TO INCLUDE THE SOFTWARE IN A CONFORMING IMPLEMENTATION 45 | OF THIS ITU RECOMMENDATION, PLEASE BE FURTHER ADVISED THAT: 46 | 47 | The Software Copyright Holder will grant agrees to grant a copyright 48 | license on reasonable and non-discriminatory terms and conditions for 49 | the purpose of including the Software in a conforming implementation 50 | of the ITU Recommendation | ISO/IEC International 51 | Standard. Negotiations with regard to the license are left to the 52 | parties concerned and are performed outside of ITU | ISO/IEC. 53 | 54 | No patent licence is granted, nor is a patent licensing commitment made, by 55 | implication, estoppel or otherwise. 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | libjpeg 2 | ======= 3 | 4 | A complete implementation of 10918-1 (JPEG) coming from jpeg.org (the ISO group) with extensions for HDR standardized as 18477 (JPEG XT) 5 | 6 | This release also includes the "JPEG on Steroids" improvements implemented for the ICIP 2016 Grand Challenge on Image Compression. For ideal visual performance, run jpeg as follows: 7 | 8 | jpeg -q -oz -v -qt 3 -h -s 1x1,2x2,2x2 input.ppm output.jpg 9 | 10 | -------------------------------------------------------------------------------- /automakefile.in: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: automakefile.in,v 1.3 2020/04/08 10:05:29 thor Exp $ 3 | ## 4 | ####################################################################### 5 | ## Makefile for the jpeg project, 6 | ## THOR Software, May 20, 2012, Thomas Richter 7 | ####################################################################### 8 | ## 9 | ## 10 | ## The following variable defines the compiler we use 11 | ## for running the code. 12 | ## 13 | COMPILER_CMD = @COMPILER@ 14 | CC_ONLY = @CC_ONLY@ 15 | SETTINGS = @SETTINGS@ 16 | PREFIX = @PREFIX@ 17 | PTHREADCFLAGS = @PTHREAD_CFLAGS@ 18 | PTHREADLDFLAGS = @PTHREAD_CFLAGS@ 19 | PTHREADLIBS = @PTHREAD_LIBS@ 20 | HWTYPE = @HARDWARE@ 21 | HAVE_ADDONS = @HAVE_ADDONS@ 22 | BITSIZE = @BITSIZE@ 23 | ## 24 | ## Additional options 25 | ADDOPTS = -DUSE_AUTOCONF @FPU_OPTS@ @HW_DEFINE@ @ASSEMBLY_FLAG@ 26 | LIB_OPTS = @LIB_OPTS@ @LIB_PICOPTS@ -DBUILD_LIB 27 | EXTRA_LIBS = @LGCCS_OPTS@ @MALLOC_LIB@ 28 | WARNOPTS = @WARN_OPTS@ 29 | ## 30 | ## Miscellaneous compiler options 31 | CPU = @CPU@ 32 | TUNE = @TUNE@ 33 | -------------------------------------------------------------------------------- /boxes/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.15 2015/03/11 16:02:38 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = box superbox namespace filetypebox databox tonemapperbox \ 12 | inversetonemappingbox floattonemappingbox \ 13 | parametrictonemappingbox nonlineartrafobox colortrafobox \ 14 | dctbox outputconversionbox refinementspecbox mergingspecbox \ 15 | matrixbox lineartransformationbox floattransformationbox \ 16 | checksumbox alphabox 17 | 18 | DIRNAME = boxes 19 | SUPER = ../ 20 | 21 | include ../Makefile.template 22 | -------------------------------------------------------------------------------- /boxes/databox.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This box implements a data container for refinement scans, as hidden 43 | ** in the APP11 markers. 44 | ** 45 | ** $Id: databox.cpp,v 1.10 2014/09/30 08:33:14 thor Exp $ 46 | ** 47 | */ 48 | 49 | /// Includes 50 | #include "boxes/box.hpp" 51 | #include "boxes/databox.hpp" 52 | #include "io/bytestream.hpp" 53 | #include "io/memorystream.hpp" 54 | #include "io/decoderstream.hpp" 55 | /// 56 | 57 | /// DataBox::EncoderBufferOf 58 | // Return the byte stream buffer where the encoder can drop the data 59 | // on encoding. 60 | ByteStream *DataBox::EncoderBufferOf(void) 61 | { 62 | return OutputStreamOf(); 63 | } 64 | /// 65 | 66 | /// DataBox::DecoderBufferOf 67 | // Return the stream the decoder will decode from. 68 | ByteStream *DataBox::DecoderBufferOf(void) 69 | { 70 | return InputStreamOf(); 71 | } 72 | /// 73 | 74 | /// DataBox::Flush 75 | // Flush the buffered data of the box and create the markers. 76 | void DataBox::Flush(class ByteStream *target,UWORD enumerator) 77 | { 78 | WriteBoxContent(target,enumerator); 79 | } 80 | /// 81 | -------------------------------------------------------------------------------- /boxes/matrixbox.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This box keeps a linear matrix of unknown elements. It is a base class 43 | ** for either the fix or floating point transformation. 44 | ** 45 | ** $Id: matrixbox.cpp,v 1.3 2014/09/30 08:33:15 thor Exp $ 46 | ** 47 | */ 48 | -------------------------------------------------------------------------------- /boxes/tonemapperbox.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This abstract box keeps the data for any type of tone mapping. It can 43 | ** be substituted by an inverse tone mapping box or an 44 | ** inverse parametric tone mapping box. 45 | ** 46 | ** $Id: tonemapperbox.cpp,v 1.6 2014/09/30 08:33:15 thor Exp $ 47 | ** 48 | */ 49 | -------------------------------------------------------------------------------- /cmd/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.5 2015/03/11 16:02:41 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | XFILES = main bitmaphook filehook iohelpers tmo defaulttmoc \ 12 | encodea encodeb encodec reconstruct 13 | 14 | XDIST = 15 | 16 | DIRNAME = cmd 17 | SUPER = ../ 18 | 19 | include ../Makefile.template 20 | -------------------------------------------------------------------------------- /cmd/defaulttmoc.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file provides a simple TMO that provides fine quality and natural 43 | ** look in most cases. It is mostly a global Reinhard operator: 44 | ** Erik Reinhard and Kate Devlin. Dynamic Range Reduction Inspired by 45 | ** Photoreceptor Physiology. IEEE Transactions on Visualization and 46 | ** Computer Graphics (2004). 47 | ** 48 | ** This is the default TMO for profile C. 49 | ** 50 | ** $Id: defaulttmoc.hpp,v 1.2 2014/09/30 08:33:15 thor Exp $ 51 | ** 52 | */ 53 | 54 | #ifndef CMD_DEFAULTTMOC_HPP 55 | #define CMD_DEFAULTTMOC_HPP 56 | 57 | /// Includes 58 | #include "interface/types.hpp" 59 | #include "std/stdio.hpp" 60 | /// 61 | 62 | /// Prototypes 63 | extern void BuildToneMapping_C(FILE *in,int w,int h,int depth,int count,UWORD tonemapping[65536], 64 | bool flt,bool bigendian,bool xyz,int hiddenbits); 65 | /// 66 | 67 | /// 68 | #endif 69 | -------------------------------------------------------------------------------- /cmd/encodea.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** Parameter definition and encoding for profile A. 43 | ** 44 | ** $Id: encodea.cpp,v 1.31 2021/11/15 08:59:59 thor Exp $ 45 | ** 46 | */ 47 | 48 | /// Includes 49 | #include "cmd/encodea.hpp" 50 | #include "cmd/iohelpers.hpp" 51 | #include "cmd/main.hpp" 52 | #include "cmd/defaulttmoc.hpp" 53 | #include "cmd/bitmaphook.hpp" 54 | #include "cmd/filehook.hpp" 55 | #include "cmd/tmo.hpp" 56 | #include "interface/parameters.hpp" 57 | #include "interface/hooks.hpp" 58 | #include "interface/tagitem.hpp" 59 | #include "interface/jpeg.hpp" 60 | #include "tools/traits.hpp" 61 | #include "std/math.hpp" 62 | #include "std/assert.hpp" 63 | #include "std/string.hpp" 64 | #include "std/stdlib.hpp" 65 | -------------------------------------------------------------------------------- /cmd/encodea.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** Parameter definition and encoding for profile A. 43 | ** 44 | ** $Id: encodea.hpp,v 1.18 2021/11/15 08:59:59 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef CMD_ENCODEA_HPP 49 | #define CMD_ENCODEA_HPP 50 | 51 | /// Includes 52 | #include "interface/types.hpp" 53 | #include "std/stdio.hpp" 54 | #endif 55 | -------------------------------------------------------------------------------- /cmd/encodeb.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** Parameter definition and encoding for profile B. 43 | ** 44 | ** $Id: encodeb.cpp,v 1.42 2021/11/15 08:59:59 thor Exp $ 45 | ** 46 | */ 47 | 48 | /// Includes 49 | #include "cmd/encodeb.hpp" 50 | #include "cmd/iohelpers.hpp" 51 | #include "cmd/main.hpp" 52 | #include "cmd/bitmaphook.hpp" 53 | #include "cmd/filehook.hpp" 54 | #include "cmd/tmo.hpp" 55 | #include "interface/parameters.hpp" 56 | #include "interface/tagitem.hpp" 57 | #include "interface/hooks.hpp" 58 | #include "interface/jpeg.hpp" 59 | #include "tools/traits.hpp" 60 | #include "std/math.hpp" 61 | #include "std/stdlib.hpp" 62 | #include "std/string.hpp" 63 | #include "std/assert.hpp" 64 | -------------------------------------------------------------------------------- /cmd/encodeb.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** Parameter definition and encoding for profile B. 43 | ** 44 | ** $Id: encodeb.hpp,v 1.23 2021/11/15 08:59:59 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef CMD_ENCODEB_HPP 49 | #define CMD_ENCODEB_HPP 50 | 51 | /// Includes 52 | #include "interface/types.hpp" 53 | #include "std/stdio.hpp" 54 | #endif 55 | -------------------------------------------------------------------------------- /cmd/filehook.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This module implements the IO-Hook function that reads and writes 43 | ** the encoded data. 44 | ** 45 | ** $Id: filehook.hpp,v 1.2 2014/09/30 08:33:15 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef CMD_FILEHOOK_HPP 50 | #define CMD_FILEHOOK_HPP 51 | 52 | /// Includes 53 | #include "interface/types.hpp" 54 | /// 55 | 56 | /// Forwards 57 | struct JPG_Hook; 58 | struct JPG_TagItem; 59 | /// 60 | 61 | /// Prototypes 62 | extern JPG_LONG FileHook(struct JPG_Hook *hook, struct JPG_TagItem *tags); 63 | /// 64 | 65 | /// 66 | #endif 67 | -------------------------------------------------------------------------------- /cmd/main.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This header provides the main function. 43 | ** This main function is only a demo, it is not part of the libjpeg code. 44 | ** It is here to serve as an entry point for the command line image 45 | ** compressor. 46 | ** 47 | ** $Id: main.hpp,v 1.9 2015/03/11 16:02:42 thor Exp $ 48 | ** 49 | */ 50 | 51 | #ifndef CMD_MAIN_HPP 52 | #define CMD_MAIN_HPP 53 | 54 | /// Includes 55 | #include "interface/types.hpp" 56 | /// 57 | 58 | /// Prototypes 59 | extern int main(int argc,char **argv); 60 | extern void ParseSubsamplingFactors(UBYTE *sx,UBYTE *sy,const char *sub,int cnt); 61 | /// 62 | 63 | /// 64 | #endif 65 | -------------------------------------------------------------------------------- /cmd/reconstruct.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file includes the decompressor front-end of the 43 | ** command line interface. It doesn't do much except 44 | ** calling libjpeg. 45 | ** 46 | ** $Id: reconstruct.hpp,v 1.4 2017/11/28 13:08:03 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef CMD_RECONSTRUCT_HPP 51 | #define CMD_RECONSTRUCT_HPP 52 | 53 | /// Prototypes 54 | extern void Reconstruct(const char *infile,const char *outfile,int colortrafo,const char *alpha, 55 | bool upsample); 56 | /// 57 | 58 | /// 59 | #endif 60 | -------------------------------------------------------------------------------- /codestream/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.38 2014/11/16 15:49:58 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = encoder decoder tables image entropyparser rectanglerequest \ 12 | sequentialscan acsequentialscan \ 13 | predictorbase predictor \ 14 | predictivescan losslessscan aclosslessscan \ 15 | refinementscan acrefinementscan \ 16 | jpeglsscan singlecomponentlsscan lineinterleavedlsscan \ 17 | sampleinterleavedlsscan 18 | 19 | DIRNAME = codestream 20 | SUPER = ../ 21 | 22 | include ../Makefile.template 23 | -------------------------------------------------------------------------------- /codestream/decoder.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class parses the markers and holds the decoder together. 43 | ** 44 | ** $Id: decoder.hpp,v 1.17 2017/02/21 15:48:21 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef CODESTREAM_DECODER_HPP 49 | #define CODESTREAM_DECODER_HPP 50 | 51 | /// Include 52 | #include "interface/types.hpp" 53 | #include "tools/environment.hpp" 54 | /// 55 | 56 | /// Forwards 57 | class ByteStream; 58 | class Quantization; 59 | class HuffmanTable; 60 | class Frame; 61 | class Image; 62 | class Tables; 63 | /// 64 | 65 | /// class Decoder 66 | class Decoder : public JKeeper { 67 | // 68 | // The image object 69 | class Image *m_pImage; 70 | // 71 | public: 72 | Decoder(class Environ *env); 73 | // 74 | ~Decoder(void); 75 | // 76 | // Parse off the header, return the image in case 77 | // the header was parsed off completely. 78 | class Image *ParseHeaderIncremental(class ByteStream *io); 79 | // 80 | // Parse off the EOI marker at the end of the image. 81 | // Returns true if there are more scans in the file, 82 | // else false. 83 | bool ParseTrailer(class ByteStream *io); 84 | // 85 | // Parse off decoder parameters. 86 | void ParseTags(const struct JPG_TagItem *tags); 87 | }; 88 | /// 89 | 90 | /// 91 | #endif 92 | -------------------------------------------------------------------------------- /codestream/lineinterleavedlsscan.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** A JPEG LS scan interleaving the components line by line. 43 | ** 44 | ** $Id: lineinterleavedlsscan.hpp,v 1.8 2014/09/30 08:33:15 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef CODESTREAM_LINEINTERLEAVEDLSSCAN_HPP 49 | #define CODESTREAM_LINEINTERLEAVEDLSSCAN_HPP 50 | 51 | /// Includes 52 | #include "codestream/jpeglsscan.hpp" 53 | /// 54 | 55 | /// class LineInterleavedLSScan 56 | // A JPEG LS scan interleaving the components line by line. 57 | class LineInterleavedLSScan : public JPEGLSScan { 58 | // 59 | // 60 | public: 61 | // Create a new scan. This is only the base type. 62 | LineInterleavedLSScan(class Frame *frame,class Scan *scan,UBYTE near,const UBYTE *mapping,UBYTE point); 63 | // 64 | virtual ~LineInterleavedLSScan(void); 65 | // 66 | // Parse a single MCU in this scan. Return true if there are more 67 | // MCUs in this row. 68 | virtual bool ParseMCU(void); 69 | // 70 | // Write a single MCU in this scan. 71 | virtual bool WriteMCU(void); 72 | }; 73 | /// 74 | 75 | 76 | /// 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /codestream/predictor.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This is the abstract description for the predictor of the JPEG 44 | ** predictive scan types. They implement, templated by the prediction 45 | ** mode, the various lookup types from neighbours. 46 | ** 47 | ** $Id: predictor.cpp,v 1.1 2014/11/16 15:49:58 thor Exp $ 48 | ** 49 | */ 50 | 51 | /// Includes 52 | #include "tools/environment.hpp" 53 | #include "codestream/predictorbase.hpp" 54 | #include "codestream/predictor.hpp" 55 | /// 56 | 57 | -------------------------------------------------------------------------------- /codestream/sampleinterleavedlsscan.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** A JPEG LS scan interleaving samples of several components, 43 | ** sample by sample. 44 | ** 45 | ** $Id: sampleinterleavedlsscan.hpp,v 1.9 2014/09/30 08:33:15 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef CODESTREAM_SAMPLEINTERLEAVEDLSSCAN_HPP 50 | #define CODESTREAM_SAMPLEINTERLEAVEDLSSCAN_HPP 51 | 52 | /// Includes 53 | #include "codestream/jpeglsscan.hpp" 54 | /// 55 | 56 | /// class SampleInterleavedLSScan 57 | class SampleInterleavedLSScan : public JPEGLSScan { 58 | // 59 | // Collect component information and install the component dimensions. 60 | virtual void FindComponentDimensions(void); 61 | // 62 | public: 63 | // Create a new scan. This is only the base type. 64 | SampleInterleavedLSScan(class Frame *frame,class Scan *scan, 65 | UBYTE near,const UBYTE *mapping,UBYTE point); 66 | // 67 | virtual ~SampleInterleavedLSScan(void); 68 | // 69 | // Parse a single MCU in this scan. Return true if there are more 70 | // MCUs in this row. 71 | virtual bool ParseMCU(void); 72 | // 73 | // Write a single MCU in this scan. 74 | virtual bool WriteMCU(void); 75 | }; 76 | /// 77 | 78 | 79 | /// 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /codestream/singlecomponentlsscan.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** A JPEG LS scan covering only a single component. 43 | ** 44 | ** $Id: singlecomponentlsscan.hpp,v 1.8 2014/09/30 08:33:15 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef CODESTREAM_SINGLECOMPONENTLSSCAN_HPP 49 | #define CODESTREAM_SINGLECOMPONENTLSSCAN_HPP 50 | 51 | /// Includes 52 | #include "codestream/jpeglsscan.hpp" 53 | /// 54 | 55 | /// class SingleComponentLSScan 56 | class SingleComponentLSScan : public JPEGLSScan { 57 | // 58 | // 59 | public: 60 | // Create a new scan. This is only the base type. 61 | SingleComponentLSScan(class Frame *frame,class Scan *scan,UBYTE near,const UBYTE *mapping,UBYTE point); 62 | // 63 | virtual ~SingleComponentLSScan(void); 64 | // 65 | // Parse a single MCU in this scan. Return true if there are more 66 | // MCUs in this row. 67 | virtual bool ParseMCU(void); 68 | // 69 | // Write a single MCU in this scan. 70 | virtual bool WriteMCU(void); 71 | }; 72 | /// 73 | 74 | 75 | /// 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /coding/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.10 2012/05/20 16:17:27 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = decodertemplate huffmantemplate arithmetictemplate \ 12 | huffmancoder huffmandecoder blockrow quantizedrow \ 13 | arthdeco qmcoder huffmanstatistics actemplate 14 | 15 | DIRNAME = coding 16 | SUPER = ../ 17 | 18 | include ../Makefile.template 19 | -------------------------------------------------------------------------------- /coding/arithmetictemplate.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class is responsible for parsing the AC specific part of the 43 | ** DHT marker and generating the corresponding decoder classes. 44 | ** 45 | ** $Id: arithmetictemplate.cpp,v 1.8 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | 49 | /// Includes 50 | #include "coding/arithmetictemplate.hpp" 51 | #include "io/bytestream.hpp" 52 | /// 53 | 54 | /// ArithmeticTemplate::ArithmeticTemplate 55 | ArithmeticTemplate::ArithmeticTemplate(class Environ *env) 56 | : DecoderTemplate(env) 57 | { 58 | } 59 | /// 60 | 61 | /// ArithmeticTemplate::~ArithmeticTemplate 62 | ArithmeticTemplate::~ArithmeticTemplate(void) 63 | { 64 | } 65 | /// 66 | 67 | /// ArithmeticTemplate::ParseMarker 68 | void ArithmeticTemplate::ParseMarker(class ByteStream *) 69 | { 70 | } 71 | /// 72 | -------------------------------------------------------------------------------- /coding/arithmetictemplate.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class is responsible for parsing the AC specific part of the 43 | ** DHT marker and generating the corresponding decoder classes. 44 | ** 45 | ** $Id: arithmetictemplate.hpp,v 1.7 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef CODING_ARITHMETICTEMPLATE_HPP 50 | #define CODING_ARITHMETICTEMPLATE_HPP 51 | 52 | /// Includes 53 | #include "coding/decodertemplate.hpp" 54 | /// 55 | 56 | /// Forwards 57 | /// 58 | 59 | /// class ArithmeticTemplate 60 | class ArithmeticTemplate : public DecoderTemplate { 61 | // 62 | public: 63 | ArithmeticTemplate(class Environ *env); 64 | // 65 | ~ArithmeticTemplate(void); 66 | // 67 | // Parse the AC specific part of the DHT table. 68 | virtual void ParseMarker(class ByteStream *io); 69 | }; 70 | /// 71 | 72 | /// 73 | #endif 74 | 75 | 76 | -------------------------------------------------------------------------------- /coding/decodertemplate.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class is the abstract superclass for all decoder templates, i.e. 43 | ** classes that generate the classes for decoding bits to symbols. 44 | ** 45 | ** $Id: decodertemplate.cpp,v 1.7 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | -------------------------------------------------------------------------------- /coding/decodertemplate.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class is the abstract superclass for all decoder templates, i.e. 43 | ** classes that generate the classes for decoding bits to symbols. 44 | ** 45 | ** $Id: decodertemplate.hpp,v 1.7 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef CODING_DECODERTEMPLATE_HPP 50 | #define CODING_DECODERTEMPLATE_HPP 51 | 52 | /// Includes 53 | #include "tools/environment.hpp" 54 | /// 55 | 56 | /// Forwards 57 | class ByteStream; 58 | /// 59 | 60 | /// class DecoderTemplate 61 | class DecoderTemplate : public JKeeper { 62 | // 63 | public: 64 | DecoderTemplate(class Environ *env) 65 | : JKeeper(env) 66 | { } 67 | // 68 | virtual ~DecoderTemplate(void) 69 | { 70 | } 71 | // 72 | // Parse the huffman specific part of the DHT table. 73 | virtual void ParseMarker(class ByteStream *io) = 0; 74 | }; 75 | /// 76 | 77 | /// 78 | #endif 79 | -------------------------------------------------------------------------------- /coding/huffmandecoder.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class implements a decoder for a single group of bits in a huffman 43 | ** decoder. 44 | ** 45 | ** $Id: huffmandecoder.cpp,v 1.7 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | -------------------------------------------------------------------------------- /coding/quantizedrow.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This class represents one row of quantized data of coefficients, i.e. one 44 | ** row of 8x8 blocks. 45 | ** 46 | ** $Id: quantizedrow.cpp,v 1.10 2014/09/30 08:33:16 thor Exp $ 47 | ** 48 | */ 49 | -------------------------------------------------------------------------------- /coding/quantizedrow.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This class represents one row of quantized data of coefficients, i.e. one 44 | ** row of 8x8 blocks. 45 | ** 46 | ** $Id: quantizedrow.hpp,v 1.10 2014/09/30 08:33:16 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef CODING_QUANTIZEDROW_HPP 51 | #define CODING_QUANTIZEDROW_HPP 52 | 53 | /// Includes 54 | #include "tools/environment.hpp" 55 | #include "coding/blockrow.hpp" 56 | /// 57 | 58 | /// class QuantizedRow 59 | // This class represents one row of quantized data of coefficients, i.e. one 60 | // row of 8x8 blocks. 61 | class QuantizedRow : public BlockRow { 62 | // Nothing new in it. 63 | public: 64 | QuantizedRow(class Environ *env) 65 | : BlockRow(env) 66 | { } 67 | // 68 | ~QuantizedRow(void) 69 | { } 70 | }; 71 | /// 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /colortrafo/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.11 2014/09/12 11:40:43 thor Exp $ 3 | ## 4 | ## Makefile for the j2k transcoder project, 5 | ## THOR Software, 2. Jul. 2003, Thomas Richter for 6 | ## Pegasus Digital Imaging 7 | ## 8 | ## This sub-makefile includes definitions relative to this 9 | ## directory. 10 | ## 11 | 12 | FILES = colortrafo integertrafo floattrafo \ 13 | ycbcrtrafo multiplicationtrafo \ 14 | lslosslesstrafo trivialtrafo colortransformerfactory 15 | 16 | DIRNAME = colortrafo 17 | SUPER = ../ 18 | 19 | include ../Makefile.template 20 | -------------------------------------------------------------------------------- /colortrafo/colortrafo.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file provides the transformation from RGB to YCbCr 43 | ** 44 | ** $Id: colortrafo.cpp,v 1.8 2014/09/30 08:33:16 thor Exp $ 45 | ** 46 | */ 47 | 48 | /// Includes 49 | #include "tools/environment.hpp" 50 | #include "tools/rectangle.hpp" 51 | #include "interface/imagebitmap.hpp" 52 | #include "colortrafo/colortrafo.hpp" 53 | #include "tools/traits.hpp" 54 | /// 55 | -------------------------------------------------------------------------------- /colortrafo/floattrafo.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class is the base class for all floating-point based transformers, 43 | ** most notably profiles A and B of 18477-7. 44 | ** 45 | ** $Id: floattrafo.cpp,v 1.2 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | -------------------------------------------------------------------------------- /colortrafo/integertrafo.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file provides the base class for all integer-based transformations 43 | ** 44 | ** $Id: integertrafo.cpp,v 1.2 2014/09/30 08:33:16 thor Exp $ 45 | ** 46 | */ 47 | -------------------------------------------------------------------------------- /colortrafo/multiplicationtrafo.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file provides the transformation from RGB to YCbCr in the floating 43 | ** point profiles, profiles A and B of 18477-7. 44 | ** 45 | ** $Id: multiplicationtrafo.cpp,v 1.18 2020/04/08 10:05:41 thor Exp $ 46 | ** 47 | */ 48 | 49 | /// Includes 50 | #include "boxes/mergingspecbox.hpp" 51 | #include "colortrafo/colortrafo.hpp" 52 | #include "colortrafo/floattrafo.hpp" 53 | #include "colortrafo/multiplicationtrafo.hpp" 54 | #include "tools/numerics.hpp" 55 | #include "std/assert.hpp" 56 | -------------------------------------------------------------------------------- /colortrafo/multiplicationtrafo.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This file provides the transformation from RGB to YCbCr in the floating 43 | ** point profiles, profiles A and B of 18477-7. 44 | ** 45 | ** $Id: multiplicationtrafo.hpp,v 1.5 2014/10/13 13:06:42 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef COLORTRAFO_MULTIPLICATIONTRAFO_HPP 50 | #define COLORTRAFO_MULTIPLICATIONTRAFO_HPP 51 | 52 | /// Includes 53 | #include "tools/traits.hpp" 54 | #include "colortrafo/colortrafo.hpp" 55 | #include "colortrafo/trivialtrafo.hpp" 56 | #endif 57 | -------------------------------------------------------------------------------- /control/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.13 2013/03/05 08:12:39 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = bitmapctrl residualblockhelper \ 12 | blockctrl blockbuffer residualbuffer linebuffer \ 13 | blockbitmaprequester linebitmaprequester \ 14 | lineadapter blocklineadapter linelineadapter \ 15 | linemerger hierarchicalbitmaprequester bufferctrl 16 | 17 | DIRNAME = control 18 | 19 | SUPER = ../ 20 | 21 | include ../Makefile.template 22 | -------------------------------------------------------------------------------- /control/blockctrl.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class defines the minimal abstract interface the block based 43 | ** scan types require to access quantized data. 44 | ** 45 | ** $Id: blockctrl.cpp,v 1.10 2014/09/30 08:33:16 thor Exp $ 46 | ** 47 | */ 48 | 49 | -------------------------------------------------------------------------------- /control/bufferctrl.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This is a common subclass of both the class controlling the 44 | ** hierarchical process, the LineAdapter, as well as the class controlling 45 | ** direct communication with the user buffer, the BitmapCtrl. 46 | ** It only exists for casting between the two and to the target class, 47 | ** the line or block buffer. 48 | ** 49 | ** $Id: bufferctrl.cpp,v 1.7 2014/09/30 08:33:16 thor Exp $ 50 | ** 51 | */ 52 | 53 | -------------------------------------------------------------------------------- /control/residualbuffer.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class provides an access path to the residual image in the 43 | ** form consistent to the block buffer / buffer control class, except 44 | ** that all the regular accesses go to the residual part. It does not 45 | ** manage buffers itself, but requires a block bitmap requester as 46 | ** base to forward the requests to. 47 | ** 48 | ** $Id: residualbuffer.cpp,v 1.4 2014/09/30 08:33:16 thor Exp $ 49 | ** 50 | */ 51 | -------------------------------------------------------------------------------- /cptosvn: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make configure 4 | cp -a configure configure.in automakefile.in autoconfig.h.in Makefile Makefile_Settings.gcc Makefile.template README README.license README.history doxyconfig doxyfilter.py ../jpeg-svn 5 | for i in `find . -type d -not -name CVS`; do 6 | cp -a $i/*.hpp $i/*.cpp $i/Makefile ../jpeg-svn/$i/. 7 | done 8 | -------------------------------------------------------------------------------- /cutheader.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # $Id: cutheader.pl,v 1.1 2012-06-02 10:27:13 thor Exp $ 4 | # 5 | 6 | $line = ; 7 | if ($line =~ /\/\*\*/) { 8 | do { 9 | $line = ; 10 | } while ($line !~ /\*\*\/$/); 11 | } else { 12 | print $line; 13 | } 14 | 15 | while($line = ) { 16 | print $line; 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /dct/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.14 2016/10/28 13:58:53 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = dct idct liftingdct deringing 12 | 13 | DIRNAME = dct 14 | SUPER = ../ 15 | 16 | include ../Makefile.template 17 | -------------------------------------------------------------------------------- /dct/dct.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** Generic DCT transformation plus quantization class. 44 | ** All DCT implementations should derive from this. 45 | ** 46 | ** $Id: dct.cpp,v 1.9 2016/10/28 13:58:53 thor Exp $ 47 | ** 48 | */ 49 | 50 | 51 | /// Includes 52 | #include "dct/dct.hpp" 53 | 54 | /// DCT::ScanOrder 55 | // The scan order. 56 | #define P(x,y) ((x) + ((y) << 3)) 57 | const int DCT::ScanOrder[64] = { 58 | P(0,0), 59 | P(1,0),P(0,1), 60 | P(0,2),P(1,1),P(2,0), 61 | P(3,0),P(2,1),P(1,2),P(0,3), 62 | P(0,4),P(1,3),P(2,2),P(3,1),P(4,0), 63 | P(5,0),P(4,1),P(3,2),P(2,3),P(1,4),P(0,5), 64 | P(0,6),P(1,5),P(2,4),P(3,3),P(4,2),P(5,1),P(6,0), 65 | P(7,0),P(6,1),P(5,2),P(4,3),P(3,4),P(2,5),P(1,6),P(0,7), 66 | P(1,7),P(2,6),P(3,5),P(4,4),P(5,3),P(6,2),P(7,1), 67 | P(7,2),P(6,3),P(5,4),P(4,5),P(3,6),P(2,7), 68 | P(3,7),P(4,6),P(5,5),P(6,4),P(7,3), 69 | P(7,4),P(6,5),P(5,6),P(4,7), 70 | P(5,7),P(6,6),P(7,5), 71 | P(7,6),P(6,7), 72 | P(7,7) 73 | }; 74 | #undef P 75 | /// 76 | 77 | -------------------------------------------------------------------------------- /doxyfilter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from __future__ import print_function 4 | import fileinput 5 | import string 6 | import re 7 | 8 | commentblock = 0 9 | emptycomment = re.compile("^//$") 10 | fullcomment = re.compile("^//.") 11 | foldmarker = re.compile("^///") 12 | hppfile = re.compile("^.*\.hpp$") 13 | for line in fileinput.input(): 14 | if hppfile.match(fileinput.filename()): 15 | line = string.expandtabs(line) 16 | token = string.strip(line) 17 | indent = len(line) - len(string.lstrip(line)) 18 | if (indent > 0): 19 | blanks = string.ljust("", indent-1) 20 | else: 21 | blanks = "" 22 | if emptycomment.match(token): 23 | continue 24 | if fullcomment.match(token) and not foldmarker.match(token): 25 | if commentblock: 26 | print(re.sub("//", " ", line)) 27 | else: 28 | print() 29 | print(blanks) 30 | print("/*!") 31 | print(re.sub("//", " ", line)) 32 | commentblock = 1 33 | else: 34 | if commentblock: 35 | print(blanks) 36 | print(" */") 37 | print(line) 38 | commentblock = 0 39 | else: 40 | print(line) 41 | else: 42 | print(line) 43 | -------------------------------------------------------------------------------- /interface/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.4 2012/05/20 16:17:27 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = hooks parameters tagitem types jpgtypes \ 12 | imagebitmap bitmaphook jpeg 13 | 14 | DIRNAME = interface 15 | SUPER = ../ 16 | 17 | include ../Makefile.template 18 | -------------------------------------------------------------------------------- /interface/hooks.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * Customizable hooks. 43 | * 44 | * $Id: hooks.cpp,v 1.8 2014/09/30 08:33:17 thor Exp $ 45 | * 46 | * Hooks provide a standard method to supply call-out functions. 47 | * They are initialized by the client application and called by 48 | * the library. They pass data in terms of tag items. 49 | * They also pass client private data. 50 | * 51 | * This is part of the external interface of the jpeg 52 | * and visible to the outher world. 53 | */ 54 | -------------------------------------------------------------------------------- /interface/jpgtypes.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * System independent type definitions. 43 | * $Id: jpgtypes.cpp,v 1.8 2014/09/30 08:33:17 thor Exp $ 44 | * 45 | * The following header defines basic types to be used in the J2K interface 46 | * routines. 47 | * 48 | * These are external definitions, visible to the outher world and part of 49 | * the jpeg interface. 50 | */ 51 | -------------------------------------------------------------------------------- /interface/parameters.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * The following file describes various tag items provided for the 43 | * client application to define all the parameters the jpeg library 44 | * needs. 45 | * 46 | * $Id: parameters.cpp,v 1.8 2014/09/30 08:33:17 thor Exp $ 47 | * 48 | * These parameters are specified by the user upon invocation of 49 | * the library. 50 | * Note that due to the construction of tag lists, it is legal to 51 | * drop most of the parameters as well. 52 | * In this case, the library will pick useful defaults, or defaults 53 | * it considers as useful, whatever this would mean for you. 54 | */ 55 | -------------------------------------------------------------------------------- /interface/types.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * Type definition: Some system independent type definitions 43 | * (thor's pecularities) 44 | * $Id: types.cpp,v 1.7 2014/09/30 08:33:17 thor Exp $ 45 | * 46 | * The following header defines basic types to be used in the J2K interface 47 | * routines. Especially, this file must be adapted if your compiler has 48 | * different ideas what a "unsigned long" is as we *MUST* fix the width 49 | * of elementary data types. Especially, do not use types not defined here for 50 | * interface glue routines. 51 | * 52 | * This is the "internal" header file defining internal types, importing the 53 | * types from the external "jpgtypes" header. 54 | */ 55 | 56 | -------------------------------------------------------------------------------- /io/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.7 2014/02/06 13:10:55 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = bytestream randomaccessstream iostream bitstream \ 12 | memorystream decoderstream staticstream checksumadapter 13 | 14 | DIRNAME = io 15 | SUPER = ../ 16 | 17 | include ../Makefile.template 18 | -------------------------------------------------------------------------------- /io/staticstream.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** An implementation of the ByteStream that reads from or writes to 43 | ** a static buffer allocated outside of this class. 44 | ** $Id: staticstream.cpp,v 1.7 2014/09/30 08:33:17 thor Exp $ 45 | ** 46 | */ 47 | -------------------------------------------------------------------------------- /marker/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.16 2016/10/28 13:58:54 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = quantization quantizationtable \ 12 | huffmantable frame component scan \ 13 | adobemarker jfifmarker exifmarker \ 14 | actable restartintervalmarker scantypes \ 15 | thresholds lscolortrafo 16 | 17 | DIRNAME = marker 18 | SUPER = ../ 19 | 20 | include ../Makefile.template 21 | -------------------------------------------------------------------------------- /marker/exifmarker.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class represents the EXIF marker, placed in APP1. This 43 | ** marker is currently only a dummy and not actually used. 44 | ** 45 | ** $Id: exifmarker.hpp,v 1.6 2014/09/30 08:33:17 thor Exp $ 46 | ** 47 | */ 48 | 49 | #ifndef MARKER_EXIFMARKER_HPP 50 | #define MARKER_EXIFMARKER_HPP 51 | 52 | /// Includes 53 | #include "tools/environment.hpp" 54 | /// 55 | 56 | /// Forwards 57 | class ByteStream; 58 | /// 59 | 60 | /// class EXIFMarker 61 | // This class collects the EXIF information 62 | class EXIFMarker : public JKeeper { 63 | // 64 | // Really nothing in it right now. 65 | // 66 | public: 67 | // 68 | EXIFMarker(class Environ *env); 69 | // 70 | ~EXIFMarker(void); 71 | // 72 | // Write the marker to the stream. 73 | void WriteMarker(class ByteStream *io); 74 | // 75 | // Parse the EXIF marker from the stream 76 | // This will throw in case the marker is not 77 | // recognized. The caller will have to catch 78 | // the exception. 79 | void ParseMarker(class ByteStream *io,UWORD len); 80 | }; 81 | /// 82 | 83 | /// 84 | #endif 85 | -------------------------------------------------------------------------------- /marker/quantizationtable.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class represents a quantization table of 64 UWORD 43 | ** entries, plus the statistics that have been measured for 44 | ** this particular table to optimize the quality. 45 | ** 46 | ** $Id: quantizationtable.cpp,v 1.2 2016/10/28 13:58:54 thor Exp $ 47 | ** 48 | */ 49 | 50 | /// Includes 51 | #include "std/string.hpp" 52 | #include "std/math.hpp" 53 | #include "tools/environment.hpp" 54 | #include "marker/quantizationtable.hpp" 55 | /// 56 | 57 | /// QuantizationTable::DefineBucketSizes 58 | // Create a table from 64 already defined quantizer values. 59 | void QuantizationTable::DefineBucketSizes(const UWORD table[64]) 60 | { 61 | memcpy(m_usDelta,table,sizeof(m_usDelta)); 62 | } 63 | /// 64 | -------------------------------------------------------------------------------- /marker/quantizationtable.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This class represents a quantization table of 64 UWORD 43 | ** entries, plus the statistics that have been measured for 44 | ** this particular table to optimize the quality. 45 | ** 46 | ** $Id: quantizationtable.hpp,v 1.2 2016/10/28 13:58:54 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef MARKER_QUANTIZATIONTABLE_HPP 51 | #define MARKER_QUANTIZATIONTABLE_HPP 52 | 53 | /// Includes 54 | #include "tools/environment.hpp" 55 | /// 56 | 57 | /// class QuantizationTable 58 | // This class describes a single quantization table plus all the statistics 59 | // of this table. 60 | class QuantizationTable : public JKeeper { 61 | // 62 | // The actual quantization values. 63 | UWORD m_usDelta[64]; 64 | // 65 | public: 66 | QuantizationTable(class Environ *env) 67 | : JKeeper(env) 68 | { } 69 | // 70 | ~QuantizationTable(void) 71 | { } 72 | // 73 | // Redefine the bucket sizes, install the default deadzone sizes 74 | // for the given bucket sizes. 75 | void DefineBucketSizes(const UWORD deltas[64]); 76 | // 77 | // Return the table of quantization settings. 78 | const UWORD *DeltasOf(void) const 79 | { 80 | return m_usDelta; 81 | } 82 | // 83 | }; 84 | /// 85 | 86 | /// 87 | #endif 88 | -------------------------------------------------------------------------------- /marker/scantypes.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** Represents the scan including the scan header for the 44 | ** arithmetic coding procedure. 45 | ** 46 | ** $Id: scantypes.cpp,v 1.7 2014/09/30 08:33:17 thor Exp $ 47 | ** 48 | */ 49 | -------------------------------------------------------------------------------- /marker/scantypes.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** Represents the scan including the scan header for the 44 | ** arithmetic coding procedure. 45 | ** 46 | ** $Id: scantypes.hpp,v 1.12 2015/02/25 16:09:42 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef MARKER_SCANTYPES_HPP 51 | #define MARKER_SCANTYPES_HPP 52 | 53 | enum ScanType { 54 | Baseline, // also sequential 55 | Sequential, 56 | Progressive, 57 | Lossless, 58 | DifferentialSequential, 59 | DifferentialProgressive, 60 | DifferentialLossless, 61 | Dimensions, // internal use only: This is the frame that holds the DHP marker. 62 | ACSequential, // AC-coded sequential 63 | ACProgressive, // AC-coded progressive 64 | ACLossless, // AC-coded lossless 65 | ACDifferentialSequential, 66 | ACDifferentialProgressive, 67 | ACDifferentialLossless, 68 | Residual, // New scan types 69 | ACResidual, 70 | ResidualProgressive, 71 | ACResidualProgressive, 72 | ResidualDCT, // HugeDCT scan type added in the Sydney meeting 73 | ACResidualDCT, // unofficial 74 | JPEG_LS // not part of 10918, but handled here as well. 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /newheader: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat >/tmp/hdr < 34 | 35 | This program is free software: you can redistribute it and/or modify 36 | it under the terms of the GNU General Public License as published by 37 | the Free Software Foundation, either version 3 of the License, or 38 | (at your option) any later version. 39 | 40 | This program is distributed in the hope that it will be useful, 41 | but WITHOUT ANY WARRANTY; without even the implied warranty of 42 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 43 | GNU General Public License for more details. 44 | 45 | You should have received a copy of the GNU General Public License 46 | along with this program. If not, see . 47 | 48 | *************************************************************************/ 49 | EOF 50 | 51 | for i in */*.hpp; do 52 | cp /tmp/hdr /tmp/t 53 | cutheader.pl <$i >>/tmp/t 54 | mv /tmp/t $i 55 | done; 56 | 57 | for i in */*.cpp; do 58 | cp /tmp/hdr /tmp/t 59 | cutheader.pl <$i >>/tmp/t 60 | mv /tmp/t $i 61 | done; 62 | -------------------------------------------------------------------------------- /std/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.2 2012/05/20 16:17:27 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = stdlib stdio math stdarg setjmp \ 12 | errno string ctype stddef unistd \ 13 | assert 14 | 15 | XFILES = 16 | 17 | DIRNAME = std 18 | SUPER = ../ 19 | 20 | include ../Makefile.template 21 | -------------------------------------------------------------------------------- /std/assert.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** An abstraction layer around the standard assert call. This also 44 | ** translates the jpeg CHECK_LEVEL into the apropriate macros for assert(). 45 | ** 46 | ** $Id: assert.cpp,v 1.8 2014/09/30 08:33:17 thor Exp $ 47 | */ 48 | -------------------------------------------------------------------------------- /std/assert.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** An abstraction layer around the standard assert call. This also 44 | ** translates the jpeg CHECK_LEVEL into the apropriate macros for assert(). 45 | ** 46 | ** $Id: assert.hpp,v 1.8 2014/09/30 08:33:17 thor Exp $ 47 | */ 48 | 49 | #ifndef STD_ASSERT_HPP 50 | #define STD_ASSERT_HPP 51 | 52 | # if HAVE_ASSERT_H 53 | # if CHECK_LEVEL > 0 54 | # undef NDEBUG 55 | # include 56 | # else 57 | # define assert(x) 58 | # endif 59 | # else 60 | # if CHECK_LEVEL > 0 61 | # define assert(x) { if(!(x)) {volatile char *x = NULL; *x = 0;}} 62 | # else 63 | # define assert(x) 64 | # endif 65 | # endif 66 | #endif 67 | -------------------------------------------------------------------------------- /std/ctype.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | #include "config.h" 43 | #if !defined(HAVE_CTYPE_H) || !defined(HAVE_ISSPACE) 44 | int isspace(int c) 45 | { 46 | if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v') 47 | return 1; 48 | return 0; 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /std/ctype.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the ctype 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: ctype.hpp,v 1.7 2014/09/30 08:33:17 thor Exp $ 48 | */ 49 | 50 | #ifndef CTYPE_HPP 51 | #define CTYPE_HPP 52 | #include "config.h" 53 | 54 | #if defined(HAVE_CTYPE_H) && defined(HAVE_ISSPACE) 55 | #include 56 | #else 57 | extern int isspace(int c); 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /std/errno.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | #include "config.h" 43 | #if !defined(HAVE_ERRNO_H) 44 | int errno = 0; 45 | #endif 46 | -------------------------------------------------------------------------------- /std/errno.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: errno.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef ERRNO_HPP 51 | #define ERRNO_HPP 52 | 53 | #include "config.h" 54 | #if defined(HAVE_ERRNO_H) 55 | #include 56 | #else 57 | // Must provide some dummy values 58 | #define ENOENT -1024 59 | #define EACCES -1025 60 | extern int errno; 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /std/math.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/math.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: math.hpp,v 1.8 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef MATH_HPP 51 | #define MATH_HPP 52 | 53 | #if HAVE_MATH_H 54 | #include 55 | #ifdef DEPLOY_PICCLIB 56 | # if defined(__cplusplus) 57 | extern "C" { 58 | # endif 59 | # include "pegasus/picclib.h" 60 | # if defined(__cplusplus) 61 | } 62 | # endif 63 | #endif 64 | 65 | // Check or add isnan and/or isinf 66 | #ifndef isnan 67 | # define isnan(x) ((x) != (x)) 68 | # ifdef _MSC_VER 69 | # define nan(x) ((HUGE_VAL+HUGE_VAL)-(HUGE_VAL+HUGE_VAL)) 70 | # endif 71 | #endif 72 | #ifndef isinf 73 | # define isinf(x) (!isnan(x) && (isnan((x) - (x)))) 74 | #endif 75 | 76 | #else 77 | #error "math.h header not available, won't compile without" 78 | #endif 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /std/setjmp.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/setjmp.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: setjmp.hpp,v 1.8 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef SETJMP_HPP 51 | #define SETJMP_HPP 52 | #include "config.h" 53 | 54 | #ifdef DEPLOY_PICCLIB 55 | # include "pegasus/setjmp.h" 56 | #else 57 | # if defined(HAVE_SETJMP_H) && defined(HAVE_LONGJMP) 58 | # include 59 | # else 60 | # error "setjmp and longjmp are not available, won't compile without" 61 | # endif 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /std/stdarg.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/stdarg.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: stdarg.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef STDARG_HPP 51 | #define STDARG_HPP 52 | #include "config.h" 53 | 54 | #if defined(HAVE_STDARG_H) 55 | #include 56 | #else 57 | #error "No stdarg.h header available, won't compile without" 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /std/stddef.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/stddef.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stddef 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: stddef.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef STDDEF_HPP 51 | #define STDDEF_HPP 52 | #include "config.h" 53 | 54 | #if defined(HAVE_STDDEF_H) && defined(HAS_PTRDIFF_T) 55 | #include 56 | #else 57 | typedef long ptrdiff_t; 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /std/stdio.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | #include "stdio.hpp" 43 | 44 | #ifndef HAVE_VSNPRINTF 45 | int vsnprintf(char *str, size_t size, const char *format, va_list ap) 46 | { 47 | return vsprintf(str,format,ap); 48 | } 49 | #endif 50 | 51 | #ifndef HAVE_SNPRINTF 52 | int TYPE_CDECL snprintf(char *str,size_t size,const char *format,...) 53 | { 54 | int result; 55 | va_list args; 56 | 57 | va_start(args,format); 58 | result = vsnprintf(str,size,format,args); 59 | 60 | va_end(args); 61 | 62 | return result; 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /std/stdio.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: stdio.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef STDIO_HPP 51 | #define STDIO_HPP 52 | #include "config.h" 53 | 54 | #if defined(HAVE_STDIO_H) 55 | #include 56 | #else 57 | #error "stdio.h not available, won't compile without" 58 | #endif 59 | 60 | #ifndef HAVE_VSNPRINTF 61 | #include "std/stdarg.hpp" 62 | extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); 63 | #endif 64 | 65 | #ifndef HAVE_SNPRINTF 66 | #include "std/stdarg.hpp" 67 | extern int TYPE_CDECL snprintf(char *str,size_t size,const char *format,...); 68 | #endif 69 | 70 | // Replace fopen by fopen64 if this is available. 71 | #ifdef HAVE_FOPEN64 72 | # define fopen fopen64 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /std/stdlib.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/stdlib.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /* 43 | ** This is an Os abstraction of the stdlib 44 | ** include file. It might possibly contain fixes for 45 | ** various Os derivations from the intended stdlib. 46 | ** 47 | ** $Id: stdlib.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 48 | */ 49 | 50 | #ifndef STDLIB_HPP 51 | #define STDLIB_HPP 52 | #include "config.h" 53 | 54 | #ifdef DEPLOY_PICCLIB 55 | # if defined(__cplusplus) 56 | extern "C" { 57 | # endif 58 | # if defined(__IS_powerpc__) 59 | # include 60 | # endif 61 | # include "pegasus/picclib.h" 62 | # if defined(__cplusplus) 63 | } 64 | # endif 65 | #else 66 | # if STDC_HEADERS 67 | # include 68 | # include 69 | # else 70 | # if HAVE_STDLIB_H 71 | # include 72 | # endif 73 | # endif 74 | #endif 75 | 76 | #if !defined(HAVE_STRTOL) 77 | #error "strtol not available, won't compile without" 78 | #endif 79 | #if !defined(HAVE_STRTOD) 80 | #error "strtod not available, won't compile without" 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /std/string.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /std/unistd.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | 42 | /// Includes 43 | #include "unistd.hpp" 44 | #include "math.hpp" 45 | /// 46 | 47 | #ifndef HAVE_SLEEP 48 | #ifdef WIN32 49 | // Comes with its own "sleep" version 50 | #include 51 | unsigned int sleep(unsigned int seconds) 52 | { 53 | Sleep(seconds * 1000); 54 | return 0; 55 | } 56 | #else 57 | unsigned int sleep(unsigned int seconds) 58 | { 59 | int x; 60 | 61 | // Pretty stupid default implementation 62 | seconds <<= 8; 63 | while(seconds > 0) { 64 | double y = 1.1; 65 | for(x = 0;x < 32767;x++) { 66 | // Just keep it busy. 67 | y = pow(y,y); 68 | if (y > 2.0) 69 | y /= 2.0; 70 | 71 | } 72 | seconds--; 73 | } 74 | return 0; 75 | } 76 | #endif 77 | #endif 78 | 79 | 80 | /// longseek 81 | // A generic 64-bit version of seek 82 | long long longseek(int stream,long long offset,int whence) 83 | { 84 | #if defined(HAVE_LSEEK64) 85 | return lseek64(stream,offset,whence); 86 | #elif defined(HAVE_LLSEEK) 87 | return llseek(stream,offset,whence); 88 | #elif defined(HAVE_LSEEK) 89 | return lseek(stream,offset,whence); 90 | #elif defined(HAVE__LSEEKI64) 91 | return _lseeki64(stream,offset,whence); 92 | #else 93 | // No seeking possible. 94 | return -1; 95 | #endif 96 | } 97 | /// 98 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.7 2014/02/06 13:10:56 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = debug environment traits rectangle line \ 12 | priorityqueue numerics checksum 13 | 14 | XFILES = 15 | 16 | XDIST = 17 | 18 | DIRNAME = tools 19 | SUPER = ../ 20 | 21 | include ../Makefile.template 22 | -------------------------------------------------------------------------------- /tools/checksum.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** This helper class keeps and updates the checksum over the legacy 43 | ** JPEG stream. 44 | ** 45 | ** $Id: checksum.cpp,v 1.3 2014/09/30 08:33:18 thor Exp $ 46 | ** 47 | */ 48 | 49 | /// Includes 50 | #include "tools/checksum.hpp" 51 | /// 52 | -------------------------------------------------------------------------------- /tools/debug.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * Definitions and functions required for debugging. 43 | * This must be turned off for final code by means of a switch. 44 | * 45 | * $Id: debug.cpp,v 1.8 2014/09/30 08:33:18 thor Exp $ 46 | * 47 | */ 48 | 49 | -------------------------------------------------------------------------------- /tools/debug.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * Definitions and functions required for debugging. 43 | * This must be turned off for final code by means of a switch. 44 | * 45 | * $Id: debug.hpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 46 | * 47 | */ 48 | 49 | #ifndef DEBUG_HPP 50 | 51 | #if DEBUG_LEVEL > 0 || CHECK_LEVEL > 0 52 | #include "std/stdio.hpp" 53 | #endif 54 | 55 | #include "std/assert.hpp" 56 | 57 | #if DEBUG_LEVEL > 2 58 | #define KP(a) a 59 | #else 60 | #define KP(a) 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /tools/line.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This class is a helper to keep a linked list of one-D lines 44 | ** for buffering purposes. 45 | ** 46 | ** $Id: line.cpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 47 | ** 48 | */ 49 | -------------------------------------------------------------------------------- /tools/line.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This class is a helper to keep a linked list of one-D lines 44 | ** for buffering purposes. 45 | ** 46 | ** $Id: line.hpp,v 1.8 2014/09/30 08:33:18 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef TOOLS_LINE_HPP 51 | #define TOOLS_LINE_HPP 52 | 53 | /// Includes 54 | #include "tools/environment.hpp" 55 | /// 56 | 57 | /// struct Line 58 | // A single line containing the source data for upsampling. 59 | struct Line : public JObject { 60 | // 61 | // The data. Width is not kept here. 62 | LONG *m_pData; 63 | // 64 | // Pointer to the next line. 65 | struct Line *m_pNext; 66 | // 67 | #if CHECK_LEVEL > 0 68 | void *m_pOwner; 69 | #endif 70 | // 71 | Line(void) 72 | : m_pData(NULL), m_pNext(NULL) 73 | { } 74 | }; 75 | /// 76 | 77 | /// 78 | #endif 79 | -------------------------------------------------------------------------------- /tools/priorityqueue.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** PriorityQueue: This is a base object that allows byte indexed 44 | ** priority sorted queues, as for example used for the buffers of 45 | ** the generic box extension layer. 46 | ** 47 | ** $Id: priorityqueue.cpp,v 1.6 2014/09/30 08:33:18 thor Exp $ 48 | ** 49 | */ 50 | -------------------------------------------------------------------------------- /tools/rectangle.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | * Definition of a rectangle. 43 | * 44 | * $Id: rectangle.cpp,v 1.7 2014/09/30 08:33:18 thor Exp $ 45 | * 46 | * This defines a rectangular array of pixels in some domain. 47 | * It is just a structure, not a class, and only used as a 48 | * tiny helper structure that I'm going to use here and there. 49 | * 50 | */ 51 | -------------------------------------------------------------------------------- /tools/traits.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | -------------------------------------------------------------------------------- /upsampling/Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | ## $Id: Makefile,v 1.7 2017/06/02 21:17:40 thor Exp $ 3 | ## 4 | ## Makefile for the jpeg transcoder project, 5 | ## THOR Software, May 20, 2012, Thomas Richter 6 | ## 7 | ## This sub-makefile includes definitions relative to this 8 | ## directory. 9 | ## 10 | 11 | FILES = upsamplerbase upsampler cositedupsampler \ 12 | downsamplerbase downsampler interdownsampler 13 | 14 | DIRNAME = upsampling 15 | SUPER = ../ 16 | 17 | include ../Makefile.template 18 | -------------------------------------------------------------------------------- /upsampling/cositedupsampler.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This file defines a class that implements the component upsampling 44 | ** procedure. 45 | ** This upsampler implements the normative cosited upsampling process. 46 | ** 47 | ** $Id: cositedupsampler.hpp,v 1.1 2017/05/19 10:56:25 thor Exp $ 48 | ** 49 | */ 50 | 51 | #ifndef COSITEDUPSAMPLING_UPSAMPLER_HPP 52 | #define COSITEDUPSAMPLING_UPSAMPLER_HPP 53 | 54 | /// Includes 55 | #include "tools/environment.hpp" 56 | #include "tools/rectangle.hpp" 57 | #include "upsampling/upsamplerbase.hpp" 58 | /// 59 | 60 | /// Class CositedUpsampler 61 | // This class performs the upsampling process. 62 | template 63 | class CositedUpsampler : public UpsamplerBase { 64 | // 65 | // 66 | public: 67 | CositedUpsampler(class Environ *env,ULONG width,ULONG height); 68 | // 69 | virtual ~CositedUpsampler(void); 70 | // 71 | // The actual upsampling process. 72 | virtual void UpsampleRegion(const RectAngle &r,LONG *buffer) const; 73 | // 74 | }; 75 | /// 76 | 77 | /// 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /upsampling/downsampler.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** The actual downsampling implementation. This is a simple box filter. 43 | ** 44 | ** $Id: downsampler.hpp,v 1.11 2018/07/27 06:56:43 thor Exp $ 45 | ** 46 | */ 47 | 48 | #ifndef UPSAMPLING_DOWNSAMPLER_HPP 49 | #define UPSAMPLING_DOWNSAMPLER_HPP 50 | 51 | /// Includes 52 | #include "tools/environment.hpp" 53 | #include "tools/rectangle.hpp" 54 | #include "upsampling/downsamplerbase.hpp" 55 | /// 56 | 57 | /// Class Downsampler 58 | // This class implements the downsampling process 59 | // with several downsampling factors. 60 | template 61 | class Downsampler : public DownsamplerBase { 62 | // 63 | public: 64 | Downsampler(class Environ *env,ULONG width,ULONG height); 65 | // 66 | virtual ~Downsampler(void); 67 | // 68 | // The actual downsampling process. To be implemented by the actual 69 | // classes inheriting from this. Coordinates are in the downsampled 70 | // block domain the block indices. Requires an output buffer that 71 | // will keep the downsampled data. 72 | virtual void DownsampleRegion(LONG bx,LONG by,LONG *buffer) const; 73 | // 74 | }; 75 | /// 76 | 77 | /// 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /upsampling/upsampler.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | 3 | This project implements a complete(!) JPEG (Recommendation ITU-T 4 | T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to 5 | encode and decode JPEG streams. 6 | It also implements ISO/IEC 18477 aka JPEG XT which is an extension 7 | towards intermediate, high-dynamic-range lossy and lossless coding 8 | of JPEG. In specific, it supports ISO/IEC 18477-3/-6/-7/-8 encoding. 9 | 10 | Note that only Profiles C and D of ISO/IEC 18477-7 are supported 11 | here. Check the JPEG XT reference software for a full implementation 12 | of ISO/IEC 18477-7. 13 | 14 | Copyright (C) 2012-2018 Thomas Richter, University of Stuttgart and 15 | Accusoft. (C) 2019-2020 Thomas Richter, Fraunhofer IIS. 16 | 17 | This program is available under two licenses, GPLv3 and the ITU 18 | Software licence Annex A Option 2, RAND conditions. 19 | 20 | For the full text of the GPU license option, see README.license.gpl. 21 | For the full text of the ITU license option, see README.license.itu. 22 | 23 | You may freely select between these two options. 24 | 25 | For the GPL option, please note the following: 26 | 27 | This program is free software: you can redistribute it and/or modify 28 | it under the terms of the GNU General Public License as published by 29 | the Free Software Foundation, either version 3 of the License, or 30 | (at your option) any later version. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License 38 | along with this program. If not, see . 39 | 40 | *************************************************************************/ 41 | /* 42 | ** 43 | ** This file defines a class that implements the component upsampling 44 | ** procedure. 45 | ** 46 | ** $Id: upsampler.hpp,v 1.12 2018/07/27 06:56:43 thor Exp $ 47 | ** 48 | */ 49 | 50 | #ifndef UPSAMPLING_UPSAMPLER_HPP 51 | #define UPSAMPLING_UPSAMPLER_HPP 52 | 53 | /// Includes 54 | #include "tools/environment.hpp" 55 | #include "tools/rectangle.hpp" 56 | #include "upsampling/upsamplerbase.hpp" 57 | /// 58 | 59 | /// Class Upsampler 60 | // This class performs the upsampling process. 61 | template 62 | class Upsampler : public UpsamplerBase { 63 | // 64 | // 65 | public: 66 | Upsampler(class Environ *env,ULONG width,ULONG height); 67 | // 68 | virtual ~Upsampler(void); 69 | // 70 | // The actual upsampling process. 71 | virtual void UpsampleRegion(const RectAngle &r,LONG *buffer) const; 72 | // 73 | }; 74 | /// 75 | 76 | /// 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /vs10.0/jpeg/jpeg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg\jpeg.vcxproj", "{AC527D40-8A13-403B-8D79-9DD1A2F66A0E}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeglib", "jpeglib\jpeglib.vcxproj", "{AD8E036E-0C26-4559-A0C9-8EB924030BEF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpegdll", "jpegdll\jpegdll.vcxproj", "{2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.Build.0 = Debug|Win32 18 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.ActiveCfg = Release|Win32 19 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.Build.0 = Release|Win32 20 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.Build.0 = Debug|Win32 22 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.ActiveCfg = Release|Win32 23 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.Build.0 = Release|Win32 24 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.Build.0 = Debug|Win32 26 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.ActiveCfg = Release|Win32 27 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /vs10.0/jpeg/jpegdll/jpegdll.cpp: -------------------------------------------------------------------------------- 1 | // There needs to be SOME input file for any project. Could be empty. 2 | 3 | // But I also wish to incur DLL exporting on the main interface classes. 4 | 5 | // It should THEORETICALLY be enough to do this: 6 | 7 | #include "interface/jpeg.hpp" 8 | #include "interface/hooks.hpp" 9 | #include "interface/tagitem.hpp" 10 | 11 | // Together with the global define J2K_EXPORT=__declspecl(dllexport) (see 12 | // Project > Settings > C/C++ > Preprocessor > Preprocessor definitions:), 13 | // that should cause the proper classes to be exported. At least according 14 | // to the MS Visual Studio's builtin documentation. This scheme replaces 15 | // .def files, which don't work well with C++ (name decoration issue). 16 | 17 | // In practice, that doesn't work because the compiler turns a class EXPORT 18 | // into an EXPORT for each member. But it doesn't emit any code 19 | // for classes/members that are simply declared. It only emits code if a 20 | // DEFINITION is seen. And if there isn't any code, the linker can't see 21 | // the export tag. 22 | 23 | // Actually, that whole problem is quite understandable, and the setup is 24 | // pretty sane. But it leaves us with the problem of how to tell the linker 25 | // to export these classes. 26 | 27 | // I haven't found ANY good workaround. Candidates are things like: 28 | // - class tempXCC : public /* virtual */ J2K {}; 29 | // - void tempXFC (void) { J2K wc; } 30 | // The second DOES at least export SOME members (namely constructors, 31 | // destructors and class info). 32 | 33 | // The following is the only thing I found that works. Drawback is that now 34 | // I HAVE to set all the Compiler options JUST like while compiling the static 35 | // lib, and I won't get a warning if I don't (but the .dll won't work...). 36 | // Real error prone. 37 | 38 | #include "interface/jpeg.hpp" 39 | -------------------------------------------------------------------------------- /vs10.0/jpeg/jpegdll/jpegdll.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thorfdbg/libjpeg/c719010a26ce0c666e98b2acf924ad5fc24b4f5d/vs10.0/jpeg/jpegdll/jpegdll.rc -------------------------------------------------------------------------------- /vs10.0/jpeg/jpegdll/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by jpegdll.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /vs10.0/jpeg/jpegdll/tagitemdll.cpp: -------------------------------------------------------------------------------- 1 | 2 | // I wish to incur DLL exporting on the main interface classes. 3 | 4 | // It should THEORETICALLY be enough to do this: 5 | 6 | #include "interface/tagitem.hpp" 7 | 8 | // See j2kdll.cpp 9 | 10 | #include "interface/tagitem.cpp" 11 | -------------------------------------------------------------------------------- /vs12.0/jpeg/jpeg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg\jpeg.vcxproj", "{AC527D40-8A13-403B-8D79-9DD1A2F66A0E}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeglib", "jpeglib\jpeglib.vcxproj", "{AD8E036E-0C26-4559-A0C9-8EB924030BEF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpegdll", "jpegdll\jpegdll.vcxproj", "{2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.Build.0 = Debug|Win32 18 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.ActiveCfg = Release|Win32 19 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.Build.0 = Release|Win32 20 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.Build.0 = Debug|Win32 22 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.ActiveCfg = Release|Win32 23 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.Build.0 = Release|Win32 24 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.Build.0 = Debug|Win32 26 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.ActiveCfg = Release|Win32 27 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /vs12.0/jpeg/jpegdll/jpegdll.cpp: -------------------------------------------------------------------------------- 1 | // There needs to be SOME input file for any project. Could be empty. 2 | 3 | // But I also wish to incur DLL exporting on the main interface classes. 4 | 5 | // It should THEORETICALLY be enough to do this: 6 | 7 | #include "interface/jpeg.hpp" 8 | #include "interface/hooks.hpp" 9 | #include "interface/tagitem.hpp" 10 | 11 | // Together with the global define J2K_EXPORT=__declspecl(dllexport) (see 12 | // Project > Settings > C/C++ > Preprocessor > Preprocessor definitions:), 13 | // that should cause the proper classes to be exported. At least according 14 | // to the MS Visual Studio's builtin documentation. This scheme replaces 15 | // .def files, which don't work well with C++ (name decoration issue). 16 | 17 | // In practice, that doesn't work because the compiler turns a class EXPORT 18 | // into an EXPORT for each member. But it doesn't emit any code 19 | // for classes/members that are simply declared. It only emits code if a 20 | // DEFINITION is seen. And if there isn't any code, the linker can't see 21 | // the export tag. 22 | 23 | // Actually, that whole problem is quite understandable, and the setup is 24 | // pretty sane. But it leaves us with the problem of how to tell the linker 25 | // to export these classes. 26 | 27 | // I haven't found ANY good workaround. Candidates are things like: 28 | // - class tempXCC : public /* virtual */ J2K {}; 29 | // - void tempXFC (void) { J2K wc; } 30 | // The second DOES at least export SOME members (namely constructors, 31 | // destructors and class info). 32 | 33 | // The following is the only thing I found that works. Drawback is that now 34 | // I HAVE to set all the Compiler options JUST like while compiling the static 35 | // lib, and I won't get a warning if I don't (but the .dll won't work...). 36 | // Real error prone. 37 | 38 | #include "interface/jpeg.hpp" 39 | -------------------------------------------------------------------------------- /vs12.0/jpeg/jpegdll/jpegdll.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thorfdbg/libjpeg/c719010a26ce0c666e98b2acf924ad5fc24b4f5d/vs12.0/jpeg/jpegdll/jpegdll.rc -------------------------------------------------------------------------------- /vs12.0/jpeg/jpegdll/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by jpegdll.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /vs12.0/jpeg/jpegdll/tagitemdll.cpp: -------------------------------------------------------------------------------- 1 | 2 | // I wish to incur DLL exporting on the main interface classes. 3 | 4 | // It should THEORETICALLY be enough to do this: 5 | 6 | #include "interface/tagitem.hpp" 7 | 8 | // See j2kdll.cpp 9 | 10 | #include "interface/tagitem.cpp" 11 | -------------------------------------------------------------------------------- /vs15.0/jpeg/jpeg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg\jpeg.vcxproj", "{AC527D40-8A13-403B-8D79-9DD1A2F66A0E}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeglib", "jpeglib\jpeglib.vcxproj", "{AD8E036E-0C26-4559-A0C9-8EB924030BEF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpegdll", "jpegdll\jpegdll.vcxproj", "{2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Debug|Win32.Build.0 = Debug|Win32 18 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.ActiveCfg = Release|Win32 19 | {AC527D40-8A13-403B-8D79-9DD1A2F66A0E}.Release|Win32.Build.0 = Release|Win32 20 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Debug|Win32.Build.0 = Debug|Win32 22 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.ActiveCfg = Release|Win32 23 | {AD8E036E-0C26-4559-A0C9-8EB924030BEF}.Release|Win32.Build.0 = Release|Win32 24 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Debug|Win32.Build.0 = Debug|Win32 26 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.ActiveCfg = Release|Win32 27 | {2F8EB3B3-9BA3-44E8-9199-5E35D4C5B883}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /vs15.0/jpeg/jpegdll/jpegdll.cpp: -------------------------------------------------------------------------------- 1 | // There needs to be SOME input file for any project. Could be empty. 2 | 3 | // But I also wish to incur DLL exporting on the main interface classes. 4 | 5 | // It should THEORETICALLY be enough to do this: 6 | 7 | #include "interface/jpeg.hpp" 8 | #include "interface/hooks.hpp" 9 | #include "interface/tagitem.hpp" 10 | 11 | // Together with the global define J2K_EXPORT=__declspecl(dllexport) (see 12 | // Project > Settings > C/C++ > Preprocessor > Preprocessor definitions:), 13 | // that should cause the proper classes to be exported. At least according 14 | // to the MS Visual Studio's builtin documentation. This scheme replaces 15 | // .def files, which don't work well with C++ (name decoration issue). 16 | 17 | // In practice, that doesn't work because the compiler turns a class EXPORT 18 | // into an EXPORT for each member. But it doesn't emit any code 19 | // for classes/members that are simply declared. It only emits code if a 20 | // DEFINITION is seen. And if there isn't any code, the linker can't see 21 | // the export tag. 22 | 23 | // Actually, that whole problem is quite understandable, and the setup is 24 | // pretty sane. But it leaves us with the problem of how to tell the linker 25 | // to export these classes. 26 | 27 | // I haven't found ANY good workaround. Candidates are things like: 28 | // - class tempXCC : public /* virtual */ J2K {}; 29 | // - void tempXFC (void) { J2K wc; } 30 | // The second DOES at least export SOME members (namely constructors, 31 | // destructors and class info). 32 | 33 | // The following is the only thing I found that works. Drawback is that now 34 | // I HAVE to set all the Compiler options JUST like while compiling the static 35 | // lib, and I won't get a warning if I don't (but the .dll won't work...). 36 | // Real error prone. 37 | 38 | #include "interface/jpeg.hpp" 39 | -------------------------------------------------------------------------------- /vs15.0/jpeg/jpegdll/jpegdll.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thorfdbg/libjpeg/c719010a26ce0c666e98b2acf924ad5fc24b4f5d/vs15.0/jpeg/jpegdll/jpegdll.rc -------------------------------------------------------------------------------- /vs15.0/jpeg/jpegdll/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by jpegdll.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /vs15.0/jpeg/jpegdll/tagitemdll.cpp: -------------------------------------------------------------------------------- 1 | 2 | // I wish to incur DLL exporting on the main interface classes. 3 | 4 | // It should THEORETICALLY be enough to do this: 5 | 6 | #include "interface/tagitem.hpp" 7 | 8 | // See j2kdll.cpp 9 | 10 | #include "interface/tagitem.cpp" 11 | --------------------------------------------------------------------------------