Updating package graphics/jpeg from version 6bnb4 to 7

pkgsrc changes:
  - update MASTER_SITES
  - bump ApI_DEPENDS in buildlink3.mk

Upstream changes:
- The new features added with version 6bnb4 are now added upstream (except
  exifautotran and jpegexiforient)

Version 7  27-Jun-2009
----------------------

New scaled DCTs implemented.
djpeg now supports scalings N/8 with all N from 1 to 16.
cjpeg now supports scalings 8/N with all N from 1 to 16.
Scaled DCTs with size larger than 8 are now also used for resolving the
common 2x2 chroma subsampling case without additional spatial resampling.
Separate spatial resampling for those kind of files is now only necessary
for N>8 scaling cases.
Furthermore, separate scaled DCT functions are provided for direct resolving
of the common asymmetric subsampling cases (2x1 and 1x2) without additional
spatial resampling.

cjpeg -quality option has been extended for support of separate quality
settings for luminance and chrominance (or in general, for every provided
quantization table slot).
New API function jpeg_default_qtables() and q_scale_factor array in library.

Added -nosmooth option to cjpeg, complementary to djpeg.
New variable "do_fancy_downsampling" in library, complement to fancy
upsampling.  Fancy upsampling now uses direct DCT scaling with sizes
larger than 8.  The old method is not reversible and has been removed.

Support arithmetic entropy encoding and decoding.
Added files jaricom.c, jcarith.c, jdarith.c.

Straighten the file structure:
Removed files jidctred.c, jcphuff.c, jchuff.h, jdphuff.c, jdhuff.h.

jpegtran has a new "lossless" cropping feature.

Implement -perfect option in jpegtran, new API function
jtransform_perfect_transform() in transupp. (DP 204_perfect.dpatch)

Better error messages for jpegtran fopen failure.
(DP 203_jpegtran_errmsg.dpatch)

Fix byte order issue with 16bit PPM/PGM files in rdppm.c/wrppm.c:
according to Netpbm, the de facto standard implementation of the PNM formats,
the most significant byte is first. (DP 203_rdppm.dpatch)

Add -raw option to rdjpgcom not to mangle the output.
(DP 205_rdjpgcom_raw.dpatch)

Make rdjpgcom locale aware. (DP 201_rdjpgcom_locale.dpatch)

Add extern "C" to jpeglib.h.
This avoids the need to put extern "C" { ... } around #include "jpeglib.h"
in your C++ application.  Defining the symbol DONT_USE_EXTERN_C in the
configuration prevents this. (DP 202_jpeglib.h_c++.dpatch)
This commit is contained in:
sno 2009-08-26 16:50:46 +00:00
parent 172aa789af
commit a65214fa58
11 changed files with 117 additions and 1983 deletions

View file

