debian/0000755000000000000000000000000012225016645007171 5ustar debian/rules0000755000000000000000000000163312225016103010241 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed VER_MAJOR = 1 VER_MINOR = 2 VER_PATCH = 1 VER_FULL = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH) VER_FULL_DFSG = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)+dfsg1 UPSTREAM_SRC = JPEGv$(VER_FULL) DEBIAN_SRC_DIR = pvrg-jpeg-$(VER_FULL) DEBIAN_SRC_TAR = pvrg-jpeg_$(VER_FULL_DFSG).orig.tar.gz CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX="/usr" \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_BUILD_TYPE:STRING="" \ -DBUILD_SHARED_LIBS=ON %: dh $@ --parallel --buildsystem=cmake override_dh_auto_configure: dh_auto_configure -- $(CMAKE_EXTRA_FLAGS) $(UPSTREAM_SRC).tar.gz: wget http://freefr.dl.sourceforge.net/project/jpeg/jpeg/PVRG%20JPEGv1.2.1/$@ get-orig-source: $(UPSTREAM_SRC).tar.gz tar xzf $(UPSTREAM_SRC).tar.gz rm -rf jpegdir/doc.ps mv jpegdir $(DEBIAN_SRC_DIR) GZIP="--best --no-name" tar czf $(DEBIAN_SRC_TAR) $(DEBIAN_SRC_DIR) debian/watch0000644000000000000000000000012511247513060010214 0ustar version=3 opts=dversionmangle=s/\+dfsg\d+$// \ http://sf.net/jpeg/JPEGv(.*)\.tar\.gz debian/changelog0000644000000000000000000000204512225016760011042 0ustar pvrg-jpeg (1.2.1+dfsg1-3) unstable; urgency=low * Add Stanford PVRG JPEG + d/p/jpegge.patch * Simplify d/rules using dh/9 * Switch to Standard Version 3.9.4, no changes needed -- Mathieu Malaterre Tue, 08 Oct 2013 16:58:29 +0200 pvrg-jpeg (1.2.1+dfsg1-2) unstable; urgency=low * Switch to dpkg-source 3.0 (quilt) format * Use my @d.o alias * Remove DMUA flag, not required * Simplify d/rules * Use hardening flags -- Mathieu Malaterre Tue, 10 Apr 2012 18:32:54 +0200 pvrg-jpeg (1.2.1+dfsg1-1) unstable; urgency=low * Initial release (Closes: #508992) * Properly install in /usr (instead of /usr/local) * Add missing pvrg-jpeg.install file. * Add note about naming convention (pvrg-jpeg) * Install changelog. Install man page. Add CPack section. * Adding patch from eli (panix.com), which adds support for PGM outputs * Properly set dfsg naming convention since doc.ps was removed from source -- Mathieu Malaterre Fri, 07 Aug 2009 11:09:09 +0200 debian/TODO0000644000000000000000000000006411246462611007661 0ustar Need to install doc.ps as part of the documentation debian/README.Debian0000644000000000000000000000133311236770317011236 0ustar Debian packages of pvrg-jpeg --------------------------- md5sum sf.net and: http://www.panix.com/~eli/jpeg/download.html match: d67276117e3b8c91340440c25d4ae1fe The original main executable (no libraries) used to be called simply 'jpeg'. I changed it to 'pvrg-jpeg' to clearly indicate that the output it not guarantee to be pure jpeg (93 specs), eg. in lossless 16bits. The bug has been reported here: http://sourceforge.net/apps/mediawiki/jpeg/index.php?title=Pvrg#Bugs or even again Java JAI: http://jai-imageio-core.dev.java.net/issues/show_bug.cgi?id=179 The most well known images with this PVRG bug are coming from this mammography database: http://marathon.csee.usf.edu/Mammography/Database.html - Mathieu Malaterre. debian/control0000644000000000000000000000170012225016103010557 0ustar Source: pvrg-jpeg Section: graphics Priority: optional Maintainer: Debian Med Packaging Team Uploaders: Mathieu Malaterre Build-Depends: debhelper (>= 9), cmake, flex Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/viewvc/debian-med/trunk/packages/pvrg-jpeg/trunk/ Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/pvrg-jpeg/trunk/ Homepage: http://jpeg.sourceforge.net/ Package: pvrg-jpeg Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: netpbm, libjpeg-progs Description: Stanford PVRG JPEG tool PVRG is the JPEG implementation from Stanford Portable Video Research Group . This package contains the pvrg-jpeg command line tool. Contrary to cjpeg/djpeg, pvrg-jpeg can also compress in lossless JPEG which is defined in ITU-T T.81, ISO/IEC IS 10918-1. It also support in a single codec 8bits and 12bits lossy JPEG compression/decompression. debian/copyright0000644000000000000000000000256111237011617011124 0ustar This package was debianized by Mathieu Malaterre on Sun, 14 Dec 2008 17:28:00 +0100. It was downloaded from http://sf.net/projects/jpeg Upstream Author: Andy C. Hung Copyright: Copyright © 1990, 1991, 1993 Andy C. Hung, all rights reserved. License: PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research Group. If you use this software, you agree to the following: This program package is purely experimental, and is licensed "as is". Permission is granted to use, modify, and distribute this program without charge for any purpose, provided this license/ disclaimer notice appears in the copies. No warranty or maintenance is given, either expressed or implied. In no event shall the author(s) be liable to you or a third party for any special, incidental, consequential, or other damages, arising out of the use or inability to use the program for any purpose (or the loss of data), even if we have been advised of such possibilities. Any public reference or advertisement of this source code should refer to it as the Portable Video Research Group (PVRG) code, and not by any author(s) (or Stanford University) name. The Debian packaging is © 2008, Mathieu Malaterre and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. debian/source/0000755000000000000000000000000012225016645010471 5ustar debian/source/format0000644000000000000000000000001411741061514011674 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000212225016103010354 0ustar 9 debian/README.source0000644000000000000000000000013411247463131011345 0ustar The file doc.ps was removed from the distribution and debian source reflects that (dfsg1-1) debian/patches/0000755000000000000000000000000012225016645010620 5ustar debian/patches/lexer.l.patch0000644000000000000000000000303112225016571013205 0ustar Description: Need to patch lexel.l to get it to produce proper code Author: Mathieu Malaterre Forwarded: not-needed Index: pvrg-jpeg-1.2.1+dfsg1/lexer.l =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/lexer.l 2013-10-08 16:37:40.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/lexer.l 2013-10-08 16:39:20.000000000 +0200 @@ -19,10 +19,27 @@ %option noyywrap +%option yylineno %{ /*LABEL lexer.c */ +/* + * flex command was run this way: + * + * $ lex -olexer.c lexer.l + */ + +/* We do not care of interactive mode */ +#define YY_NEVER_INTERACTIVE 1 +#define YY_NO_UNPUT 1 + +/* Do not include unistd.h in generated source. */ +#define YY_NO_UNISTD_H + +/* Skip declaring this function. It is a macro. */ +#define YY_SKIP_YYWRAP + static char *ReservedWords[] = { /* Token names */ "COMPONENT", "SCAN", @@ -363,12 +380,13 @@ { BEGIN("hashpjw"); char *p; - unsigned int h=0,g; + unsigned int g, h; + h=0; for(p=s;*p!=EOS;p++) /* Taken from Aho Sethi Ullman Compilers book. */ { h = (h << 4) + *p; - if (g = h&0xf0000000) + if ((g = h&0xf0000000)) { h = h ^(g >> 24); h = h ^ g; @@ -620,7 +638,7 @@ int Start,End; int *ptr,*ptr2; - while(token=yylex()) /* The code handling is simple enough. */ + while((token=yylex())) /* The code handling is simple enough. */ { /* just read the code and documentation */ ErrorValue=0; /* book... */ arrayflag=0; debian/patches/pvrg-jpeg-etb.patch0000644000000000000000000002463012225016571014315 0ustar Description: Add support for PGM output. Remove jpeg.1 patch, see jpeg.1.patch instead This web page and the etb patch to the PVRG JPEG code is by Eli the Bearded / Benjamin Elijah Griffin. Reproduction of code is permitted under the Creative Commons Attribution-ShareAlike License. Author: Eli the Bearded / Benjamin Elijah Griffin Origin: other, http://www.panix.com/~eli/jpeg/ Forwarded: not-needed Reviewed-By: Mathieu Malaterre Last-Update: 2013-10-08 Index: pvrg-jpeg-1.2.1+dfsg1/globals.h =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/globals.h 2013-10-08 16:36:17.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/globals.h 2013-10-08 16:36:24.000000000 +0200 @@ -129,6 +129,8 @@ DHUFF *DCDhuff[MAXIMUM_DEVICES]; /* Decoder huffman tables */ EHUFF *DCEhuff[MAXIMUM_DEVICES]; /* Encoder huffman tables */ XHUFF *DCXhuff[MAXIMUM_DEVICES]; /* Transmittable huffman tables */ +char *OutBaseName; /* Base file name of output streams */ +int OutPGM; /* Put a PGM header on output streams */ }; FRAME { Index: pvrg-jpeg-1.2.1+dfsg1/io.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/io.c 2013-10-08 16:36:20.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/io.c 2013-10-08 16:36:24.000000000 +0200 @@ -38,6 +38,7 @@ #endif #include +#include /* Functions which are local and which are exported. */ @@ -64,6 +65,7 @@ extern void MakeIob(); extern void PrintIob(); extern void InstallIob(); +extern void InstallHeaderIob(); extern void TerminateFile(); extern void ReadLine(); @@ -166,10 +168,12 @@ int wsize; { BEGIN("MakeIob"); - int index,sofs; + int index,sofs,hsize; + char header[128]; BUFFER **current; IOBUF *temp; + for(index=0;indexNumberComponents;index++) /* Make IOBUF */ { /* For each component */ if (!(temp = MakeStructure(IOBUF))) @@ -183,6 +187,7 @@ temp->wsize = wsize; temp->hpos=0; temp->vpos=0; + temp->hsize=0; temp->width = CFrame->Width[CScan->ci[index]]; /* Set up widthxheight */ temp->height = CFrame->Height[CScan->ci[index]]; if (CScan->NumberComponents==1) @@ -216,6 +221,10 @@ printf("Cannot allocate Iob bufferlist.\n"); exit(ERROR_MEMORY); } + if(Loud > MUTE) { + printf("About to open %s from io.c:MakeIob\n", + CFrame->ComponentFileName[CScan->ci[index]]); + } if ((temp->file = /* Open file */ open(CFrame->ComponentFileName[CScan->ci[index]], flags,UMASK)) < 0) @@ -224,7 +233,12 @@ printf("Cannot open file %s.\n", CFrame->ComponentFileName[CScan->ci[index]]); exit(ERROR_INIT_FILE); - } /* Make buffer for every line of component in MDU */ + } + + temp->hsize = snprintf(temp->header,128, + "P5\n%d %d\n255\n",temp->width,temp->height); + + /* Make buffer for every line of component in MDU */ for(sofs=0,current=temp->blist;currentblist+temp->num;current++) { *current = MakeXBuffer(CFrame->BufferSize, wsize); @@ -1148,6 +1162,67 @@ } } +/*BFUNC + +InstallHeaderIob() puts a pgm raw header on a file. Use just before closing. +EFUNC*/ + +void InstallHeaderIob() +{ + BEGIN("InstallHeaderIob"); + size_t rsize,tsize,wsize,lsize; + char *timage; + + if((Iob->hsize == 0) || (Iob->header == NULL)) { + return; + } + tsize = lseek(Iob->file,0,2); + if(tsize < 1) { + return; + } + + timage = (char*) malloc(tsize); + if(timage == NULL) { + WHEREAMI(); + printf("Malloc failure in InstallHeaderIob\n"); + exit(1); + } + + lsize = lseek(Iob->file,0,0); /* rewind */ + if(lsize != 0) { + WHEREAMI(); + printf("lseek failure in InstallHeaderIob\n"); + exit(1); + } + rsize = read(Iob->file, timage, tsize); + if(rsize != tsize) { + WHEREAMI(); + printf("Read failure in InstallHeaderIob (r %d != t %d, fd %d)\n", rsize, tsize, Iob->file); + perror("Error:"); + exit(1); + } + + lsize = lseek(Iob->file,0,0); /* rewind */ + if(lsize != 0) { + WHEREAMI(); + printf("lseek failure in InstallHeaderIob\n"); + exit(1); + } + wsize = write(Iob->file, Iob->header, Iob->hsize); + if(wsize != Iob->hsize) { + WHEREAMI(); + printf("Write failure in InstallHeaderIob\n"); + exit(1); + } + wsize = write(Iob->file, timage, tsize); + if(wsize != tsize) { + WHEREAMI(); + printf("Write failure in InstallHeaderIob\n"); + exit(1); + } + free(timage); + +} /*END*/ Index: pvrg-jpeg-1.2.1+dfsg1/jpeg.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/jpeg.c 2013-10-08 16:36:20.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/jpeg.c 2013-10-08 16:36:24.000000000 +0200 @@ -217,7 +217,13 @@ case 'n': /* Set non-interleaved mode */ ScanComponentThreshold=1; break; - case 'o': /* -o Oracle mode (input parsing)*/ + case 'g': /* use PGM header on outfiles */ + CImage->OutPGM = 1; + break; + case 'o': /* -o outfile */ + CImage->OutBaseName = argv[++i]; + break; + case 'O': /* -o Oracle mode (input parsing)*/ Oracle=1; break; case 'p': @@ -1301,7 +1307,7 @@ { if (Notify) /* Print statistics */ { - printf("> GW:%d GH:%d R:%d\n", + printf("> GlobalWidth:%d GlobalHeight:%d ResyncInverval:%d\n", CFrame->GlobalWidth, CFrame->GlobalHeight, CFrame->ResyncInterval); @@ -1310,7 +1316,7 @@ { if (Notify) { - printf(">> C:%d N:%s W:%d H:%d hf:%d vf:%d\n", + printf(">> C:%2d N: %s W:%6d H:%6d hf:%d vf:%d\n", CScan->ci[i], CFrame->ComponentFileName[CScan->ci[i]], CFrame->Width[CScan->ci[i]], @@ -1321,6 +1327,10 @@ InstallIob(i); FlushIob(); /* Close image files */ SeekEndIob(); + if (CImage->OutPGM) + { + InstallHeaderIob(); + } CloseIob(); } CurrentMDU=0; @@ -1868,6 +1878,8 @@ CImage->QuantizationMatrices[1] = ChrominanceQuantization; CImage->NumberACTables = 0; /* No tables defined yet */ CImage->NumberDCTables = 0; + CImage->OutBaseName = NULL; + CImage->OutPGM = 0; } /*BFUNC @@ -1993,22 +2005,37 @@ { BEGIN("MakeConsistentFileNames"); int i; + char ext[8]; + + if(CImage->OutBaseName == NULL) + { /* No base name specified, just use stream. */ + CImage->OutBaseName = CImage->StreamFileName; + } + + if(CImage->OutPGM) + { /* PGM header request, let's set the extension. */ + sprintf(ext,".pgm"); + } + else + { /* empty string */ + *ext = 0; + } for(i=0;iNumberComponents;i++) { if (CImage->ImageSequence) /* If in sequence, must add sequence */ { /* identifier */ CFrame->ComponentFileName[CScan->ci[i]] = - (char *) calloc(strlen(CImage->StreamFileName)+16,sizeof(char)); - sprintf(CFrame->ComponentFileName[CScan->ci[i]],"%s.%d.%d", - CImage->StreamFileName,CImage->ImageSequence,CScan->ci[i]); + (char *) calloc(strlen(CImage->StreamFileName)+20,sizeof(char)); + sprintf(CFrame->ComponentFileName[CScan->ci[i]],"%s.%d.%d%s", + CImage->OutBaseName,CImage->ImageSequence,CScan->ci[i], ext); } else if (CFrame->ComponentFileName[CScan->ci[i]] == NULL) { /* Otherwise if none specified, create. */ CFrame->ComponentFileName[CScan->ci[i]] = - (char *) calloc(strlen(CImage->StreamFileName)+8,sizeof(char)); - sprintf(CFrame->ComponentFileName[CScan->ci[i]],"%s.%d", - CImage->StreamFileName,CScan->ci[i]); + (char *) calloc(strlen(CImage->StreamFileName)+12,sizeof(char)); + sprintf(CFrame->ComponentFileName[CScan->ci[i]],"%s.%d%s", + CImage->OutBaseName,CScan->ci[i], ext); } } } @@ -2194,9 +2221,9 @@ BEGIN("Help"); printf("jpeg -iw ImageWidth -ih ImageHeight [-JFIF] [-q(l) Q-Factor]\n"); - printf(" [-a] [-b] [-d] [-k predictortype] [-n] [-o] [-y] [-z]\n"); + printf(" [-a] [-b] [-d] [-k predictortype] [-n] [-O] [-y] [-z] [-g]\n"); printf(" [-p PrecisionValue] [-t pointtransform]\n"); - printf(" [-r ResyncInterval] [-s StreamName]\n"); + printf(" [-r ResyncInterval] [-s StreamName] [-o OutBaseName]\n"); printf(" [[-ci ComponentIndex1] [-fw FrameWidth1] [-fh FrameHeight1]\n"); printf(" [-hf HorizontalFrequency1] [-vf VerticalFrequency1]\n"); printf(" ComponentFile1]\n"); @@ -2208,11 +2235,13 @@ printf("-a enables Reference DCT.\n"); printf("-b enables Lee DCT.\n"); printf("-d decoder enable.\n"); + printf("-g put PGM headers on decode output files.\n"); printf("-[k predictortype] enables lossless mode.\n"); printf("-q specifies quantization factor; -ql specifies can be long.\n"); printf("-n enables non-interleaved mode.\n"); printf("-[t pointtransform] is the number of bits for the PT shift.\n"); - printf("-o enables the Command Interpreter.\n"); + printf("-o set a base name for decode output files.\n"); + printf("-O enables the Command Interpreter.\n"); printf("-p specifies precision.\n"); printf("-y run in robust mode against errors (cannot be used with DNL).\n"); printf("-z uses default Huffman tables.\n"); Index: pvrg-jpeg-1.2.1+dfsg1/prototypes.h =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/prototypes.h 2013-10-08 16:36:20.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/prototypes.h 2013-10-08 16:36:24.000000000 +0200 @@ -106,6 +106,7 @@ extern int NumberBlocksIob(); extern int NumberBlockMDUIob(); extern void InstallIob(); +extern void InstallHeaderIob(); extern void TerminateFile(); extern int NumberLineMDUIob(); Index: pvrg-jpeg-1.2.1+dfsg1/system.h =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/system.h 2013-10-08 16:36:17.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/system.h 2013-10-08 16:36:24.000000000 +0200 @@ -68,6 +68,8 @@ int file; /* File descriptor */ int flags; /* File mode flags */ int linelastdefault; /* Last line element default */ +int hsize; /* Header size */ +char header[128]; /* Header textfield */ BUFFER **blist; /* A list of buffers */ }; debian/patches/jpegge.patch0000644000000000000000000003065012225016103013073 0ustar Description: Stanford PVRG JPEG Patches for GE DICOM MOD As described in the medical image format FAQ, as well as the conformance statement for the GE CTi, there are some problems with the JPEG lossless compression on the DICOM 130mm MOD that the older models of the CTi write. . This patch to the Stanford PVRG JPEG code copes with these bugs, determining from the compressed bit stream whether the GE bug is present or not, and if present copes with it and decompresses the images as intended. Note that one also needs to handle other bugs in the DICOM encapsulation, as do the recent versions of dicom3tools (see for example dctoraw). . The patch is a composite of contributions from various other authors who have suggested ways to handle the bug in both the Stanford and the Cornell code, and thanks are due to them, as well as those at GE who were involved in detecting, describing and correcting the bug in later CTi, MR LX and AW software versions. . There is also another patch (unrelated to the GE issue) to make the codec work on MacOSX ... it turns out that the original code made assumptions about the arguments and return values of lseek() which are not valid on some systems that use a quad long (64 bits) for the offset type (off_t). The patch corrects for this, as well as taking into account that the lseek() return value doesn't seem to be set right on MacOSX and uses fstat() instead to determine file size wrt. truncation. The most recent version also accounts for the need to not use yywrap. Author: David Clunie Origin: other, http://www.dclunie.com/jpegge.html Forwarded: not-needed Reviewed-By: Mathieu Malaterre Last-Update: 2013-10-08 Index: pvrg-jpeg-1.2.1+dfsg1/huffman.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/huffman.c 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/huffman.c 2013-10-08 16:36:20.000000000 +0200 @@ -57,6 +57,7 @@ extern void MakeDhuff(); extern void UseACHuffman(); extern void UseDCHuffman(); +extern void UseDCHuffmanCheckingGEMSBug(); extern void SetACHuffman(); extern void SetDCHuffman(); extern void PrintHuffman(); @@ -678,6 +679,42 @@ int index; { BEGIN("UseDCHuffman"); +index = 0; + Xhuff = CImage->DCXhuff[index]; + Dhuff = CImage->DCDhuff[index]; + Ehuff = CImage->DCEhuff[index]; + if (!Dhuff && !Ehuff) + { + WHEREAMI(); + printf("Reference to nonexistent table %d.\n",index); + } +} + +/*BFUNC + +UseDCHuffmanCheckingGEMSBug() installs the DC Huffman structure from the CImage +structure. + +EFUNC*/ + +void UseDCHuffmanCheckingGEMSBug(index,detected_gems_predictor_bug) + int index; + int *detected_gems_predictor_bug; +{ + BEGIN("UseDCHuffmanCheckingGEMSBug"); + + if (index == 1 + && !CImage->DCDhuff[index] && !CImage->DCEhuff[index] + && CImage->DCDhuff[0] && !CImage->DCEhuff[0]) + { + index = 0; + *detected_gems_predictor_bug = 1; + printf("GE table selection bug detected - assuming predictor bug also\n",index); + } + else + { + *detected_gems_predictor_bug = 0; + } Xhuff = CImage->DCXhuff[index]; Dhuff = CImage->DCDhuff[index]; Index: pvrg-jpeg-1.2.1+dfsg1/makefile =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/makefile 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/makefile 2013-10-08 16:36:20.000000000 +0200 @@ -7,16 +7,20 @@ # SYSV allows for SYSV system IO calls. NOTRUNCATE allows # for UNIX emulators without the ftruncate() call. # +# For gcc on Solaris use DFCNTL_FOR_O_RDONLY to include not SYSV ` +# #DEFINES = -DSYSV -DNOTRUNCATE # -DEFINES = +#DEFINES = -DFCNTL_FOR_O_RDONLY +CC = gcc +LEXARGS = -ll JFLAGS = -O DEFS = system.h globals.h prototypes.h param.h BASELINE = jpeg.o codec.o huffman.o io.o chendct.o leedct.o lexer.o marker.o stream.o transform.o .c.o: - cc $(JFLAGS) $(DEFINES) -c $*.c + $(CC) $(JFLAGS) $(DEFINES) -c $*.c .c.ln: lint -c $*.c @@ -24,10 +28,10 @@ all: jpeg clean: - rm *.o jpeg + rm -f *.o jpeg lexer.c jpeg: $(BASELINE) - cc $(DEFINES) $(JFLAGS) $(BASELINE) -lm -o jpeg + $(CC) $(DEFINES) $(JFLAGS) $(BASELINE) -lm -o jpeg jpeg.o: jpeg.c $(DEFS) tables.h codec.o: codec.c $(DEFS) @@ -54,7 +58,12 @@ # Caution: Sometimes -ll is required. # # -#lexer.c: lexer.l -# lex lexer.l -# mv lex.yy.c lexer.c -# +lexer.c: lexer.l + lex $(LEXARGS) lexer.l + #mv lex.yy.c lexer.c + echo "#ifdef FCNTL_FOR_O_RDONLY" >lexer.c + echo "#include " >>lexer.c + echo "#endif" >>lexer.c + cat lex.yy.c >>lexer.c + rm lex.yy.c + Index: pvrg-jpeg-1.2.1+dfsg1/jpeg.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/jpeg.c 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/jpeg.c 2013-10-08 16:36:20.000000000 +0200 @@ -30,6 +30,9 @@ #include "tables.h" #include "globals.h" +#ifdef FCNTL_FOR_O_RDONLY +#include +#endif #ifdef SYSV #include #endif @@ -1358,6 +1361,8 @@ int MaxElem,CurrentElem,NumberElem; int StartofLine=1,UseType=1; /* Start with type 1 coding */ int *input; + int last_pixel; /* should initialize this sometime */ + int detected_gems_predictor_bug; PointTransform=CScan->SAL; for(j=0;jNumberComponents;j++) /* Important to rewind to start */ @@ -1379,7 +1384,7 @@ } } InstallIob(0); - UseDCHuffman(CScan->td[0]); /* Install DC table */ + UseDCHuffmanCheckingGEMSBug(CScan->td[0],&detected_gems_predictor_bug); /* Install DC table */ if (CScan->NumberComponents==1) height=horfreq=1; else @@ -1466,7 +1471,8 @@ px = input[width]; break; case 2: - px = input[1]; + /*px = input[1];*/ + px = detected_gems_predictor_bug ? last_pixel : input[1]; break; case 3: px = input[0]; @@ -1493,7 +1499,13 @@ else { value = LosslessDecodeDC(); - input[width+1] = (value+px)&0xffff; + if (detected_gems_predictor_bug) { + input[width+1] = (px-value)&0xffff; + last_pixel = (px-value)&0xffff; + } + else { + input[width+1] = (value+px)&0xffff; + } if (Loud > MUTE) { printf("OUT=%d PX=%d VAL: %d\n", Index: pvrg-jpeg-1.2.1+dfsg1/io.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/io.c 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/io.c 2013-10-08 16:36:20.000000000 +0200 @@ -36,6 +36,7 @@ #include #include #endif +#include /* Functions which are local and which are exported. */ @@ -439,7 +440,8 @@ BUFFER *buffer; { BEGIN("ReadResizeBuffer"); - int retval,diff,location,amount; + int retval,diff,amount; + off_t location; diff = buffer->tptr - buffer->bptr; /* Find out the current usage */ if (len > buffer->size-1) /* calculate if we can hold it */ @@ -490,11 +492,13 @@ { BEGIN("FlushBuffer"); int retval; + off_t location; #ifdef IO_DEBUG printf("WriteLseek %d\n",buffer->streamoffs+buffer->currentoffs); #endif - lseek(buffer->iob->file,buffer->streamoffs+buffer->currentoffs,L_SET); + location=buffer->streamoffs+buffer->currentoffs; + lseek(buffer->iob->file,location,L_SET); if ((retval = write(buffer->iob->file, buffer->space, (buffer->bptr - buffer->space))) < 0) @@ -747,20 +751,25 @@ void SeekEndIob() { BEGIN("SeekEndIob"); - int size,tsize; + off_t size,tsize; static char Terminator[] = {0x80,0x00}; + off_t location; + struct stat sb; - size = lseek(Iob->file,0,2); + location=0; + /*size = lseek(Iob->file,location,2);*/ + fstat(Iob->file,&sb); + size=sb.st_size; tsize = Iob->width*Iob->height*Iob->wsize; if (size != tsize) { WHEREAMI(); printf("End not flush, making flush (actual: %d != target:%d)\n", - size,tsize); + (int)size,(int)tsize); if (sizefile,tsize-1,0L); /* Seek and terminate */ + lseek(Iob->file,tsize-1,0); /* Seek and terminate */ write(Iob->file,Terminator,1); } else if (size > tsize) @@ -768,7 +777,7 @@ #ifdef NOTRUNCATE WHEREAMI(); printf("file is too large, only first %d bytes valid\n", - tsize); + (int)tsize); #else ftruncate(Iob->file,tsize); /* simply truncate*/ #endif @@ -885,7 +894,9 @@ void TerminateFile() { BEGIN("TerminateFile"); - int i,size; + int i; + off_t size; + off_t location; static char Terminator[] = {0x80,0x00}; if (CFrame->GlobalHeight) @@ -907,16 +918,14 @@ CFrame->vf[CScan->ci[i]]); InstallIob(i); FlushIob(); - size = lseek(CScan->Iob[i]->file,0,2); - if (size != - CFrame->Width[CScan->ci[i]]*CFrame->Height[CScan->ci[i]]* - CScan->Iob[i]->wsize) + location=0; + size = lseek(CScan->Iob[i]->file,location,2); + location=CFrame->Width[CScan->ci[i]]*CFrame->Height[CScan->ci[i]]*CScan->Iob[i]->wsize; + if (size != location) { /* Terminate file */ - lseek(CScan->Iob[i]->file, /* by seeking to end */ - (CFrame->Width[CScan->ci[i]]* /* And writing byte */ - CFrame->Height[CScan->ci[i]]* - CScan->Iob[i]->wsize)-1, /* Making flush with */ - 0L); /* Original size */ + lseek(CScan->Iob[i]->file, /* by seeking to end and writing byte */ + location-1, /* Making flush with */ + 0); /* Original size */ write(CScan->Iob[i]->file,Terminator,1); } } Index: pvrg-jpeg-1.2.1+dfsg1/SETUP =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/SETUP 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/SETUP 2013-10-08 16:36:20.000000000 +0200 @@ -17,6 +17,11 @@ which allows for SYSV libraries to be used instead. The NOTRUNCATE flag avoids the lack of the ftruncate() call used in io.c. +For some gcc versions on Solaris, need to include not + otherwise O_RDONLY etc. are not defined; define +FCNTL_FOR_O_RDONLY. This also may need to be added to the lexer.c +output by lex to make it compile. + Caution: For the compilation, the lexer.l file should be older than the lexer.c file otherwise many machines will try and lex the lexer.l file (thus clobbering potentially the lexer.c file). In general, the @@ -25,6 +30,10 @@ and then remade, in which case, the lexer.c file will be older because is lexically of lesser value than lexer.l. This is a potential bug. +For recent MacOS versions, need to changer lexer.l to specify +"%option noyywrap" outside the "%{ ...}%" section and remove the +"#define yywrap() 1" definition. + 3) Testing the program. Two small test files are nonint.jpg and blkint.jpg. If you wish to Index: pvrg-jpeg-1.2.1+dfsg1/prototypes.h =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/prototypes.h 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/prototypes.h 2013-10-08 16:36:20.000000000 +0200 @@ -85,6 +85,7 @@ extern void MakeDhuff(); extern void UseACHuffman(); extern void UseDCHuffman(); +extern void UseDCHuffmanCheckingGEMSBug(); extern void SetACHuffman(); extern void SetDCHuffman(); extern void PrintHuffman(); Index: pvrg-jpeg-1.2.1+dfsg1/lexer.l =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/lexer.l 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/lexer.l 2013-10-08 16:36:20.000000000 +0200 @@ -15,14 +15,13 @@ Video Research Group (PVRG) code, and not by any author(s) (or Stanford University) name. *************************************************************/ -%{ -/*LABEL lexer.c */ -/* Redefine the yywrap so that we don't have - to worry about lex library */ +%option noyywrap -# define yywrap() (1) +%{ + +/*LABEL lexer.c */ static char *ReservedWords[] = { /* Token names */ "COMPONENT", Index: pvrg-jpeg-1.2.1+dfsg1/marker.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/marker.c 2013-10-08 16:36:18.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/marker.c 2013-10-08 16:36:20.000000000 +0200 @@ -32,6 +32,9 @@ #include "globals.h" #include "stream.h" #include "marker.h" +#ifdef FCNTL_FOR_O_RDONLY +#include +#endif #ifdef SYSV #include #endif debian/patches/marker_o_rdwr.patch0000644000000000000000000000114412225016571014474 0ustar Description: deprecated O_WRONLY, replaced by portable O_RDWR Author: Mathieu Malaterre Forwarded: not-needed Index: pvrg-jpeg-1.2.1+dfsg1/marker.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/marker.c 2013-10-08 16:36:20.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/marker.c 2013-10-08 16:36:23.000000000 +0200 @@ -671,7 +671,7 @@ } else { - MakeIob(IOB_BLOCK,O_WRONLY | O_CREAT | O_TRUNC, + MakeIob(IOB_BLOCK,O_RDWR | O_CREAT | O_TRUNC, ((CFrame->DataPrecision>8)?2:1)); if (CFrame->GlobalHeight) { debian/patches/series0000644000000000000000000000017012225016103012020 0ustar jpegge.patch lexer.l.patch cmakelists.txt.patch marker_o_rdwr.patch pvrg-jpeg-etb.patch jpeg.1.patch implicitdecl.patch debian/patches/implicitdecl.patch0000644000000000000000000001662712225016571014315 0ustar Description: Fix implicit declarations Author: Mathieu Malaterre Forwarded: not-needed Index: pvrg-jpeg-1.2.1+dfsg1/io.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/io.c 2013-10-08 16:36:24.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/io.c 2013-10-08 16:36:26.000000000 +0200 @@ -39,6 +39,8 @@ #include #include +#include +#include /* Functions which are local and which are exported. */ @@ -267,13 +269,13 @@ if (Iob) { - printf("*** Iob ID: %x ***\n",Iob); + printf("*** Iob ID: %p ***\n",(void*)Iob); printf("Number of Buffers: %d Width: %d Height: %d\n", Iob->num,Iob->width,Iob->height); printf("hpos: %d vpos: %d hor-freq: %d ver-freq: %d\n", Iob->hpos,Iob->vpos,Iob->hor,Iob->ver); - printf("filed: %d flags: %d BufferListId: %x\n", - Iob->file,Iob->flags,Iob->blist); + printf("filed: %d flags: %d BufferListId: %p\n", + Iob->file,Iob->flags,(void*)Iob->blist); } else { @@ -640,8 +642,8 @@ if (Loud > MUTE) { WHEREAMI(); - printf("%x Moving To [Horizontal:Vertical] [%d:%d] \n", - Iob,Iob->hpos,Iob->vpos); + printf("%p Moving To [Horizontal:Vertical] [%d:%d] \n", + (void*)Iob,Iob->hpos,Iob->vpos); } horizontal = Iob->hpos * BlockWidth; /* Calculate actual */ vertical = Iob->vpos * BlockHeight; /* Pixel position */ @@ -733,7 +735,7 @@ int i; if (Loud > MUTE) - printf("IOB: %x Flushing buffers\n",Iob); + printf("IOB: %p Flushing buffers\n",(void*)Iob); switch(Iob->type) { case IOB_BLOCK: @@ -1132,8 +1134,8 @@ if (Loud > MUTE) { WHEREAMI(); - printf("%x Moving To [Horizontal:Vertical] [%d:%d] \n", - Iob,Iob->hpos,Iob->vpos); + printf("%p Moving To [Horizontal:Vertical] [%d:%d] \n", + (void*)Iob,Iob->hpos,Iob->vpos); } horizontal = Iob->hpos; vertical = Iob->vpos; @@ -1198,7 +1200,7 @@ rsize = read(Iob->file, timage, tsize); if(rsize != tsize) { WHEREAMI(); - printf("Read failure in InstallHeaderIob (r %d != t %d, fd %d)\n", rsize, tsize, Iob->file); + printf("Read failure in InstallHeaderIob (r %zu != t %zu, fd %d)\n", rsize, tsize, Iob->file); perror("Error:"); exit(1); } Index: pvrg-jpeg-1.2.1+dfsg1/jpeg.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/jpeg.c 2013-10-08 16:36:24.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/jpeg.c 2013-10-08 16:36:26.000000000 +0200 @@ -36,6 +36,8 @@ #ifdef SYSV #include #endif +#include +#include /* Define the functions to be used with ANSI prototyping. @@ -102,7 +104,7 @@ /* Define the support/utility variables.*/ int ErrorValue=0; /* Holds error upon return */ int Loud=MUTE; /* Loudness gives level of debug traces */ -int HuffmanTrace=NULL; /* When set, dumps Huffman statistics */ +int HuffmanTrace=0; /* When set, dumps Huffman statistics */ int Notify=1; /* When set, gives image size feedback */ int Robust=0; static int LargeQ=0; /* When set, large quantization is enabled */ @@ -1742,7 +1744,7 @@ BEGIN("PrintImage"); int i; - printf("*** Image ID: %x ***\n",CImage); + printf("*** Image ID: %p ***\n",(void*)CImage); if (CImage) { if (CImage->StreamFileName) @@ -1792,14 +1794,14 @@ BEGIN("PrintFrame"); int i; - printf("*** Frame ID: %x *** (TYPE: %d)\n",CFrame,CFrame->Type); + printf("*** Frame ID: %p *** (TYPE: %d)\n",(void*)CFrame,CFrame->Type); if (CFrame) { printf("DataPrecision: %d ResyncInterval: %d\n", CFrame->DataPrecision,CFrame->ResyncInterval); printf("Height: %d Width: %d\n", CFrame->GlobalHeight,CFrame->GlobalWidth); - printf("BufferSize: %d Image: %x\n",CFrame->BufferSize,CFrame->Image); + printf("BufferSize: %d Image: %p\n",CFrame->BufferSize,(void*)CFrame->Image); printf("NumberComponents %d\n", CFrame->GlobalNumberComponents); for(i=0;iGlobalNumberComponents;i++) @@ -1830,7 +1832,7 @@ BEGIN("PrintScan"); int i; - printf("*** Scan ID: %x ***\n",CScan); + printf("*** Scan ID: %p ***\n",(void*)CScan); if (CScan) { printf("NumberComponents %d\n", @@ -1841,8 +1843,8 @@ i,CScan->ci[i]); printf("DC Huffman Table: %d AC Huffman Table: %d\n", CScan->td[i],CScan->ta[i]); - printf("LastDC: %d Iob: %x\n", - *(CScan->LastDC[i]),CScan->Iob[i]); + printf("LastDC: %d Iob: %p\n", + *(CScan->LastDC[i]),(void*)CScan->Iob[i]); } printf("NumberACSend: %d NumberDCSend: %d NumberQSend: %d\n", CScan->NumberACTablesSend, Index: pvrg-jpeg-1.2.1+dfsg1/stream.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/stream.c 2013-10-08 16:36:17.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/stream.c 2013-10-08 16:36:26.000000000 +0200 @@ -32,6 +32,7 @@ #include "globals.h" #include "marker.h" #include "stream.h" +#include /*PUBLIC*/ @@ -675,7 +676,7 @@ read_position= -1; /* Make sure we are byte-flush. */ while(marker_read_byte==MARKER_FIL) /* Get rid of FIL markers */ { -#ifdef VERSION_1.0 +#ifdef VERSION_1_0 if ((marker_read_byte = bgetc())!=MARKER_MARKER) { WHEREAMI(); Index: pvrg-jpeg-1.2.1+dfsg1/transform.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/transform.c 2013-10-08 16:36:17.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/transform.c 2013-10-08 16:36:26.000000000 +0200 @@ -33,6 +33,7 @@ #include "globals.h" #include "dct.h" #include +#include /*PUBLIC*/ Index: pvrg-jpeg-1.2.1+dfsg1/marker.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/marker.c 2013-10-08 16:36:23.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/marker.c 2013-10-08 16:36:26.000000000 +0200 @@ -38,6 +38,8 @@ #ifdef SYSV #include #endif +#include +#include /*PUBLIC*/ extern void WriteSoi(); Index: pvrg-jpeg-1.2.1+dfsg1/huffman.c =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/huffman.c 2013-10-08 16:36:20.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/huffman.c 2013-10-08 16:36:26.000000000 +0200 @@ -33,6 +33,8 @@ #include "globals.h" #include "stream.h" +#include +#include /*PUBLIC*/ @@ -543,7 +545,7 @@ else { WHEREAMI(); - printf("Huffman read error: l=%d code=%d\n"); + printf("Huffman read error: l=%d code=%d\n", l, code); Resync(); ErrorValue = ERROR_HUFFMAN_READ; return(0); @@ -773,7 +775,7 @@ if (Xhuff) { - printf("Xhuff ID: %x\n",Xhuff); + printf("Xhuff ID: %p\n",(void*)Xhuff); printf("Bits: [length:number]\n"); for(i=1;i<9;i++) { @@ -791,7 +793,7 @@ } if (Ehuff) { - printf("Ehuff ID: %x\n",Ehuff); + printf("Ehuff ID: %p\n",(void*)Ehuff); printf("Ehufco:\n"); PrintTable(Ehuff->ehufco); printf("Ehufsi:\n"); @@ -799,7 +801,7 @@ } if (Dhuff) { - printf("Dhuff ID: %x\n",Dhuff); + printf("Dhuff ID: %p\n",(void*)Dhuff); printf("MaxLength: %d\n",Dhuff->ml); printf("[index:MaxCode:MinCode:ValPtr]\n"); for(i=1;i<5;i++) debian/patches/cmakelists.txt.patch0000644000000000000000000001165312225016571014622 0ustar Description: The main author prefer cmake type build system, original build system was replaced by a cmake based one Author: Mathieu Malaterre Forwarded: not-needed Index: pvrg-jpeg-1.2.1+dfsg1/CMakeLists.txt =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ pvrg-jpeg-1.2.1+dfsg1/CMakeLists.txt 2013-10-08 16:36:22.000000000 +0200 @@ -0,0 +1,147 @@ +# Main CMakeLists.txt to build the PVRG project using CMake (www.cmake.org) +# Written by Mathieu Malaterre +IF(NOT PVRG_NAMESPACE) + SET(PVRG_NAMESPACE "PVRG") + SET(PVRG_STANDALONE 1) + SET(PVRG_INSTALL_BIN_DIR bin) + SET(PVRG_INSTALL_LIB_DIR lib) + SET(PVRG_INSTALL_INCLUDE_DIR include/pvrg) + SET(PVRG_INSTALL_MAN_DIR share/man) + OPTION(PVRG_BUILD_SHARED_LIBS "Build PVRG with shared libraries." OFF) + SET(BUILD_SHARED_LIBS ${PVRG_BUILD_SHARED_LIBS}) +ELSE(NOT PVRG_NAMESPACE) + IF(COMMAND APPEND_COPYRIGHT) + APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/COPYING) + ENDIF(COMMAND APPEND_COPYRIGHT) +ENDIF(NOT PVRG_NAMESPACE) +# In all cases: +STRING(TOLOWER ${PVRG_NAMESPACE} PVRG_LIBRARY_NAME) + +PROJECT(${PVRG_NAMESPACE} C) +CMAKE_MINIMUM_REQUIRED(VERSION 2.2) + +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + +#----------------------------------------------------------------------------- +# PVRG version number, usefull for packaging and doxygen doc: +SET(PVRG_MAJOR_VERSION 1) +SET(PVRG_MINOR_VERSION 2) +SET(PVRG_BUILD_VERSION 1) +SET(PVRG_VERSION + "${PVRG_MAJOR_VERSION}.${PVRG_MINOR_VERSION}.${PVRG_BUILD_VERSION}") + +SET(PVRG_LIBRARY_PROPERTIES ${PVRG_LIBRARY_PROPERTIES} + VERSION "${PVRG_VERSION}" + SOVERSION "${PVRG_MAJOR_VERSION}.${PVRG_MINOR_VERSION}" +) + +# Do full dependency headers. +INCLUDE_REGULAR_EXPRESSION("^.*$") + +SET( + PVRG_SRCS + jpeg.c + codec.c + huffman.c + io.c + chendct.c + leedct.c + marker.c + stream.c + transform.c +) + +FIND_PROGRAM(LEX_COMPILER + NAMES lex +) + +IF(LEX_COMPILER) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lexer.c + COMMAND ${LEX_COMPILER} + ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/lexer.c + ${CMAKE_CURRENT_SOURCE_DIR}/lexer.l + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lexer.l + COMMENT "Generating (newer) lexer.c based on lexer.l" + ) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + SET( PVRG_SRCS + ${PVRG_SRCS} + ${CMAKE_CURRENT_BINARY_DIR}/lexer.c + ) +ELSE(LEX_COMPILER) + SET( PVRG_SRCS + ${PVRG_SRCS} + lexer.c + ) +ENDIF(LEX_COMPILER) + + + +# might not be portable, so simply rename the function in the code itself... +#SET_SOURCE_FILES_PROPERTIES(jpeg.c +# PROPERTIES +# COMPILE_FLAGS -Dmain=pvrgmain +#) +IF(MSVC) +ADD_DEFINITIONS(-DNOTRUNCATE) +ELSE(MSVC) +ADD_DEFINITIONS(-DSYSV -DNOTRUNCATE) +ENDIF(MSVC) +#ADD_DEFINITIONS(-DIO_DEBUG) +#ADD_LIBRARY(pvrg ${PVRG_SRCS}) + +ADD_EXECUTABLE(${PVRG_LIBRARY_NAME}-jpeg ${PVRG_SRCS}) +#TARGET_LINK_LIBRARIES(${PVRG_LIBRARY_NAME}-jpeg pvrg) + +#IF(NOT PVRG_INSTALL_NO_DEVELOPMENT) +# FILE(GLOB header_files "*.h") +# INSTALL(FILES ${header_files} +# DESTINATION ${PVRG_INSTALL_INCLUDE_DIR} COMPONENT Development +# ) +#ENDIF(NOT PVRG_INSTALL_NO_DEVELOPMENT) + +IF(NOT PVRG_INSTALL_NO_LIBRARIES) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/jpeg.1 + ${CMAKE_CURRENT_BINARY_DIR}/${PVRG_LIBRARY_NAME}-jpeg.1) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PVRG_LIBRARY_NAME}-jpeg.1 + DESTINATION ${PVRG_INSTALL_MAN_DIR}/man1 COMPONENT Development + ) + INSTALL(TARGETS ${PVRG_LIBRARY_NAME}-jpeg + RUNTIME DESTINATION ${PVRG_INSTALL_BIN_DIR} COMPONENT Runtime + LIBRARY DESTINATION ${PVRG_INSTALL_LIB_DIR} COMPONENT Runtime + ARCHIVE DESTINATION ${PVRG_INSTALL_LIB_DIR} COMPONENT Development + ) +ENDIF(NOT PVRG_INSTALL_NO_LIBRARIES) + +IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PVRG_PACKAGE_DESCRIPTION_SUMMARY}) + SET(CPACK_PACKAGE_VENDOR "PVRG") + #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt") + #SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt") + SET(CPACK_PACKAGE_VERSION_MAJOR "${PVRG_MAJOR_VERSION}") + SET(CPACK_PACKAGE_VERSION_MINOR "${PVRG_MINOR_VERSION}") + SET(CPACK_PACKAGE_VERSION_PATCH "${PVRG_BUILD_VERSION}") + SET(CPACK_SOURCE_PACKAGE_FILE_NAME "pvrg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + + SET(CPACK_SOURCE_IGNORE_FILES "/debian/" "/CVS/" "/\\\\.svn/" "\\\\.swp$") + INCLUDE(CPack) +ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + +# +# Should you wish to modify the interpreter +# modify this portion here. +# +# Make sure that you move the first comment from the start to +# within the braces %{ /* */ %} in lexer.l, +# otherwise it will give you a error (definitions too long). +# +# Caution: Sometimes -ll is required. +# +# +#lexer.c: lexer.l +# lex lexer.l +# mv lex.yy.c lexer.c +# debian/patches/jpeg.1.patch0000644000000000000000000001734512225016571012735 0ustar Description: Replace jpeg with pvrg-jpeg. Properly escape all - with \ Author: Mathieu Malaterre Forwarded: not-needed Index: pvrg-jpeg-1.2.1+dfsg1/jpeg.1 =================================================================== --- pvrg-jpeg-1.2.1+dfsg1.orig/jpeg.1 2013-10-08 16:36:17.000000000 +0200 +++ pvrg-jpeg-1.2.1+dfsg1/jpeg.1 2013-10-08 16:36:25.000000000 +0200 @@ -1,35 +1,43 @@ -.TH JPEG 1 "14 June 1993" +.TH PVRG\-JPEG 1 "14 June 1993" .UC 4 .SH NAME -jpeg \- JPEG compression and decompression +pvrg\-jpeg \- JPEG compression and decompression .SH SYNOPSIS .B -jpeg -iw ImageWidth -ih ImageHeight [-JFIF] [-q(l) Q-Factor] +pvrg\-jpeg \-iw ImageWidth \-ih ImageHeight [\-JFIF] [\-q(l) Q\-Factor] .B - [-a] [-b] [-d] [-k predictortype] [-n] [-o] [-y] [-z] + [\-a] [\-b] [\-d] [\-k predictortype] [\-n] [\-O] [\-y] [\-z] [\-g] .B - [-p PrecisionValue] [-t pointtransform] + [\-p PrecisionValue] [\-t pointtransform] .B - [-r ResyncInterval] [-s StreamName] + [\-r ResyncInterval] [\-s StreamName] [\-o OutBaseName] .B - [[-ci ComponentIndex1] [-fw FrameWidth1] [-fh FrameHeight1] + [[\-ci ComponentIndex1] [\-fw FrameWidth1] [\-fh FrameHeight1] .B - [-hf HorizontalFrequency1] [-vf VerticalFrequency1] + [\-hf HorizontalFrequency1] [\-vf VerticalFrequency1] .B ComponentFile1] .B - [[-ci ComponentIndex2] [-fw FrameWidth2] [-fh FrameHeight2] + [[\-ci ComponentIndex2] [\-fw FrameWidth2] [\-fh FrameHeight2] .B - [-hf HorizontalFrequency2] [-vf VerticalFrequency2] + [\-hf HorizontalFrequency2] [\-vf VerticalFrequency2] .B ComponentFile2] .B .... .br .SH DESCRIPTION -.I jpeg -is a still-image compression/decompression program that performs -JPEG encoding and decoding of multiple raster-scanned files. +.I pvrg\-jpeg +is a still\-image compression/decompression program that performs +JPEG encoding and decoding of multiple raster\-scanned files. +.PP +These ``raster\-scanned files'' are basically PGM (portable graymap) files +without the PGM header. A typical JPEG image is made of three of these +files representing the Y, Cr, and Cb color channels. Usually the Y (lumience) +channel is full size, while the two chroma channels are half width and +half height. But no particular channel really needs to be full size, so +.I pvrg\-jpeg +will need to know the dimensions of the original image when creating jpegs. .PP .SH OPTIONS .TP @@ -44,78 +52,88 @@ specifies the height of the tallest component. This corresponds to the height of the ``original image''. .TP -.B -JFIF +.B \-JFIF specifies that a JFIF header is placed on the encoded stream. This is unnecessary for decoding. .TP -.B Q-Factor +.B Q\-Factor option specifies a multiplicative factor for the quantization: each quantization coefficient of the default matrix is scaled by -(Q-Factor/50). A Q-Factor of 0 is the same thing as a Q-Factor of 50 +(Q\-Factor/50). A Q\-Factor of 0 is the same thing as a Q\-Factor of 50 because it disables this function. -.B -q +.B \-q specifies an 8 bit quantization matrix; -.B -ql +.B \-ql specifies a 16 bit quantization matrix, useful for 12 bit data. .TP -.B -a -enables the double-precision floating point Reference DCT. (Default +.B \-a +enables the double\-precision floating point Reference DCT. (Default is Chen DCT.) .TP -.B -b +.B \-b enables the Lee DCT. (Default is Chen DCT.) .TP -.B -d +.B \-d enables decoding. See below. .TP -.B -k predictortype -The lossless predictor type, specified as an integer between 1-7. +.B \-g +This option will put PGM headers on output files when decoding. +.TP +.B \-k predictortype +The lossless predictor type, specified as an integer between 1\-7. If specified, then lossless mode is used. .TP -.B -n +.B \-n This option specifies that the files should not be transmitted in interleaved format. .TP -.B -o +.B \-o OutBaseName +This will use specified string as a base name for output files when decoding. +.TP +.B \-O signals that the command interpreter will read from the standard input. .TP -.B -p -Specifies the precision. Normally should be between 2-16 for +.B \-p +Specifies the precision. Normally should be between 2\-16 for lossless; 8 or 12 for DCT. If it is specified as a number greater than 8 then the input is considered to be unsigned shorts (16 bits, msb first). Not aggressively checked. .TP -.B -t pointtransform +.B \-s JPEGStreamName +When encoding, this will be used as the output file. When decoding, this +will be used as the input file. +.TP +.B \-t pointtransform Specifies the shifting (right) upon loading input and shifting (left) upon writing input. Generally used by the lossless mode only. Can be used by the DCT mode to add or subtract bits. .TP -.B -y +.B \-y for decoding only, signals that .I no resynchronization is enabled, thus ignore any markers found in the data stream. .TP -.B -z +.B \-z enables use of default Huffman tables. This converts the coding from a -two-pass system using the first pass to generate custom tables to a -one-pass system using internal default tables. With this option, the +two\-pass system using the first pass to generate custom tables to a +one\-pass system using internal default tables. With this option, the compression speed is nearly doubled, but because the internal tables are not custom to the image, the compressed file size increases slightly. .TP .B ResyncInterval specifies a resync (restart) -interval for the input file--if set to 0 (default), resynchronization +interval for the input file\-\-if set to 0 (default), resynchronization is disabled; otherwise it signifies the number of MDU between a resync marker. .TP .B StreamName is the place to load(decoder)/store(encoder) -the coded image--if unspecified it defaults to +the coded image\-\-if unspecified it defaults to .B ComponentFile1.jpg. .br @@ -129,7 +147,7 @@ 1; U is in 2; V is in 3. The file specfications, if left undisturbed, will result in component location of 1 for the first component file, 2 for the second component file, and so on. If -.B -ci +.B \-ci is specified for the previous component file, then the next component index defaults to the previous component index plus 1. @@ -152,12 +170,11 @@ FrameWidth, this should equal the file size of the component. See the above discussion on the actual specification. .TP -.B Hor-Frequency +.B Hor\-Frequency specifies the block sampling frequency of the component in the horizontal direction for every MDU transmitted. .TP -.B -Ver-Frequency +.B Ver\-Frequency specifies the block sampling frequency of the component in the vertical direction. When multiplied together with the Horizontal frequency, it corresponds to the number of blocks of @@ -168,7 +185,7 @@ represents the directory path location of the \fIn\fRth component file. .PP .SH EXAMPLES -In order to encode a set of raster-scanned files: +In order to encode a set of raster\-scanned files: 128x128 in .B image.Y; 64x128 in @@ -181,7 +198,7 @@ .br .B -jpeg -iw 128 -ih 128 -hf 2 image.Y image.U image.V -s image.jpg +pvrg\-jpeg \-iw 128 \-ih 128 \-hf 2 image.Y image.U image.V \-s image.jpg .br In order to decode a compressed file in @@ -190,7 +207,7 @@ .br .B -jpeg -d -s image.jpg +pvrg\-jpeg \-d \-s image.jpg .br The three output files will be in @@ -212,17 +229,11 @@ .I doc.ps for more details. .PP -.SH FTP -.I jpeg -is available by anonymous ftp from -.I havefun.stanford.edu:pub/jpeg/JPEGv1.2.tar.Z. -.PP .SH BUGS Somewhat slower than many commercial implementations, some bugs are probably lurking around. Lossless coding and decoding are especially slow. -Please inform the author at achung@cs.stanford.edu if any bugs -are found. +This program can produce jpeg files that other programs cannot understand. .PP .SH AUTHOR .PP