]> Creatis software - gdcm.git/blob - src/gdcmJpeg.cxx
ENH: A few minor cosmetic cleanups, mostly some const correctness on gdcmDict* classe...
[gdcm.git] / src / gdcmJpeg.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmJpeg.cxx,v $
5   Language:  C++
6   Date:      $Date: 2004/10/18 02:17:07 $
7   Version:   $Revision: 1.27 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 #include "gdcmFile.h"
19
20 /*
21 DICOM provides a mechanism for supporting the use of JPEG Image Compression 
22 through the Encapsulated Format (see PS 3.3 of the DICOM Standard). 
23 Annex A defines a number of Transfer Syntaxes which reference 
24 the JPEG Standard and provide a number of lossless (bit preserving) 
25 and lossy compression schemes.
26 In order to facilitate interoperability of implementations conforming 
27 to the DICOM Standard which elect to use one or more 
28 of the Transfer Syntaxes for JPEG Image Compression, the following policy is specified:
29
30   Any implementation which conforms to the DICOM Standard and has elected 
31   to support any one of the Transfer Syntaxes for lossless JPEG Image Compression, 
32   shall support the following lossless compression: 
33   The subset (first-order horizontal prediction [Selection Value 1) of JPEG Process 14 
34   (DPCM, non-hierarchical with Huffman coding) (see Annex F of the DICOM Standard).
35
36    Any implementation which conforms to the DICOM Standard and has elected 
37    to support any one of the Transfer Syntaxes for 8-bit lossy JPEG Image Compression, 
38    shall support the JPEG Baseline Compression (coding Process 1).
39
40    Any implementation which conforms to the DICOM Standard and has elected 
41    to support any one of the Transfer Syntaxes for 12-bit lossy JPEG Image Compression, 
42    shall support the JPEG Compression Process 4.
43
44 Note: The DICOM conformance statement shall differentiate between implementations 
45 that can simply receive JPEG encoded images and those that can receive and process 
46 JPEG encoded images (see PS 3.2 of the DICOM Standard).
47
48 The use of the DICOM Encapsulated Format to support JPEG Compressed Pixel Data 
49 implies that the Data Elements which are related to the Native Format Pixel Data encoding
50 (e.g. Bits Allocated, Bits Stored, High Bit, Pixel Representation, Rows, Columns, etc.) 
51 shall contain values which are consistent with the characteristics 
52 of the uncompressed pixel data from which the compressed Data Stream was derived. 
53 The Pixel Data characteristics included in the JPEG Interchange Format 
54 shall be used to decode the compressed data stream.
55
56 Run Length Encoding Compression
57
58 DICOM provides a mechanism for supporting the use of Run Length Encoding (RLE) 
59 Compression which is a byte oriented lossless compression scheme through 
60 the encapsulated Format (see PS 3.3 of this Standard). 
61 Annex G of the DICOM Standard defines RLE Compression and its Transfer Syntax.
62
63 Note: The RLE Compression algorithm described in Annex G 
64 of the DICOM Standard is the compression used in 
65 the TIFF 6.0 specification known as the "PackBits" scheme.
66
67 The use of the DICOM Encapsulated Format to support RLE Compressed Pixel Data 
68 implies that the Data Elements which are related to the Native Format Pixel Data encoding (
69 e.g. Bits Allocated, Bits Stored, High Bit, Pixel Representation, Rows, Columns, etc.) 
70 shall contain values which are consistent with the characteristics 
71 of the uncompressed pixel data from which the compressed data is derived
72 */
73
74 /*
75  * <setjmp.h> is used for the optional error recovery mechanism shown in
76  * the second part of the example.
77  */
78
79 /*
80  * Include file for users of JPEG library.
81  * You will need to have included system headers that define at least
82  * the typedefs FILE and size_t before you can include jpeglib.h.
83  * (stdio.h is sufficient on ANSI-conforming systems.)
84  * You may also wish to include "jerror.h".
85  */
86
87 #include <setjmp.h>
88
89 namespace gdcm 
90 {
91
92 /******************** JPEG COMPRESSION SAMPLE INTERFACE *******************/
93
94 /* This half of the example shows how to feed data into the JPEG compressor.
95  * We present a minimal version that does not worry about refinements such
96  * as error recovery (the JPEG code will just exit() if it gets an error).
97  */
98
99 /*
100  * IMAGE DATA FORMATS:
101  *
102  * The standard input image format is a rectangular array of pixels, with
103  * each pixel having the same number of "component" values (color channels).
104  * Each pixel row is an array of JSAMPLEs (which typically are unsigned chars).
105  * If you are working with color data, then the color values for each pixel
106  * must be adjacent in the row; for example, R,G,B,R,G,B,R,G,B,... for 24-bit
107  * RGB color.
108  *
109  * For this example, we'll assume that this data structure matches the way
110  * our application has stored the image in memory, so we can just pass a
111  * pointer to our image buffer.  In particular, let's say that the image is
112  * RGB color and is described by:
113  */
114
115
116 //extern JSAMPLE * image_buffer; /* Points to large array of R,G,B-order data */
117 //extern int image_height;       /* Number of rows in image */
118 //extern int image_width;        /* Number of columns in image */
119
120
121
122 /*
123  * Sample routine for JPEG compression.  We assume that the target file name
124  * and a compression quality factor are passed in.
125  */
126
127  /**
128  * \ingroup File
129  * \brief   routine for JPEG decompression 
130  * @param fp pointer to an already open file descriptor 
131  *                      8 significant bits per pixel
132  * @param im_buf Points to array (of R,G,B-order) data to compress
133  * @param quality compression quality
134  * @param image_height Number of rows in image 
135  * @param image_width Number of columns in image
136  * @return 1 on success, 0 on error
137  */
138  
139 bool gdcm_write_JPEG_file (FILE* fp, void*  im_buf, 
140                            int image_width, int image_height, int quality)
141 {
142
143    JSAMPLE* image_buffer = (JSAMPLE*) im_buf;
144
145   /* This struct contains the JPEG compression parameters and pointers to
146    * working space (which is allocated as needed by the JPEG library).
147    * It is possible to have several such structures, representing multiple
148    * compression/decompression processes, in existence at once.  We refer
149    * to any one struct (and its associated working data) as a "JPEG object".
150    */
151   struct jpeg_compress_struct cinfo;
152   /* This struct represents a JPEG error handler.  It is declared separately
153    * because applications often want to supply a specialized error handler
154    * (see the second half of this file for an example).  But here we just
155    * take the easy way out and use the standard error handler, which will
156    * print a message on stderr and call exit() if compression fails.
157    * Note that this struct must live as long as the main JPEG parameter
158    * struct, to avoid dangling-pointer problems.
159    */
160   struct jpeg_error_mgr jerr;
161   /* More stuff */
162   //FILE*  outfile;    /* target FILE* /
163   JSAMPROW row_pointer[1];   /* pointer to JSAMPLE row[s] */
164   int row_stride;            /* physical row width in image buffer */
165
166   /* Step 1: allocate and initialize JPEG compression object */
167
168   /* We have to set up the error handler first, in case the initialization
169    * step fails.  (Unlikely, but it could happen if you are out of memory.)
170    * This routine fills in the contents of struct jerr, and returns jerr's
171    * address which we place into the link field in cinfo.
172    */
173   cinfo.err = jpeg_std_error(&jerr);
174   /* Now we can initialize the JPEG compression object. */
175   jpeg_create_compress(&cinfo);
176
177   /* Step 2: specify data destination (eg, a file) */
178   /* Note: steps 2 and 3 can be done in either order. */
179
180   /* Here we use the library-supplied code to send compressed data to a
181    * stdio stream.  You can also write your own code to do something else.
182    * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
183    * requires it in order to write binary files.
184    */
185  // if ((outfile = fopen(filename, "wb")) == NULL) {
186  //   fprintf(stderr, "can't open %s\n", filename);
187  //   exit(1);
188  //
189  // }
190   jpeg_stdio_dest(&cinfo, fp);
191
192   /* Step 3: set parameters for compression */
193
194   /* First we supply a description of the input image.
195    * Four fields of the cinfo struct must be filled in:
196    */
197   cinfo.image_width = image_width;/* image width and height, in pixels */
198   cinfo.image_height = image_height;
199   cinfo.input_components = 3;     /* # of color components per pixel */
200   cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
201   /* Now use the library's routine to set default compression parameters.
202    * (You must set at least cinfo.in_color_space before calling this,
203    * since the defaults depend on the source color space.)
204    */
205   jpeg_set_defaults(&cinfo);
206   /* Now you can set any non-default parameters you wish to.
207    * Here we just illustrate the use of quality (quantization table) scaling:
208    */
209   jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
210
211   /* Step 4: Start compressor */
212
213   /* TRUE ensures that we will write a complete interchange-JPEG file.
214    * Pass TRUE unless you are very sure of what you're doing.
215    */
216   jpeg_start_compress(&cinfo, TRUE);
217
218   /* Step 5: while (scan lines remain to be written) */
219   /*           jpeg_write_scanlines(...); */
220
221   /* Here we use the library's state variable cinfo.next_scanline as the
222    * loop counter, so that we don't have to keep track ourselves.
223    * To keep things simple, we pass one scanline per call; you can pass
224    * more if you wish, though.
225    */
226   row_stride = image_width * 3;/* JSAMPLEs per row in image_buffer */
227
228   while (cinfo.next_scanline < cinfo.image_height) {
229     /* jpeg_write_scanlines expects an array of pointers to scanlines.
230      * Here the array is only one element long, but you could pass
231      * more than one scanline at a time if that's more convenient.
232      */
233     row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
234
235     (void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
236   }
237
238   /* Step 6: Finish compression */
239
240   jpeg_finish_compress(&cinfo);
241   
242   /* After finish_compress, we can close the output file. */
243   
244  // fclose(fp); --> the caller will close (multiframe treatement)
245
246   /* Step 7: release JPEG compression object */
247
248   /* This is an important step since it will release a good deal of memory. */
249   jpeg_destroy_compress(&cinfo);
250
251   /* And we're done! */
252
253   return true; //???
254 }
255
256
257
258 /*
259  * SOME FINE POINTS:
260  *
261  * In the above loop, we ignored the return value of jpeg_write_scanlines,
262  * which is the number of scanlines actually written.  We could get away
263  * with this because we were only relying on the value of cinfo.next_scanline,
264  * which will be incremented correctly.  If you maintain additional loop
265  * variables then you should be careful to increment them properly.
266  * Actually, for output to a stdio stream you needn't worry, because
267  * then jpeg_write_scanlines will write all the lines passed (or else exit
268  * with a fatal error).  Partial writes can only occur if you use a data
269  * destination module that can demand suspension of the compressor.
270  * (If you don't know what that's for, you don't need it.)
271  *
272  * If the compressor requires full-image buffers (for entropy-coding
273  * optimization or a multi-scan JPEG file), it will create temporary
274  * files for anything that doesn't fit within the maximum-memory setting.
275  * (Note that temp files are NOT needed if you use the default parameters.)
276  * On some systems you may need to set up a signal handler to ensure that
277  * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
278  *
279  * Scanlines MUST be supplied in top-to-bottom order if you want your JPEG
280  * files to be compatible with everyone else's.  If you cannot readily read
281  * your data in that order, you'll need an intermediate array to hold the
282  * image.  See rdtarga.c or rdbmp.c for examples of handling bottom-to-top
283  * source data using the JPEG code's internal virtual-array mechanisms.
284  */
285
286
287
288 /******************** JPEG DECOMPRESSION SAMPLE INTERFACE *******************/
289
290 /* This half of the example shows how to read data from the JPEG decompressor.
291  * It's a bit more refined than the above, in that we show:
292  *   (a) how to modify the JPEG library's standard error-reporting behavior;
293  *   (b) how to allocate workspace using the library's memory manager.
294  *
295  * Just to make this example a little different from the first one, we'll
296  * assume that we do not intend to put the whole image into an in-memory
297  * buffer, but to send it line-by-line someplace else.  We need a one-
298  * scanline-high JSAMPLE array as a work buffer, and we will let the JPEG
299  * memory manager allocate it for us.  This approach is actually quite useful
300  * because we don't need to remember to deallocate the buffer separately: it
301  * will go away automatically when the JPEG object is cleaned up.
302  */
303
304 /*
305  * ERROR HANDLING:
306  *
307  * The JPEG library's standard error handler (jerror.c) is divided into
308  * several "methods" which you can override individually.  This lets you
309  * adjust the behavior without duplicating a lot of code, which you might
310  * have to update with each future release.
311  *
312  * Our example here shows how to override the "error_exit" method so that
313  * control is returned to the library's caller when a fatal error occurs,
314  * rather than calling exit() as the standard error_exit method does.
315  *
316  * We use C's setjmp/longjmp facility to return control.  This means that the
317  * routine which calls the JPEG library must first execute a setjmp() call to
318  * establish the return point.  We want the replacement error_exit to do a
319  * longjmp().  But we need to make the setjmp buffer accessible to the
320  * error_exit routine.  To do this, we make a private extension of the
321  * standard JPEG error handler object.  (If we were using C++, we'd say we
322  * were making a subclass of the regular error handler.)
323  *
324  * Here's the extended error handler struct:
325  */
326
327 //-----------------------------------------------------------------------------
328 struct my_error_mgr {
329    struct jpeg_error_mgr pub; /* "public" fields */
330    jmp_buf setjmp_buffer;     /* for return to caller */
331 };
332
333 //-----------------------------------------------------------------------------
334 typedef struct my_error_mgr* my_error_ptr;
335
336 /*
337  * Here's the routine that will replace the standard error_exit method:
338  */
339 METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
340    /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
341    my_error_ptr myerr = (my_error_ptr) cinfo->err;
342
343    /* Always display the message. */
344    /* We could postpone this until after returning, if we chose. */
345    (*cinfo->err->output_message) (cinfo);
346
347    /* Return control to the setjmp point */
348    longjmp(myerr->setjmp_buffer, 1);
349 }
350
351 //-----------------------------------------------------------------------------
352 /*
353  * Sample routine for JPEG decompression.  We assume that the source file name
354  * is passed in.  We want to return 1 on success, 0 on error.
355  */
356  
357  /**
358  * \brief   routine for JPEG decompression 
359  * @param fp pointer to an already open file descriptor 
360  *                      8 significant bits per pixel
361  * @param image_buffer to receive uncompressed pixels
362  * @return 1 on success, 0 on error
363  */
364  
365 bool gdcm_read_JPEG_file ( FILE* fp, void* image_buffer )
366 {
367    char* pimage;
368
369    /* This struct contains the JPEG decompression parameters and pointers to
370     * working space (which is allocated as needed by the JPEG library).
371     */
372    struct jpeg_decompress_struct cinfo;
373
374    /* -------------- inside, we found :
375     * JDIMENSION image_width;       // input image width 
376     * JDIMENSION image_height;      // input image height 
377     * int input_components;         // nb of color components in input image 
378     * J_COLOR_SPACE in_color_space; // colorspace of input image 
379     * double input_gamma;           // image gamma of input image 
380     * -------------- */
381
382    /* We use our private extension JPEG error handler.
383     * Note that this struct must live as long as the main JPEG parameter
384     * struct, to avoid dangling-pointer problems.
385     */
386    struct my_error_mgr jerr;
387    /* More stuff */
388
389    JSAMPARRAY buffer;/* Output row buffer */
390   
391    // rappel :
392    // ------
393    // typedef unsigned char JSAMPLE;
394    // typedef JSAMPLE FAR *JSAMPROW;/* ptr to one image row of pixel samples. */
395    // typedef JSAMPROW *JSAMPARRAY;/* ptr to some rows (a 2-D sample array) */
396    // typedef JSAMPARRAY *JSAMPIMAGE;/* a 3-D sample array: top index is color */
397
398    int row_stride;/* physical row width in output buffer */
399   
400 #ifdef GDCM_JPG_DEBUG
401    printf("entree dans File::gdcm_read_JPEG_file (i.e. 8), depuis gdcmJpeg\n");
402 #endif //GDCM_JPG_DEBUG
403
404    /* In this example we want to open the input file before doing anything else,
405     * so that the setjmp() error recovery below can assume the file is open.
406     * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
407     * requires it in order to read binary files.
408     */
409     
410   /* Step 1: allocate and initialize JPEG decompression object */  
411 #ifdef GDCM_JPG_DEBUG
412   printf("Entree Step 1\n");
413 #endif //GDCM_JPG_DEBUG
414   
415   /* We set up the normal JPEG error routines, then override error_exit. */
416   
417   cinfo.err = jpeg_std_error(&jerr.pub);
418   jerr.pub.error_exit = my_error_exit;
419   
420   /* Establish the setjmp return context for my_error_exit to use. */  
421   if (setjmp(jerr.setjmp_buffer))
422   {
423     /* If we get here, the JPEG code has signaled an error.
424      * We need to clean up the JPEG object, close the input file, and return.
425      */
426     jpeg_destroy_decompress(&cinfo);
427     return 0;
428   }
429   /* Now we can initialize the JPEG decompression object. */
430   jpeg_create_decompress(&cinfo);
431
432    /* Step 2: specify data source (eg, a file) */
433 #ifdef GDCM_JPG_DEBUG
434   printf("Entree Step 2\n");
435 #endif //GDCM_JPG_DEBUG
436
437    jpeg_stdio_src(&cinfo, fp);
438
439    /* Step 3: read file parameters with jpeg_read_header() */
440 #ifdef GDCM_JPG_DEBUG
441   printf("Entree Step 3\n");
442 #endif //GDCM_JPG_DEBUG
443
444    (void) jpeg_read_header(&cinfo, TRUE);
445    
446    /* We can ignore the return value from jpeg_read_header since
447     *   (a) suspension is not possible with the stdio data source, and
448     *   (b) we passed TRUE to reject a tables-only JPEG file as an error.
449     * See libjpeg.doc for more info.
450     */
451
452     // prevent the library from performing any color space conversion
453    if( cinfo.process == JPROC_LOSSLESS )
454    {
455       cinfo.jpeg_color_space = JCS_UNKNOWN;
456       cinfo.out_color_space = JCS_UNKNOWN;
457    }
458
459
460 #ifdef GDCM_JPG_DEBUG
461       printf("--------------Header contents :----------------\n");
462       printf("image_width %d image_height %d\n", 
463               cinfo.image_width , cinfo.image_height);
464       printf("bits of precision in image data  %d \n", 
465               cinfo.output_components);
466       printf("nb of color components returned  %d \n", 
467               cinfo.data_precision);
468 #endif //GDCM_JPG_DEBUG
469
470
471    /*
472     * JDIMENSION image_width;       // input image width 
473     * JDIMENSION image_height;      // input image height 
474     * int output_components;        // # of color components returned 
475     * J_COLOR_SPACE in_color_space; // colorspace of input image 
476     * double input_gamma;           // image gamma of input image
477     * int data_precision;           // bits of precision in image data 
478     */
479
480    /* Step 4: set parameters for decompression */
481 #ifdef GDCM_JPG_DEBUG
482   printf("Entree Step 4\n");
483 #endif //GDCM_JPG_DEBUG
484    /* In this example, we don't need to change any of the defaults set by
485     * jpeg_read_header(), so we do nothing here.
486     */
487
488    /* Step 5: Start decompressor */
489 #ifdef GDCM_JPG_DEBUG
490    printf("Entree Step 5\n");
491 #endif //GDCM_JPG_DEBUG
492
493    (void) jpeg_start_decompress(&cinfo);
494    /* We can ignore the return value since suspension is not possible
495     * with the stdio data source.
496     */
497
498    /* We may need to do some setup of our own at this point before reading
499     * the data.  After jpeg_start_decompress() we have the correct scaled
500     * output image dimensions available, as well as the output colormap
501     * if we asked for color quantization.
502     * In this example, we need to make an output work buffer of the right size.
503     */ 
504
505    /* JSAMPLEs per row in output buffer */
506    row_stride = cinfo.output_width * cinfo.output_components;
507   
508 #ifdef GDCM_JPG_DEBUG
509   printf ("cinfo.output_width %d cinfo.output_components %d  row_stride %d\n",
510                       cinfo.output_width, cinfo.output_components,row_stride);
511 #endif //GDCM_JPG_DEBUG
512
513    /* Make a one-row-high sample array that will go away when done with image */
514    buffer = (*cinfo.mem->alloc_sarray)
515             ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
516
517    /* Step 6: while (scan lines remain to be read) */
518 #ifdef GDCM_JPG_DEBUG
519     printf("Entree Step 6\n"); 
520 #endif //GDCM_JPG_DEBUG
521    /*           jpeg_read_scanlines(...); */
522
523    /* Here we use the library's state variable cinfo.output_scanline as the
524     * loop counter, so that we don't have to keep track ourselves.
525     */
526 #ifdef GDCM_JPG_DEBUG
527       printf ("cinfo.output_height %d  cinfo.output_width %d\n",
528                cinfo.output_height,cinfo.output_width);
529 #endif //GDCM_JPG_DEBUG
530    pimage=(char *)image_buffer;
531   
532    int bufsize = cinfo.output_width * cinfo.output_components;
533    size_t rowsize = bufsize * sizeof(JSAMPLE);
534
535    while (cinfo.output_scanline < cinfo.output_height) {
536       /* jpeg_read_scanlines expects an array of pointers to scanlines.
537        * Here the array is only one element long, but you could ask for
538        * more than one scanline at a time if that's more convenient.
539        */
540
541      //printf( "scanlines: %d\n",cinfo.output_scanline);
542       (void) jpeg_read_scanlines(&cinfo, buffer, 1);
543       memcpy( pimage, *buffer,rowsize); 
544       pimage+=rowsize;
545    }
546
547   /* Step 7: Finish decompression */
548 #ifdef GDCM_JPG_DEBUG
549    printf("Entree Step 7\n");
550 #endif //GDCM_JPG_DEBUG
551
552    (void) jpeg_finish_decompress(&cinfo);
553    
554    /* We can ignore the return value since suspension is not possible
555     * with the stdio data source.
556     */
557
558    /* Step 8: Release JPEG decompression object */
559
560 #ifdef GDCM_JPG_DEBUG
561   printf("Entree Step 8\n");
562 #endif //GDCM_JPG_DEBUG
563
564    /* This is an important step since it will release a good deal of memory. */
565
566    jpeg_destroy_decompress(&cinfo);
567
568    /* After finish_decompress, we can close the input file.
569     * Here we postpone it until after no more JPEG errors are possible,
570     * so as to simplify the setjmp error logic above.  (Actually, I don't
571     * think that jpeg_destroy can do an error exit, but why assume anything...)
572     */
573
574    /* At this point you may want to check to see whether any corrupt-data
575     * warnings occurred (test whether jerr.pub.num_warnings is nonzero).
576     */
577
578    /* And we're done! */
579
580    return true;
581 }
582
583
584 /*
585  * SOME FINE POINTS:
586  *
587  * In the above code, we ignored the return value of jpeg_read_scanlines,
588  * which is the number of scanlines actually read.  We could get away with
589  * this because we asked for only one line at a time and we weren't using
590  * a suspending data source.  See libjpeg.doc for more info.
591  *
592  * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress();
593  * we should have done it beforehand to ensure that the space would be
594  * counted against the JPEG max_memory setting.  In some systems the above
595  * code would risk an out-of-memory error.  However, in general we don't
596  * know the output image dimensions before jpeg_start_decompress(), unless we
597  * call jpeg_calc_output_dimensions().  See libjpeg.doc for more about this.
598  *
599  * Scanlines are returned in the same order as they appear in the JPEG file,
600  * which is standardly top-to-bottom.  If you must emit data bottom-to-top,
601  * you can use one of the virtual arrays provided by the JPEG memory manager
602  * to invert the data.  See wrbmp.c for an example.
603  *
604  * As with compression, some operating modes may require temporary files.
605  * On some systems you may need to set up a signal handler to ensure that
606  * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
607  */
608  
609 //----------------------------------------------------------------------------
610
611 } // end namespace gdcm