@ -1,12 +1,10 @@
# $NetBSD: Makefile,v 1.37 2007/08/01 11:47:15 obache Exp $
# $NetBSD: Makefile,v 1.38 2009/08/26 16:50:46 sno Exp $
#
DISTNAME= jpegsrc.v6b
PKGNAME= jpeg-6b
PKGREVISION= 4
DISTNAME= jpegsrc.v7
PKGNAME= jpeg-7
CATEGORIES= graphics
MASTER_SITES= ftp://ftp.fu-berlin.de/unix/graphics/jpeg/ \
ftp://ftp.uu.net/graphics/jpeg/
MASTER_SITES= http://www.ijg.org/files/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.ijg.org/
@ -19,21 +17,15 @@ WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
USE_LIBTOOL= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= --enable-static
INSTALL_TARGET= install install-lib
INSTALLATION_DIRS= bin lib include ${PKGMANDIR}/man1
INSTALL_MAKE_FLAGS+= prefix=${DESTDIR}${PREFIX}
post-extract:
${CP} ${FILESDIR}/jpegexiforient.c ${WRKSRC}
post-install:
${INSTALL_SCRIPT} ${FILESDIR}/exifautotran ${DESTDIR}${PREFIX}/bin
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/doc/jpeg
${INSTALL_DATA} ${WRKSRC}/*.doc ${DESTDIR}${PREFIX}/share/doc/jpeg
${INSTALL_DATA} ${WRKSRC}/*.txt ${DESTDIR}${PREFIX}/share/doc/jpeg
${INSTALL_DATA} ${WRKSRC}/jpegint.h ${DESTDIR}${PREFIX}/include
.include "../../mk/bsd.pkg.mk"

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.7 2009/06/14 17:59:19 joerg Exp $
@comment $NetBSD: PLIST,v 1.8 2009/08/26 16:50:46 sno Exp $
bin/cjpeg
bin/djpeg
bin/exifautotran
@ -17,11 +17,11 @@ man/man1/djpeg.1
man/man1/jpegtran.1
man/man1/rdjpgcom.1
man/man1/wrjpgcom.1
share/doc/jpeg/coderules.doc
share/doc/jpeg/filelist.doc
share/doc/jpeg/install.doc
share/doc/jpeg/jconfig.doc
share/doc/jpeg/libjpeg.doc
share/doc/jpeg/structure.doc
share/doc/jpeg/usage.doc
share/doc/jpeg/wizard.doc
share/doc/jpeg/coderules.txt
share/doc/jpeg/filelist.txt
share/doc/jpeg/install.txt
share/doc/jpeg/jconfig.txt
share/doc/jpeg/libjpeg.txt
share/doc/jpeg/structure.txt
share/doc/jpeg/usage.txt
share/doc/jpeg/wizard.txt

View file

@ -1,12 +1,12 @@
# $NetBSD: buildlink3.mk,v 1.10 2009/03/20 19:24:41 joerg Exp $
# $NetBSD: buildlink3.mk,v 1.11 2009/08/26 16:50:46 sno Exp $
BUILDLINK_TREE+= jpeg
.if !defined(JPEG_BUILDLINK3_MK)
JPEG_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.jpeg+= jpeg>=6b
BUILDLINK_ABI_DEPENDS.jpeg+= jpeg>=6bnb2
BUILDLINK_API_DEPENDS.jpeg+= jpeg>=7
#BUILDLINK_ABI_DEPENDS.jpeg+= jpeg>=7
BUILDLINK_PKGSRCDIR.jpeg?= ../../graphics/jpeg
.endif # JPEG_BUILDLINK3_MK

View file

@ -1,10 +1,7 @@
$NetBSD: distinfo,v 1.7 2008/03/28 09:01:30 obache Exp $
$NetBSD: distinfo,v 1.8 2009/08/26 16:50:46 sno Exp $
SHA1 (jpegsrc.v6b.tar.gz) = 7079f0d6c42fad0cfba382cf6ad322add1ace8f9
RMD160 (jpegsrc.v6b.tar.gz) = 18892206014fbb8cae2a44e281f4ed53feaf7882
Size (jpegsrc.v6b.tar.gz) = 613261 bytes
SHA1 (patch-aa) = 6a02e633084aa91e2b6b1bbd5668d91e9ec2c321
SHA1 (patch-ab) = e57da4f693e638cf58b414bfbc50e21d80270109
SHA1 (patch-ac) = 6c34738effc7df671d4522b4ecca06dab640ed16
SHA1 (patch-ad) = 73afda7c2c849c93d1c1dd2c632e1e67a1db97dc
SHA1 (patch-ae) = 4d2b3316df3a6b3ae9c0ef5099620f5f24300cca
SHA1 (jpegsrc.v7.tar.gz) = 88cced0fc3dbdbc82115e1d08abce4e9d23a4b47
RMD160 (jpegsrc.v7.tar.gz) = 6049c5fee2682c0757d4b51740abd981d1b24487
Size (jpegsrc.v7.tar.gz) = 960379 bytes
SHA1 (patch-af) = 77d847be360338c0cde0eef34f670a289f56ea15
SHA1 (patch-ag) = 9b72e28530eca39821ec5c7d1698435deba29b5b

View file

@ -1,61 +0,0 @@
$NetBSD: patch-aa,v 1.10 2008/03/28 09:01:30 obache Exp $
--- makefile.cfg.orig 1998-03-21 19:08:57.000000000 +0000
+++ makefile.cfg
@@ -17,7 +17,7 @@ includedir = $(prefix)/include
binprefix =
manprefix =
manext = 1
-mandir = $(prefix)/man/man$(manext)
+mandir = $(DESTDIR)@mandir@/man$(manext)
# The name of your C compiler:
CC= @CC@
@@ -86,7 +86,7 @@ SYSDEPSOURCES= jmemansi.c jmemname.c jme
# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c \
rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c \
- rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+ rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c jpegexiforient.c
SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
# files included by source files
INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h \
@@ -133,7 +133,7 @@ DOBJECTS= djpeg.$(O) wrppm.$(O) wrgif.$(
TROBJECTS= jpegtran.$(O) rdswitch.$(O) cdjpeg.$(O) transupp.$(O)
-all: @A2K_DEPS@ libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+all: @A2K_DEPS@ libjpeg.$(A) cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpegexiforient
# Special compilation rules to support ansi2knr and libtool.
.SUFFIXES: .lo .la
@@ -179,6 +179,9 @@ cjpeg: $(COBJECTS) libjpeg.$(A)
djpeg: $(DOBJECTS) libjpeg.$(A)
$(LN) $(LDFLAGS) -o djpeg $(DOBJECTS) libjpeg.$(A) $(LDLIBS)
+jpegexiforient: jpegexiforient.$(O)
+ $(LN) $(LDFLAGS) -o jpegexiforient jpegexiforient.$(O) $(LDLIBS)
+
jpegtran: $(TROBJECTS) libjpeg.$(A)
$(LN) $(LDFLAGS) -o jpegtran $(TROBJECTS) libjpeg.$(A) $(LDLIBS)
@@ -190,9 +193,10 @@ wrjpgcom: wrjpgcom.$(O)
# Installation rules:
-install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom @FORCE_INSTALL_LIB@
+install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpegexiforient @FORCE_INSTALL_LIB@
$(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
$(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
+ $(INSTALL_PROGRAM) jpegexiforient $(bindir)/$(binprefix)jpegexiforient
$(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
$(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
$(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
@@ -300,6 +304,7 @@ jmemdos.$(O): jmemdos.c jinclude.h jconf
jmemmac.$(O): jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
cjpeg.$(O): cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
djpeg.$(O): djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegexiforient.$(O): jpegexiforient.c
jpegtran.$(O): jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
rdjpgcom.$(O): rdjpgcom.c jinclude.h jconfig.h
wrjpgcom.$(O): wrjpgcom.c jinclude.h jconfig.h

File diff suppressed because it is too large Load diff

View file

@ -1,12 +0,0 @@
$NetBSD: patch-ac,v 1.1 2007/06/05 22:07:26 tnn Exp $
--- jerror.h.orig 2007-06-05 22:37:04.000000000 +0200
+++ jerror.h
@@ -45,6 +45,7 @@ JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYP
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
+JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")

View file

@ -1,193 +0,0 @@
$NetBSD: patch-ad,v 1.1 2007/06/05 22:07:26 tnn Exp $
--- jpegtran.c.orig 2007-06-05 22:37:58.000000000 +0200
+++ jpegtran.c
@@ -1,7 +1,7 @@
/*
* jpegtran.c
*
- * Copyright (C) 1995-1997, Thomas G. Lane.
+ * Copyright (C) 1995-2001, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -64,8 +64,10 @@ usage (void)
#endif
#if TRANSFORMS_SUPPORTED
fprintf(stderr, "Switches for modifying the image:\n");
+ fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n");
fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
+ fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n");
fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
fprintf(stderr, " -transpose Transpose image\n");
fprintf(stderr, " -transverse Transverse transpose image\n");
@@ -133,7 +135,9 @@ parse_switches (j_compress_ptr cinfo, in
copyoption = JCOPYOPT_DEFAULT;
transformoption.transform = JXFORM_NONE;
transformoption.trim = FALSE;
+ transformoption.perfect = FALSE;
transformoption.force_grayscale = FALSE;
+ transformoption.crop = FALSE;
cinfo->err->trace_level = 0;
/* Scan command line options, adjust parameters */
@@ -160,7 +164,7 @@ parse_switches (j_compress_ptr cinfo, in
exit(EXIT_FAILURE);
#endif
- } else if (keymatch(arg, "copy", 1)) {
+ } else if (keymatch(arg, "copy", 2)) {
/* Select which extra markers to copy. */
if (++argn >= argc) /* advance to next argument */
usage();
@@ -173,6 +177,20 @@ parse_switches (j_compress_ptr cinfo, in
} else
usage();
+ } else if (keymatch(arg, "crop", 2)) {
+ /* Perform lossless cropping. */
+#if TRANSFORMS_SUPPORTED
+ if (++argn >= argc) /* advance to next argument */
+ usage();
+ if (! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
+ fprintf(stderr, "%s: bogus -crop argument '%s'\n",
+ progname, argv[argn]);
+ exit(EXIT_FAILURE);
+ }
+#else
+ select_transform(JXFORM_NONE); /* force an error */
+#endif
+
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
/* Enable debug printouts. */
/* On first -d, print version identification */
@@ -233,7 +251,12 @@ parse_switches (j_compress_ptr cinfo, in
usage();
outfilename = argv[argn]; /* save it away for later use */
- } else if (keymatch(arg, "progressive", 1)) {
+ } else if (keymatch(arg, "perfect", 2)) {
+ /* Fail if there is any partial edge MCUs that the transform can't
+ * handle. */
+ transformoption.perfect = TRUE;
+
+ } else if (keymatch(arg, "progressive", 2)) {
/* Select simple progressive mode. */
#ifdef C_PROGRESSIVE_SUPPORTED
simple_progressive = TRUE;
@@ -342,8 +365,10 @@ main (int argc, char **argv)
jvirt_barray_ptr * src_coef_arrays;
jvirt_barray_ptr * dst_coef_arrays;
int file_index;
- FILE * input_file;
- FILE * output_file;
+ /* We assume all-in-memory processing and can therefore use only a
+ * single file pointer for sequential input and output operation.
+ */
+ FILE * fp;
/* On Mac, fetch a command line. */
#ifdef USE_CCOMMAND
@@ -406,24 +431,13 @@ main (int argc, char **argv)
/* Open the input file. */
if (file_index < argc) {
- if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
- fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
+ if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
+ fprintf(stderr, "%s: can't open %s for reading\n", progname, argv[file_index]);
exit(EXIT_FAILURE);
}
} else {
/* default input file is stdin */
- input_file = read_stdin();
- }
-
- /* Open the output file. */
- if (outfilename != NULL) {
- if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
- fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
- exit(EXIT_FAILURE);
- }
- } else {
- /* default output file is stdout */
- output_file = write_stdout();
+ fp = read_stdin();
}
#ifdef PROGRESS_REPORT
@@ -431,7 +445,7 @@ main (int argc, char **argv)
#endif
/* Specify data source for decompression */
- jpeg_stdio_src(&srcinfo, input_file);
+ jpeg_stdio_src(&srcinfo, fp);
/* Enable saving of extra markers that we want to copy */
jcopy_markers_setup(&srcinfo, copyoption);
@@ -443,6 +457,15 @@ main (int argc, char **argv)
* jpeg_read_coefficients so that memory allocation will be done right.
*/
#if TRANSFORMS_SUPPORTED
+ /* Fails right away if -perfect is given and transformation is not perfect.
+ */
+ if (transformoption.perfect &&
+ !jtransform_perfect_transform(srcinfo.image_width, srcinfo.image_height,
+ srcinfo.max_h_samp_factor * DCTSIZE, srcinfo.max_v_samp_factor * DCTSIZE,
+ transformoption.transform)) {
+ fprintf(stderr, "%s: transformation is not perfect\n", progname);
+ exit(EXIT_FAILURE);
+ }
jtransform_request_workspace(&srcinfo, &transformoption);
#endif
@@ -463,11 +486,32 @@ main (int argc, char **argv)
dst_coef_arrays = src_coef_arrays;
#endif
+ /* Close input file, if we opened it.
+ * Note: we assume that jpeg_read_coefficients consumed all input
+ * until JPEG_REACHED_EOI, and that jpeg_finish_decompress will
+ * only consume more while (! cinfo->inputctl->eoi_reached).
+ * We cannot call jpeg_finish_decompress here since we still need the
+ * virtual arrays allocated from the source object for processing.
+ */
+ if (fp != stdin)
+ fclose(fp);
+
+ /* Open the output file. */
+ if (outfilename != NULL) {
+ if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) {
+ fprintf(stderr, "%s: can't open %s for writing\n", progname, outfilename);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ /* default output file is stdout */
+ fp = write_stdout();
+ }
+
/* Adjust default compression parameters by re-parsing the options */
file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE);
/* Specify data destination for compression */
- jpeg_stdio_dest(&dstinfo, output_file);
+ jpeg_stdio_dest(&dstinfo, fp);
/* Start compressor (note no image data is actually written here) */
jpeg_write_coefficients(&dstinfo, dst_coef_arrays);
@@ -488,11 +532,9 @@ main (int argc, char **argv)
(void) jpeg_finish_decompress(&srcinfo);
jpeg_destroy_decompress(&srcinfo);
- /* Close files, if we opened them */
- if (input_file != stdin)
- fclose(input_file);
- if (output_file != stdout)
- fclose(output_file);
+ /* Close output file, if we opened it */
+ if (fp != stdout)
+ fclose(fp);
#ifdef PROGRESS_REPORT
end_progress_monitor((j_common_ptr) &dstinfo);

