Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / compiler / libjpeg / test / cdjpeg.h
blob7191c6e187805f3bd31ba5b24af4c2f9c495b6e4
1 /*
2 $Id$
3 */
5 /*
6 * cdjpeg.h
8 * Copyright (C) 1994-1997, Thomas G. Lane.
9 * This file is part of the Independent JPEG Group's software.
10 * For conditions of distribution and use, see the accompanying README file.
12 * This file contains common declarations for the sample applications
13 * cjpeg and djpeg. It is NOT used by the core JPEG library.
16 #define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
17 #define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
18 #include "jinclude.h"
19 #include "jpeglib.h"
20 #include "jerror.h" /* get library error codes too */
21 #include "cderror.h" /* get application-specific error codes */
25 * Object interface for cjpeg's source file decoding modules
28 typedef struct cjpeg_source_struct * cjpeg_source_ptr;
30 struct cjpeg_source_struct {
31 JMETHOD(void, start_input, (j_compress_ptr cinfo,
32 cjpeg_source_ptr sinfo));
33 JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
34 cjpeg_source_ptr sinfo));
35 JMETHOD(void, finish_input, (j_compress_ptr cinfo,
36 cjpeg_source_ptr sinfo));
38 FILE *input_file;
40 JSAMPARRAY buffer;
41 JDIMENSION buffer_height;
46 * Object interface for djpeg's output file encoding modules
49 typedef struct djpeg_dest_struct * djpeg_dest_ptr;
51 struct djpeg_dest_struct {
52 /* start_output is called after jpeg_start_decompress finishes.
53 * The color map will be ready at this time, if one is needed.
55 JMETHOD(void, start_output, (j_decompress_ptr cinfo,
56 djpeg_dest_ptr dinfo));
57 /* Emit the specified number of pixel rows from the buffer. */
58 JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
59 djpeg_dest_ptr dinfo,
60 JDIMENSION rows_supplied));
61 /* Finish up at the end of the image. */
62 JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
63 djpeg_dest_ptr dinfo));
65 /* Target file spec; filled in by djpeg.c after object is created. */
66 FILE * output_file;
68 /* Output pixel-row buffer. Created by module init or start_output.
69 * Width is cinfo->output_width * cinfo->output_components;
70 * height is buffer_height.
72 JSAMPARRAY buffer;
73 JDIMENSION buffer_height;
78 * cjpeg/djpeg may need to perform extra passes to convert to or from
79 * the source/destination file format. The JPEG library does not know
80 * about these passes, but we'd like them to be counted by the progress
81 * monitor. We use an expanded progress monitor object to hold the
82 * additional pass count.
85 struct cdjpeg_progress_mgr {
86 struct jpeg_progress_mgr pub; /* fields known to JPEG library */
87 int completed_extra_passes; /* extra passes completed */
88 int total_extra_passes; /* total extra */
89 /* last printed percentage stored here to avoid multiple printouts */
90 int percent_done;
93 typedef struct cdjpeg_progress_mgr * cd_progress_ptr;
96 /* Short forms of external names for systems with brain-damaged linkers. */
98 #ifdef NEED_SHORT_EXTERNAL_NAMES
99 #define jinit_read_bmp jIRdBMP
100 #define jinit_write_bmp jIWrBMP
101 #define jinit_read_gif jIRdGIF
102 #define jinit_write_gif jIWrGIF
103 #define jinit_read_ppm jIRdPPM
104 #define jinit_write_ppm jIWrPPM
105 #define jinit_read_rle jIRdRLE
106 #define jinit_write_rle jIWrRLE
107 #define jinit_read_targa jIRdTarga
108 #define jinit_write_targa jIWrTarga
109 #define read_quant_tables RdQTables
110 #define read_scan_script RdScnScript
111 #define set_quant_slots SetQSlots
112 #define set_sample_factors SetSFacts
113 #define read_color_map RdCMap
114 #define enable_signal_catcher EnSigCatcher
115 #define start_progress_monitor StProgMon
116 #define end_progress_monitor EnProgMon
117 #define read_stdin RdStdin
118 #define write_stdout WrStdout
119 #endif /* NEED_SHORT_EXTERNAL_NAMES */
121 /* Module selection routines for I/O modules. */
123 JEXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
124 JEXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
125 boolean is_os2));
126 JEXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
127 JEXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
128 JEXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
129 JEXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
130 JEXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
131 JEXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
132 JEXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
133 JEXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
135 /* cjpeg support routines (in rdswitch.c) */
137 JEXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
138 int scale_factor, boolean force_baseline));
139 JEXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
140 JEXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
141 JEXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
143 /* djpeg support routines (in rdcolmap.c) */
145 JEXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile));
147 /* common support routines (in cdjpeg.c) */
149 JEXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
150 JEXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
151 cd_progress_ptr progress));
152 JEXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
153 JEXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
154 JEXTERN(FILE *) read_stdin JPP((void));
155 JEXTERN(FILE *) write_stdout JPP((void));
157 /* routines missing in original file */
159 JEXTERN(boolean) set_simple_lossless JPP((j_compress_ptr cinfo, char *arg));
162 /* miscellaneous useful macros */
164 #ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
165 #define READ_BINARY "r"
166 #define WRITE_BINARY "w"
167 #else
168 #ifdef VMS /* VMS is very nonstandard */
169 #define READ_BINARY "rb", "ctx=stm"
170 #define WRITE_BINARY "wb", "ctx=stm"
171 #else /* standard ANSI-compliant case */
172 #define READ_BINARY "rb"
173 #define WRITE_BINARY "wb"
174 #endif
175 #endif
177 #ifndef EXIT_FAILURE /* define exit() codes if not provided */
178 #define EXIT_FAILURE 1
179 #endif
180 #ifndef EXIT_SUCCESS
181 #ifdef VMS
182 #define EXIT_SUCCESS 1 /* VMS is very nonstandard */
183 #else
184 #define EXIT_SUCCESS 0
185 #endif
186 #endif
187 #ifndef EXIT_WARNING
188 #ifdef VMS
189 #define EXIT_WARNING 1 /* VMS is very nonstandard */
190 #else
191 #define EXIT_WARNING 2
192 #endif
193 #endif