summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/packages/jpeg/jpeg-6b/debian.patch1874
-rw-r--r--meta/packages/jpeg/jpeg-6b/ldflags.patch16
-rw-r--r--meta/packages/jpeg/jpeg-6b/libtool_tweak.patch52
-rw-r--r--meta/packages/jpeg/jpeg-6b/paths.patch77
-rwxr-xr-xmeta/packages/jpeg/jpeg-8b/debian-libjpeg7_7-1.diff1066
-rw-r--r--meta/packages/jpeg/jpeg_8b.bb (renamed from meta/packages/jpeg/jpeg_6b.bb)10
6 files changed, 1071 insertions, 2024 deletions
diff --git a/meta/packages/jpeg/jpeg-6b/debian.patch b/meta/packages/jpeg/jpeg-6b/debian.patch
deleted file mode 100644
index a169ad19d6..0000000000
--- a/meta/packages/jpeg/jpeg-6b/debian.patch
+++ /dev/null
@@ -1,1874 +0,0 @@
1--- jpeg-6b/jpegtran.1~libjpeg6bb-5
2+++ jpeg-6b/jpegtran.1
3@@ -131,6 +131,24 @@
4 .B \-rot 180 -trim
5 trims both edges.
6 .PP
7+We also offer a lossless-crop option, which discards data outside a given
8+image region but losslessly preserves what is inside. Like the rotate and
9+flip transforms, lossless crop is restricted by the JPEG format: the upper
10+left corner of the selected region must fall on an iMCU boundary. If this
11+does not hold for the given crop parameters, we silently move the upper left
12+corner up and/or left to make it so, simultaneously increasing the region
13+dimensions to keep the lower right crop corner unchanged. (Thus, the
14+output image covers at least the requested region, but may cover more.)
15+
16+Note: lossless-crop is an enhancement from http://sylvana.net/jpegcrop/
17+that may not be available on non-Debian systems.
18+
19+The image can be losslessly cropped by giving the switch:
20+.TP
21+.B \-crop WxH+X+Y
22+Crop to a rectangular subarea of width W, height H starting at point X,Y.
23+.PP
24+.PP
25 Another not-strictly-lossless transformation switch is:
26 .TP
27 .B \-grayscale
28--- jpeg-6b/configure~libjpeg6bb-5
29+++ jpeg-6b/configure
30@@ -52,7 +52,7 @@
31 includedir='${prefix}/include'
32 oldincludedir='/usr/include'
33 infodir='${prefix}/info'
34-mandir='${prefix}/man'
35+mandir='${prefix}/share/man'
36
37 # Initialize some other variables.
38 subdirs=
39--- jpeg-6b/makefile.cfg~libjpeg6bb-5
40+++ jpeg-6b/makefile.cfg
41@@ -17,7 +17,7 @@
42 binprefix =
43 manprefix =
44 manext = 1
45-mandir = $(prefix)/man/man$(manext)
46+mandir = $(prefix)/share/man/man$(manext)
47
48 # The name of your C compiler:
49 CC= @CC@
50@@ -210,6 +210,11 @@
51 $(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
52 $(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
53 $(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
54+#<ballombe@debian.org>:mjpegtools require this file to build and header say:
55+# * These declarations are considered internal to the JPEG library; most
56+# * applications using the library shouldn't need to include this file.
57+# So it is not forbidden to use it, therefore it must be installed.
58+ $(INSTALL_DATA) $(srcdir)/jpegint.h $(includedir)/jpegint.h
59
60 clean:
61 $(RM) *.o *.lo libjpeg.a libjpeg.la
62--- jpeg-6b/jpegtran.c~libjpeg6bb-5
63+++ jpeg-6b/jpegtran.c
64@@ -1,7 +1,7 @@
65 /*
66 * jpegtran.c
67 *
68- * Copyright (C) 1995-1997, Thomas G. Lane.
69+ * Copyright (C) 1995-2001, Thomas G. Lane.
70 * This file is part of the Independent JPEG Group's software.
71 * For conditions of distribution and use, see the accompanying README file.
72 *
73@@ -64,6 +64,7 @@
74 #endif
75 #if TRANSFORMS_SUPPORTED
76 fprintf(stderr, "Switches for modifying the image:\n");
77+ fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n");
78 fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n");
79 fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n");
80 fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n");
81@@ -134,6 +135,7 @@
82 transformoption.transform = JXFORM_NONE;
83 transformoption.trim = FALSE;
84 transformoption.force_grayscale = FALSE;
85+ transformoption.crop = FALSE;
86 cinfo->err->trace_level = 0;
87
88 /* Scan command line options, adjust parameters */
89@@ -160,7 +162,7 @@
90 exit(EXIT_FAILURE);
91 #endif
92
93- } else if (keymatch(arg, "copy", 1)) {
94+ } else if (keymatch(arg, "copy", 2)) {
95 /* Select which extra markers to copy. */
96 if (++argn >= argc) /* advance to next argument */
97 usage();
98@@ -173,6 +175,20 @@
99 } else
100 usage();
101
102+ } else if (keymatch(arg, "crop", 2)) {
103+ /* Perform lossless cropping. */
104+#if TRANSFORMS_SUPPORTED
105+ if (++argn >= argc) /* advance to next argument */
106+ usage();
107+ if (! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
108+ fprintf(stderr, "%s: bogus -crop argument '%s'\n",
109+ progname, argv[argn]);
110+ exit(EXIT_FAILURE);
111+ }
112+#else
113+ select_transform(JXFORM_NONE); /* force an error */
114+#endif
115+
116 } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) {
117 /* Enable debug printouts. */
118 /* On first -d, print version identification */
119@@ -342,8 +358,10 @@
120 jvirt_barray_ptr * src_coef_arrays;
121 jvirt_barray_ptr * dst_coef_arrays;
122 int file_index;
123- FILE * input_file;
124- FILE * output_file;
125+ /* We assume all-in-memory processing and can therefore use only a
126+ * single file pointer for sequential input and output operation.
127+ */
128+ FILE * fp;
129
130 /* On Mac, fetch a command line. */
131 #ifdef USE_CCOMMAND
132@@ -406,24 +424,13 @@
133
134 /* Open the input file. */
135 if (file_index < argc) {
136- if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
137+ if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
138 fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);
139 exit(EXIT_FAILURE);
140 }
141 } else {
142 /* default input file is stdin */
143- input_file = read_stdin();
144- }
145-
146- /* Open the output file. */
147- if (outfilename != NULL) {
148- if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) {
149- fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
150- exit(EXIT_FAILURE);
151- }
152- } else {
153- /* default output file is stdout */
154- output_file = write_stdout();
155+ fp = read_stdin();
156 }
157
158 #ifdef PROGRESS_REPORT
159@@ -431,7 +438,7 @@
160 #endif
161
162 /* Specify data source for decompression */
163- jpeg_stdio_src(&srcinfo, input_file);
164+ jpeg_stdio_src(&srcinfo, fp);
165
166 /* Enable saving of extra markers that we want to copy */
167 jcopy_markers_setup(&srcinfo, copyoption);
168@@ -463,11 +470,32 @@
169 dst_coef_arrays = src_coef_arrays;
170 #endif
171
172+ /* Close input file, if we opened it.
173+ * Note: we assume that jpeg_read_coefficients consumed all input
174+ * until JPEG_REACHED_EOI, and that jpeg_finish_decompress will
175+ * only consume more while (! cinfo->inputctl->eoi_reached).
176+ * We cannot call jpeg_finish_decompress here since we still need the
177+ * virtual arrays allocated from the source object for processing.
178+ */
179+ if (fp != stdin)
180+ fclose(fp);
181+
182+ /* Open the output file. */
183+ if (outfilename != NULL) {
184+ if ((fp = fopen(outfilename, WRITE_BINARY)) == NULL) {
185+ fprintf(stderr, "%s: can't open %s\n", progname, outfilename);
186+ exit(EXIT_FAILURE);
187+ }
188+ } else {
189+ /* default output file is stdout */
190+ fp = write_stdout();
191+ }
192+
193 /* Adjust default compression parameters by re-parsing the options */
194 file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE);
195
196 /* Specify data destination for compression */
197- jpeg_stdio_dest(&dstinfo, output_file);
198+ jpeg_stdio_dest(&dstinfo, fp);
199
200 /* Start compressor (note no image data is actually written here) */
201 jpeg_write_coefficients(&dstinfo, dst_coef_arrays);
202@@ -488,11 +516,9 @@
203 (void) jpeg_finish_decompress(&srcinfo);
204 jpeg_destroy_decompress(&srcinfo);
205
206- /* Close files, if we opened them */
207- if (input_file != stdin)
208- fclose(input_file);
209- if (output_file != stdout)
210- fclose(output_file);
211+ /* Close output file, if we opened it */
212+ if (fp != stdout)
213+ fclose(fp);
214
215 #ifdef PROGRESS_REPORT
216 end_progress_monitor((j_common_ptr) &dstinfo);
217--- jpeg-6b/rdjpgcom.c~libjpeg6bb-5
218+++ jpeg-6b/rdjpgcom.c
219@@ -14,6 +14,7 @@
220 #define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */
221 #include "jinclude.h" /* get auto-config symbols, <stdio.h> */
222
223+#include <locale.h> /*ballombe@debian.org: use locale for isprint*/
224 #include <ctype.h> /* to declare isupper(), tolower() */
225 #ifdef USE_SETMODE
226 #include <fcntl.h> /* to declare setmode()'s parameter macros */
227@@ -223,7 +224,10 @@
228 unsigned int length;
229 int ch;
230 int lastch = 0;
231-
232+/* ballombe@debian.org Thu, 15 Nov 2001 20:04:47 +0100*/
233+/* Set locale properly for isprint*/
234+ setlocale(LC_CTYPE,"");
235+
236 /* Get the marker parameter length count */
237 length = read_2_bytes();
238 /* Length includes itself, so must be at least 2 */
239@@ -254,6 +258,8 @@
240 length--;
241 }
242 printf("\n");
243+/*ballombe@debian.org: revert to C locale*/
244+ setlocale(LC_CTYPE,"C");
245 }
246
247
248--- jpeg-6b/transupp.c~libjpeg6bb-5
249+++ jpeg-6b/transupp.c
250@@ -1,7 +1,7 @@
251 /*
252 * transupp.c
253 *
254- * Copyright (C) 1997, Thomas G. Lane.
255+ * Copyright (C) 1997-2001, Thomas G. Lane.
256 * This file is part of the Independent JPEG Group's software.
257 * For conditions of distribution and use, see the accompanying README file.
258 *
259@@ -20,6 +20,7 @@
260 #include "jinclude.h"
261 #include "jpeglib.h"
262 #include "transupp.h" /* My own external interface */
263+#include <ctype.h> /* to declare isdigit() */
264
265
266 #if TRANSFORMS_SUPPORTED
267@@ -28,7 +29,8 @@
268 * Lossless image transformation routines. These routines work on DCT
269 * coefficient arrays and thus do not require any lossy decompression
270 * or recompression of the image.
271- * Thanks to Guido Vollbeding for the initial design and code of this feature.
272+ * Thanks to Guido Vollbeding for the initial design and code of this feature,
273+ * and to Ben Jackson for introducing the cropping feature.
274 *
275 * Horizontal flipping is done in-place, using a single top-to-bottom
276 * pass through the virtual source array. It will thus be much the
277@@ -42,6 +44,13 @@
278 * arrays for most of the transforms. That could result in much thrashing
279 * if the image is larger than main memory.
280 *
281+ * If cropping or trimming is involved, the destination arrays may be smaller
282+ * than the source arrays. Note it is not possible to do horizontal flip
283+ * in-place when a nonzero Y crop offset is specified, since we'd have to move
284+ * data from one block row to another but the virtual array manager doesn't
285+ * guarantee we can touch more than one row at a time. So in that case,
286+ * we have to use a separate destination array.
287+ *
288 * Some notes about the operating environment of the individual transform
289 * routines:
290 * 1. Both the source and destination virtual arrays are allocated from the
291@@ -54,20 +63,65 @@
292 * and we may as well take that as the effective iMCU size.
293 * 4. When "trim" is in effect, the destination's dimensions will be the
294 * trimmed values but the source's will be untrimmed.
295- * 5. All the routines assume that the source and destination buffers are
296+ * 5. When "crop" is in effect, the destination's dimensions will be the
297+ * cropped values but the source's will be uncropped. Each transform
298+ * routine is responsible for picking up source data starting at the
299+ * correct X and Y offset for the crop region. (The X and Y offsets
300+ * passed to the transform routines are measured in iMCU blocks of the
301+ * destination.)
302+ * 6. All the routines assume that the source and destination buffers are
303 * padded out to a full iMCU boundary. This is true, although for the
304 * source buffer it is an undocumented property of jdcoefct.c.
305- * Notes 2,3,4 boil down to this: generally we should use the destination's
306- * dimensions and ignore the source's.
307 */
308
309
310 LOCAL(void)
311-do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
312- jvirt_barray_ptr *src_coef_arrays)
313-/* Horizontal flip; done in-place, so no separate dest array is required */
314+do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
315+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
316+ jvirt_barray_ptr *src_coef_arrays,
317+ jvirt_barray_ptr *dst_coef_arrays)
318+/* Crop. This is only used when no rotate/flip is requested with the crop. */
319 {
320- JDIMENSION MCU_cols, comp_width, blk_x, blk_y;
321+ JDIMENSION dst_blk_y, x_crop_blocks, y_crop_blocks;
322+ int ci, offset_y;
323+ JBLOCKARRAY src_buffer, dst_buffer;
324+ jpeg_component_info *compptr;
325+
326+ /* We simply have to copy the right amount of data (the destination's
327+ * image size) starting at the given X and Y offsets in the source.
328+ */
329+ for (ci = 0; ci < dstinfo->num_components; ci++) {
330+ compptr = dstinfo->comp_info + ci;
331+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
332+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
333+ for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
334+ dst_blk_y += compptr->v_samp_factor) {
335+ dst_buffer = (*srcinfo->mem->access_virt_barray)
336+ ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
337+ (JDIMENSION) compptr->v_samp_factor, TRUE);
338+ src_buffer = (*srcinfo->mem->access_virt_barray)
339+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
340+ dst_blk_y + y_crop_blocks,
341+ (JDIMENSION) compptr->v_samp_factor, FALSE);
342+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
343+ jcopy_block_row(src_buffer[offset_y] + x_crop_blocks,
344+ dst_buffer[offset_y],
345+ compptr->width_in_blocks);
346+ }
347+ }
348+ }
349+}
350+
351+
352+LOCAL(void)
353+do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
354+ JDIMENSION x_crop_offset,
355+ jvirt_barray_ptr *src_coef_arrays)
356+/* Horizontal flip; done in-place, so no separate dest array is required.
357+ * NB: this only works when y_crop_offset is zero.
358+ */
359+{
360+ JDIMENSION MCU_cols, comp_width, blk_x, blk_y, x_crop_blocks;
361 int ci, k, offset_y;
362 JBLOCKARRAY buffer;
363 JCOEFPTR ptr1, ptr2;
364@@ -79,17 +133,19 @@
365 * mirroring by changing the signs of odd-numbered columns.
366 * Partial iMCUs at the right edge are left untouched.
367 */
368- MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
369+ MCU_cols = srcinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
370
371 for (ci = 0; ci < dstinfo->num_components; ci++) {
372 compptr = dstinfo->comp_info + ci;
373 comp_width = MCU_cols * compptr->h_samp_factor;
374+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
375 for (blk_y = 0; blk_y < compptr->height_in_blocks;
376 blk_y += compptr->v_samp_factor) {
377 buffer = (*srcinfo->mem->access_virt_barray)
378 ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y,
379 (JDIMENSION) compptr->v_samp_factor, TRUE);
380 for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
381+ /* Do the mirroring */
382 for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) {
383 ptr1 = buffer[offset_y][blk_x];
384 ptr2 = buffer[offset_y][comp_width - blk_x - 1];
385@@ -105,6 +161,79 @@
386 *ptr2++ = -temp1;
387 }
388 }
389+ if (x_crop_blocks > 0) {
390+ /* Now left-justify the portion of the data to be kept.
391+ * We can't use a single jcopy_block_row() call because that routine
392+ * depends on memcpy(), whose behavior is unspecified for overlapping
393+ * source and destination areas. Sigh.
394+ */
395+ for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) {
396+ jcopy_block_row(buffer[offset_y] + blk_x + x_crop_blocks,
397+ buffer[offset_y] + blk_x,
398+ (JDIMENSION) 1);
399+ }
400+ }
401+ }
402+ }
403+ }
404+}
405+
406+
407+LOCAL(void)
408+do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
409+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
410+ jvirt_barray_ptr *src_coef_arrays,
411+ jvirt_barray_ptr *dst_coef_arrays)
412+/* Horizontal flip in general cropping case */
413+{
414+ JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
415+ JDIMENSION x_crop_blocks, y_crop_blocks;
416+ int ci, k, offset_y;
417+ JBLOCKARRAY src_buffer, dst_buffer;
418+ JBLOCKROW src_row_ptr, dst_row_ptr;
419+ JCOEFPTR src_ptr, dst_ptr;
420+ jpeg_component_info *compptr;
421+
422+ /* Here we must output into a separate array because we can't touch
423+ * different rows of a single virtual array simultaneously. Otherwise,
424+ * this is essentially the same as the routine above.
425+ */
426+ MCU_cols = srcinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
427+
428+ for (ci = 0; ci < dstinfo->num_components; ci++) {
429+ compptr = dstinfo->comp_info + ci;
430+ comp_width = MCU_cols * compptr->h_samp_factor;
431+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
432+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
433+ for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
434+ dst_blk_y += compptr->v_samp_factor) {
435+ dst_buffer = (*srcinfo->mem->access_virt_barray)
436+ ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
437+ (JDIMENSION) compptr->v_samp_factor, TRUE);
438+ src_buffer = (*srcinfo->mem->access_virt_barray)
439+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
440+ dst_blk_y + y_crop_blocks,
441+ (JDIMENSION) compptr->v_samp_factor, FALSE);
442+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
443+ dst_row_ptr = dst_buffer[offset_y];
444+ src_row_ptr = src_buffer[offset_y];
445+ for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
446+ if (x_crop_blocks + dst_blk_x < comp_width) {
447+ /* Do the mirrorable blocks */
448+ dst_ptr = dst_row_ptr[dst_blk_x];
449+ src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
450+ /* this unrolled loop doesn't need to know which row it's on... */
451+ for (k = 0; k < DCTSIZE2; k += 2) {
452+ *dst_ptr++ = *src_ptr++; /* copy even column */
453+ *dst_ptr++ = - *src_ptr++; /* copy odd column with sign change */
454+ }
455+ } else {
456+ /* Copy last partial block(s) verbatim */
457+ jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks,
458+ dst_row_ptr + dst_blk_x,
459+ (JDIMENSION) 1);
460+ }
461+ }
462 }
463 }
464 }
465@@ -113,11 +242,13 @@
466
467 LOCAL(void)
468 do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
469+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
470 jvirt_barray_ptr *src_coef_arrays,
471 jvirt_barray_ptr *dst_coef_arrays)
472 /* Vertical flip */
473 {
474 JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
475+ JDIMENSION x_crop_blocks, y_crop_blocks;
476 int ci, i, j, offset_y;
477 JBLOCKARRAY src_buffer, dst_buffer;
478 JBLOCKROW src_row_ptr, dst_row_ptr;
479@@ -131,33 +262,38 @@
480 * of odd-numbered rows.
481 * Partial iMCUs at the bottom edge are copied verbatim.
482 */
483- MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
484+ MCU_rows = srcinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
485
486 for (ci = 0; ci < dstinfo->num_components; ci++) {
487 compptr = dstinfo->comp_info + ci;
488 comp_height = MCU_rows * compptr->v_samp_factor;
489+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
490+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
491 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
492 dst_blk_y += compptr->v_samp_factor) {
493 dst_buffer = (*srcinfo->mem->access_virt_barray)
494 ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
495 (JDIMENSION) compptr->v_samp_factor, TRUE);
496- if (dst_blk_y < comp_height) {
497+ if (y_crop_blocks + dst_blk_y < comp_height) {
498 /* Row is within the mirrorable area. */
499 src_buffer = (*srcinfo->mem->access_virt_barray)
500 ((j_common_ptr) srcinfo, src_coef_arrays[ci],
501- comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
502+ comp_height - y_crop_blocks - dst_blk_y -
503+ (JDIMENSION) compptr->v_samp_factor,
504 (JDIMENSION) compptr->v_samp_factor, FALSE);
505 } else {
506 /* Bottom-edge blocks will be copied verbatim. */
507 src_buffer = (*srcinfo->mem->access_virt_barray)
508- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
509+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
510+ dst_blk_y + y_crop_blocks,
511 (JDIMENSION) compptr->v_samp_factor, FALSE);
512 }
513 for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
514- if (dst_blk_y < comp_height) {
515+ if (y_crop_blocks + dst_blk_y < comp_height) {
516 /* Row is within the mirrorable area. */
517 dst_row_ptr = dst_buffer[offset_y];
518 src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
519+ src_row_ptr += x_crop_blocks;
520 for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
521 dst_blk_x++) {
522 dst_ptr = dst_row_ptr[dst_blk_x];
523@@ -173,7 +309,8 @@
524 }
525 } else {
526 /* Just copy row verbatim. */
527- jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y],
528+ jcopy_block_row(src_buffer[offset_y] + x_crop_blocks,
529+ dst_buffer[offset_y],
530 compptr->width_in_blocks);
531 }
532 }
533@@ -184,11 +321,12 @@
534
535 LOCAL(void)
536 do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
537+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
538 jvirt_barray_ptr *src_coef_arrays,
539 jvirt_barray_ptr *dst_coef_arrays)
540 /* Transpose source into destination */
541 {
542- JDIMENSION dst_blk_x, dst_blk_y;
543+ JDIMENSION dst_blk_x, dst_blk_y, x_crop_blocks, y_crop_blocks;
544 int ci, i, j, offset_x, offset_y;
545 JBLOCKARRAY src_buffer, dst_buffer;
546 JCOEFPTR src_ptr, dst_ptr;
547@@ -201,6 +339,8 @@
548 */
549 for (ci = 0; ci < dstinfo->num_components; ci++) {
550 compptr = dstinfo->comp_info + ci;
551+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
552+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
553 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
554 dst_blk_y += compptr->v_samp_factor) {
555 dst_buffer = (*srcinfo->mem->access_virt_barray)
556@@ -210,11 +350,12 @@
557 for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
558 dst_blk_x += compptr->h_samp_factor) {
559 src_buffer = (*srcinfo->mem->access_virt_barray)
560- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
561+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
562+ dst_blk_x + x_crop_blocks,
563 (JDIMENSION) compptr->h_samp_factor, FALSE);
564 for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
565- src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
566 dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
567+ src_ptr = src_buffer[offset_x][dst_blk_y + offset_y + y_crop_blocks];
568 for (i = 0; i < DCTSIZE; i++)
569 for (j = 0; j < DCTSIZE; j++)
570 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
571@@ -228,6 +369,7 @@
572
573 LOCAL(void)
574 do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
575+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
576 jvirt_barray_ptr *src_coef_arrays,
577 jvirt_barray_ptr *dst_coef_arrays)
578 /* 90 degree rotation is equivalent to
579@@ -237,6 +379,7 @@
580 */
581 {
582 JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
583+ JDIMENSION x_crop_blocks, y_crop_blocks;
584 int ci, i, j, offset_x, offset_y;
585 JBLOCKARRAY src_buffer, dst_buffer;
586 JCOEFPTR src_ptr, dst_ptr;
587@@ -246,11 +389,13 @@
588 * at the (output) right edge properly. They just get transposed and
589 * not mirrored.
590 */
591- MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
592+ MCU_cols = srcinfo->image_height / (dstinfo->max_h_samp_factor * DCTSIZE);
593
594 for (ci = 0; ci < dstinfo->num_components; ci++) {
595 compptr = dstinfo->comp_info + ci;
596 comp_width = MCU_cols * compptr->h_samp_factor;
597+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
598+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
599 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
600 dst_blk_y += compptr->v_samp_factor) {
601 dst_buffer = (*srcinfo->mem->access_virt_barray)
602@@ -259,15 +404,26 @@
603 for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
604 for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
605 dst_blk_x += compptr->h_samp_factor) {
606- src_buffer = (*srcinfo->mem->access_virt_barray)
607- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
608- (JDIMENSION) compptr->h_samp_factor, FALSE);
609+ if (x_crop_blocks + dst_blk_x < comp_width) {
610+ /* Block is within the mirrorable area. */
611+ src_buffer = (*srcinfo->mem->access_virt_barray)
612+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
613+ comp_width - x_crop_blocks - dst_blk_x -
614+ (JDIMENSION) compptr->h_samp_factor,
615+ (JDIMENSION) compptr->h_samp_factor, FALSE);
616+ } else {
617+ /* Edge blocks are transposed but not mirrored. */
618+ src_buffer = (*srcinfo->mem->access_virt_barray)
619+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
620+ dst_blk_x + x_crop_blocks,
621+ (JDIMENSION) compptr->h_samp_factor, FALSE);
622+ }
623 for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
624- src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
625- if (dst_blk_x < comp_width) {
626+ dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
627+ if (x_crop_blocks + dst_blk_x < comp_width) {
628 /* Block is within the mirrorable area. */
629- dst_ptr = dst_buffer[offset_y]
630- [comp_width - dst_blk_x - offset_x - 1];
631+ src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
632+ [dst_blk_y + offset_y + y_crop_blocks];
633 for (i = 0; i < DCTSIZE; i++) {
634 for (j = 0; j < DCTSIZE; j++)
635 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
636@@ -277,7 +433,8 @@
637 }
638 } else {
639 /* Edge blocks are transposed but not mirrored. */
640- dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
641+ src_ptr = src_buffer[offset_x]
642+ [dst_blk_y + offset_y + y_crop_blocks];
643 for (i = 0; i < DCTSIZE; i++)
644 for (j = 0; j < DCTSIZE; j++)
645 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
646@@ -292,6 +449,7 @@
647
648 LOCAL(void)
649 do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
650+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
651 jvirt_barray_ptr *src_coef_arrays,
652 jvirt_barray_ptr *dst_coef_arrays)
653 /* 270 degree rotation is equivalent to
654@@ -301,6 +459,7 @@
655 */
656 {
657 JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
658+ JDIMENSION x_crop_blocks, y_crop_blocks;
659 int ci, i, j, offset_x, offset_y;
660 JBLOCKARRAY src_buffer, dst_buffer;
661 JCOEFPTR src_ptr, dst_ptr;
662@@ -310,11 +469,13 @@
663 * at the (output) bottom edge properly. They just get transposed and
664 * not mirrored.
665 */
666- MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
667+ MCU_rows = srcinfo->image_width / (dstinfo->max_v_samp_factor * DCTSIZE);
668
669 for (ci = 0; ci < dstinfo->num_components; ci++) {
670 compptr = dstinfo->comp_info + ci;
671 comp_height = MCU_rows * compptr->v_samp_factor;
672+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
673+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
674 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
675 dst_blk_y += compptr->v_samp_factor) {
676 dst_buffer = (*srcinfo->mem->access_virt_barray)
677@@ -324,14 +485,15 @@
678 for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
679 dst_blk_x += compptr->h_samp_factor) {
680 src_buffer = (*srcinfo->mem->access_virt_barray)
681- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
682+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
683+ dst_blk_x + x_crop_blocks,
684 (JDIMENSION) compptr->h_samp_factor, FALSE);
685 for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
686 dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
687- if (dst_blk_y < comp_height) {
688+ if (y_crop_blocks + dst_blk_y < comp_height) {
689 /* Block is within the mirrorable area. */
690 src_ptr = src_buffer[offset_x]
691- [comp_height - dst_blk_y - offset_y - 1];
692+ [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
693 for (i = 0; i < DCTSIZE; i++) {
694 for (j = 0; j < DCTSIZE; j++) {
695 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
696@@ -341,7 +503,8 @@
697 }
698 } else {
699 /* Edge blocks are transposed but not mirrored. */
700- src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
701+ src_ptr = src_buffer[offset_x]
702+ [dst_blk_y + offset_y + y_crop_blocks];
703 for (i = 0; i < DCTSIZE; i++)
704 for (j = 0; j < DCTSIZE; j++)
705 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
706@@ -356,6 +519,7 @@
707
708 LOCAL(void)
709 do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
710+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
711 jvirt_barray_ptr *src_coef_arrays,
712 jvirt_barray_ptr *dst_coef_arrays)
713 /* 180 degree rotation is equivalent to
714@@ -365,89 +529,93 @@
715 */
716 {
717 JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
718+ JDIMENSION x_crop_blocks, y_crop_blocks;
719 int ci, i, j, offset_y;
720 JBLOCKARRAY src_buffer, dst_buffer;
721 JBLOCKROW src_row_ptr, dst_row_ptr;
722 JCOEFPTR src_ptr, dst_ptr;
723 jpeg_component_info *compptr;
724
725- MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
726- MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
727+ MCU_cols = srcinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
728+ MCU_rows = srcinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
729
730 for (ci = 0; ci < dstinfo->num_components; ci++) {
731 compptr = dstinfo->comp_info + ci;
732 comp_width = MCU_cols * compptr->h_samp_factor;
733 comp_height = MCU_rows * compptr->v_samp_factor;
734+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
735+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
736 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
737 dst_blk_y += compptr->v_samp_factor) {
738 dst_buffer = (*srcinfo->mem->access_virt_barray)
739 ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
740 (JDIMENSION) compptr->v_samp_factor, TRUE);
741- if (dst_blk_y < comp_height) {
742+ if (y_crop_blocks + dst_blk_y < comp_height) {
743 /* Row is within the vertically mirrorable area. */
744 src_buffer = (*srcinfo->mem->access_virt_barray)
745 ((j_common_ptr) srcinfo, src_coef_arrays[ci],
746- comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
747+ comp_height - y_crop_blocks - dst_blk_y -
748+ (JDIMENSION) compptr->v_samp_factor,
749 (JDIMENSION) compptr->v_samp_factor, FALSE);
750 } else {
751 /* Bottom-edge rows are only mirrored horizontally. */
752 src_buffer = (*srcinfo->mem->access_virt_barray)
753- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
754+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
755+ dst_blk_y + y_crop_blocks,
756 (JDIMENSION) compptr->v_samp_factor, FALSE);
757 }
758 for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
759- if (dst_blk_y < comp_height) {
760+ dst_row_ptr = dst_buffer[offset_y];
761+ if (y_crop_blocks + dst_blk_y < comp_height) {
762 /* Row is within the mirrorable area. */
763- dst_row_ptr = dst_buffer[offset_y];
764 src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
765- /* Process the blocks that can be mirrored both ways. */
766- for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
767+ for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
768 dst_ptr = dst_row_ptr[dst_blk_x];
769- src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
770- for (i = 0; i < DCTSIZE; i += 2) {
771- /* For even row, negate every odd column. */
772- for (j = 0; j < DCTSIZE; j += 2) {
773- *dst_ptr++ = *src_ptr++;
774- *dst_ptr++ = - *src_ptr++;
775+ if (x_crop_blocks + dst_blk_x < comp_width) {
776+ /* Process the blocks that can be mirrored both ways. */
777+ src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
778+ for (i = 0; i < DCTSIZE; i += 2) {
779+ /* For even row, negate every odd column. */
780+ for (j = 0; j < DCTSIZE; j += 2) {
781+ *dst_ptr++ = *src_ptr++;
782+ *dst_ptr++ = - *src_ptr++;
783+ }
784+ /* For odd row, negate every even column. */
785+ for (j = 0; j < DCTSIZE; j += 2) {
786+ *dst_ptr++ = - *src_ptr++;
787+ *dst_ptr++ = *src_ptr++;
788+ }
789 }
790- /* For odd row, negate every even column. */
791- for (j = 0; j < DCTSIZE; j += 2) {
792- *dst_ptr++ = - *src_ptr++;
793- *dst_ptr++ = *src_ptr++;
794+ } else {
795+ /* Any remaining right-edge blocks are only mirrored vertically. */
796+ src_ptr = src_row_ptr[x_crop_blocks + dst_blk_x];
797+ for (i = 0; i < DCTSIZE; i += 2) {
798+ for (j = 0; j < DCTSIZE; j++)
799+ *dst_ptr++ = *src_ptr++;
800+ for (j = 0; j < DCTSIZE; j++)
801+ *dst_ptr++ = - *src_ptr++;
802 }
803 }
804 }
805- /* Any remaining right-edge blocks are only mirrored vertically. */
806- for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
807- dst_ptr = dst_row_ptr[dst_blk_x];
808- src_ptr = src_row_ptr[dst_blk_x];
809- for (i = 0; i < DCTSIZE; i += 2) {
810- for (j = 0; j < DCTSIZE; j++)
811- *dst_ptr++ = *src_ptr++;
812- for (j = 0; j < DCTSIZE; j++)
813- *dst_ptr++ = - *src_ptr++;
814- }
815- }
816 } else {
817 /* Remaining rows are just mirrored horizontally. */
818- dst_row_ptr = dst_buffer[offset_y];
819 src_row_ptr = src_buffer[offset_y];
820- /* Process the blocks that can be mirrored. */
821- for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
822- dst_ptr = dst_row_ptr[dst_blk_x];
823- src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
824- for (i = 0; i < DCTSIZE2; i += 2) {
825- *dst_ptr++ = *src_ptr++;
826- *dst_ptr++ = - *src_ptr++;
827+ for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
828+ if (x_crop_blocks + dst_blk_x < comp_width) {
829+ /* Process the blocks that can be mirrored. */
830+ dst_ptr = dst_row_ptr[dst_blk_x];
831+ src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
832+ for (i = 0; i < DCTSIZE2; i += 2) {
833+ *dst_ptr++ = *src_ptr++;
834+ *dst_ptr++ = - *src_ptr++;
835+ }
836+ } else {
837+ /* Any remaining right-edge blocks are only copied. */
838+ jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks,
839+ dst_row_ptr + dst_blk_x,
840+ (JDIMENSION) 1);
841 }
842 }
843- /* Any remaining right-edge blocks are only copied. */
844- for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
845- dst_ptr = dst_row_ptr[dst_blk_x];
846- src_ptr = src_row_ptr[dst_blk_x];
847- for (i = 0; i < DCTSIZE2; i++)
848- *dst_ptr++ = *src_ptr++;
849- }
850 }
851 }
852 }
853@@ -457,6 +625,7 @@
854
855 LOCAL(void)
856 do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
857+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
858 jvirt_barray_ptr *src_coef_arrays,
859 jvirt_barray_ptr *dst_coef_arrays)
860 /* Transverse transpose is equivalent to
861@@ -470,18 +639,21 @@
862 */
863 {
864 JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
865+ JDIMENSION x_crop_blocks, y_crop_blocks;
866 int ci, i, j, offset_x, offset_y;
867 JBLOCKARRAY src_buffer, dst_buffer;
868 JCOEFPTR src_ptr, dst_ptr;
869 jpeg_component_info *compptr;
870
871- MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
872- MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
873+ MCU_cols = srcinfo->image_height / (dstinfo->max_h_samp_factor * DCTSIZE);
874+ MCU_rows = srcinfo->image_width / (dstinfo->max_v_samp_factor * DCTSIZE);
875
876 for (ci = 0; ci < dstinfo->num_components; ci++) {
877 compptr = dstinfo->comp_info + ci;
878 comp_width = MCU_cols * compptr->h_samp_factor;
879 comp_height = MCU_rows * compptr->v_samp_factor;
880+ x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
881+ y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
882 for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
883 dst_blk_y += compptr->v_samp_factor) {
884 dst_buffer = (*srcinfo->mem->access_virt_barray)
885@@ -490,17 +662,26 @@
886 for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
887 for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
888 dst_blk_x += compptr->h_samp_factor) {
889- src_buffer = (*srcinfo->mem->access_virt_barray)
890- ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
891- (JDIMENSION) compptr->h_samp_factor, FALSE);
892+ if (x_crop_blocks + dst_blk_x < comp_width) {
893+ /* Block is within the mirrorable area. */
894+ src_buffer = (*srcinfo->mem->access_virt_barray)
895+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
896+ comp_width - x_crop_blocks - dst_blk_x -
897+ (JDIMENSION) compptr->h_samp_factor,
898+ (JDIMENSION) compptr->h_samp_factor, FALSE);
899+ } else {
900+ src_buffer = (*srcinfo->mem->access_virt_barray)
901+ ((j_common_ptr) srcinfo, src_coef_arrays[ci],
902+ dst_blk_x + x_crop_blocks,
903+ (JDIMENSION) compptr->h_samp_factor, FALSE);
904+ }
905 for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
906- if (dst_blk_y < comp_height) {
907- src_ptr = src_buffer[offset_x]
908- [comp_height - dst_blk_y - offset_y - 1];
909- if (dst_blk_x < comp_width) {
910+ dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
911+ if (y_crop_blocks + dst_blk_y < comp_height) {
912+ if (x_crop_blocks + dst_blk_x < comp_width) {
913 /* Block is within the mirrorable area. */
914- dst_ptr = dst_buffer[offset_y]
915- [comp_width - dst_blk_x - offset_x - 1];
916+ src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
917+ [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
918 for (i = 0; i < DCTSIZE; i++) {
919 for (j = 0; j < DCTSIZE; j++) {
920 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
921@@ -516,7 +697,8 @@
922 }
923 } else {
924 /* Right-edge blocks are mirrored in y only */
925- dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
926+ src_ptr = src_buffer[offset_x]
927+ [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
928 for (i = 0; i < DCTSIZE; i++) {
929 for (j = 0; j < DCTSIZE; j++) {
930 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
931@@ -526,11 +708,10 @@
932 }
933 }
934 } else {
935- src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
936- if (dst_blk_x < comp_width) {
937+ if (x_crop_blocks + dst_blk_x < comp_width) {
938 /* Bottom-edge blocks are mirrored in x only */
939- dst_ptr = dst_buffer[offset_y]
940- [comp_width - dst_blk_x - offset_x - 1];
941+ src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
942+ [dst_blk_y + offset_y + y_crop_blocks];
943 for (i = 0; i < DCTSIZE; i++) {
944 for (j = 0; j < DCTSIZE; j++)
945 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
946@@ -540,7 +721,8 @@
947 }
948 } else {
949 /* At lower right corner, just transpose, no mirroring */
950- dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
951+ src_ptr = src_buffer[offset_x]
952+ [dst_blk_y + offset_y + y_crop_blocks];
953 for (i = 0; i < DCTSIZE; i++)
954 for (j = 0; j < DCTSIZE; j++)
955 dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
956@@ -554,8 +736,116 @@
957 }
958
959
960+/* Parse an unsigned integer: subroutine for jtransform_parse_crop_spec.
961+ * Returns TRUE if valid integer found, FALSE if not.
962+ * *strptr is advanced over the digit string, and *result is set to its value.
963+ */
964+
965+LOCAL(boolean)
966+jt_read_integer (const char ** strptr, JDIMENSION * result)
967+{
968+ const char * ptr = *strptr;
969+ JDIMENSION val = 0;
970+
971+ for (; isdigit(*ptr); ptr++) {
972+ val = val * 10 + (JDIMENSION) (*ptr - '0');
973+ }
974+ *result = val;
975+ if (ptr == *strptr)
976+ return FALSE; /* oops, no digits */
977+ *strptr = ptr;
978+ return TRUE;
979+}
980+
981+
982+/* Parse a crop specification (written in X11 geometry style).
983+ * The routine returns TRUE if the spec string is valid, FALSE if not.
984+ *
985+ * The crop spec string should have the format
986+ * <width>x<height>{+-}<xoffset>{+-}<yoffset>
987+ * where width, height, xoffset, and yoffset are unsigned integers.
988+ * Each of the elements can be omitted to indicate a default value.
989+ * (A weakness of this style is that it is not possible to omit xoffset
990+ * while specifying yoffset, since they look alike.)
991+ *
992+ * This code is loosely based on XParseGeometry from the X11 distribution.
993+ */
994+
995+GLOBAL(boolean)
996+jtransform_parse_crop_spec (jpeg_transform_info *info, const char *spec)
997+{
998+ info->crop = FALSE;
999+ info->crop_width_set = JCROP_UNSET;
1000+ info->crop_height_set = JCROP_UNSET;
1001+ info->crop_xoffset_set = JCROP_UNSET;
1002+ info->crop_yoffset_set = JCROP_UNSET;
1003+
1004+ if (isdigit(*spec)) {
1005+ /* fetch width */
1006+ if (! jt_read_integer(&spec, &info->crop_width))
1007+ return FALSE;
1008+ info->crop_width_set = JCROP_POS;
1009+ }
1010+ if (*spec == 'x' || *spec == 'X') {
1011+ /* fetch height */
1012+ spec++;
1013+ if (! jt_read_integer(&spec, &info->crop_height))
1014+ return FALSE;
1015+ info->crop_height_set = JCROP_POS;
1016+ }
1017+ if (*spec == '+' || *spec == '-') {
1018+ /* fetch xoffset */
1019+ info->crop_xoffset_set = (*spec == '-') ? JCROP_NEG : JCROP_POS;
1020+ spec++;
1021+ if (! jt_read_integer(&spec, &info->crop_xoffset))
1022+ return FALSE;
1023+ }
1024+ if (*spec == '+' || *spec == '-') {
1025+ /* fetch yoffset */
1026+ info->crop_yoffset_set = (*spec == '-') ? JCROP_NEG : JCROP_POS;
1027+ spec++;
1028+ if (! jt_read_integer(&spec, &info->crop_yoffset))
1029+ return FALSE;
1030+ }
1031+ /* We had better have gotten to the end of the string. */
1032+ if (*spec != '\0')
1033+ return FALSE;
1034+ info->crop = TRUE;
1035+ return TRUE;
1036+}
1037+
1038+
1039+/* Trim off any partial iMCUs on the indicated destination edge */
1040+
1041+LOCAL(void)
1042+trim_right_edge (jpeg_transform_info *info, JDIMENSION full_width)
1043+{
1044+ JDIMENSION MCU_cols;
1045+
1046+ MCU_cols = info->output_width / (info->max_h_samp_factor * DCTSIZE);
1047+ if (MCU_cols > 0 && info->x_crop_offset + MCU_cols ==
1048+ full_width / (info->max_h_samp_factor * DCTSIZE))
1049+ info->output_width = MCU_cols * (info->max_h_samp_factor * DCTSIZE);
1050+}
1051+
1052+LOCAL(void)
1053+trim_bottom_edge (jpeg_transform_info *info, JDIMENSION full_height)
1054+{
1055+ JDIMENSION MCU_rows;
1056+
1057+ MCU_rows = info->output_height / (info->max_v_samp_factor * DCTSIZE);
1058+ if (MCU_rows > 0 && info->y_crop_offset + MCU_rows ==
1059+ full_height / (info->max_v_samp_factor * DCTSIZE))
1060+ info->output_height = MCU_rows * (info->max_v_samp_factor * DCTSIZE);
1061+}
1062+
1063+
1064 /* Request any required workspace.
1065 *
1066+ * This routine figures out the size that the output image will be
1067+ * (which implies that all the transform parameters must be set before
1068+ * it is called).
1069+ *
1070 * We allocate the workspace virtual arrays from the source decompression
1071 * object, so that all the arrays (both the original data and the workspace)
1072 * will be taken into account while making memory management decisions.
1073@@ -569,9 +859,13 @@
1074 jpeg_transform_info *info)
1075 {
1076 jvirt_barray_ptr *coef_arrays = NULL;
1077+ boolean need_workspace, transpose_it;
1078 jpeg_component_info *compptr;
1079- int ci;
1080+ JDIMENSION xoffset, yoffset, width_in_iMCUs, height_in_iMCUs;
1081+ JDIMENSION width_in_blocks, height_in_blocks;
1082+ int ci, h_samp_factor, v_samp_factor;
1083
1084+ /* Determine number of components in output image */
1085 if (info->force_grayscale &&
1086 srcinfo->jpeg_color_space == JCS_YCbCr &&
1087 srcinfo->num_components == 3) {
1088@@ -581,55 +875,181 @@
1089 /* Process all the components */
1090 info->num_components = srcinfo->num_components;
1091 }
1092+ /* If there is only one output component, force the iMCU size to be 1;
1093+ * else use the source iMCU size. (This allows us to do the right thing
1094+ * when reducing color to grayscale, and also provides a handy way of
1095+ * cleaning up "funny" grayscale images whose sampling factors are not 1x1.)
1096+ */
1097+
1098+ switch (info->transform) {
1099+ case JXFORM_TRANSPOSE:
1100+ case JXFORM_TRANSVERSE:
1101+ case JXFORM_ROT_90:
1102+ case JXFORM_ROT_270:
1103+ info->output_width = srcinfo->image_height;
1104+ info->output_height = srcinfo->image_width;
1105+ if (info->num_components == 1) {
1106+ info->max_h_samp_factor = 1;
1107+ info->max_v_samp_factor = 1;
1108+ } else {
1109+ info->max_h_samp_factor = srcinfo->max_v_samp_factor;
1110+ info->max_v_samp_factor = srcinfo->max_h_samp_factor;
1111+ }
1112+ break;
1113+ default:
1114+ info->output_width = srcinfo->image_width;
1115+ info->output_height = srcinfo->image_height;
1116+ if (info->num_components == 1) {
1117+ info->max_h_samp_factor = 1;
1118+ info->max_v_samp_factor = 1;
1119+ } else {
1120+ info->max_h_samp_factor = srcinfo->max_h_samp_factor;
1121+ info->max_v_samp_factor = srcinfo->max_v_samp_factor;
1122+ }
1123+ break;
1124+ }
1125+
1126+ /* If cropping has been requested, compute the crop area's position and
1127+ * dimensions, ensuring that its upper left corner falls at an iMCU boundary.
1128+ */
1129+ if (info->crop) {
1130+ /* Insert default values for unset crop parameters */
1131+ if (info->crop_xoffset_set == JCROP_UNSET)
1132+ info->crop_xoffset = 0; /* default to +0 */
1133+ if (info->crop_yoffset_set == JCROP_UNSET)
1134+ info->crop_yoffset = 0; /* default to +0 */
1135+ if (info->crop_xoffset >= info->output_width ||
1136+ info->crop_yoffset >= info->output_height)
1137+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
1138+ if (info->crop_width_set == JCROP_UNSET)
1139+ info->crop_width = info->output_width - info->crop_xoffset;
1140+ if (info->crop_height_set == JCROP_UNSET)
1141+ info->crop_height = info->output_height - info->crop_yoffset;
1142+ /* Ensure parameters are valid */
1143+ if (info->crop_width <= 0 || info->crop_width > info->output_width ||
1144+ info->crop_height <= 0 || info->crop_height > info->output_height ||
1145+ info->crop_xoffset > info->output_width - info->crop_width ||
1146+ info->crop_yoffset > info->output_height - info->crop_height)
1147+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
1148+ /* Convert negative crop offsets into regular offsets */
1149+ if (info->crop_xoffset_set == JCROP_NEG)
1150+ xoffset = info->output_width - info->crop_width - info->crop_xoffset;
1151+ else
1152+ xoffset = info->crop_xoffset;
1153+ if (info->crop_yoffset_set == JCROP_NEG)
1154+ yoffset = info->output_height - info->crop_height - info->crop_yoffset;
1155+ else
1156+ yoffset = info->crop_yoffset;
1157+ /* Now adjust so that upper left corner falls at an iMCU boundary */
1158+ info->output_width =
1159+ info->crop_width + (xoffset % (info->max_h_samp_factor * DCTSIZE));
1160+ info->output_height =
1161+ info->crop_height + (yoffset % (info->max_v_samp_factor * DCTSIZE));
1162+ /* Save x/y offsets measured in iMCUs */
1163+ info->x_crop_offset = xoffset / (info->max_h_samp_factor * DCTSIZE);
1164+ info->y_crop_offset = yoffset / (info->max_v_samp_factor * DCTSIZE);
1165+ } else {
1166+ info->x_crop_offset = 0;
1167+ info->y_crop_offset = 0;
1168+ }
1169
1170+ /* Figure out whether we need workspace arrays,
1171+ * and if so whether they are transposed relative to the source.
1172+ */
1173+ need_workspace = FALSE;
1174+ transpose_it = FALSE;
1175 switch (info->transform) {
1176 case JXFORM_NONE:
1177+ if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
1178+ need_workspace = TRUE;
1179+ /* No workspace needed if neither cropping nor transforming */
1180+ break;
1181 case JXFORM_FLIP_H:
1182- /* Don't need a workspace array */
1183+ if (info->trim)
1184+ trim_right_edge(info, srcinfo->image_width);
1185+ if (info->y_crop_offset != 0)
1186+ need_workspace = TRUE;
1187+ /* do_flip_h_no_crop doesn't need a workspace array */
1188 break;
1189 case JXFORM_FLIP_V:
1190- case JXFORM_ROT_180:
1191- /* Need workspace arrays having same dimensions as source image.
1192- * Note that we allocate arrays padded out to the next iMCU boundary,
1193- * so that transform routines need not worry about missing edge blocks.
1194- */
1195- coef_arrays = (jvirt_barray_ptr *)
1196- (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
1197- SIZEOF(jvirt_barray_ptr) * info->num_components);
1198- for (ci = 0; ci < info->num_components; ci++) {
1199- compptr = srcinfo->comp_info + ci;
1200- coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
1201- ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
1202- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
1203- (long) compptr->h_samp_factor),
1204- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
1205- (long) compptr->v_samp_factor),
1206- (JDIMENSION) compptr->v_samp_factor);
1207- }
1208+ if (info->trim)
1209+ trim_bottom_edge(info, srcinfo->image_height);
1210+ /* Need workspace arrays having same dimensions as source image. */
1211+ need_workspace = TRUE;
1212 break;
1213 case JXFORM_TRANSPOSE:
1214+ /* transpose does NOT have to trim anything */
1215+ /* Need workspace arrays having transposed dimensions. */
1216+ need_workspace = TRUE;
1217+ transpose_it = TRUE;
1218+ break;
1219 case JXFORM_TRANSVERSE:
1220+ if (info->trim) {
1221+ trim_right_edge(info, srcinfo->image_height);
1222+ trim_bottom_edge(info, srcinfo->image_width);
1223+ }
1224+ /* Need workspace arrays having transposed dimensions. */
1225+ need_workspace = TRUE;
1226+ transpose_it = TRUE;
1227+ break;
1228 case JXFORM_ROT_90:
1229+ if (info->trim)
1230+ trim_right_edge(info, srcinfo->image_height);
1231+ /* Need workspace arrays having transposed dimensions. */
1232+ need_workspace = TRUE;
1233+ transpose_it = TRUE;
1234+ break;
1235+ case JXFORM_ROT_180:
1236+ if (info->trim) {
1237+ trim_right_edge(info, srcinfo->image_width);
1238+ trim_bottom_edge(info, srcinfo->image_height);
1239+ }
1240+ /* Need workspace arrays having same dimensions as source image. */
1241+ need_workspace = TRUE;
1242+ break;
1243 case JXFORM_ROT_270:
1244- /* Need workspace arrays having transposed dimensions.
1245- * Note that we allocate arrays padded out to the next iMCU boundary,
1246- * so that transform routines need not worry about missing edge blocks.
1247- */
1248+ if (info->trim)
1249+ trim_bottom_edge(info, srcinfo->image_width);
1250+ /* Need workspace arrays having transposed dimensions. */
1251+ need_workspace = TRUE;
1252+ transpose_it = TRUE;
1253+ break;
1254+ }
1255+
1256+ /* Allocate workspace if needed.
1257+ * Note that we allocate arrays padded out to the next iMCU boundary,
1258+ * so that transform routines need not worry about missing edge blocks.
1259+ */
1260+ if (need_workspace) {
1261 coef_arrays = (jvirt_barray_ptr *)
1262 (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
1263- SIZEOF(jvirt_barray_ptr) * info->num_components);
1264+ SIZEOF(jvirt_barray_ptr) * info->num_components);
1265+ width_in_iMCUs = (JDIMENSION)
1266+ jdiv_round_up((long) info->output_width,
1267+ (long) (info->max_h_samp_factor * DCTSIZE));
1268+ height_in_iMCUs = (JDIMENSION)
1269+ jdiv_round_up((long) info->output_height,
1270+ (long) (info->max_v_samp_factor * DCTSIZE));
1271 for (ci = 0; ci < info->num_components; ci++) {
1272 compptr = srcinfo->comp_info + ci;
1273+ if (info->num_components == 1) {
1274+ /* we're going to force samp factors to 1x1 in this case */
1275+ h_samp_factor = v_samp_factor = 1;
1276+ } else if (transpose_it) {
1277+ h_samp_factor = compptr->v_samp_factor;
1278+ v_samp_factor = compptr->h_samp_factor;
1279+ } else {
1280+ h_samp_factor = compptr->h_samp_factor;
1281+ v_samp_factor = compptr->v_samp_factor;
1282+ }
1283+ width_in_blocks = width_in_iMCUs * h_samp_factor;
1284+ height_in_blocks = height_in_iMCUs * v_samp_factor;
1285 coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
1286 ((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
1287- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
1288- (long) compptr->v_samp_factor),
1289- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
1290- (long) compptr->h_samp_factor),
1291- (JDIMENSION) compptr->h_samp_factor);
1292+ width_in_blocks, height_in_blocks, (JDIMENSION) v_samp_factor);
1293 }
1294- break;
1295 }
1296+
1297 info->workspace_coef_arrays = coef_arrays;
1298 }
1299
1300@@ -642,14 +1062,8 @@
1301 int tblno, i, j, ci, itemp;
1302 jpeg_component_info *compptr;
1303 JQUANT_TBL *qtblptr;
1304- JDIMENSION dtemp;
1305 UINT16 qtemp;
1306
1307- /* Transpose basic image dimensions */
1308- dtemp = dstinfo->image_width;
1309- dstinfo->image_width = dstinfo->image_height;
1310- dstinfo->image_height = dtemp;
1311-
1312 /* Transpose sampling factors */
1313 for (ci = 0; ci < dstinfo->num_components; ci++) {
1314 compptr = dstinfo->comp_info + ci;
1315@@ -674,46 +1088,159 @@
1316 }
1317
1318
1319-/* Trim off any partial iMCUs on the indicated destination edge */
1320+/* Adjust Exif image parameters.
1321+ *
1322+ * We try to adjust the Tags ExifImageWidth and ExifImageHeight if possible.
1323+ */
1324
1325 LOCAL(void)
1326-trim_right_edge (j_compress_ptr dstinfo)
1327+adjust_exif_parameters (JOCTET FAR * data, unsigned int length,
1328+ JDIMENSION new_width, JDIMENSION new_height)
1329 {
1330- int ci, max_h_samp_factor;
1331- JDIMENSION MCU_cols;
1332+ boolean is_motorola; /* Flag for byte order */
1333+ unsigned int number_of_tags, tagnum;
1334+ unsigned int firstoffset, offset;
1335+ JDIMENSION new_value;
1336
1337- /* We have to compute max_h_samp_factor ourselves,
1338- * because it hasn't been set yet in the destination
1339- * (and we don't want to use the source's value).
1340- */
1341- max_h_samp_factor = 1;
1342- for (ci = 0; ci < dstinfo->num_components; ci++) {
1343- int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor;
1344- max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor);
1345+ if (length < 12) return; /* Length of an IFD entry */
1346+
1347+ /* Discover byte order */
1348+ if (GETJOCTET(data[0]) == 0x49 && GETJOCTET(data[1]) == 0x49)
1349+ is_motorola = FALSE;
1350+ else if (GETJOCTET(data[0]) == 0x4D && GETJOCTET(data[1]) == 0x4D)
1351+ is_motorola = TRUE;
1352+ else
1353+ return;
1354+
1355+ /* Check Tag Mark */
1356+ if (is_motorola) {
1357+ if (GETJOCTET(data[2]) != 0) return;
1358+ if (GETJOCTET(data[3]) != 0x2A) return;
1359+ } else {
1360+ if (GETJOCTET(data[3]) != 0) return;
1361+ if (GETJOCTET(data[2]) != 0x2A) return;
1362 }
1363- MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE);
1364- if (MCU_cols > 0) /* can't trim to 0 pixels */
1365- dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE);
1366-}
1367
1368-LOCAL(void)
1369-trim_bottom_edge (j_compress_ptr dstinfo)
1370-{
1371- int ci, max_v_samp_factor;
1372- JDIMENSION MCU_rows;
1373+ /* Get first IFD offset (offset to IFD0) */
1374+ if (is_motorola) {
1375+ if (GETJOCTET(data[4]) != 0) return;
1376+ if (GETJOCTET(data[5]) != 0) return;
1377+ firstoffset = GETJOCTET(data[6]);
1378+ firstoffset <<= 8;
1379+ firstoffset += GETJOCTET(data[7]);
1380+ } else {
1381+ if (GETJOCTET(data[7]) != 0) return;
1382+ if (GETJOCTET(data[6]) != 0) return;
1383+ firstoffset = GETJOCTET(data[5]);
1384+ firstoffset <<= 8;
1385+ firstoffset += GETJOCTET(data[4]);
1386+ }
1387+ if (firstoffset > length - 2) return; /* check end of data segment */
1388
1389- /* We have to compute max_v_samp_factor ourselves,
1390- * because it hasn't been set yet in the destination
1391- * (and we don't want to use the source's value).
1392- */
1393- max_v_samp_factor = 1;
1394- for (ci = 0; ci < dstinfo->num_components; ci++) {
1395- int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor;
1396- max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor);
1397+ /* Get the number of directory entries contained in this IFD */
1398+ if (is_motorola) {
1399+ number_of_tags = GETJOCTET(data[firstoffset]);
1400+ number_of_tags <<= 8;
1401+ number_of_tags += GETJOCTET(data[firstoffset+1]);
1402+ } else {
1403+ number_of_tags = GETJOCTET(data[firstoffset+1]);
1404+ number_of_tags <<= 8;
1405+ number_of_tags += GETJOCTET(data[firstoffset]);
1406 }
1407- MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE);
1408- if (MCU_rows > 0) /* can't trim to 0 pixels */
1409- dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE);
1410+ if (number_of_tags == 0) return;
1411+ firstoffset += 2;
1412+
1413+ /* Search for ExifSubIFD offset Tag in IFD0 */
1414+ for (;;) {
1415+ if (firstoffset > length - 12) return; /* check end of data segment */
1416+ /* Get Tag number */
1417+ if (is_motorola) {
1418+ tagnum = GETJOCTET(data[firstoffset]);
1419+ tagnum <<= 8;
1420+ tagnum += GETJOCTET(data[firstoffset+1]);
1421+ } else {
1422+ tagnum = GETJOCTET(data[firstoffset+1]);
1423+ tagnum <<= 8;
1424+ tagnum += GETJOCTET(data[firstoffset]);
1425+ }
1426+ if (tagnum == 0x8769) break; /* found ExifSubIFD offset Tag */
1427+ if (--number_of_tags == 0) return;
1428+ firstoffset += 12;
1429+ }
1430+
1431+ /* Get the ExifSubIFD offset */
1432+ if (is_motorola) {
1433+ if (GETJOCTET(data[firstoffset+8]) != 0) return;
1434+ if (GETJOCTET(data[firstoffset+9]) != 0) return;
1435+ offset = GETJOCTET(data[firstoffset+10]);
1436+ offset <<= 8;
1437+ offset += GETJOCTET(data[firstoffset+11]);
1438+ } else {
1439+ if (GETJOCTET(data[firstoffset+11]) != 0) return;
1440+ if (GETJOCTET(data[firstoffset+10]) != 0) return;
1441+ offset = GETJOCTET(data[firstoffset+9]);
1442+ offset <<= 8;
1443+ offset += GETJOCTET(data[firstoffset+8]);
1444+ }
1445+ if (offset > length - 2) return; /* check end of data segment */
1446+
1447+ /* Get the number of directory entries contained in this SubIFD */
1448+ if (is_motorola) {
1449+ number_of_tags = GETJOCTET(data[offset]);
1450+ number_of_tags <<= 8;
1451+ number_of_tags += GETJOCTET(data[offset+1]);
1452+ } else {
1453+ number_of_tags = GETJOCTET(data[offset+1]);
1454+ number_of_tags <<= 8;
1455+ number_of_tags += GETJOCTET(data[offset]);
1456+ }
1457+ if (number_of_tags < 2) return;
1458+ offset += 2;
1459+
1460+ /* Search for ExifImageWidth and ExifImageHeight Tags in this SubIFD */
1461+ do {
1462+ if (offset > length - 12) return; /* check end of data segment */
1463+ /* Get Tag number */
1464+ if (is_motorola) {
1465+ tagnum = GETJOCTET(data[offset]);
1466+ tagnum <<= 8;
1467+ tagnum += GETJOCTET(data[offset+1]);
1468+ } else {
1469+ tagnum = GETJOCTET(data[offset+1]);
1470+ tagnum <<= 8;
1471+ tagnum += GETJOCTET(data[offset]);
1472+ }
1473+ if (tagnum == 0xA002 || tagnum == 0xA003) {
1474+ if (tagnum == 0xA002)
1475+ new_value = new_width; /* ExifImageWidth Tag */
1476+ else
1477+ new_value = new_height; /* ExifImageHeight Tag */
1478+ if (is_motorola) {
1479+ data[offset+2] = 0; /* Format = unsigned long (4 octets) */
1480+ data[offset+3] = 4;
1481+ data[offset+4] = 0; /* Number Of Components = 1 */
1482+ data[offset+5] = 0;
1483+ data[offset+6] = 0;
1484+ data[offset+7] = 1;
1485+ data[offset+8] = 0;
1486+ data[offset+9] = 0;
1487+ data[offset+10] = (JOCTET)((new_value >> 8) & 0xFF);
1488+ data[offset+11] = (JOCTET)(new_value & 0xFF);
1489+ } else {
1490+ data[offset+2] = 4; /* Format = unsigned long (4 octets) */
1491+ data[offset+3] = 0;
1492+ data[offset+4] = 1; /* Number Of Components = 1 */
1493+ data[offset+5] = 0;
1494+ data[offset+6] = 0;
1495+ data[offset+7] = 0;
1496+ data[offset+8] = (JOCTET)(new_value & 0xFF);
1497+ data[offset+9] = (JOCTET)((new_value >> 8) & 0xFF);
1498+ data[offset+10] = 0;
1499+ data[offset+11] = 0;
1500+ }
1501+ }
1502+ offset += 12;
1503+ } while (--number_of_tags);
1504 }
1505
1506
1507@@ -736,18 +1263,22 @@
1508 {
1509 /* If force-to-grayscale is requested, adjust destination parameters */
1510 if (info->force_grayscale) {
1511- /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
1512- * properly. Among other things, the target h_samp_factor & v_samp_factor
1513- * will get set to 1, which typically won't match the source.
1514- * In fact we do this even if the source is already grayscale; that
1515- * provides an easy way of coercing a grayscale JPEG with funny sampling
1516- * factors to the customary 1,1. (Some decoders fail on other factors.)
1517+ /* First, ensure we have YCbCr or grayscale data, and that the source's
1518+ * Y channel is full resolution. (No reasonable person would make Y
1519+ * be less than full resolution, so actually coping with that case
1520+ * isn't worth extra code space. But we check it to avoid crashing.)
1521 */
1522- if ((dstinfo->jpeg_color_space == JCS_YCbCr &&
1523- dstinfo->num_components == 3) ||
1524- (dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
1525- dstinfo->num_components == 1)) {
1526- /* We have to preserve the source's quantization table number. */
1527+ if (((dstinfo->jpeg_color_space == JCS_YCbCr &&
1528+ dstinfo->num_components == 3) ||
1529+ (dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
1530+ dstinfo->num_components == 1)) &&
1531+ srcinfo->comp_info[0].h_samp_factor == srcinfo->max_h_samp_factor &&
1532+ srcinfo->comp_info[0].v_samp_factor == srcinfo->max_v_samp_factor) {
1533+ /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
1534+ * properly. Among other things, it sets the target h_samp_factor &
1535+ * v_samp_factor to 1, which typically won't match the source.
1536+ * We have to preserve the source's quantization table number, however.
1537+ */
1538 int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no;
1539 jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE);
1540 dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no;
1541@@ -755,50 +1286,52 @@
1542 /* Sorry, can't do it */
1543 ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL);
1544 }
1545+ } else if (info->num_components == 1) {
1546+ /* For a single-component source, we force the destination sampling factors
1547+ * to 1x1, with or without force_grayscale. This is useful because some
1548+ * decoders choke on grayscale images with other sampling factors.
1549+ */
1550+ dstinfo->comp_info[0].h_samp_factor = 1;
1551+ dstinfo->comp_info[0].v_samp_factor = 1;
1552 }
1553
1554- /* Correct the destination's image dimensions etc if necessary */
1555+ /* Correct the destination's image dimensions as necessary
1556+ * for crop and rotate/flip operations.
1557+ */
1558+ dstinfo->image_width = info->output_width;
1559+ dstinfo->image_height = info->output_height;
1560+
1561+ /* Transpose destination image parameters */
1562 switch (info->transform) {
1563- case JXFORM_NONE:
1564- /* Nothing to do */
1565- break;
1566- case JXFORM_FLIP_H:
1567- if (info->trim)
1568- trim_right_edge(dstinfo);
1569- break;
1570- case JXFORM_FLIP_V:
1571- if (info->trim)
1572- trim_bottom_edge(dstinfo);
1573- break;
1574 case JXFORM_TRANSPOSE:
1575- transpose_critical_parameters(dstinfo);
1576- /* transpose does NOT have to trim anything */
1577- break;
1578 case JXFORM_TRANSVERSE:
1579- transpose_critical_parameters(dstinfo);
1580- if (info->trim) {
1581- trim_right_edge(dstinfo);
1582- trim_bottom_edge(dstinfo);
1583- }
1584- break;
1585 case JXFORM_ROT_90:
1586- transpose_critical_parameters(dstinfo);
1587- if (info->trim)
1588- trim_right_edge(dstinfo);
1589- break;
1590- case JXFORM_ROT_180:
1591- if (info->trim) {
1592- trim_right_edge(dstinfo);
1593- trim_bottom_edge(dstinfo);
1594- }
1595- break;
1596 case JXFORM_ROT_270:
1597 transpose_critical_parameters(dstinfo);
1598- if (info->trim)
1599- trim_bottom_edge(dstinfo);
1600 break;
1601 }
1602
1603+ /* Adjust Exif properties */
1604+ if (srcinfo->marker_list != NULL &&
1605+ srcinfo->marker_list->marker == JPEG_APP0+1 &&
1606+ srcinfo->marker_list->data_length >= 6 &&
1607+ GETJOCTET(srcinfo->marker_list->data[0]) == 0x45 &&
1608+ GETJOCTET(srcinfo->marker_list->data[1]) == 0x78 &&
1609+ GETJOCTET(srcinfo->marker_list->data[2]) == 0x69 &&
1610+ GETJOCTET(srcinfo->marker_list->data[3]) == 0x66 &&
1611+ GETJOCTET(srcinfo->marker_list->data[4]) == 0 &&
1612+ GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
1613+ /* Suppress output of JFIF marker */
1614+ dstinfo->write_JFIF_header = FALSE;
1615+ /* Adjust Exif image parameters */
1616+ if (dstinfo->image_width != srcinfo->image_width ||
1617+ dstinfo->image_height != srcinfo->image_height)
1618+ /* Align data segment to start of TIFF structure for parsing */
1619+ adjust_exif_parameters(srcinfo->marker_list->data + 6,
1620+ srcinfo->marker_list->data_length - 6,
1621+ dstinfo->image_width, dstinfo->image_height);
1622+ }
1623+
1624 /* Return the appropriate output data set */
1625 if (info->workspace_coef_arrays != NULL)
1626 return info->workspace_coef_arrays;
1627@@ -816,36 +1349,53 @@
1628 */
1629
1630 GLOBAL(void)
1631-jtransform_execute_transformation (j_decompress_ptr srcinfo,
1632- j_compress_ptr dstinfo,
1633- jvirt_barray_ptr *src_coef_arrays,
1634- jpeg_transform_info *info)
1635+jtransform_execute_transform (j_decompress_ptr srcinfo,
1636+ j_compress_ptr dstinfo,
1637+ jvirt_barray_ptr *src_coef_arrays,
1638+ jpeg_transform_info *info)
1639 {
1640 jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays;
1641
1642+ /* Note: conditions tested here should match those in switch statement
1643+ * in jtransform_request_workspace()
1644+ */
1645 switch (info->transform) {
1646 case JXFORM_NONE:
1647+ if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
1648+ do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1649+ src_coef_arrays, dst_coef_arrays);
1650 break;
1651 case JXFORM_FLIP_H:
1652- do_flip_h(srcinfo, dstinfo, src_coef_arrays);
1653+ if (info->y_crop_offset != 0)
1654+ do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1655+ src_coef_arrays, dst_coef_arrays);
1656+ else
1657+ do_flip_h_no_crop(srcinfo, dstinfo, info->x_crop_offset,
1658+ src_coef_arrays);
1659 break;
1660 case JXFORM_FLIP_V:
1661- do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1662+ do_flip_v(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1663+ src_coef_arrays, dst_coef_arrays);
1664 break;
1665 case JXFORM_TRANSPOSE:
1666- do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1667+ do_transpose(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1668+ src_coef_arrays, dst_coef_arrays);
1669 break;
1670 case JXFORM_TRANSVERSE:
1671- do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1672+ do_transverse(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1673+ src_coef_arrays, dst_coef_arrays);
1674 break;
1675 case JXFORM_ROT_90:
1676- do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1677+ do_rot_90(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1678+ src_coef_arrays, dst_coef_arrays);
1679 break;
1680 case JXFORM_ROT_180:
1681- do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1682+ do_rot_180(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1683+ src_coef_arrays, dst_coef_arrays);
1684 break;
1685 case JXFORM_ROT_270:
1686- do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
1687+ do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
1688+ src_coef_arrays, dst_coef_arrays);
1689 break;
1690 }
1691 }
1692--- jpeg-6b/jerror.h~libjpeg6bb-5
1693+++ jpeg-6b/jerror.h
1694@@ -45,6 +45,7 @@
1695 JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
1696 JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
1697 JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
1698+JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
1699 JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
1700 JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
1701 JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
1702--- jpeg-6b/transupp.h~libjpeg6bb-5
1703+++ jpeg-6b/transupp.h
1704@@ -1,7 +1,7 @@
1705 /*
1706 * transupp.h
1707 *
1708- * Copyright (C) 1997, Thomas G. Lane.
1709+ * Copyright (C) 1997-2001, Thomas G. Lane.
1710 * This file is part of the Independent JPEG Group's software.
1711 * For conditions of distribution and use, see the accompanying README file.
1712 *
1713@@ -22,32 +22,6 @@
1714 #define TRANSFORMS_SUPPORTED 1 /* 0 disables transform code */
1715 #endif
1716
1717-/* Short forms of external names for systems with brain-damaged linkers. */
1718-
1719-#ifdef NEED_SHORT_EXTERNAL_NAMES
1720-#define jtransform_request_workspace jTrRequest
1721-#define jtransform_adjust_parameters jTrAdjust
1722-#define jtransform_execute_transformation jTrExec
1723-#define jcopy_markers_setup jCMrkSetup
1724-#define jcopy_markers_execute jCMrkExec
1725-#endif /* NEED_SHORT_EXTERNAL_NAMES */
1726-
1727-
1728-/*
1729- * Codes for supported types of image transformations.
1730- */
1731-
1732-typedef enum {
1733- JXFORM_NONE, /* no transformation */
1734- JXFORM_FLIP_H, /* horizontal flip */
1735- JXFORM_FLIP_V, /* vertical flip */
1736- JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
1737- JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
1738- JXFORM_ROT_90, /* 90-degree clockwise rotation */
1739- JXFORM_ROT_180, /* 180-degree rotation */
1740- JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
1741-} JXFORM_CODE;
1742-
1743 /*
1744 * Although rotating and flipping data expressed as DCT coefficients is not
1745 * hard, there is an asymmetry in the JPEG format specification for images
1746@@ -75,6 +49,19 @@
1747 * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
1748 * followed by -rot 180 -trim trims both edges.)
1749 *
1750+ * We also offer a lossless-crop option, which discards data outside a given
1751+ * image region but losslessly preserves what is inside. Like the rotate and
1752+ * flip transforms, lossless crop is restricted by the JPEG format: the upper
1753+ * left corner of the selected region must fall on an iMCU boundary. If this
1754+ * does not hold for the given crop parameters, we silently move the upper left
1755+ * corner up and/or left to make it so, simultaneously increasing the region
1756+ * dimensions to keep the lower right crop corner unchanged. (Thus, the
1757+ * output image covers at least the requested region, but may cover more.)
1758+ *
1759+ * If both crop and a rotate/flip transform are requested, the crop is applied
1760+ * last --- that is, the crop region is specified in terms of the destination
1761+ * image.
1762+ *
1763 * We also offer a "force to grayscale" option, which simply discards the
1764 * chrominance channels of a YCbCr image. This is lossless in the sense that
1765 * the luminance channel is preserved exactly. It's not the same kind of
1766@@ -83,20 +70,87 @@
1767 * be aware of the option to know how many components to work on.
1768 */
1769
1770+
1771+/* Short forms of external names for systems with brain-damaged linkers. */
1772+
1773+#ifdef NEED_SHORT_EXTERNAL_NAMES
1774+#define jtransform_parse_crop_spec jTrParCrop
1775+#define jtransform_request_workspace jTrRequest
1776+#define jtransform_adjust_parameters jTrAdjust
1777+#define jtransform_execute_transform jTrExec
1778+#define jcopy_markers_setup jCMrkSetup
1779+#define jcopy_markers_execute jCMrkExec
1780+#endif /* NEED_SHORT_EXTERNAL_NAMES */
1781+
1782+
1783+/*
1784+ * Codes for supported types of image transformations.
1785+ */
1786+
1787+typedef enum {
1788+ JXFORM_NONE, /* no transformation */
1789+ JXFORM_FLIP_H, /* horizontal flip */
1790+ JXFORM_FLIP_V, /* vertical flip */
1791+ JXFORM_TRANSPOSE, /* transpose across UL-to-LR axis */
1792+ JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */
1793+ JXFORM_ROT_90, /* 90-degree clockwise rotation */
1794+ JXFORM_ROT_180, /* 180-degree rotation */
1795+ JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */
1796+} JXFORM_CODE;
1797+
1798+/*
1799+ * Codes for crop parameters, which can individually be unspecified,
1800+ * positive, or negative. (Negative width or height makes no sense, though.)
1801+ */
1802+
1803+typedef enum {
1804+ JCROP_UNSET,
1805+ JCROP_POS,
1806+ JCROP_NEG
1807+} JCROP_CODE;
1808+
1809+/*
1810+ * Transform parameters struct.
1811+ * NB: application must not change any elements of this struct after
1812+ * calling jtransform_request_workspace.
1813+ */
1814+
1815 typedef struct {
1816 /* Options: set by caller */
1817 JXFORM_CODE transform; /* image transform operator */
1818 boolean trim; /* if TRUE, trim partial MCUs as needed */
1819 boolean force_grayscale; /* if TRUE, convert color image to grayscale */
1820+ boolean crop; /* if TRUE, crop source image */
1821+
1822+ /* Crop parameters: application need not set these unless crop is TRUE.
1823+ * These can be filled in by jtransform_parse_crop_spec().
1824+ */
1825+ JDIMENSION crop_width; /* Width of selected region */
1826+ JCROP_CODE crop_width_set;
1827+ JDIMENSION crop_height; /* Height of selected region */
1828+ JCROP_CODE crop_height_set;
1829+ JDIMENSION crop_xoffset; /* X offset of selected region */
1830+ JCROP_CODE crop_xoffset_set; /* (negative measures from right edge) */
1831+ JDIMENSION crop_yoffset; /* Y offset of selected region */
1832+ JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */
1833
1834 /* Internal workspace: caller should not touch these */
1835 int num_components; /* # of components in workspace */
1836 jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
1837+ JDIMENSION output_width; /* cropped destination dimensions */
1838+ JDIMENSION output_height;
1839+ JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */
1840+ JDIMENSION y_crop_offset;
1841+ int max_h_samp_factor; /* destination iMCU size */
1842+ int max_v_samp_factor;
1843 } jpeg_transform_info;
1844
1845
1846 #if TRANSFORMS_SUPPORTED
1847
1848+/* Parse a crop specification (written in X11 geometry style) */
1849+EXTERN(boolean) jtransform_parse_crop_spec
1850+ JPP((jpeg_transform_info *info, const char *spec));
1851 /* Request any required workspace */
1852 EXTERN(void) jtransform_request_workspace
1853 JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
1854@@ -106,11 +160,18 @@
1855 jvirt_barray_ptr *src_coef_arrays,
1856 jpeg_transform_info *info));
1857 /* Execute the actual transformation, if any */
1858-EXTERN(void) jtransform_execute_transformation
1859+EXTERN(void) jtransform_execute_transform
1860 JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
1861 jvirt_barray_ptr *src_coef_arrays,
1862 jpeg_transform_info *info));
1863
1864+/* jtransform_execute_transform used to be called
1865+ * jtransform_execute_transformation, but some compilers complain about
1866+ * routine names that long. This macro is here to avoid breaking any
1867+ * old source code that uses the original name...
1868+ */
1869+#define jtransform_execute_transformation jtransform_execute_transform
1870+
1871 #endif /* TRANSFORMS_SUPPORTED */
1872
1873
1874
diff --git a/meta/packages/jpeg/jpeg-6b/ldflags.patch b/meta/packages/jpeg/jpeg-6b/ldflags.patch
deleted file mode 100644
index 727327bc6e..0000000000
--- a/meta/packages/jpeg/jpeg-6b/ldflags.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1
2#
3# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4#
5
6--- jpeg-6b/makefile.cfg~ldflags
7+++ jpeg-6b/makefile.cfg
8@@ -169,7 +169,7 @@
9 # with libtool:
10 libjpeg.la: @A2K_DEPS@ $(LIBOBJECTS)
11 $(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
12- -rpath $(libdir) -version-info $(JPEG_LIB_VERSION)
13+ -rpath $(libdir) -version-info $(JPEG_LIB_VERSION) $(LDFLAGS)
14
15 # sample programs:
16
diff --git a/meta/packages/jpeg/jpeg-6b/libtool_tweak.patch b/meta/packages/jpeg/jpeg-6b/libtool_tweak.patch
deleted file mode 100644
index d61476adc0..0000000000
--- a/meta/packages/jpeg/jpeg-6b/libtool_tweak.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1Index: jpeg-6b/configure
2===================================================================
3--- jpeg-6b.orig/configure 2008-05-07 15:53:15.000000000 +0100
4+++ jpeg-6b/configure 2008-05-07 15:54:40.000000000 +0100
5@@ -1532,7 +1532,7 @@
6 LIBTOOL="./libtool"
7 O="lo"
8 A="la"
9- LN='$(LIBTOOL) --mode=link $(CC)'
10+ LN='$(LIBTOOL) --tag=CC --mode=link $(CC)'
11 INSTALL_LIB='$(LIBTOOL) --mode=install ${INSTALL}'
12 INSTALL_PROGRAM="\$(LIBTOOL) --mode=install $INSTALL_PROGRAM"
13 else
14@@ -1559,7 +1559,6 @@
15 if test "x$LTSTATIC" = xno; then
16 disable_static="--disable-static"
17 fi
18- $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh
19 fi
20
21 # Select memory manager depending on user input.
22Index: jpeg-6b/makefile.cfg
23===================================================================
24--- jpeg-6b.orig/makefile.cfg 2008-05-07 15:53:24.000000000 +0100
25+++ jpeg-6b/makefile.cfg 2008-05-07 15:56:22.000000000 +0100
26@@ -141,7 +141,7 @@
27
28 # How to compile with libtool.
29 @COM_LT@.c.lo:
30-@COM_LT@ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
31+@COM_LT@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
32
33 # How to use ansi2knr, when not using libtool.
34 @COM_A2K@.c.o:
35@@ -152,7 +152,7 @@
36 # How to use ansi2knr AND libtool.
37 @COM_A2K@.c.lo:
38 @COM_A2K@ ./ansi2knr $(srcdir)/$*.c knr/$*.c
39-@COM_A2K@ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
40+@COM_A2K@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) -c knr/$*.c
41 @COM_A2K@ $(RM) knr/$*.c
42
43 ansi2knr: ansi2knr.c
44@@ -169,7 +169,7 @@
45
46 # with libtool:
47 libjpeg.la: @A2K_DEPS@ $(LIBOBJECTS)
48- $(LIBTOOL) --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
49+ $(LIBTOOL) --tag=CC --mode=link $(CC) -o libjpeg.la $(LIBOBJECTS) \
50 -rpath $(libdir) -version-info $(JPEG_LIB_VERSION) $(LDFLAGS)
51
52 # sample programs:
diff --git a/meta/packages/jpeg/jpeg-6b/paths.patch b/meta/packages/jpeg/jpeg-6b/paths.patch
deleted file mode 100644
index 014bf4ec0f..0000000000
--- a/meta/packages/jpeg/jpeg-6b/paths.patch
+++ /dev/null
@@ -1,77 +0,0 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- jpeg-6b/makefile.cfg~paths.patch
7+++ jpeg-6b/makefile.cfg
8@@ -7,17 +7,18 @@
9 # For compiling with source and object files in different directories.
10 srcdir = @srcdir@
11 VPATH = @srcdir@
12+DESTDIR = @DESTDIR@
13
14 # Where to install the programs and man pages.
15 prefix = @prefix@
16 exec_prefix = @exec_prefix@
17-bindir = $(exec_prefix)/bin
18-libdir = $(exec_prefix)/lib
19-includedir = $(prefix)/include
20+bindir = @bindir@
21+libdir = @libdir@
22+includedir = @includedir@
23 binprefix =
24 manprefix =
25 manext = 1
26-mandir = $(prefix)/share/man/man$(manext)
27+mandir = @mandir@/man$(manext)
28
29 # The name of your C compiler:
30 CC= @CC@
31@@ -191,30 +192,30 @@
32 # Installation rules:
33
34 install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom @FORCE_INSTALL_LIB@
35- $(INSTALL_PROGRAM) cjpeg $(bindir)/$(binprefix)cjpeg
36- $(INSTALL_PROGRAM) djpeg $(bindir)/$(binprefix)djpeg
37- $(INSTALL_PROGRAM) jpegtran $(bindir)/$(binprefix)jpegtran
38- $(INSTALL_PROGRAM) rdjpgcom $(bindir)/$(binprefix)rdjpgcom
39- $(INSTALL_PROGRAM) wrjpgcom $(bindir)/$(binprefix)wrjpgcom
40- $(INSTALL_DATA) $(srcdir)/cjpeg.1 $(mandir)/$(manprefix)cjpeg.$(manext)
41- $(INSTALL_DATA) $(srcdir)/djpeg.1 $(mandir)/$(manprefix)djpeg.$(manext)
42- $(INSTALL_DATA) $(srcdir)/jpegtran.1 $(mandir)/$(manprefix)jpegtran.$(manext)
43- $(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(mandir)/$(manprefix)rdjpgcom.$(manext)
44- $(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(mandir)/$(manprefix)wrjpgcom.$(manext)
45+ $(INSTALL_PROGRAM) cjpeg $(DESTDIR)$(bindir)/$(binprefix)cjpeg
46+ $(INSTALL_PROGRAM) djpeg $(DESTDIR)$(bindir)/$(binprefix)djpeg
47+ $(INSTALL_PROGRAM) jpegtran $(DESTDIR)$(bindir)/$(binprefix)jpegtran
48+ $(INSTALL_PROGRAM) rdjpgcom $(DESTDIR)$(bindir)/$(binprefix)rdjpgcom
49+ $(INSTALL_PROGRAM) wrjpgcom $(DESTDIR)$(bindir)/$(binprefix)wrjpgcom
50+ $(INSTALL_DATA) $(srcdir)/cjpeg.1 $(DESTDIR)$(mandir)/$(manprefix)cjpeg.$(manext)
51+ $(INSTALL_DATA) $(srcdir)/djpeg.1 $(DESTDIR)$(mandir)/$(manprefix)djpeg.$(manext)
52+ $(INSTALL_DATA) $(srcdir)/jpegtran.1 $(DESTDIR)$(mandir)/$(manprefix)jpegtran.$(manext)
53+ $(INSTALL_DATA) $(srcdir)/rdjpgcom.1 $(DESTDIR)$(mandir)/$(manprefix)rdjpgcom.$(manext)
54+ $(INSTALL_DATA) $(srcdir)/wrjpgcom.1 $(DESTDIR)$(mandir)/$(manprefix)wrjpgcom.$(manext)
55
56 install-lib: libjpeg.$(A) install-headers
57- $(INSTALL_LIB) libjpeg.$(A) $(libdir)/$(binprefix)libjpeg.$(A)
58+ $(INSTALL_LIB) libjpeg.$(A) $(DESTDIR)$(libdir)/$(binprefix)libjpeg.$(A)
59
60 install-headers: jconfig.h
61- $(INSTALL_DATA) jconfig.h $(includedir)/jconfig.h
62- $(INSTALL_DATA) $(srcdir)/jpeglib.h $(includedir)/jpeglib.h
63- $(INSTALL_DATA) $(srcdir)/jmorecfg.h $(includedir)/jmorecfg.h
64- $(INSTALL_DATA) $(srcdir)/jerror.h $(includedir)/jerror.h
65+ $(INSTALL_DATA) jconfig.h $(DESTDIR)$(includedir)/jconfig.h
66+ $(INSTALL_DATA) $(srcdir)/jpeglib.h $(DESTDIR)$(includedir)/jpeglib.h
67+ $(INSTALL_DATA) $(srcdir)/jmorecfg.h $(DESTDIR)$(includedir)/jmorecfg.h
68+ $(INSTALL_DATA) $(srcdir)/jerror.h $(DESTDIR)$(includedir)/jerror.h
69 #<ballombe@debian.org>:mjpegtools require this file to build and header say:
70 # * These declarations are considered internal to the JPEG library; most
71 # * applications using the library shouldn't need to include this file.
72 # So it is not forbidden to use it, therefore it must be installed.
73- $(INSTALL_DATA) $(srcdir)/jpegint.h $(includedir)/jpegint.h
74+ $(INSTALL_DATA) $(srcdir)/jpegint.h $(DESTDIR)$(includedir)/jpegint.h
75
76 clean:
77 $(RM) *.o *.lo libjpeg.a libjpeg.la
diff --git a/meta/packages/jpeg/jpeg-8b/debian-libjpeg7_7-1.diff b/meta/packages/jpeg/jpeg-8b/debian-libjpeg7_7-1.diff
new file mode 100755
index 0000000000..2e4867aa75
--- /dev/null
+++ b/meta/packages/jpeg/jpeg-8b/debian-libjpeg7_7-1.diff
@@ -0,0 +1,1066 @@
1--- libjpeg7-7.orig/config.sub
2+++ libjpeg7-7/config.sub
3@@ -1,4 +1,10 @@
4 #! /bin/sh
5+# autotools-dev hack (<ballombe@debian.org>, Wed, 14 Nov 2001 10:13:10 +0100)
6+if [ -x /usr/share/misc/config.sub ]; then
7+ /usr/share/misc/config.sub $*
8+ exit $?
9+fi
10+
11 # Configuration validation subroutine script.
12 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
13 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
14--- libjpeg7-7.orig/config.guess
15+++ libjpeg7-7/config.guess
16@@ -1,4 +1,10 @@
17 #! /bin/sh
18+# autotools-dev hack (<ballombe@debian.org>, Wed, 14 Nov 2001 10:13:10 +0100)
19+if [ -x /usr/share/misc/config.guess ]; then
20+ /usr/share/misc/config.guess $*
21+ exit $?
22+fi
23+
24 # Attempt to guess a canonical system name.
25 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
26 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
27--- libjpeg7-7.orig/debian/libjpeg7-dev.files
28+++ libjpeg7-7/debian/libjpeg7-dev.files
29@@ -0,0 +1,4 @@
30+usr/include
31+usr/lib/libjpeg.a
32+usr/lib/libjpeg.la
33+usr/lib/libjpeg.so
34--- libjpeg7-7.orig/debian/libjpeg-progs.README.Debian
35+++ libjpeg7-7/debian/libjpeg-progs.README.Debian
36@@ -0,0 +1,13 @@
37+libjpeg-progs for Debian
38+========================
39+
40+This package contains programs for manipulating JPEG files:
41+ cjpeg/djpeg: convert to/from the JPEG file format
42+ rdjpgcom/wrjpgcom: read/write comments in JPEG files
43+ jpegtran: lossless transformations of JPEG files
44+ jpegexiforient/exifautotran: manipulate EXIF orientation tag
45+
46+Thanks for using Debian!
47+
48+--
49+Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:18:59 +0200
50--- libjpeg7-7.orig/debian/shlibs.local
51+++ libjpeg7-7/debian/shlibs.local
52@@ -0,0 +1 @@
53+libjpeg 7 libjpeg7
54--- libjpeg7-7.orig/debian/rules
55+++ libjpeg7-7/debian/rules
56@@ -0,0 +1,71 @@
57+#!/usr/bin/make -f
58+# Made with the aid of debmake, by Christoph Lameter,
59+# based on the sample debian/rules file for GNU hello by Ian Jackson.
60+
61+package=libjpeg
62+
63+export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
64+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
65+
66+export CFLAGS=-D_REENTRANT -g -Wall
67+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
68+CFLAGS += -O0
69+else
70+CFLAGS += -O2
71+endif
72+
73+#export DH_VERBOSE=1
74+
75+build: build-stamp
76+build-stamp:
77+ dh_testdir
78+ ./configure --prefix=/usr --mandir=/usr/share/man \
79+ --enable-static --enable-shared \
80+ --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
81+ $(MAKE)
82+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
83+ $(MAKE) check
84+endif
85+ $(MAKE) -C debian/extra
86+
87+ touch build-stamp
88+
89+clean:
90+ dh_testdir
91+ dh_testroot
92+ -rm -f build-stamp
93+ if [ -f Makefile ]; then $(MAKE) distclean; fi
94+ $(MAKE) clean -C debian/extra
95+ dh_clean
96+
97+binary-indep:
98+
99+binary-arch: build
100+ dh_testdir
101+ dh_testroot
102+ dh_clean -k
103+ dh_installdirs
104+ $(MAKE) install DESTDIR=`pwd`/debian/tmp
105+ $(MAKE) install -C debian/extra prefix=/usr DESTDIR=`pwd`/debian/tmp
106+ # fix jconfig.h
107+ rm debian/tmp/usr/include/jconfig.h
108+ sed -e "s/#\(undef\|define\) HAVE_\(LOCALE\|\(STD\(DEF\|LIB\)\)\)_H 1//g" \
109+ jconfig.h > debian/tmp/usr/include/jconfig.h
110+ # separate out lib package
111+ dh_movefiles
112+ # Finish it off with debhelper
113+ dh_installdocs README
114+ dh_installexamples
115+ dh_installchangelogs change.log
116+ dh_strip --dbg-package=libjpeg7-dbg
117+ dh_compress
118+ dh_fixperms
119+ dh_installdeb
120+ dh_shlibdeps -l`pwd`/debian/libjpeg7/usr/lib
121+ dh_gencontrol
122+ dh_md5sums
123+ dh_builddeb
124+
125+binary: binary-indep binary-arch
126+
127+.PHONY: clean binary-indep binary-arch binary build
128--- libjpeg7-7.orig/debian/libjpeg7-dev.README.Debian
129+++ libjpeg7-7/debian/libjpeg7-dev.README.Debian
130@@ -0,0 +1,18 @@
131+IJG JPEG for Debian
132+===================
133+
134+The following patch has been applied to the headers files:
135+
136+--- jconfig.h: Remove unused symbol HAVE_STDDEF_H, HAVE_STDLIB_H and
137+HAVE_LOCALE_H since they are not used by the installed headers files and cause
138+problem with autoconf.
139+
140+This can theoretically cause problems if your software relies on theses symbols
141+being defined by this header. If it ever happens, please define them manually.
142+
143+Note: this is not Debian-specific, others distributions apply similar patches.
144+
145+Thanks for using Debian!
146+
147+---
148+Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:17:56 +0200
149--- libjpeg7-7.orig/debian/shlibs
150+++ libjpeg7-7/debian/shlibs
151@@ -0,0 +1 @@
152+libjpeg 7 libjpeg7
153--- libjpeg7-7.orig/debian/control
154+++ libjpeg7-7/debian/control
155@@ -0,0 +1,52 @@
156+Source: libjpeg7
157+Maintainer: Bill Allombert <ballombe@debian.org>
158+Section: graphics
159+Priority: optional
160+Build-Depends: debhelper (>= 5), autotools-dev
161+Standards-Version: 3.8.2
162+
163+Package: libjpeg7
164+Architecture: any
165+Section: libs
166+Description: The Independent JPEG Group's JPEG runtime library
167+ The Independent JPEG Group's JPEG library is a library for handling
168+ JPEG files.
169+ .
170+ This package contains the shared library.
171+Depends: ${shlibs:Depends}
172+
173+Package: libjpeg7-dev
174+Architecture: any
175+Section: libdevel
176+Description: Development files for the IJG JPEG library
177+ The Independent JPEG Group's JPEG library is a library for handling
178+ JPEG files.
179+ .
180+ This package contains the static library, headers and documentation.
181+Depends: libjpeg7 (=${binary:Version}), libc-dev
182+Conflicts: libjpeg62-dev
183+Replaces: libjpeg62-dev
184+
185+Package: libjpeg7-dbg
186+Architecture: any
187+Section: debug
188+Priority: extra
189+Description: Development files for the IJG JPEG library
190+ The Independent JPEG Group's JPEG library is a library for handling
191+ JPEG files.
192+ .
193+ This package contains the debugging symbols for libjpeg.
194+Provides: libjpeg-dbg
195+Depends: libjpeg7 (=${binary:Version})
196+Conflicts: libjpeg62-dbg
197+Replaces: libjpeg62-dbg
198+
199+Package: libjpeg-progs
200+Architecture: any
201+Description: Programs for manipulating JPEG files
202+ This package contains programs for manipulating JPEG files:
203+ cjpeg/djpeg: convert to/from the JPEG file format
204+ rdjpgcom/wrjpgcom: read/write comments in JPEG files
205+ jpegtran: lossless transformations of JPEG files
206+ jpegexiforient/exifautotran: manipulate EXIF orientation tag
207+Depends: ${shlibs:Depends}
208--- libjpeg7-7.orig/debian/libjpeg7.files
209+++ libjpeg7-7/debian/libjpeg7.files
210@@ -0,0 +1,2 @@
211+/usr/lib/libjpeg.so.7.0.0
212+/usr/lib/libjpeg.so.7
213--- libjpeg7-7.orig/debian/postinst
214+++ libjpeg7-7/debian/postinst
215@@ -0,0 +1,8 @@
216+#!/bin/sh -e
217+
218+#DEBHELPER#
219+
220+if [ "$1" = "configure" ]; then
221+ ldconfig
222+fi
223+
224--- libjpeg7-7.orig/debian/compat
225+++ libjpeg7-7/debian/compat
226@@ -0,0 +1 @@
227+5
228--- libjpeg7-7.orig/debian/libjpeg7-dev.examples
229+++ libjpeg7-7/debian/libjpeg7-dev.examples
230@@ -0,0 +1 @@
231+example.c
232--- libjpeg7-7.orig/debian/changelog
233+++ libjpeg7-7/debian/changelog
234@@ -0,0 +1,245 @@
235+libjpeg7 (7-1) unstable; urgency=low
236+
237+ * The "Yoan" release.
238+ * New upstream release. closes: #535350
239+ - This release includes configure.ac and Makefile.am. closes: #346126
240+ - All patches merged upstream.
241+ - Remove dpatch support.
242+ * debian/control:
243+ - Remove Build-Dependency on libtool and sharutils.
244+ - Move libjpeg7-dbg to debug section.
245+ - Bump standard version to 3.8.2.
246+ * Skip test-suite if nocheck is set. closes: #451222
247+
248+ -- Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:29:27 +0200
249+
250+libjpeg6b (6b-14) unstable; urgency=low
251+
252+ * The "Lino" release.
253+ * exifautotran:
254+ - fix typo in manpage. closes: #376371, thanks Reuben Thomas.
255+ - preserve file mode. closes: #383379, thanks Vincent Arkesteijn.
256+ * debian/control, debian/rules, debian/compat:
257+ + switch to debhelper v5
258+ + add libjpeg-dbg debugging package.
259+ * debian/rules: remove - before "make clean" rules.
260+ * Add patch 204_jpegtran_man to improve readability of manpage.
261+ closes: #437453. Thanks Jorgen Grahn.
262+ * jpegexiforient.1: Apply patch from Jorgen Grahn to improve formatting.
263+ closes: #437446.
264+
265+ -- Bill Allombert <ballombe@debian.org> Thu, 16 Aug 2007 22:59:21 +0200
266+
267+libjpeg6b (6b-13) unstable; urgency=low
268+
269+ * The "If at first you don't succeed..." release.
270+ * Change --enable-maxmem to 1024, following Guido advice.
271+ This should fix the slowdowns with large files (for large < 1Gb):
272+ closes: #356556, #365025, Thanks Nicolas.
273+ If you hit performance problems, please set the JPEGMEM variable to
274+ about half your available RAM, see jpegtran(1).
275+ * Update libjpeg-progs README.Debian to reflect the new patch set and
276+ the JPEGMEM feature.
277+ * Bump standard version to 3.7.2.
278+
279+ -- Bill Allombert <ballombe@debian.org> Fri, 5 May 2006 19:14:25 +0200
280+
281+libjpeg6b (6b-12) unstable; urgency=low
282+
283+ * The "vote for me" release
284+ * Bump standard version to 3.6.2.
285+ * Run 'make test' instead of home-made test-suite.
286+ * Switch to debhelper v4.
287+ * libjpeg is now configured with --enable-maxmem=32. This limits the memory
288+ usage to 32Mb and it can be overrided by JPEGMEM. Without this flag
289+ JPEGMEM is ignored and there were no limits.
290+ closes: #346023. Thanks C. Scott Ananian.
291+
292+ -- Bill Allombert <ballombe@debian.org> Thu, 2 Mar 2006 18:52:44 +0100
293+
294+libjpeg6b (6b-11) unstable; urgency=high
295+
296+ * The "Silencio" release
297+ * exifautotran: Apply patch by Uwe Zeisberger to fix bad temporary file
298+ handling. closes: #340079
299+
300+ -- Bill Allombert <ballombe@debian.org> Sun, 20 Nov 2005 20:57:07 +0100
301+
302+libjpeg6b (6b-10) unstable; urgency=low
303+
304+ * The "timeout" release.
305+ * Rebuild with current toolchain.
306+ * Depends on libc-dev instead of libc6-dev. closes: #294696
307+ Thanks Joel Aelwyn for discussing thoroughly the matter.
308+ * Instead of copying /usr/bin/libtool, we replace it by a script that
309+ call libtool (using standard path search). Remarked by Jesus Climent.
310+ * debian/control: remove pre-hamm cruft.
311+ * Add jpegexiforient and jpegautotran by Guido Vollbeding
312+ <http://sylvana.net/jpegcrop/exif_orientation.html> as proposed by Philip
313+ Armstrong. closes: #257061.
314+ * Run the test-suite at build time instead of shipping it in the package:
315+ - /usr/share/doc/libjpeg-progs/tests: removed.
316+ - debian/control: Add Build-Depends on sharutils for uuencode.
317+ - debian/libjpeg-progs.dirs: removed.
318+ - debian/libjpeg-progs.test: removed.
319+
320+ -- Bill Allombert <ballombe@debian.org> Tue, 1 Mar 2005 19:43:26 +0100
321+
322+libjpeg6b (6b-9) unstable; urgency=low
323+
324+ * The "I'm all for aggressive goals" release.
325+ * Rebuild with new libtool. closes: #201943.
326+ * patch 100_crop: Updated from Guido Vollbeding <guido@jpegclub.org>
327+ to include patches 203_jpegtran_errmsg,204_perfect.
328+ * patch 200_crop_man: Include 205_perfect_man.
329+ * patches 203_jpegtran_errmsg, 204_perfect, 205_perfect_man: removed
330+ * Add patch 203_rdppm: fix cjpeg issue with 16-bit PPM files. closes: #208937
331+ * Bump standard version to 3.6.1.
332+ * Update debian/edit-patch.
333+
334+ -- Bill Allombert <ballombe@debian.org> Mon, 8 Sep 2003 16:22:08 +0200
335+
336+libjpeg6b (6b-8) unstable; urgency=low
337+
338+ * The "I *hate* when that happens" release.
339+ * Move libjpeg62-dev to libdevel section.
340+ * See debian/README.sources for detail about the (d)patch system.
341+ * debian/rules: avoid to run configure twice.
342+ * Add patches 204_perfect and 205_perfect_man. They implement the
343+ -perfect jpegtran option as proposed by Mark W. Eichin. closes: #189027
344+ * Bump standard version to 3.5.10.
345+ * Use /usr/bin/libtool instead of ldconfig-generated libtool, and remove
346+ various libtool related kludges, including patch 301_configure.
347+ closes: #195281. Thanks Robert Millan for the suggestion.
348+ * Remove patch 302_makefile. Fix debian/rules instead.
349+
350+ -- Bill Allombert <ballombe@debian.org> Sat, 31 May 2003 16:16:59 +0200
351+
352+libjpeg6b (6b-7) unstable; urgency=low
353+
354+ * Rebuild with new gcc/new glibc/new debhelper.
355+ * Add -g to build options according to new policy.
356+ * Add support for DEB_BUILD_OPTIONS noopt. nostrip is handled by dh_strip.
357+ * Bump standard version to 3.5.9.
358+ * Extend description a bit (If you have a better one please email me!).
359+ * Use dpatch to handle the patches.
360+
361+ -- Bill Allombert <ballombe@debian.org> Sun, 16 Mar 2003 12:19:36 +0100
362+
363+libjpeg6b (6b-6) unstable; urgency=low
364+
365+ * The "Try to break sarge before it even got a name" release
366+ * jpegtran: better error messages when opening files.
367+ closes: #147516 Thanks Mark W. Eichin.
368+ * Add debian/patch dir with my patches.
369+ * Add extern "C" if we are under C++.
370+ closes: #113167 Thanks, Fredrik Jagenheim.
371+ * Remove HAVE_STD{LIB,DEF}_H from jconfig.h since they are not used and
372+ conflict with autoconf. closes: #109516 Thanks <Benedikt.Roth@gmx.net>
373+ * Add README.Debian in /usr/share/libjpeg62-dev
374+
375+ -- Bill Allombert <ballombe@debian.org> Mon, 3 Jun 2002 19:34:08 +0200
376+
377+libjpeg6b (6b-5) unstable; urgency=low
378+
379+ * jpeg-->JPEG in libjpeg-progs description.
380+ * Add lib path to dh_shlibdeps to avoid warning.
381+ * Apply patch from <http://sylvana.net/jpegcrop/croppatch.tar.gz> by
382+ <guido@jpegclub.org> closes: #129412 Thanks, Colin Marquardt.
383+
384+ -- Bill Allombert <ballombe@debian.org> Mon, 20 May 2002 11:55:22 +0200
385+
386+libjpeg6b (6b-4) unstable; urgency=low
387+
388+ * Avoid bashism in debian/rules.
389+ * Update libtool to 1.3.5. (1.4 will break).
390+ closes: #52095 Thanks, <Marcus.Brinkmann@ruhr-uni-bochum.de>
391+ * Patch config.guess to use version in the autotools-dev package.
392+ * Correct Section: field of libjpeg62 and libjpeg62-dev.
393+
394+ -- Bill Allombert <ballombe@debian.org> Tue, 20 Nov 2001 10:23:47 +0100
395+
396+libjpeg6b (6b-3) unstable; urgency=low
397+
398+ * The "Where is ltconfig ?" release.
399+ * Remove jconfig.h in debian/rules clean and do some clean up.
400+ * Install libjpeg.la per Policy 11.2.
401+ * Remove duplicate wizard.doc file in libjpeg62-dev.
402+ * Use dpkg-architecture instead of config.guess.
403+ * Patch config.sub to use version in the autotools-dev package.
404+ closes: #85558, #120039
405+ * Patch rdjpgcom.c to use locales for isprint check on comment chars.
406+ closes: #116589 Thanks, Neal H Walfield <neal@cs.uml.edu>
407+ * Apply patch from <http://sylvana.net/jpegcrop/transupp.c> by
408+ <guido@jpegclub.org> closes: #114415 Thanks, <Jean-Marc.Notin@loria.fr>
409+
410+ -- Bill Allombert <ballombe@debian.org> Tue, 13 Nov 2001 21:41:49 +0000
411+
412+libjpeg6b (6b-2) unstable; urgency=low
413+
414+ * New Maintainer. Mark, If you want back the package, just ask!
415+ * Acknowledge previous NMU:
416+ Jordi: closes: #74087, #24330, #24291
417+ Colin: closes: #80752
418+ Joel: closes: #25324, #27033, #28341
419+ * Write source location as a valid URL in debian/copyright.
420+ closes: #118628 Thanks, Doug Porter <dsp@debian.org>.
421+ * Fix formating of description of libjpeg-progs.
422+ closes: #114378 Thanks, Colin Watson <cjwatson@flatline.org.uk>.
423+ * Install jpegint.h header needed by some apps. closes: #100171
424+ * Remove unused/empty debian/postrm.
425+ closes: #24849 Thanks, Adrian Bridgett <adrian.bridgett@zetnet.co.uk>.
426+ * Install wizard.doc file. closes: #64807 Thanks <amc@arwen.cs.berkeley.edu>.
427+ * Fix libjpeg-progs test.sh.
428+ * Fix lintian bugs: typo in copyright, emacs user info in changelog.
429+ * Fix false lintian bug: unsafe ldconfig in postinst, by reformatting.
430+ * Remove "-g" from CFLAGS per Policy 11.1, hoping m68k is fixed now.
431+ * Remove libtool and Makefile in debian/rules clean.
432+ * Fix the test system. As a side effect,
433+ closes: #109195 Thanks Daniel Schepler <schepler@math.berkeley.edu>
434+ * Standards-Version is now 3.5.6.
435+
436+ -- Bill Allombert <ballombe@debian.org> Fri, 9 Nov 2001 22:40:16 +0100
437+
438+libjpeg6b (6b-1.3) frozen unstable; urgency=low
439+
440+ * Non-Maintainer Upload.
441+ * Added Build-Depends.
442+ * Gil Bahat <coutal@netvision.net.il> did the rest of the changes.
443+ * Close bug regarding non-standard jpegs not being processed
444+ (closes: #74087).
445+ * The output gifs are uncompressed, so have no UNISYS patent issues.
446+ (closes: #24330, #24291).
447+ * Standards-Version is now 3.0.0.
448+
449+ -- Jordi Mallach <jordi@debian.org> Sat, 24 Feb 2001 22:17:38 +0100
450+
451+libjpeg6b (6b-1.2) frozen unstable; urgency=low (HIGH for m68k)
452+
453+ * Non-maintainer release.
454+ * Recompile for m68k since existing djpeg binary claims all jpegs I have
455+ are invalid (yet hamm djpeg has no problem with them).
456+ Specifically, added "-O2 -g -Wall" to CFLAGS -- possible gcc bug?
457+
458+ -- Chris Lawrence <lawrencc@debian.org> Tue, 10 Nov 1998 20:57:38 -0600
459+
460+libjpeg6b (6b-1.1) frozen unstable; urgency=high
461+
462+ * Non-maintainer release.
463+ * Use upstream library soname (62).
464+ * Removed libjpeg-gif package, as the source notes
465+ that the GIF reading has been removed, and the GIFs written
466+ do not infringe on the LZW patent.
467+
468+ -- Joel Klecker <espy@debian.org> Thu, 22 Oct 1998 05:49:48 -0700
469+
470+libjpeg6b (6b-1) unstable; urgency=low
471+
472+ * New binary packages for 6b
473+ * New upstream release
474+
475+ -- Mark Mickan <mmickan@debian.org> Tue, 7 Jul 1998 22:27:10 +0930
476+
477+Local variables:
478+mode: debian-changelog
479+End:
480--- libjpeg7-7.orig/debian/libjpeg-progs.files
481+++ libjpeg7-7/debian/libjpeg-progs.files
482@@ -0,0 +1,2 @@
483+usr/bin
484+usr/share/man/man1
485--- libjpeg7-7.orig/debian/libjpeg7-dev.docs
486+++ libjpeg7-7/debian/libjpeg7-dev.docs
487@@ -0,0 +1,3 @@
488+libjpeg.txt
489+structure.txt
490+coderules.txt
491--- libjpeg7-7.orig/debian/libjpeg-progs.docs
492+++ libjpeg7-7/debian/libjpeg-progs.docs
493@@ -0,0 +1,2 @@
494+usage.txt
495+wizard.txt
496--- libjpeg7-7.orig/debian/copyright
497+++ libjpeg7-7/debian/copyright
498@@ -0,0 +1,96 @@
499+This is Debian's prepackaged version of the `jpeg library' by the Independent
500+JPEG Group.
501+
502+This package was created by Mark Mickan <mmickan@debian.org> from sources
503+which can be found at ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
504+
505+It is partly based on the libjpeg6a package originally put together by
506+Andy Guy <awpguy@acs.ucalgary.ca> and later maintained by Mark Mickan.
507+
508+Current Debian maintainer is Bill Allombert <ballombe@debian.org>.
509+
510+LEGAL ISSUES [ from README supplied with source - MM ]
511+============
512+
513+In plain English:
514+
515+1. We don't promise that this software works. (But if you find any bugs,
516+ please let us know!)
517+2. You can use this software for whatever you want. You don't have to pay us.
518+3. You may not pretend that you wrote this software. If you use it in a
519+ program, you must acknowledge somewhere in your documentation that
520+ you've used the IJG code.
521+
522+In legalese:
523+
524+The authors make NO WARRANTY or representation, either express or implied,
525+with respect to this software, its quality, accuracy, merchantability, or
526+fitness for a particular purpose. This software is provided "AS IS", and you,
527+its user, assume the entire risk as to its quality and accuracy.
528+
529+This software is copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
530+All Rights Reserved except as specified below.
531+
532+Permission is hereby granted to use, copy, modify, and distribute this
533+software (or portions thereof) for any purpose, without fee, subject to these
534+conditions:
535+(1) If any part of the source code for this software is distributed, then this
536+README file must be included, with this copyright and no-warranty notice
537+unaltered; and any additions, deletions, or changes to the original files
538+must be clearly indicated in accompanying documentation.
539+(2) If only executable code is distributed, then the accompanying
540+documentation must state that "this software is based in part on the work of
541+the Independent JPEG Group".
542+(3) Permission for use of this software is granted only if the user accepts
543+full responsibility for any undesirable consequences; the authors accept
544+NO LIABILITY for damages of any kind.
545+
546+These conditions apply to any software derived from or based on the IJG code,
547+not just to the unmodified library. If you use our work, you ought to
548+acknowledge us.
549+
550+Permission is NOT granted for the use of any IJG author's name or company name
551+in advertising or publicity relating to this software or products derived from
552+it. This software may be referred to only as "the Independent JPEG Group's
553+software".
554+
555+We specifically permit and encourage the use of this software as the basis of
556+commercial products, provided that all warranty or liability claims are
557+assumed by the product vendor.
558+
559+
560+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
561+sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
562+ansi2knr.c is NOT covered by the above copyright and conditions, but instead
563+by the usual distribution terms of the Free Software Foundation; principally,
564+that you must include source code if you redistribute it. (See the file
565+ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
566+of any program generated from the IJG code, this does not limit you more than
567+the foregoing paragraphs do.
568+
569+The Unix configuration script "configure" was produced with GNU Autoconf.
570+It is copyright by the Free Software Foundation but is freely distributable.
571+The same holds for its supporting scripts (config.guess, config.sub,
572+ltconfig, ltmain.sh). Another support script, install-sh, is copyright
573+by M.I.T. but is also freely distributable.
574+
575+It appears that the arithmetic coding option of the JPEG spec is covered by
576+patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
577+legally be used without obtaining one or more licenses. For this reason,
578+support for arithmetic coding has been removed from the free JPEG software.
579+(Since arithmetic coding provides only a marginal gain over the unpatented
580+Huffman mode, it is unlikely that very many implementations will support it.)
581+So far as we are aware, there are no patent restrictions on the remaining
582+code.
583+
584+The IJG distribution formerly included code to read and write GIF files.
585+To avoid entanglement with the Unisys LZW patent, GIF reading support has
586+been removed altogether, and the GIF writer has been simplified to produce
587+"uncompressed GIFs". This technique does not use the LZW algorithm; the
588+resulting GIF files are larger than usual, but are readable by all standard
589+GIF decoders.
590+
591+We are required to state that
592+ "The Graphics Interchange Format(c) is the Copyright property of
593+ CompuServe Incorporated. GIF(sm) is a Service Mark property of
594+ CompuServe Incorporated."
595--- libjpeg7-7.orig/debian/extra/jpegexiforient.c
596+++ libjpeg7-7/debian/extra/jpegexiforient.c
597@@ -0,0 +1,299 @@
598+/*
599+ * jpegexiforient.c
600+ *
601+ * This is a utility program to get and set the Exif Orientation Tag.
602+ * It can be used together with jpegtran in scripts for automatic
603+ * orientation correction of digital camera pictures.
604+ *
605+ * The Exif orientation value gives the orientation of the camera
606+ * relative to the scene when the image was captured. The relation
607+ * of the '0th row' and '0th column' to visual position is shown as
608+ * below.
609+ *
610+ * Value | 0th Row | 0th Column
611+ * ------+-------------+-----------
612+ * 1 | top | left side
613+ * 2 | top | rigth side
614+ * 3 | bottom | rigth side
615+ * 4 | bottom | left side
616+ * 5 | left side | top
617+ * 6 | right side | top
618+ * 7 | right side | bottom
619+ * 8 | left side | bottom
620+ *
621+ * For convenience, here is what the letter F would look like if it were
622+ * tagged correctly and displayed by a program that ignores the orientation
623+ * tag:
624+ *
625+ * 1 2 3 4 5 6 7 8
626+ *
627+ * 888888 888888 88 88 8888888888 88 88 8888888888
628+ * 88 88 88 88 88 88 88 88 88 88 88 88
629+ * 8888 8888 8888 8888 88 8888888888 8888888888 88
630+ * 88 88 88 88
631+ * 88 88 888888 888888
632+ *
633+ */
634+
635+#include <stdio.h>
636+#include <stdlib.h>
637+
638+static FILE * myfile; /* My JPEG file */
639+
640+static unsigned char exif_data[65536L];
641+
642+/* Return next input byte, or EOF if no more */
643+#define NEXTBYTE() getc(myfile)
644+
645+/* Error exit handler */
646+#define ERREXIT(msg) (exit(0))
647+
648+/* Read one byte, testing for EOF */
649+static int
650+read_1_byte (void)
651+{
652+ int c;
653+
654+ c = NEXTBYTE();
655+ if (c == EOF)
656+ ERREXIT("Premature EOF in JPEG file");
657+ return c;
658+}
659+
660+/* Read 2 bytes, convert to unsigned int */
661+/* All 2-byte quantities in JPEG markers are MSB first */
662+static unsigned int
663+read_2_bytes (void)
664+{
665+ int c1, c2;
666+
667+ c1 = NEXTBYTE();
668+ if (c1 == EOF)
669+ ERREXIT("Premature EOF in JPEG file");
670+ c2 = NEXTBYTE();
671+ if (c2 == EOF)
672+ ERREXIT("Premature EOF in JPEG file");
673+ return (((unsigned int) c1) << 8) + ((unsigned int) c2);
674+}
675+
676+static const char * progname; /* program name for error messages */
677+
678+static void
679+usage (FILE *out)
680+/* complain about bad command line */
681+{
682+ fprintf(out, "jpegexiforient reads or writes the Exif Orientation Tag ");
683+ fprintf(out, "in a JPEG Exif file.\n");
684+
685+ fprintf(out, "Usage: %s [switches] jpegfile\n", progname);
686+
687+ fprintf(out, "Switches:\n");
688+ fprintf(out, " --help display this help and exit\n");
689+ fprintf(out, " --version output version information and exit\n");
690+ fprintf(out, " -n Do not output the trailing newline\n");
691+ fprintf(out, " -1 .. -8 Set orientation value 1 .. 8\n");
692+}
693+
694+/*
695+ * The main program.
696+ */
697+
698+int
699+main (int argc, char **argv)
700+{
701+ int n_flag, set_flag;
702+ unsigned int length, i;
703+ int is_motorola; /* Flag for byte order */
704+ unsigned int offset, number_of_tags, tagnum;
705+
706+ progname = argv[0];
707+ if (progname == NULL || progname[0] == 0)
708+ progname = "jpegexiforient"; /* in case C library doesn't provide it */
709+
710+ if (argc < 2) { usage(stderr); return 1; }
711+
712+ n_flag = 0; set_flag = 0;
713+
714+ i = 1;
715+ while (argv[i][0] == '-') {
716+ switch (argv[i][1]) {
717+ case '-':
718+ switch (argv[i][2]) {
719+ case 'h': usage(stdout); return 0;
720+ case 'v': fprintf(stdout,"jpegexiforient\n"); return 0;
721+ }
722+ case 'n':
723+ n_flag = 1;
724+ break;
725+ case '1':
726+ case '2':
727+ case '3':
728+ case '4':
729+ case '5':
730+ case '6':
731+ case '7':
732+ case '8':
733+ set_flag = argv[i][1] - '0';
734+ break;
735+ default:
736+ usage(stderr); return 1;
737+ }
738+ if (++i >= argc) { usage(stderr); return 1; }
739+ }
740+
741+ if (set_flag) {
742+ if ((myfile = fopen(argv[i], "rb+")) == NULL) {
743+ fprintf(stderr, "%s: can't open %s\n", progname, argv[i]);
744+ return 0;
745+ }
746+ } else {
747+ if ((myfile = fopen(argv[i], "rb")) == NULL) {
748+ fprintf(stderr, "%s: can't open %s\n", progname, argv[i]);
749+ return 0;
750+ }
751+ }
752+
753+ /* Read File head, check for JPEG SOI + Exif APP1 */
754+ for (i = 0; i < 4; i++)
755+ exif_data[i] = (unsigned char) read_1_byte();
756+ if (exif_data[0] != 0xFF ||
757+ exif_data[1] != 0xD8 ||
758+ exif_data[2] != 0xFF ||
759+ exif_data[3] != 0xE1)
760+ return 0;
761+
762+ /* Get the marker parameter length count */
763+ length = read_2_bytes();
764+ /* Length includes itself, so must be at least 2 */
765+ /* Following Exif data length must be at least 6 */
766+ if (length < 8)
767+ return 0;
768+ length -= 8;
769+ /* Read Exif head, check for "Exif" */
770+ for (i = 0; i < 6; i++)
771+ exif_data[i] = (unsigned char) read_1_byte();
772+ if (exif_data[0] != 0x45 ||
773+ exif_data[1] != 0x78 ||
774+ exif_data[2] != 0x69 ||
775+ exif_data[3] != 0x66 ||
776+ exif_data[4] != 0 ||
777+ exif_data[5] != 0)
778+ return 0;
779+ /* Read Exif body */
780+ for (i = 0; i < length; i++)
781+ exif_data[i] = (unsigned char) read_1_byte();
782+
783+ if (length < 12) return 0; /* Length of an IFD entry */
784+
785+ /* Discover byte order */
786+ if (exif_data[0] == 0x49 && exif_data[1] == 0x49)
787+ is_motorola = 0;
788+ else if (exif_data[0] == 0x4D && exif_data[1] == 0x4D)
789+ is_motorola = 1;
790+ else
791+ return 0;
792+
793+ /* Check Tag Mark */
794+ if (is_motorola) {
795+ if (exif_data[2] != 0) return 0;
796+ if (exif_data[3] != 0x2A) return 0;
797+ } else {
798+ if (exif_data[3] != 0) return 0;
799+ if (exif_data[2] != 0x2A) return 0;
800+ }
801+
802+ /* Get first IFD offset (offset to IFD0) */
803+ if (is_motorola) {
804+ if (exif_data[4] != 0) return 0;
805+ if (exif_data[5] != 0) return 0;
806+ offset = exif_data[6];
807+ offset <<= 8;
808+ offset += exif_data[7];
809+ } else {
810+ if (exif_data[7] != 0) return 0;
811+ if (exif_data[6] != 0) return 0;
812+ offset = exif_data[5];
813+ offset <<= 8;
814+ offset += exif_data[4];
815+ }
816+ if (offset > length - 2) return 0; /* check end of data segment */
817+
818+ /* Get the number of directory entries contained in this IFD */
819+ if (is_motorola) {
820+ number_of_tags = exif_data[offset];
821+ number_of_tags <<= 8;
822+ number_of_tags += exif_data[offset+1];
823+ } else {
824+ number_of_tags = exif_data[offset+1];
825+ number_of_tags <<= 8;
826+ number_of_tags += exif_data[offset];
827+ }
828+ if (number_of_tags == 0) return 0;
829+ offset += 2;
830+
831+ /* Search for Orientation Tag in IFD0 */
832+ for (;;) {
833+ if (offset > length - 12) return 0; /* check end of data segment */
834+ /* Get Tag number */
835+ if (is_motorola) {
836+ tagnum = exif_data[offset];
837+ tagnum <<= 8;
838+ tagnum += exif_data[offset+1];
839+ } else {
840+ tagnum = exif_data[offset+1];
841+ tagnum <<= 8;
842+ tagnum += exif_data[offset];
843+ }
844+ if (tagnum == 0x0112) break; /* found Orientation Tag */
845+ if (--number_of_tags == 0) return 0;
846+ offset += 12;
847+ }
848+
849+ if (set_flag) {
850+ /* Set the Orientation value */
851+ if (is_motorola) {
852+ exif_data[offset+2] = 0; /* Format = unsigned short (2 octets) */
853+ exif_data[offset+3] = 3;
854+ exif_data[offset+4] = 0; /* Number Of Components = 1 */
855+ exif_data[offset+5] = 0;
856+ exif_data[offset+6] = 0;
857+ exif_data[offset+7] = 1;
858+ exif_data[offset+8] = 0;
859+ exif_data[offset+9] = (unsigned char)set_flag;
860+ exif_data[offset+10] = 0;
861+ exif_data[offset+11] = 0;
862+ } else {
863+ exif_data[offset+2] = 3; /* Format = unsigned short (2 octets) */
864+ exif_data[offset+3] = 0;
865+ exif_data[offset+4] = 1; /* Number Of Components = 1 */
866+ exif_data[offset+5] = 0;
867+ exif_data[offset+6] = 0;
868+ exif_data[offset+7] = 0;
869+ exif_data[offset+8] = (unsigned char)set_flag;
870+ exif_data[offset+9] = 0;
871+ exif_data[offset+10] = 0;
872+ exif_data[offset+11] = 0;
873+ }
874+ fseek(myfile, (4 + 2 + 6 + 2) + offset, SEEK_SET);
875+ fwrite(exif_data + 2 + offset, 1, 10, myfile);
876+ } else {
877+ /* Get the Orientation value */
878+ if (is_motorola) {
879+ if (exif_data[offset+8] != 0) return 0;
880+ set_flag = exif_data[offset+9];
881+ } else {
882+ if (exif_data[offset+9] != 0) return 0;
883+ set_flag = exif_data[offset+8];
884+ }
885+ if (set_flag > 8) return 0;
886+ }
887+
888+ /* Write out Orientation value */
889+ if (n_flag)
890+ printf("%c", '0' + set_flag);
891+ else
892+ printf("%c\n", '0' + set_flag);
893+
894+ /* All done. */
895+ return 0;
896+}
897--- libjpeg7-7.orig/debian/extra/exifautotran.1
898+++ libjpeg7-7/debian/extra/exifautotran.1
899@@ -0,0 +1,13 @@
900+.TH EXIFAUTOTRAN "1" "February 2005" "exifautotran" "User Commands"
901+.SH NAME
902+exifautotran \- Transforms Exif files so that Orientation becomes 1
903+.SH DESCRIPTION
904+exifautotran [list of files]
905+.PP
906+Take a list of files as input and transform them in place so that the
907+Orientation becomes 1.
908+.SH "AUTHOR"
909+ Guido Vollbeding <guido@jpegclub.org>
910+.SH "SEE ALSO"
911+.BR jpegtran(1)
912+.BR jpegexiforient(1)
913--- libjpeg7-7.orig/debian/extra/jpegexiforient.1
914+++ libjpeg7-7/debian/extra/jpegexiforient.1
915@@ -0,0 +1,73 @@
916+.TH JPEGEXIFORIENT "1" "February 2005" "jpegexiforient" "User Commands"
917+.SH NAME
918+jpegexiforient \- reads or writes the Exif Orientation Tag
919+.SH SYNOPSIS
920+.B jpegexiforient
921+[\fIswitches\fR] \fIjpegfile\fR
922+.SH DESCRIPTION
923+.
924+This is a utility program to get and set the Exif Orientation Tag.
925+It can be used together with jpegtran in scripts for automatic
926+orientation correction of digital camera pictures.
927+.PP
928+The Exif orientation value gives the orientation of the camera
929+relative to the scene when the image was captured. The relation
930+of the '0th row' and '0th column' to visual position is shown as
931+below.
932+.IP
933+.nf
934+.ft CR
935+Value | 0th Row | 0th Column
936+------+-------------+-----------
937+ 1 | top | left side
938+ 2 | top | rigth side
939+ 3 | bottom | rigth side
940+ 4 | bottom | left side
941+ 5 | left side | top
942+ 6 | right side | top
943+ 7 | right side | bottom
944+ 8 | left side | bottom
945+.fi
946+.PP
947+For convenience, here is what the letter F would look like if it were
948+tagged correctly and displayed by a program that ignores the orientation
949+tag:
950+.IP
951+.nf
952+.ft CB
953+ 1 2 3 4
954+
955+888888 888888 88 88
956+88 88 88 88
957+8888 8888 8888 8888
958+88 88 88 88
959+88 88 888888 888888
960+
961+ 5 6 7 8
962+
963+8888888888 88 88 8888888888
964+88 88 88 88 88 88 88 88
965+88 8888888888 8888888888 88
966+.fi
967+.PP
968+jpegexiforient output the Exif Orientation Tag in a JPEG Exif file.
969+With the options -1 .. -8, it can also be used to set the tag.
970+.
971+.SS "OPTIONS"
972+.TP
973+\fB\-\-help\fR
974+display this help and exit
975+.TP
976+\fB\-\-version\fR
977+output version information and exit
978+.TP
979+\fB\-n\fR
980+Do not output the trailing newline
981+.TP
982+\fB\-1\fR .. \fB\-8\fR
983+Set orientation value 1 .. 8
984+.SH "AUTHOR"
985+ Guido Vollbeding <guido@jpegclub.org>
986+.SH "SEE ALSO"
987+.BR jpegtran(1)
988+.BR exifautotran(1)
989--- libjpeg7-7.orig/debian/extra/exifautotran
990+++ libjpeg7-7/debian/extra/exifautotran
991@@ -0,0 +1,50 @@
992+#!/bin/sh
993+# exifautotran [list of files]
994+#
995+# Transforms Exif files so that Orientation becomes 1
996+#
997+
998+trap "if test -n \"\$tempfile\"; then rm -f \"\$tempfile\"; fi" INT QUIT TERM
999+
1000+for i
1001+do
1002+ case $i in
1003+ -v|--version) echo "exifautotran"; exit 0;;
1004+ -h|--help)
1005+ cat <<EOF
1006+exifautotran [list of files]
1007+
1008+Transforms Exif files so that Orientation becomes 1
1009+EOF
1010+ exit 0;;
1011+ esac
1012+
1013+ case `jpegexiforient -n "$i"` in
1014+ 1) transform="";;
1015+ 2) transform="-flip horizontal";;
1016+ 3) transform="-rotate 180";;
1017+ 4) transform="-flip vertical";;
1018+ 5) transform="-transpose";;
1019+ 6) transform="-rotate 90";;
1020+ 7) transform="-transverse";;
1021+ 8) transform="-rotate 270";;
1022+ *) transform="";;
1023+ esac
1024+ if test -n "$transform"; then
1025+ tempfile=`mktemp`;
1026+ if test "$?" -ne "0"; then
1027+ echo "Failed to create temporary file" >&2
1028+ exit 1;
1029+ fi
1030+ echo Executing: jpegtran -copy all $transform $i >&2
1031+ jpegtran -copy all $transform "$i" > $tempfile
1032+ if test $? -ne 0; then
1033+ echo Error while transforming $i - skipped. >&2
1034+ rm "$tempfile"
1035+ else
1036+ cp "$tempfile" "$i"
1037+ rm "$tempfile"
1038+ jpegexiforient -1 "$i" > /dev/null
1039+ fi
1040+ fi
1041+done
1042--- libjpeg7-7.orig/debian/extra/Makefile
1043+++ libjpeg7-7/debian/extra/Makefile
1044@@ -0,0 +1,22 @@
1045+CFLAGS = -O2 -Wall -g
1046+CC = cc
1047+INSTALL = install -m755 -o root -g root
1048+INSTALLDIR = install -m755 -o root -g root -d
1049+DESTDIR =
1050+prefix = /usr/local
1051+bindir = $(prefix)/bin
1052+mandir = $(prefix)/share/man/man1
1053+
1054+all: jpegexiforient
1055+
1056+jpegexiforient: jpegexiforient.c
1057+ $(CC) $(CFLAGS) -o jpegexiforient jpegexiforient.c
1058+clean:
1059+ -rm -f jpegexiforient
1060+install:
1061+ $(INSTALLDIR) $(DESTDIR)$(bindir)
1062+ $(INSTALLDIR) $(DESTDIR)$(mandir)
1063+ $(INSTALL) jpegexiforient $(DESTDIR)$(bindir)
1064+ $(INSTALL) jpegexiforient.1 $(DESTDIR)$(mandir)
1065+ $(INSTALL) exifautotran $(DESTDIR)$(bindir)
1066+ $(INSTALL) exifautotran.1 $(DESTDIR)$(mandir)
diff --git a/meta/packages/jpeg/jpeg_6b.bb b/meta/packages/jpeg/jpeg_8b.bb
index 87293676de..53847e715a 100644
--- a/meta/packages/jpeg/jpeg_6b.bb
+++ b/meta/packages/jpeg/jpeg_8b.bb
@@ -3,6 +3,9 @@ HOMEPAGE = "http://www.ijg.org/"
3BUGTRACKER = "" 3BUGTRACKER = ""
4 4
5LICENSE ="jpeg" 5LICENSE ="jpeg"
6LIC_FILES_CHKSUM = "file://cdjpeg.h;endline=12;md5=78fa8dbac547bb5b2a0e6457a6cfe21d \
7 file://jpeglib.h;endline=14;md5=dd06b5575519f735ec2565ed36ce62e7 \
8 file://djpeg.c;endline=13;md5=ca89254925da06fef47e4b6468233432"
6 9
7SECTION = "libs" 10SECTION = "libs"
8PRIORITY = "required" 11PRIORITY = "required"
@@ -10,13 +13,10 @@ PRIORITY = "required"
10DEPENDS = "libtool-cross" 13DEPENDS = "libtool-cross"
11DEPENDS_virtclass-native = "libtool-native" 14DEPENDS_virtclass-native = "libtool-native"
12 15
13PR = "r9" 16PR = "r0"
14 17
15SRC_URI = "http://www.ijg.org/files/jpegsrc.v${PV}.tar.gz \ 18SRC_URI = "http://www.ijg.org/files/jpegsrc.v${PV}.tar.gz \
16 file://debian.patch;patch=1 \ 19 file://debian-libjpeg7_7-1.diff;patch=1"
17 file://ldflags.patch;patch=1 \
18 file://paths.patch;patch=1 \
19 file://libtool_tweak.patch;patch=1"
20 20
21inherit autotools 21inherit autotools
22 22