View file

@ -1,182 +0,0 @@
$NetBSD: patch-ae,v 1.1 2007/06/05 22:07:26 tnn Exp $
--- transupp.h.orig 2007-06-05 22:46:42.000000000 +0200
+++ transupp.h
@@ -1,7 +1,7 @@
/*
* transupp.h
*
- * Copyright (C) 1997, Thomas G. Lane.
+ * Copyright (C) 1997-2001, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -22,32 +22,6 @@
#define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */
#endif
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jtransform_request_workspace jTrRequest
-#define jtransform_adjust_parameters jTrAdjust
-#define jtransform_execute_transformation jTrExec
-#define jcopy_markers_setup jCMrkSetup
-#define jcopy_markers_execute jCMrkExec
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-
-/*
- * Codes for supported types of image transformations.
- */
-
-typedef enum {
- JXFORM_NONE, /* no transformation */
- JXFORM_FLIP_H, /* horizontal flip */
- JXFORM_FLIP_V, /* vertical flip */
- JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
- JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
- JXFORM_ROT_90, /* 90-degree clockwise rotation */
- JXFORM_ROT_180, /* 180-degree rotation */
- JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
-} JXFORM_CODE;
-
/*
* Although rotating and flipping data expressed as DCT coefficients is not
* hard, there is an asymmetry in the JPEG format specification for images
@@ -75,6 +49,19 @@ typedef enum {
* (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
* followed by -rot 180 -trim trims both edges.)
*
+ * We also offer a lossless-crop option, which discards data outside a given
+ * image region but losslessly preserves what is inside. Like the rotate and
+ * flip transforms, lossless crop is restricted by the JPEG format: the upper
+ * left corner of the selected region must fall on an iMCU boundary. If this
+ * does not hold for the given crop parameters, we silently move the upper left
+ * corner up and/or left to make it so, simultaneously increasing the region
+ * dimensions to keep the lower right crop corner unchanged. (Thus, the
+ * output image covers at least the requested region, but may cover more.)
+ *
+ * If both crop and a rotate/flip transform are requested, the crop is applied
+ * last --- that is, the crop region is specified in terms of the destination
+ * image.
+ *
* We also offer a "force to grayscale" option, which simply discards the
* chrominance channels of a YCbCr image. This is lossless in the sense that
* the luminance channel is preserved exactly. It's not the same kind of
@@ -83,20 +70,89 @@ typedef enum {
* be aware of the option to know how many components to work on.
*/
+
+/* Short forms of external names for systems with brain-damaged linkers. */
+
+#ifdef NEED_SHORT_EXTERNAL_NAMES
+#define jtransform_parse_crop_spec jTrParCrop
+#define jtransform_request_workspace jTrRequest
+#define jtransform_adjust_parameters jTrAdjust
+#define jtransform_execute_transform jTrExec
+#define jtransform_perfect_transform jTrPerfect
+#define jcopy_markers_setup jCMrkSetup
+#define jcopy_markers_execute jCMrkExec
+#endif /* NEED_SHORT_EXTERNAL_NAMES */
+
+
+/*
+ * Codes for supported types of image transformations.
+ */
+
+typedef enum {
+ JXFORM_NONE, /* no transformation */
+ JXFORM_FLIP_H, /* horizontal flip */
+ JXFORM_FLIP_V, /* vertical flip */
+ JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
+ JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
+ JXFORM_ROT_90, /* 90-degree clockwise rotation */
+ JXFORM_ROT_180, /* 180-degree rotation */
+ JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
+} JXFORM_CODE;
+
+/*
+ * Codes for crop parameters, which can individually be unspecified,
+ * positive, or negative. (Negative width or height makes no sense, though.)
+ */
+
+typedef enum {
+ JCROP_UNSET,
+ JCROP_POS,
+ JCROP_NEG
+} JCROP_CODE;
+
+/*
+ * Transform parameters struct.
+ * NB: application must not change any elements of this struct after
+ * calling jtransform_request_workspace.
+ */
+
typedef struct {
/* Options: set by caller */
JXFORM_CODE transform; /* image transform operator */
+ boolean perfect; /* if TRUE, fail if partial MCUs are requested */
boolean trim; /* if TRUE, trim partial MCUs as needed */
boolean force_grayscale; /* if TRUE, convert color image to grayscale */
+ boolean crop; /* if TRUE, crop source image */
+
+ /* Crop parameters: application need not set these unless crop is TRUE.
+ * These can be filled in by jtransform_parse_crop_spec().
+ */
+ JDIMENSION crop_width; /* Width of selected region */
+ JCROP_CODE crop_width_set;
+ JDIMENSION crop_height; /* Height of selected region */
+ JCROP_CODE crop_height_set;
+ JDIMENSION crop_xoffset; /* X offset of selected region */
+ JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */
+ JDIMENSION crop_yoffset; /* Y offset of selected region */
+ JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */
/* Internal workspace: caller should not touch these */
int num_components; /* # of components in workspace */
jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
+ JDIMENSION output_width; /* cropped destination dimensions */
+ JDIMENSION output_height;
+ JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */
+ JDIMENSION y_crop_offset;
+ int max_h_samp_factor; /* destination iMCU size */
+ int max_v_samp_factor;
} jpeg_transform_info;
#if TRANSFORMS_SUPPORTED
+/* Parse a crop specification (written in X11 geometry style) */
+EXTERN(boolean) jtransform_parse_crop_spec
+ JPP((jpeg_transform_info *info, const char *spec));
/* Request any required workspace */
EXTERN(void) jtransform_request_workspace
JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
@@ -106,10 +162,24 @@ EXTERN(jvirt_barray_ptr *) jtransform_ad
jvirt_barray_ptr *src_coef_arrays,
jpeg_transform_info *info));
/* Execute the actual transformation, if any */
-EXTERN(void) jtransform_execute_transformation
+EXTERN(void) jtransform_execute_transform
JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
jvirt_barray_ptr *src_coef_arrays,
jpeg_transform_info *info));
+/* Determine whether lossless transformation is perfectly
+ * possible for a specified image and transformation.
+ */
+EXTERN(boolean) jtransform_perfect_transform
+ JPP((JDIMENSION image_width, JDIMENSION image_height,
+ int MCU_width, int MCU_height,
+ JXFORM_CODE transform));
+
+/* jtransform_execute_transform used to be called
+ * jtransform_execute_transformation, but some compilers complain about
+ * routine names that long. This macro is here to avoid breaking any
+ * old source code that uses the original name...
+ */
+#define jtransform_execute_transformation jtransform_execute_transform
#endif /* TRANSFORMS_SUPPORTED */

