ReactOS 0.4.16-dev-297-gc569aee
cdjpeg.h
Go to the documentation of this file.
1/*
2 * cdjpeg.h
3 *
4 * Copyright (C) 1994-1997, Thomas G. Lane.
5 * Modified 2019 by Guido Vollbeding.
6 * This file is part of the Independent JPEG Group's software.
7 * For conditions of distribution and use, see the accompanying README file.
8 *
9 * This file contains common declarations for the sample applications
10 * cjpeg and djpeg. It is NOT used by the core JPEG library.
11 */
12
13#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
14#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
15#include "jinclude.h"
16#include "jpeglib.h"
17#include "jerror.h" /* get library error codes too */
18#include "cderror.h" /* get application-specific error codes */
19
20
21/*
22 * Object interface for cjpeg's source file decoding modules
23 */
24
26
28 JMETHOD(void, start_input, (j_compress_ptr cinfo,
30 JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
32 JMETHOD(void, finish_input, (j_compress_ptr cinfo,
34
36
39};
40
41
42/*
43 * Object interface for djpeg's output file encoding modules
44 */
45
47
49 /* start_output is called after jpeg_start_decompress finishes.
50 * The color map will be ready at this time, if one is needed.
51 */
52 JMETHOD(void, start_output, (j_decompress_ptr cinfo,
53 djpeg_dest_ptr dinfo));
54 /* Emit the specified number of pixel rows from the buffer. */
55 JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo,
56 djpeg_dest_ptr dinfo,
57 JDIMENSION rows_supplied));
58 /* Finish up at the end of the image. */
59 JMETHOD(void, finish_output, (j_decompress_ptr cinfo,
60 djpeg_dest_ptr dinfo));
61
62 /* Target file spec; filled in by djpeg.c after object is created. */
64
65 /* Output pixel-row buffer. Created by module init or start_output.
66 * Width is cinfo->output_width * cinfo->output_components;
67 * height is buffer_height.
68 */
71};
72
73
74/*
75 * cjpeg/djpeg may need to perform extra passes to convert to or from
76 * the source/destination file format. The JPEG library does not know
77 * about these passes, but we'd like them to be counted by the progress
78 * monitor. We use an expanded progress monitor object to hold the
79 * additional pass count.
80 */
81
83 struct jpeg_progress_mgr pub; /* fields known to JPEG library */
84 int completed_extra_passes; /* extra passes completed */
85 int total_extra_passes; /* total extra */
86 /* last printed percentage stored here to avoid multiple printouts */
88};
89
91
92
93/* Short forms of external names for systems with brain-damaged linkers. */
94
95#ifdef NEED_SHORT_EXTERNAL_NAMES
96#define jinit_read_bmp jIRdBMP
97#define jinit_write_bmp jIWrBMP
98#define jinit_read_gif jIRdGIF
99#define jinit_write_gif jIWrGIF
100#define jinit_read_ppm jIRdPPM
101#define jinit_write_ppm jIWrPPM
102#define jinit_read_rle jIRdRLE
103#define jinit_write_rle jIWrRLE
104#define jinit_read_targa jIRdTarga
105#define jinit_write_targa jIWrTarga
106#define read_quant_tables RdQTables
107#define read_scan_script RdScnScript
108#define set_quality_ratings SetQRates
109#define set_quant_slots SetQSlots
110#define set_sample_factors SetSFacts
111#define read_color_map RdCMap
112#define enable_signal_catcher EnSigCatcher
113#define start_progress_monitor StProgMon
114#define end_progress_monitor EnProgMon
115#define read_stdin RdStdin
116#define write_stdout WrStdout
117#endif /* NEED_SHORT_EXTERNAL_NAMES */
118
119/* Module selection routines for I/O modules. */
120
121EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
123 boolean is_os2));
124EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
125EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo,
126 boolean is_lzw));
127EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
128EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
129EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
130EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
131EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo));
132EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo));
133
134/* cjpeg support routines (in rdswitch.c) */
135
137 boolean force_baseline));
138EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
140 boolean force_baseline));
141EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg));
142EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg));
143
144/* djpeg support routines (in rdcolmap.c) */
145
146EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile));
147
148/* common support routines (in cdjpeg.c) */
149
150EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo));
151EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo,
153EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
154EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
156EXTERN(FILE *) write_stdout JPP((void));
157
158/* miscellaneous useful macros */
159
160#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
161#define READ_BINARY "r"
162#define WRITE_BINARY "w"
163#else
164#ifdef VMS /* VMS is very nonstandard */
165#define READ_BINARY "rb", "ctx=stm"
166#define WRITE_BINARY "wb", "ctx=stm"
167#else /* standard ANSI-compliant case */
168#define READ_BINARY "rb"
169#define WRITE_BINARY "wb"
170#endif
171#endif
172
173#ifndef EXIT_FAILURE /* define exit() codes if not provided */
174#define EXIT_FAILURE 1
175#endif
176#ifndef EXIT_SUCCESS
177#ifdef VMS
178#define EXIT_SUCCESS 1 /* VMS is very nonstandard */
179#else
180#define EXIT_SUCCESS 0
181#endif
182#endif
183#ifndef EXIT_WARNING
184#ifdef VMS
185#define EXIT_WARNING 1 /* VMS is very nonstandard */
186#else
187#define EXIT_WARNING 2
188#endif
189#endif
read_stdin(void)
Definition: cdjpeg.c:149
write_stdout(void)
Definition: cdjpeg.c:167
keymatch(char *arg, const char *keyword, int minchars)
Definition: cdjpeg.c:122
cd_progress_ptr progress
Definition: cdjpeg.h:152
struct cdjpeg_progress_mgr * cd_progress_ptr
Definition: cdjpeg.h:90
boolean is_os2
Definition: cdjpeg.h:123
const char int minchars
Definition: cdjpeg.h:154
struct djpeg_dest_struct * djpeg_dest_ptr
Definition: cdjpeg.h:46
EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo
boolean is_lzw
Definition: cdjpeg.h:126
struct cjpeg_source_struct * cjpeg_source_ptr
Definition: cdjpeg.h:25
char boolean force_baseline
Definition: cdjpeg.h:137
FILE * infile
Definition: cdjpeg.h:146
const char * filename
Definition: ioapi.h:137
unsigned int JDIMENSION
Definition: jmorecfg.h:229
#define JPP(arglist)
Definition: jpeglib.h:877
JSAMPROW * JSAMPARRAY
Definition: jpeglib.h:76
set_quality_ratings(j_compress_ptr cinfo, char *arg, boolean force_baseline)
Definition: rdswitch.c:267
read_quant_tables(j_compress_ptr cinfo, char *filename, boolean force_baseline)
Definition: rdswitch.c:75
set_sample_factors(j_compress_ptr cinfo, char *arg)
Definition: rdswitch.c:334
set_quant_slots(j_compress_ptr cinfo, char *arg)
Definition: rdswitch.c:299
int total_extra_passes
Definition: cdjpeg.h:85
struct jpeg_progress_mgr pub
Definition: cdjpeg.h:83
int completed_extra_passes
Definition: cdjpeg.h:84
JDIMENSION buffer_height
Definition: cdjpeg.h:38
JMETHOD(void, start_input,(j_compress_ptr cinfo, cjpeg_source_ptr sinfo))
JSAMPARRAY buffer
Definition: cdjpeg.h:37
JMETHOD(void, finish_input,(j_compress_ptr cinfo, cjpeg_source_ptr sinfo))
FILE * input_file
Definition: cdjpeg.h:35
JMETHOD(JDIMENSION, get_pixel_rows,(j_compress_ptr cinfo, cjpeg_source_ptr sinfo))
JMETHOD(void, start_output,(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo))
JMETHOD(void, finish_output,(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo))
FILE * output_file
Definition: cdjpeg.h:63
JDIMENSION buffer_height
Definition: cdjpeg.h:70
JSAMPARRAY buffer
Definition: cdjpeg.h:69
JMETHOD(void, put_pixel_rows,(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, JDIMENSION rows_supplied))
Definition: general.c:220