Developer World
Spresense SDK Library v3.3.0-375c679
cdjpeg.h
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,
29 cjpeg_source_ptr sinfo));
30 JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo,
31 cjpeg_source_ptr sinfo));
32 JMETHOD(void, finish_input, (j_compress_ptr cinfo,
33 cjpeg_source_ptr sinfo));
34
35 FILE *input_file;
36
37 JSAMPARRAY buffer;
38 JDIMENSION buffer_height;
39};
40
41
42/*
43 * Object interface for djpeg's output file encoding modules
44 */
45
46typedef struct djpeg_dest_struct * djpeg_dest_ptr;
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. */
63 FILE * output_file;
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 */
69 JSAMPARRAY buffer;
70 JDIMENSION buffer_height;
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 */
87 int percent_done;
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));
122EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_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
136EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename,
137 boolean force_baseline));
138EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename));
139EXTERN(boolean) set_quality_ratings JPP((j_compress_ptr cinfo, char *arg,
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,
152 cd_progress_ptr progress));
153EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo));
154EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars));
155EXTERN(FILE *) read_stdin JPP((void));
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
Definition: cdjpeg.h:82
Definition: cdjpeg.h:27
Definition: cdjpeg.h:48
Definition: jpeglib.h:297
Definition: jpeglib.h:312
Definition: jpeglib.h:480
Definition: jpeglib.h:789