#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jcmarker.c:

Go to the source code of this file.
Defines | |
| #define | JPEG_INTERNALS |
Enumerations | |
| enum | JPEG_MARKER { M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, M_DHT = 0xc4, M_DAC = 0xcc, M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, M_RST3 = 0xd3, M_RST4 = 0xd4, M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, M_DQT = 0xdb, M_DNL = 0xdc, M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, M_APP0 = 0xe0, M_APP1 = 0xe1, M_APP2 = 0xe2, M_APP3 = 0xe3, M_APP4 = 0xe4, M_APP5 = 0xe5, M_APP6 = 0xe6, M_APP7 = 0xe7, M_APP8 = 0xe8, M_APP9 = 0xe9, M_APP10 = 0xea, M_APP11 = 0xeb, M_APP12 = 0xec, M_APP13 = 0xed, M_APP14 = 0xee, M_APP15 = 0xef, M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, M_TEM = 0x01, M_ERROR = 0x100 } |
Functions | |
| LOCAL void | emit_2bytes (j_compress_ptr cinfo, int value) |
| LOCAL void | emit_adobe_app14 (j_compress_ptr cinfo) |
| LOCAL void | emit_byte (j_compress_ptr cinfo, int val) |
| LOCAL void | emit_dac (j_compress_ptr cinfo) |
| LOCAL void | emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) |
| LOCAL int | emit_dqt (j_compress_ptr cinfo, int index) |
| LOCAL void | emit_dri (j_compress_ptr cinfo) |
| LOCAL void | emit_jfif_app0 (j_compress_ptr cinfo) |
| LOCAL void | emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) |
| LOCAL void | emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) |
| LOCAL void | emit_sos (j_compress_ptr cinfo) |
| GLOBAL void | jinit_marker_writer (j_compress_ptr cinfo) |
| METHODDEF void | write_any_marker (j_compress_ptr cinfo, int marker, const JOCTET *dataptr, unsigned int datalen) |
| METHODDEF void | write_file_header (j_compress_ptr cinfo) |
| METHODDEF void | write_file_trailer (j_compress_ptr cinfo) |
| METHODDEF void | write_frame_header (j_compress_ptr cinfo) |
| METHODDEF void | write_scan_header (j_compress_ptr cinfo) |
| METHODDEF void | write_tables_only (j_compress_ptr cinfo) |
|
|
Definition at line 11 of file jcmarker.c. |
|
|
Definition at line 16 of file jcmarker.c. Referenced by write_any_marker(). 00016 { /* JPEG marker codes */
00017 M_SOF0 = 0xc0,
00018 M_SOF1 = 0xc1,
00019 M_SOF2 = 0xc2,
00020 M_SOF3 = 0xc3,
00021
00022 M_SOF5 = 0xc5,
00023 M_SOF6 = 0xc6,
00024 M_SOF7 = 0xc7,
00025
00026 M_JPG = 0xc8,
00027 M_SOF9 = 0xc9,
00028 M_SOF10 = 0xca,
00029 M_SOF11 = 0xcb,
00030
00031 M_SOF13 = 0xcd,
00032 M_SOF14 = 0xce,
00033 M_SOF15 = 0xcf,
00034
00035 M_DHT = 0xc4,
00036
00037 M_DAC = 0xcc,
00038
00039 M_RST0 = 0xd0,
00040 M_RST1 = 0xd1,
00041 M_RST2 = 0xd2,
00042 M_RST3 = 0xd3,
00043 M_RST4 = 0xd4,
00044 M_RST5 = 0xd5,
00045 M_RST6 = 0xd6,
00046 M_RST7 = 0xd7,
00047
00048 M_SOI = 0xd8,
00049 M_EOI = 0xd9,
00050 M_SOS = 0xda,
00051 M_DQT = 0xdb,
00052 M_DNL = 0xdc,
00053 M_DRI = 0xdd,
00054 M_DHP = 0xde,
00055 M_EXP = 0xdf,
00056
00057 M_APP0 = 0xe0,
00058 M_APP1 = 0xe1,
00059 M_APP2 = 0xe2,
00060 M_APP3 = 0xe3,
00061 M_APP4 = 0xe4,
00062 M_APP5 = 0xe5,
00063 M_APP6 = 0xe6,
00064 M_APP7 = 0xe7,
00065 M_APP8 = 0xe8,
00066 M_APP9 = 0xe9,
00067 M_APP10 = 0xea,
00068 M_APP11 = 0xeb,
00069 M_APP12 = 0xec,
00070 M_APP13 = 0xed,
00071 M_APP14 = 0xee,
00072 M_APP15 = 0xef,
00073
00074 M_JPG0 = 0xf0,
00075 M_JPG13 = 0xfd,
00076 M_COM = 0xfe,
00077
00078 M_TEM = 0x01,
00079
00080 M_ERROR = 0x100
00081 } JPEG_MARKER;
|
|
||||||||||||
|
Definition at line 120 of file jcmarker.c. References emit_byte, j_compress_ptr, and value. Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_sof(), emit_sos(), and write_any_marker().
|
|
|
Definition at line 374 of file jcmarker.c. References emit_2bytes(), emit_byte, emit_marker(), j_compress_ptr, JCS_YCbCr, JCS_YCCK, jpeg_compress_struct::jpeg_color_space, and M_APP14. Referenced by write_file_header(). 00376 {
00377 /*
00378 * Length of APP14 block (2 bytes)
00379 * Block ID (5 bytes - ASCII "Adobe")
00380 * Version Number (2 bytes - currently 100)
00381 * Flags0 (2 bytes - currently 0)
00382 * Flags1 (2 bytes - currently 0)
00383 * Color transform (1 byte)
00384 *
00385 * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
00386 * now in circulation seem to use Version = 100, so that's what we write.
00387 *
00388 * We write the color transform byte as 1 if the JPEG color space is
00389 * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
00390 * whether the encoder performed a transformation, which is pretty useless.
00391 */
00392
00393 emit_marker(cinfo, M_APP14);
00394
00395 emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
00396
00397 emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
00398 emit_byte(cinfo, 0x64);
00399 emit_byte(cinfo, 0x6F);
00400 emit_byte(cinfo, 0x62);
00401 emit_byte(cinfo, 0x65);
00402 emit_2bytes(cinfo, 100); /* Version */
00403 emit_2bytes(cinfo, 0); /* Flags0 */
00404 emit_2bytes(cinfo, 0); /* Flags1 */
00405 switch (cinfo->jpeg_color_space) {
00406 case JCS_YCbCr:
00407 emit_byte(cinfo, 1); /* Color transform = 1 */
00408 break;
00409 case JCS_YCCK:
00410 emit_byte(cinfo, 2); /* Color transform = 2 */
00411 break;
00412 default:
00413 emit_byte(cinfo, 0); /* Color transform = 0 */
00414 break;
00415 }
00416 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 97 of file jcmarker.c. References jpeg_compress_struct::dest, ERREXIT, jpeg_destination_mgr::free_in_buffer, j_compress_ptr, JOCTET, and jpeg_destination_mgr::next_output_byte. 00099 {
00100 struct jpeg_destination_mgr * dest = cinfo->dest;
00101
00102 *(dest->next_output_byte)++ = (JOCTET) val;
00103 if (--dest->free_in_buffer == 0) {
00104 if (! (*dest->empty_output_buffer) (cinfo))
00105 ERREXIT(cinfo, JERR_CANT_SUSPEND);
00106 }
00107 }
|
|
|
Definition at line 209 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::arith_ac_K, jpeg_compress_struct::arith_dc_L, jpeg_compress_struct::arith_dc_U, jpeg_compress_struct::comps_in_scan, jpeg_compress_struct::cur_comp_info, jpeg_component_info::dc_tbl_no, emit_2bytes(), emit_byte, emit_marker(), i, j_compress_ptr, length(), and M_DAC. Referenced by write_scan_header(). 00213 {
00214 #ifdef C_ARITH_CODING_SUPPORTED
00215 char dc_in_use[NUM_ARITH_TBLS];
00216 char ac_in_use[NUM_ARITH_TBLS];
00217 int length, i;
00218 jpeg_component_info *compptr;
00219
00220 for (i = 0; i < NUM_ARITH_TBLS; i++)
00221 dc_in_use[i] = ac_in_use[i] = 0;
00222
00223 for (i = 0; i < cinfo->comps_in_scan; i++) {
00224 compptr = cinfo->cur_comp_info[i];
00225 dc_in_use[compptr->dc_tbl_no] = 1;
00226 ac_in_use[compptr->ac_tbl_no] = 1;
00227 }
00228
00229 length = 0;
00230 for (i = 0; i < NUM_ARITH_TBLS; i++)
00231 length += dc_in_use[i] + ac_in_use[i];
00232
00233 emit_marker(cinfo, M_DAC);
00234
00235 emit_2bytes(cinfo, length*2 + 2);
00236
00237 for (i = 0; i < NUM_ARITH_TBLS; i++) {
00238 if (dc_in_use[i]) {
00239 emit_byte(cinfo, i);
00240 emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
00241 }
00242 if (ac_in_use[i]) {
00243 emit_byte(cinfo, i + 0x10);
00244 emit_byte(cinfo, cinfo->arith_ac_K[i]);
00245 }
00246 }
00247 #endif /* C_ARITH_CODING_SUPPORTED */
00248 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 171 of file jcmarker.c. References jpeg_compress_struct::ac_huff_tbl_ptrs, JHUFF_TBL::bits, jpeg_compress_struct::dc_huff_tbl_ptrs, emit_2bytes(), emit_byte, emit_marker(), ERREXIT1, JHUFF_TBL::huffval, i, j_compress_ptr, JERR_NO_HUFF_TABLE, length(), M_DHT, and JHUFF_TBL::sent_table. Referenced by write_scan_header(), and write_tables_only(). 00173 {
00174 JHUFF_TBL * htbl;
00175 int length, i;
00176
00177 if (is_ac) {
00178 htbl = cinfo->ac_huff_tbl_ptrs[index];
00179 index += 0x10; /* output index has AC bit set */
00180 } else {
00181 htbl = cinfo->dc_huff_tbl_ptrs[index];
00182 }
00183
00184 if (htbl == NULL)
00185 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
00186
00187 if (! htbl->sent_table) {
00188 emit_marker(cinfo, M_DHT);
00189
00190 length = 0;
00191 for (i = 1; i <= 16; i++)
00192 length += htbl->bits[i];
00193
00194 emit_2bytes(cinfo, length + 2 + 1 + 16);
00195 emit_byte(cinfo, index);
00196
00197 for (i = 1; i <= 16; i++)
00198 emit_byte(cinfo, htbl->bits[i]);
00199
00200 for (i = 0; i < length; i++)
00201 emit_byte(cinfo, htbl->huffval[i]);
00202
00203 htbl->sent_table = TRUE;
00204 }
00205 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 133 of file jcmarker.c. References DCTSIZE2, emit_2bytes(), emit_byte, emit_marker(), ERREXIT1, i, j_compress_ptr, JERR_NO_QUANT_TABLE, M_DQT, jpeg_compress_struct::quant_tbl_ptrs, JQUANT_TBL::quantval, and JQUANT_TBL::sent_table. Referenced by write_frame_header(), and write_tables_only(). 00136 {
00137 JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
00138 int prec;
00139 int i;
00140
00141 if (qtbl == NULL)
00142 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
00143
00144 prec = 0;
00145 for (i = 0; i < DCTSIZE2; i++) {
00146 if (qtbl->quantval[i] > 255)
00147 prec = 1;
00148 }
00149
00150 if (! qtbl->sent_table) {
00151 emit_marker(cinfo, M_DQT);
00152
00153 emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
00154
00155 emit_byte(cinfo, index + (prec<<4));
00156
00157 for (i = 0; i < DCTSIZE2; i++) {
00158 if (prec)
00159 emit_byte(cinfo, qtbl->quantval[i] >> 8);
00160 emit_byte(cinfo, qtbl->quantval[i] & 0xFF);
00161 }
00162
00163 qtbl->sent_table = TRUE;
00164 }
00165
00166 return prec;
00167 }
|
Here is the call graph for this function:

|
|
Definition at line 252 of file jcmarker.c. References emit_2bytes(), emit_marker(), j_compress_ptr, M_DRI, and jpeg_compress_struct::restart_interval. Referenced by write_scan_header(). 00254 {
00255 emit_marker(cinfo, M_DRI);
00256
00257 emit_2bytes(cinfo, 4); /* fixed length */
00258
00259 emit_2bytes(cinfo, (int) cinfo->restart_interval);
00260 }
|
Here is the call graph for this function:

|
|
Definition at line 336 of file jcmarker.c. References jpeg_compress_struct::density_unit, emit_2bytes(), emit_byte, emit_marker(), j_compress_ptr, M_APP0, jpeg_compress_struct::X_density, and jpeg_compress_struct::Y_density. Referenced by write_file_header(). 00338 {
00339 /*
00340 * Length of APP0 block (2 bytes)
00341 * Block ID (4 bytes - ASCII "JFIF")
00342 * Zero byte (1 byte to terminate the ID string)
00343 * Version Major, Minor (2 bytes - 0x01, 0x01)
00344 * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
00345 * Xdpu (2 bytes - dots per unit horizontal)
00346 * Ydpu (2 bytes - dots per unit vertical)
00347 * Thumbnail X size (1 byte)
00348 * Thumbnail Y size (1 byte)
00349 */
00350
00351 emit_marker(cinfo, M_APP0);
00352
00353 emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
00354
00355 emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
00356 emit_byte(cinfo, 0x46);
00357 emit_byte(cinfo, 0x49);
00358 emit_byte(cinfo, 0x46);
00359 emit_byte(cinfo, 0);
00360 /* We currently emit version code 1.01 since we use no 1.02 features.
00361 * This may avoid complaints from some older decoders.
00362 */
00363 emit_byte(cinfo, 1); /* Major version */
00364 emit_byte(cinfo, 1); /* Minor version */
00365 emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
00366 emit_2bytes(cinfo, (int) cinfo->X_density);
00367 emit_2bytes(cinfo, (int) cinfo->Y_density);
00368 emit_byte(cinfo, 0); /* No thumbnail image */
00369 emit_byte(cinfo, 0);
00370 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 111 of file jcmarker.c. References emit_byte, and j_compress_ptr. Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_sof(), emit_sos(), write_any_marker(), write_file_header(), write_file_trailer(), and write_tables_only().
|
|
||||||||||||
|
Definition at line 264 of file jcmarker.c. References code, jpeg_compress_struct::comp_info, jpeg_component_info::component_id, jpeg_compress_struct::data_precision, emit_2bytes(), emit_byte, emit_marker(), ERREXIT1, jpeg_component_info::h_samp_factor, jpeg_compress_struct::image_height, jpeg_compress_struct::image_width, j_compress_ptr, JERR_IMAGE_TOO_BIG, L, jpeg_compress_struct::num_components, jpeg_component_info::quant_tbl_no, and jpeg_component_info::v_samp_factor. Referenced by write_frame_header(). 00266 {
00267 int ci;
00268 jpeg_component_info *compptr;
00269
00270 emit_marker(cinfo, code);
00271
00272 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
00273
00274 /* Make sure image isn't bigger than SOF field can handle */
00275 if ((long) cinfo->image_height > 65535L ||
00276 (long) cinfo->image_width > 65535L)
00277 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
00278
00279 emit_byte(cinfo, cinfo->data_precision);
00280 emit_2bytes(cinfo, (int) cinfo->image_height);
00281 emit_2bytes(cinfo, (int) cinfo->image_width);
00282
00283 emit_byte(cinfo, cinfo->num_components);
00284
00285 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00286 ci++, compptr++) {
00287 emit_byte(cinfo, compptr->component_id);
00288 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
00289 emit_byte(cinfo, compptr->quant_tbl_no);
00290 }
00291 }
|
Here is the call graph for this function:

|
|
Definition at line 295 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::Ah, jpeg_compress_struct::Al, jpeg_compress_struct::arith_code, jpeg_component_info::component_id, jpeg_compress_struct::comps_in_scan, jpeg_compress_struct::cur_comp_info, jpeg_component_info::dc_tbl_no, emit_2bytes(), emit_byte, emit_marker(), i, j_compress_ptr, M_SOS, jpeg_compress_struct::progressive_mode, jpeg_compress_struct::Se, and jpeg_compress_struct::Ss. Referenced by write_scan_header(). 00297 {
00298 int i, td, ta;
00299 jpeg_component_info *compptr;
00300
00301 emit_marker(cinfo, M_SOS);
00302
00303 emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
00304
00305 emit_byte(cinfo, cinfo->comps_in_scan);
00306
00307 for (i = 0; i < cinfo->comps_in_scan; i++) {
00308 compptr = cinfo->cur_comp_info[i];
00309 emit_byte(cinfo, compptr->component_id);
00310 td = compptr->dc_tbl_no;
00311 ta = compptr->ac_tbl_no;
00312 if (cinfo->progressive_mode) {
00313 /* Progressive mode: only DC or only AC tables are used in one scan;
00314 * furthermore, Huffman coding of DC refinement uses no table at all.
00315 * We emit 0 for unused field(s); this is recommended by the P&M text
00316 * but does not seem to be specified in the standard.
00317 */
00318 if (cinfo->Ss == 0) {
00319 ta = 0; /* DC scan */
00320 if (cinfo->Ah != 0 && !cinfo->arith_code)
00321 td = 0; /* no DC table either */
00322 } else {
00323 td = 0; /* AC scan */
00324 }
00325 }
00326 emit_byte(cinfo, (td << 4) + ta);
00327 }
00328
00329 emit_byte(cinfo, cinfo->Ss);
00330 emit_byte(cinfo, cinfo->Se);
00331 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
00332 }
|
Here is the call graph for this function:

|
|
Definition at line 626 of file jcmarker.c. References j_common_ptr, j_compress_ptr, jpeg_compress_struct::marker, and SIZEOF. Referenced by jinit_compress_master(), jpeg_write_tables(), and transencode_master_selection(). 00627 {
00628 /* Create the subobject */
00629 cinfo->marker = (struct jpeg_marker_writer *)
00630 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00631 SIZEOF(struct jpeg_marker_writer));
00632 /* Initialize method pointers */
00633 cinfo->marker->write_any_marker = write_any_marker;
00634 cinfo->marker->write_file_header = write_file_header;
00635 cinfo->marker->write_frame_header = write_frame_header;
00636 cinfo->marker->write_scan_header = write_scan_header;
00637 cinfo->marker->write_file_trailer = write_file_trailer;
00638 cinfo->marker->write_tables_only = write_tables_only;
00639 }
|
|
||||||||||||||||||||
|
Definition at line 428 of file jcmarker.c. References emit_2bytes(), emit_byte, emit_marker(), j_compress_ptr, JOCTET, JPEG_MARKER, and marker. 00431 {
00432 if (datalen <= (unsigned int) 65533) { /* safety check */
00433 emit_marker(cinfo, (JPEG_MARKER) marker);
00434
00435 emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
00436
00437 while (datalen--) {
00438 emit_byte(cinfo, *dataptr);
00439 dataptr++;
00440 }
00441 }
00442 }
|
Here is the call graph for this function:

|
|
Definition at line 457 of file jcmarker.c. References emit_adobe_app14(), emit_jfif_app0(), emit_marker(), j_compress_ptr, M_SOI, jpeg_compress_struct::write_Adobe_marker, and jpeg_compress_struct::write_JFIF_header. 00458 {
00459 emit_marker(cinfo, M_SOI); /* first the SOI */
00460
00461 if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
00462 emit_jfif_app0(cinfo);
00463 if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
00464 emit_adobe_app14(cinfo);
00465 }
|
Here is the call graph for this function:

|
|
Definition at line 583 of file jcmarker.c. References emit_marker(), j_compress_ptr, and M_EOI. 00584 {
00585 emit_marker(cinfo, M_EOI);
00586 }
|
Here is the call graph for this function:

|
|
Definition at line 477 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::arith_code, jpeg_compress_struct::comp_info, jpeg_compress_struct::data_precision, jpeg_component_info::dc_tbl_no, emit_dqt(), emit_sof(), j_compress_ptr, JTRC_16BIT_TABLES, M_SOF0, M_SOF1, M_SOF2, M_SOF9, jpeg_compress_struct::num_components, jpeg_compress_struct::progressive_mode, jpeg_component_info::quant_tbl_no, and TRACEMS. 00478 {
00479 int ci, prec;
00480 boolean is_baseline;
00481 jpeg_component_info *compptr;
00482
00483 /* Emit DQT for each quantization table.
00484 * Note that emit_dqt() suppresses any duplicate tables.
00485 */
00486 prec = 0;
00487 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00488 ci++, compptr++) {
00489 prec += emit_dqt(cinfo, compptr->quant_tbl_no);
00490 }
00491 /* now prec is nonzero iff there are any 16-bit quant tables. */
00492
00493 /* Check for a non-baseline specification.
00494 * Note we assume that Huffman table numbers won't be changed later.
00495 */
00496 if (cinfo->arith_code || cinfo->progressive_mode ||
00497 cinfo->data_precision != 8) {
00498 is_baseline = FALSE;
00499 } else {
00500 is_baseline = TRUE;
00501 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00502 ci++, compptr++) {
00503 if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
00504 is_baseline = FALSE;
00505 }
00506 if (prec && is_baseline) {
00507 is_baseline = FALSE;
00508 /* If it's baseline except for quantizer size, warn the user */
00509 TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
00510 }
00511 }
00512
00513 /* Emit the proper SOF marker */
00514 if (cinfo->arith_code) {
00515 emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
00516 } else {
00517 if (cinfo->progressive_mode)
00518 emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
00519 else if (is_baseline)
00520 emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
00521 else
00522 emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
00523 }
00524 }
|
Here is the call graph for this function:

