ReactOS 0.4.15-dev-7842-g558ab78
jcapistd.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jcapistd.c:

Go to the source code of this file.

Macros

#define JPEG_INTERNALS
 

Functions

 jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
 
 jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
 
 jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, JDIMENSION num_lines)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 18 of file jcapistd.c.

Function Documentation

◆ jpeg_start_compress()

jpeg_start_compress ( j_compress_ptr  cinfo,
boolean  write_all_tables 
)

Definition at line 39 of file jcapistd.c.

40{
41 if (cinfo->global_state != CSTATE_START)
42 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
43
45 jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
46
47 /* (Re)initialize error mgr and destination modules */
48 (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
49 (*cinfo->dest->init_destination) (cinfo);
50 /* Perform master selection of active modules */
52 /* Set up for the first pass */
53 (*cinfo->master->prepare_for_pass) (cinfo);
54 /* Ready for application to drive first pass through jpeg_write_scanlines
55 * or jpeg_write_raw_data.
56 */
57 cinfo->next_scanline = 0;
58 cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
59}
#define FALSE
Definition: types.h:117
jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress)
Definition: jcapimin.c:127
jinit_compress_master(j_compress_ptr cinfo)
Definition: jcinit.c:193
#define ERREXIT1(cinfo, code, p1)
Definition: jerror.h:212
#define CSTATE_RAW_OK
Definition: jpegint.h:28
#define CSTATE_START
Definition: jpegint.h:26
#define CSTATE_SCANNING
Definition: jpegint.h:27
boolean write_all_tables
Definition: jpeglib.h:1014
struct jpeg_comp_master * master
Definition: jpeglib.h:443
boolean raw_data_in
Definition: jpeglib.h:357
struct jpeg_destination_mgr * dest
Definition: jpeglib.h:295
JDIMENSION next_scanline
Definition: jpeglib.h:395

Referenced by main(), and write_JPEG_file().

◆ jpeg_write_raw_data()

jpeg_write_raw_data ( j_compress_ptr  cinfo,
JSAMPIMAGE  data,
JDIMENSION  num_lines 
)

Definition at line 121 of file jcapistd.c.

123{
124 JDIMENSION lines_per_iMCU_row;
125
126 if (cinfo->global_state != CSTATE_RAW_OK)
127 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
128 if (cinfo->next_scanline >= cinfo->image_height) {
129 WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
130 return 0;
131 }
132
133 /* Call progress monitor hook if present */
134 if (cinfo->progress != NULL) {
135 cinfo->progress->pass_counter = (long) cinfo->next_scanline;
136 cinfo->progress->pass_limit = (long) cinfo->image_height;
137 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
138 }
139
140 /* Give master control module another chance if this is first call to
141 * jpeg_write_raw_data. This lets output of the frame/scan headers be
142 * delayed so that application can write COM, etc, markers between
143 * jpeg_start_compress and jpeg_write_raw_data.
144 */
145 if (cinfo->master->call_pass_startup)
146 (*cinfo->master->pass_startup) (cinfo);
147
148 /* Verify that at least one iMCU row has been passed. */
149 lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size;
150 if (num_lines < lines_per_iMCU_row)
151 ERREXIT(cinfo, JERR_BUFFER_SIZE);
152
153 /* Directly compress the row. */
154 if (! (*cinfo->coef->compress_data) (cinfo, data)) {
155 /* If compressor did not consume the whole row, suspend processing. */
156 return 0;
157 }
158
159 /* OK, we processed one iMCU row. */
160 cinfo->next_scanline += lines_per_iMCU_row;
161 return lines_per_iMCU_row;
162}
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WARNMS(cinfo, code)
Definition: jerror.h:251
unsigned int JDIMENSION
Definition: jmorecfg.h:229
JSAMPARRAY JDIMENSION num_lines
Definition: jpeglib.h:1017
#define long
Definition: qsort.c:33
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
JDIMENSION image_height
Definition: jpeglib.h:303
struct jpeg_c_coef_controller * coef
Definition: jpeglib.h:446

◆ jpeg_write_scanlines()

jpeg_write_scanlines ( j_compress_ptr  cinfo,
JSAMPARRAY  scanlines,
JDIMENSION  num_lines 
)

Definition at line 78 of file jcapistd.c.

80{
81 JDIMENSION row_ctr, rows_left;
82
83 if (cinfo->global_state != CSTATE_SCANNING)
84 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
85 if (cinfo->next_scanline >= cinfo->image_height)
86 WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
87
88 /* Call progress monitor hook if present */
89 if (cinfo->progress != NULL) {
90 cinfo->progress->pass_counter = (long) cinfo->next_scanline;
91 cinfo->progress->pass_limit = (long) cinfo->image_height;
92 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
93 }
94
95 /* Give master control module another chance if this is first call to
96 * jpeg_write_scanlines. This lets output of the frame/scan headers be
97 * delayed so that application can write COM, etc, markers between
98 * jpeg_start_compress and jpeg_write_scanlines.
99 */
100 if (cinfo->master->call_pass_startup)
101 (*cinfo->master->pass_startup) (cinfo);
102
103 /* Ignore any extra scanlines at bottom of image. */
104 rows_left = cinfo->image_height - cinfo->next_scanline;
105 if (num_lines > rows_left)
106 num_lines = rows_left;
107
108 row_ctr = 0;
109 (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
110 cinfo->next_scanline += row_ctr;
111 return row_ctr;
112}
JSAMPARRAY scanlines
Definition: jpeglib.h:1016
struct jpeg_c_main_controller * main
Definition: jpeglib.h:444

Referenced by main(), and write_JPEG_file().