xref: /plan9/sys/src/cmd/gs/src/sjpeg.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: sjpeg.h,v 1.5 2002/06/16 05:00:54 lpd Exp $ */
18 /* IJG entry point wrappers */
19 /* Requires sdct.h, jpeg/jpeglib.h */
20 
21 #ifndef sjpeg_INCLUDED
22 #  define sjpeg_INCLUDED
23 
24 /*
25  * Each routine gs_jpeg_xxx is equivalent to the IJG entry point jpeg_xxx,
26  * except that
27  *   (a) it takes a pointer to stream_DCT_state instead of just the IJG
28  *       jpeg_(de)compress_data struct;
29  *   (b) it catches any error exit from the IJG code and converts it into
30  *       an error return value per Ghostscript custom.  A negative return
31  *       value is an error code, except for gs_jpeg_alloc_xxx which return
32  *       NULL (indicating e_VMerror).
33  */
34 
35 /* Common to encode/decode */
36 
37 void gs_jpeg_error_setup(stream_DCT_state * st);
38 int gs_jpeg_log_error(stream_DCT_state * st);
39 JQUANT_TBL *gs_jpeg_alloc_quant_table(stream_DCT_state * st);
40 JHUFF_TBL *gs_jpeg_alloc_huff_table(stream_DCT_state * st);
41 int gs_jpeg_destroy(stream_DCT_state * st);
42 
43 /* Encode */
44 
45 int gs_jpeg_create_compress(stream_DCT_state * st);
46 int gs_jpeg_set_defaults(stream_DCT_state * st);
47 int gs_jpeg_set_colorspace(stream_DCT_state * st,
48 			   J_COLOR_SPACE colorspace);
49 int gs_jpeg_set_linear_quality(stream_DCT_state * st,
50 			       int scale_factor, boolean force_baseline);
51 int gs_jpeg_set_quality(stream_DCT_state * st,
52 			int quality, boolean force_baseline);
53 int gs_jpeg_start_compress(stream_DCT_state * st,
54 			   boolean write_all_tables);
55 int gs_jpeg_write_scanlines(stream_DCT_state * st,
56 			    JSAMPARRAY scanlines, int num_lines);
57 int gs_jpeg_finish_compress(stream_DCT_state * st);
58 
59 /* Decode */
60 
61 int gs_jpeg_create_decompress(stream_DCT_state * st);
62 int gs_jpeg_read_header(stream_DCT_state * st,
63 			boolean require_image);
64 int gs_jpeg_start_decompress(stream_DCT_state * st);
65 int gs_jpeg_read_scanlines(stream_DCT_state * st,
66 			   JSAMPARRAY scanlines, int max_lines);
67 int gs_jpeg_finish_decompress(stream_DCT_state * st);
68 
69 #endif /* sjpeg_INCLUDED */
70