View file

@ -0,0 +1,20 @@
--- Makefile.am.orig 2009-08-23 15:48:01.000000000 +0200
+++ Makefile.am 2009-08-23 15:49:50.000000000 +0200
@@ -75,7 +75,7 @@
endif
# Executables to build
-bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
+bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpegexiforient
# Executable sources & libs
cjpeg_SOURCES = cjpeg.c rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c \
@@ -88,6 +88,8 @@
jpegtran_LDADD = libjpeg.la
rdjpgcom_SOURCES = rdjpgcom.c
wrjpgcom_SOURCES = wrjpgcom.c
+jpegexiforient_SOURCES = jpegexiforient.c
+jpegexiforient_LDADD = libjpeg.la
# Manual pages to install
man_MANS = $(DISTMANS)

View file

@ -0,0 +1,74 @@
--- Makefile.in.orig 2009-08-23 15:47:53.000000000 +0200
+++ Makefile.in 2009-08-23 15:56:25.000000000 +0200
@@ -46,7 +46,7 @@
ANSI2KNR = @ANSI2KNR@
@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=$(srcdir)/libjpeg.map
bin_PROGRAMS = cjpeg$(EXEEXT) djpeg$(EXEEXT) jpegtran$(EXEEXT) \
- rdjpgcom$(EXEEXT) wrjpgcom$(EXEEXT)
+ rdjpgcom$(EXEEXT) wrjpgcom$(EXEEXT) jpegexiforient$(EXEEXT)
subdir = .
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
@@ -128,6 +128,9 @@
am_wrjpgcom_OBJECTS = wrjpgcom$U.$(OBJEXT)
wrjpgcom_OBJECTS = $(am_wrjpgcom_OBJECTS)
wrjpgcom_LDADD = $(LDADD)
+am_jpegexiforient_OBJECTS = jpegexiforient$U.$(OBJEXT)
+jpegexiforient_OBJECTS = $(am_jpegexiforient_OBJECTS)
+jpegexiforient_DEPENDENCIES = libjpeg.la
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -155,7 +158,8 @@
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libjpeg_la_SOURCES) $(cjpeg_SOURCES) $(djpeg_SOURCES) \
- $(jpegtran_SOURCES) $(rdjpgcom_SOURCES) $(wrjpgcom_SOURCES)
+ $(jpegtran_SOURCES) $(rdjpgcom_SOURCES) $(wrjpgcom_SOURCES) \
+ $(jpegexiforient_SOURCES)
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(man_MANS)
@@ -369,6 +373,7 @@
jpegtran_LDADD = libjpeg.la
rdjpgcom_SOURCES = rdjpgcom.c
wrjpgcom_SOURCES = wrjpgcom.c
+jpegexiforient_SOURCES = jpegexiforient.c
# Manual pages to install
man_MANS = $(DISTMANS)
@@ -535,6 +540,9 @@
wrjpgcom$(EXEEXT): $(wrjpgcom_OBJECTS) $(wrjpgcom_DEPENDENCIES)
@rm -f wrjpgcom$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(wrjpgcom_OBJECTS) $(wrjpgcom_LDADD) $(LIBS)
+jpegexiforient$(EXEEXT): $(jpegexiforient_OBJECTS) $(jpegexiforient_DEPENDENCIES)
+ @rm -f jpegexiforient$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(jpegexiforient_OBJECTS) $(jpegexiforient_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -597,6 +605,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctfst$U.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jidctint$U.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmemmgr$U.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jpegexiforient$U.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jpegtran$U.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant1$U.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jquant2$U.Plo@am__quote@
@@ -732,6 +741,8 @@
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jidctint.c; then echo $(srcdir)/jidctint.c; else echo jidctint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
jmemmgr_.c: jmemmgr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jmemmgr.c; then echo $(srcdir)/jmemmgr.c; else echo jmemmgr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jpegexiforient_.c: jpegexiforient.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jpegexiforient.c; then echo $(srcdir)/jpegexiforient.c; else echo jpegexiforient.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
jpegtran_.c: jpegtran.c $(ANSI2KNR)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jpegtran.c; then echo $(srcdir)/jpegtran.c; else echo jpegtran.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
jquant1_.c: jquant1.c $(ANSI2KNR)
@@ -793,6 +804,7 @@
jfdctfst_.$(OBJEXT) jfdctfst_.lo jfdctint_.$(OBJEXT) jfdctint_.lo \
jidctflt_.$(OBJEXT) jidctflt_.lo jidctfst_.$(OBJEXT) jidctfst_.lo \
jidctint_.$(OBJEXT) jidctint_.lo jmemmgr_.$(OBJEXT) jmemmgr_.lo \
+jpegexiforient_.$(OBJEXT) jpegexiforient_.lo \
jpegtran_.$(OBJEXT) jpegtran_.lo jquant1_.$(OBJEXT) jquant1_.lo \
jquant2_.$(OBJEXT) jquant2_.lo jutils_.$(OBJEXT) jutils_.lo \
rdbmp_.$(OBJEXT) rdbmp_.lo rdcolmap_.$(OBJEXT) rdcolmap_.lo \