|
|
Definition at line 534 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::Ah, jpeg_compress_struct::arith_code, jpeg_compress_struct::comps_in_scan, jpeg_compress_struct::cur_comp_info, jpeg_component_info::dc_tbl_no, emit_dac(), emit_dht(), emit_dri(), emit_sos(), FALSE, i, j_compress_ptr, jpeg_compress_struct::progressive_mode, jpeg_compress_struct::restart_interval, jpeg_compress_struct::Ss, and TRUE. 00535 {
00536 int i;
00537 jpeg_component_info *compptr;
00538
00539 if (cinfo->arith_code) {
00540 /* Emit arith conditioning info. We may have some duplication
00541 * if the file has multiple scans, but it's so small it's hardly
00542 * worth worrying about.
00543 */
00544 emit_dac(cinfo);
00545 } else {
00546 /* Emit Huffman tables.
00547 * Note that emit_dht() suppresses any duplicate tables.
00548 */
00549 for (i = 0; i < cinfo->comps_in_scan; i++) {
00550 compptr = cinfo->cur_comp_info[i];
00551 if (cinfo->progressive_mode) {
00552 /* Progressive mode: only DC or only AC tables are used in one scan */
00553 if (cinfo->Ss == 0) {
00554 if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
00555 emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
00556 } else {
00557 emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
00558 }
00559 } else {
00560 /* Sequential mode: need both DC and AC tables */
00561 emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
00562 emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
00563 }
00564 }
00565 }
00566
00567 /* Emit DRI if required --- note that DRI value could change for each scan.
00568 * If it doesn't, a tiny amount of space is wasted in multiple-scan files.
00569 * We assume DRI will never be nonzero for one scan and zero for a later one.
00570 */
00571 if (cinfo->restart_interval)
00572 emit_dri(cinfo);
00573
00574 emit_sos(cinfo);
00575 }
|
Here is the call graph for this function:

|
|
Definition at line 597 of file jcmarker.c. References jpeg_compress_struct::ac_huff_tbl_ptrs, jpeg_compress_struct::arith_code, jpeg_compress_struct::dc_huff_tbl_ptrs, emit_dht(), emit_dqt(), emit_marker(), FALSE, i, j_compress_ptr, M_EOI, M_SOI, jpeg_compress_struct::quant_tbl_ptrs, and TRUE. 00598 {
00599 int i;
00600
00601 emit_marker(cinfo, M_SOI);
00602
00603 for (i = 0; i < NUM_QUANT_TBLS; i++) {
00604 if (cinfo->quant_tbl_ptrs[i] != NULL)
00605 (void) emit_dqt(cinfo, i);
00606 }
00607
00608 if (! cinfo->arith_code) {
00609 for (i = 0; i < NUM_HUFF_TBLS; i++) {
00610 if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
00611 emit_dht(cinfo, i, FALSE);
00612 if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
00613 emit_dht(cinfo, i, TRUE);
00614 }
00615 }
00616
00617 emit_marker(cinfo, M_EOI);
00618 }
|
Here is the call graph for this function:

1.3.9.1