Doxygen Source Code Documentation
jcmarker.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Go to the source code of this file.
Define Documentation
|
Definition at line 11 of file jcmarker.c. |
Typedef Documentation
|
Definition at line 92 of file jcmarker.c. |
Enumeration Type Documentation
|
Definition at line 16 of file jcmarker.c. Referenced by emit_marker(), emit_sof(), and write_marker_header().
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; |
Function Documentation
|
Definition at line 131 of file jcmarker.c. References emit_byte. Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_sof(), emit_sos(), and write_marker_header().
|
|
Definition at line 384 of file jcmarker.c. References emit_2bytes(), emit_byte, emit_marker(), JCS_YCbCr, JCS_YCCK, jpeg_compress_struct::jpeg_color_space, and M_APP14. Referenced by write_file_header().
00386 { 00387 /* 00388 * Length of APP14 block (2 bytes) 00389 * Block ID (5 bytes - ASCII "Adobe") 00390 * Version Number (2 bytes - currently 100) 00391 * Flags0 (2 bytes - currently 0) 00392 * Flags1 (2 bytes - currently 0) 00393 * Color transform (1 byte) 00394 * 00395 * Although Adobe TN 5116 mentions Version = 101, all the Adobe files 00396 * now in circulation seem to use Version = 100, so that's what we write. 00397 * 00398 * We write the color transform byte as 1 if the JPEG color space is 00399 * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with 00400 * whether the encoder performed a transformation, which is pretty useless. 00401 */ 00402 00403 emit_marker(cinfo, M_APP14); 00404 00405 emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ 00406 00407 emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ 00408 emit_byte(cinfo, 0x64); 00409 emit_byte(cinfo, 0x6F); 00410 emit_byte(cinfo, 0x62); 00411 emit_byte(cinfo, 0x65); 00412 emit_2bytes(cinfo, 100); /* Version */ 00413 emit_2bytes(cinfo, 0); /* Flags0 */ 00414 emit_2bytes(cinfo, 0); /* Flags1 */ 00415 switch (cinfo->jpeg_color_space) { 00416 case JCS_YCbCr: 00417 emit_byte(cinfo, 1); /* Color transform = 1 */ 00418 break; 00419 case JCS_YCCK: 00420 emit_byte(cinfo, 2); /* Color transform = 2 */ 00421 break; 00422 default: 00423 emit_byte(cinfo, 0); /* Color transform = 0 */ 00424 break; 00425 } 00426 } |
|
Definition at line 108 of file jcmarker.c. References jpeg_compress_struct::dest, ERREXIT, jpeg_destination_mgr::free_in_buffer, and jpeg_destination_mgr::next_output_byte.
00110 { 00111 struct jpeg_destination_mgr * dest = cinfo->dest; 00112 00113 *(dest->next_output_byte)++ = (JOCTET) val; 00114 if (--dest->free_in_buffer == 0) { 00115 if (! (*dest->empty_output_buffer) (cinfo)) 00116 ERREXIT(cinfo, JERR_CANT_SUSPEND); 00117 } 00118 } |
|
Definition at line 222 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, compptr, 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, M_DAC, and NUM_ARITH_TBLS. Referenced by write_scan_header().
00226 { 00227 #ifdef C_ARITH_CODING_SUPPORTED 00228 char dc_in_use[NUM_ARITH_TBLS]; 00229 char ac_in_use[NUM_ARITH_TBLS]; 00230 int length, i; 00231 jpeg_component_info *compptr; 00232 00233 for (i = 0; i < NUM_ARITH_TBLS; i++) 00234 dc_in_use[i] = ac_in_use[i] = 0; 00235 00236 for (i = 0; i < cinfo->comps_in_scan; i++) { 00237 compptr = cinfo->cur_comp_info[i]; 00238 dc_in_use[compptr->dc_tbl_no] = 1; 00239 ac_in_use[compptr->ac_tbl_no] = 1; 00240 } 00241 00242 length = 0; 00243 for (i = 0; i < NUM_ARITH_TBLS; i++) 00244 length += dc_in_use[i] + ac_in_use[i]; 00245 00246 emit_marker(cinfo, M_DAC); 00247 00248 emit_2bytes(cinfo, length*2 + 2); 00249 00250 for (i = 0; i < NUM_ARITH_TBLS; i++) { 00251 if (dc_in_use[i]) { 00252 emit_byte(cinfo, i); 00253 emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); 00254 } 00255 if (ac_in_use[i]) { 00256 emit_byte(cinfo, i + 0x10); 00257 emit_byte(cinfo, cinfo->arith_ac_K[i]); 00258 } 00259 } 00260 #endif /* C_ARITH_CODING_SUPPORTED */ 00261 } |
|
Definition at line 184 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, M_DHT, and JHUFF_TBL::sent_table. Referenced by write_scan_header(), and write_tables_only().
00186 { 00187 JHUFF_TBL * htbl; 00188 int length, i; 00189 00190 if (is_ac) { 00191 htbl = cinfo->ac_huff_tbl_ptrs[index]; 00192 index += 0x10; /* output index has AC bit set */ 00193 } else { 00194 htbl = cinfo->dc_huff_tbl_ptrs[index]; 00195 } 00196 00197 if (htbl == NULL) 00198 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); 00199 00200 if (! htbl->sent_table) { 00201 emit_marker(cinfo, M_DHT); 00202 00203 length = 0; 00204 for (i = 1; i <= 16; i++) 00205 length += htbl->bits[i]; 00206 00207 emit_2bytes(cinfo, length + 2 + 1 + 16); 00208 emit_byte(cinfo, index); 00209 00210 for (i = 1; i <= 16; i++) 00211 emit_byte(cinfo, htbl->bits[i]); 00212 00213 for (i = 0; i < length; i++) 00214 emit_byte(cinfo, htbl->huffval[i]); 00215 00216 htbl->sent_table = TRUE; 00217 } 00218 } |
|
Definition at line 144 of file jcmarker.c. References emit_2bytes(), emit_byte, emit_marker(), ERREXIT1, i, 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().
00147 { 00148 JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index]; 00149 int prec; 00150 int i; 00151 00152 if (qtbl == NULL) 00153 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index); 00154 00155 prec = 0; 00156 for (i = 0; i < DCTSIZE2; i++) { 00157 if (qtbl->quantval[i] > 255) 00158 prec = 1; 00159 } 00160 00161 if (! qtbl->sent_table) { 00162 emit_marker(cinfo, M_DQT); 00163 00164 emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); 00165 00166 emit_byte(cinfo, index + (prec<<4)); 00167 00168 for (i = 0; i < DCTSIZE2; i++) { 00169 /* The table entries must be emitted in zigzag order. */ 00170 unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; 00171 if (prec) 00172 emit_byte(cinfo, (int) (qval >> 8)); 00173 emit_byte(cinfo, (int) (qval & 0xFF)); 00174 } 00175 00176 qtbl->sent_table = TRUE; 00177 } 00178 00179 return prec; 00180 } |
|
Definition at line 265 of file jcmarker.c. References emit_2bytes(), emit_marker(), M_DRI, and jpeg_compress_struct::restart_interval. Referenced by write_scan_header().
00267 { 00268 emit_marker(cinfo, M_DRI); 00269 00270 emit_2bytes(cinfo, 4); /* fixed length */ 00271 00272 emit_2bytes(cinfo, (int) cinfo->restart_interval); 00273 } |
|
Definition at line 349 of file jcmarker.c. References jpeg_compress_struct::density_unit, emit_2bytes(), emit_byte, emit_marker(), jpeg_compress_struct::JFIF_major_version, jpeg_compress_struct::JFIF_minor_version, M_APP0, jpeg_compress_struct::X_density, and jpeg_compress_struct::Y_density. Referenced by write_file_header().
00351 { 00352 /* 00353 * Length of APP0 block (2 bytes) 00354 * Block ID (4 bytes - ASCII "JFIF") 00355 * Zero byte (1 byte to terminate the ID string) 00356 * Version Major, Minor (2 bytes - major first) 00357 * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) 00358 * Xdpu (2 bytes - dots per unit horizontal) 00359 * Ydpu (2 bytes - dots per unit vertical) 00360 * Thumbnail X size (1 byte) 00361 * Thumbnail Y size (1 byte) 00362 */ 00363 00364 emit_marker(cinfo, M_APP0); 00365 00366 emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ 00367 00368 emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ 00369 emit_byte(cinfo, 0x46); 00370 emit_byte(cinfo, 0x49); 00371 emit_byte(cinfo, 0x46); 00372 emit_byte(cinfo, 0); 00373 emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */ 00374 emit_byte(cinfo, cinfo->JFIF_minor_version); 00375 emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ 00376 emit_2bytes(cinfo, (int) cinfo->X_density); 00377 emit_2bytes(cinfo, (int) cinfo->Y_density); 00378 emit_byte(cinfo, 0); /* No thumbnail image */ 00379 emit_byte(cinfo, 0); 00380 } |
|
Definition at line 122 of file jcmarker.c. References emit_byte, JPEG_MARKER, and mark. Referenced by emit_adobe_app14(), emit_dac(), emit_dht(), emit_dqt(), emit_dri(), emit_jfif_app0(), emit_sof(), emit_sos(), write_file_header(), write_file_trailer(), write_marker_header(), and write_tables_only().
|
|
Definition at line 277 of file jcmarker.c. References jpeg_compress_struct::comp_info, jpeg_component_info::component_id, compptr, 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, JPEG_MARKER, L, jpeg_compress_struct::num_components, jpeg_component_info::quant_tbl_no, and jpeg_component_info::v_samp_factor. Referenced by write_frame_header().
00279 { 00280 int ci; 00281 jpeg_component_info *compptr; 00282 00283 emit_marker(cinfo, code); 00284 00285 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ 00286 00287 /* Make sure image isn't bigger than SOF field can handle */ 00288 if ((long) cinfo->image_height > 65535L || 00289 (long) cinfo->image_width > 65535L) 00290 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); 00291 00292 emit_byte(cinfo, cinfo->data_precision); 00293 emit_2bytes(cinfo, (int) cinfo->image_height); 00294 emit_2bytes(cinfo, (int) cinfo->image_width); 00295 00296 emit_byte(cinfo, cinfo->num_components); 00297 00298 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00299 ci++, compptr++) { 00300 emit_byte(cinfo, compptr->component_id); 00301 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); 00302 emit_byte(cinfo, compptr->quant_tbl_no); 00303 } 00304 } |
|
Definition at line 308 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, compptr, 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, M_SOS, jpeg_compress_struct::progressive_mode, jpeg_compress_struct::Se, and jpeg_compress_struct::Ss. Referenced by write_scan_header().
00310 { 00311 int i, td, ta; 00312 jpeg_component_info *compptr; 00313 00314 emit_marker(cinfo, M_SOS); 00315 00316 emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ 00317 00318 emit_byte(cinfo, cinfo->comps_in_scan); 00319 00320 for (i = 0; i < cinfo->comps_in_scan; i++) { 00321 compptr = cinfo->cur_comp_info[i]; 00322 emit_byte(cinfo, compptr->component_id); 00323 td = compptr->dc_tbl_no; 00324 ta = compptr->ac_tbl_no; 00325 if (cinfo->progressive_mode) { 00326 /* Progressive mode: only DC or only AC tables are used in one scan; 00327 * furthermore, Huffman coding of DC refinement uses no table at all. 00328 * We emit 0 for unused field(s); this is recommended by the P&M text 00329 * but does not seem to be specified in the standard. 00330 */ 00331 if (cinfo->Ss == 0) { 00332 ta = 0; /* DC scan */ 00333 if (cinfo->Ah != 0 && !cinfo->arith_code) 00334 td = 0; /* no DC table either */ 00335 } else { 00336 td = 0; /* AC scan */ 00337 } 00338 } 00339 emit_byte(cinfo, (td << 4) + ta); 00340 } 00341 00342 emit_byte(cinfo, cinfo->Ss); 00343 emit_byte(cinfo, cinfo->Se); 00344 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); 00345 } |
|
Definition at line 645 of file jcmarker.c. References JPOOL_IMAGE, marker, SIZEOF, write_file_header(), write_file_trailer(), write_frame_header(), write_marker_byte(), write_marker_header(), write_scan_header(), and write_tables_only(). Referenced by jinit_compress_master(), jpeg_write_tables(), and transencode_master_selection().
00646 { 00647 my_marker_ptr marker; 00648 00649 /* Create the subobject */ 00650 marker = (my_marker_ptr) 00651 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00652 SIZEOF(my_marker_writer)); 00653 cinfo->marker = (struct jpeg_marker_writer *) marker; 00654 /* Initialize method pointers */ 00655 marker->pub.write_file_header = write_file_header; 00656 marker->pub.write_frame_header = write_frame_header; 00657 marker->pub.write_scan_header = write_scan_header; 00658 marker->pub.write_file_trailer = write_file_trailer; 00659 marker->pub.write_tables_only = write_tables_only; 00660 marker->pub.write_marker_header = write_marker_header; 00661 marker->pub.write_marker_byte = write_marker_byte; 00662 /* Initialize private state */ 00663 marker->last_restart_interval = 0; 00664 } |
|
Definition at line 469 of file jcmarker.c. References emit_adobe_app14(), emit_jfif_app0(), emit_marker(), M_SOI, jpeg_compress_struct::marker, marker, jpeg_compress_struct::write_Adobe_marker, and jpeg_compress_struct::write_JFIF_header. Referenced by jinit_marker_writer().
00470 { 00471 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; 00472 00473 emit_marker(cinfo, M_SOI); /* first the SOI */ 00474 00475 /* SOI is defined to reset restart interval to 0 */ 00476 marker->last_restart_interval = 0; 00477 00478 if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ 00479 emit_jfif_app0(cinfo); 00480 if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ 00481 emit_adobe_app14(cinfo); 00482 } |
|
Definition at line 602 of file jcmarker.c. References emit_marker(), and M_EOI. Referenced by jinit_marker_writer().
00603 { 00604 emit_marker(cinfo, M_EOI); 00605 } |
|
Definition at line 494 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::arith_code, jpeg_compress_struct::comp_info, compptr, jpeg_compress_struct::data_precision, jpeg_component_info::dc_tbl_no, emit_dqt(), emit_sof(), 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. Referenced by jinit_marker_writer().
00495 { 00496 int ci, prec; 00497 boolean is_baseline; 00498 jpeg_component_info *compptr; 00499 00500 /* Emit DQT for each quantization table. 00501 * Note that emit_dqt() suppresses any duplicate tables. 00502 */ 00503 prec = 0; 00504 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00505 ci++, compptr++) { 00506 prec += emit_dqt(cinfo, compptr->quant_tbl_no); 00507 } 00508 /* now prec is nonzero iff there are any 16-bit quant tables. */ 00509 00510 /* Check for a non-baseline specification. 00511 * Note we assume that Huffman table numbers won't be changed later. 00512 */ 00513 if (cinfo->arith_code || cinfo->progressive_mode || 00514 cinfo->data_precision != 8) { 00515 is_baseline = FALSE; 00516 } else { 00517 is_baseline = TRUE; 00518 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00519 ci++, compptr++) { 00520 if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1) 00521 is_baseline = FALSE; 00522 } 00523 if (prec && is_baseline) { 00524 is_baseline = FALSE; 00525 /* If it's baseline except for quantizer size, warn the user */ 00526 TRACEMS(cinfo, 0, JTRC_16BIT_TABLES); 00527 } 00528 } 00529 00530 /* Emit the proper SOF marker */ 00531 if (cinfo->arith_code) { 00532 emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ 00533 } else { 00534 if (cinfo->progressive_mode) 00535 emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ 00536 else if (is_baseline) 00537 emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ 00538 else 00539 emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ 00540 } 00541 } |
|
Definition at line 450 of file jcmarker.c. References emit_byte. Referenced by jinit_marker_writer(), and jpeg_write_marker().
00452 { 00453 emit_byte(cinfo, val); 00454 } |
|
Definition at line 438 of file jcmarker.c. References datalen, emit_2bytes(), emit_marker(), ERREXIT, JPEG_MARKER, and marker. Referenced by jinit_marker_writer().
00440 { 00441 if (datalen > (unsigned int) 65533) /* safety check */ 00442 ERREXIT(cinfo, JERR_BAD_LENGTH); 00443 00444 emit_marker(cinfo, (JPEG_MARKER) marker); 00445 00446 emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ 00447 } |
|
Definition at line 551 of file jcmarker.c. References jpeg_component_info::ac_tbl_no, jpeg_compress_struct::Ah, jpeg_compress_struct::arith_code, compptr, 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(), i, jpeg_compress_struct::marker, marker, jpeg_compress_struct::progressive_mode, jpeg_compress_struct::restart_interval, and jpeg_compress_struct::Ss. Referenced by jinit_marker_writer().
00552 { 00553 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; 00554 int i; 00555 jpeg_component_info *compptr; 00556 00557 if (cinfo->arith_code) { 00558 /* Emit arith conditioning info. We may have some duplication 00559 * if the file has multiple scans, but it's so small it's hardly 00560 * worth worrying about. 00561 */ 00562 emit_dac(cinfo); 00563 } else { 00564 /* Emit Huffman tables. 00565 * Note that emit_dht() suppresses any duplicate tables. 00566 */ 00567 for (i = 0; i < cinfo->comps_in_scan; i++) { 00568 compptr = cinfo->cur_comp_info[i]; 00569 if (cinfo->progressive_mode) { 00570 /* Progressive mode: only DC or only AC tables are used in one scan */ 00571 if (cinfo->Ss == 0) { 00572 if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ 00573 emit_dht(cinfo, compptr->dc_tbl_no, FALSE); 00574 } else { 00575 emit_dht(cinfo, compptr->ac_tbl_no, TRUE); 00576 } 00577 } else { 00578 /* Sequential mode: need both DC and AC tables */ 00579 emit_dht(cinfo, compptr->dc_tbl_no, FALSE); 00580 emit_dht(cinfo, compptr->ac_tbl_no, TRUE); 00581 } 00582 } 00583 } 00584 00585 /* Emit DRI if required --- note that DRI value could change for each scan. 00586 * We avoid wasting space with unnecessary DRIs, however. 00587 */ 00588 if (cinfo->restart_interval != marker->last_restart_interval) { 00589 emit_dri(cinfo); 00590 marker->last_restart_interval = cinfo->restart_interval; 00591 } 00592 00593 emit_sos(cinfo); 00594 } |
|
Definition at line 616 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(), i, M_EOI, M_SOI, NUM_HUFF_TBLS, NUM_QUANT_TBLS, and jpeg_compress_struct::quant_tbl_ptrs. Referenced by jinit_marker_writer().
00617 { 00618 int i; 00619 00620 emit_marker(cinfo, M_SOI); 00621 00622 for (i = 0; i < NUM_QUANT_TBLS; i++) { 00623 if (cinfo->quant_tbl_ptrs[i] != NULL) 00624 (void) emit_dqt(cinfo, i); 00625 } 00626 00627 if (! cinfo->arith_code) { 00628 for (i = 0; i < NUM_HUFF_TBLS; i++) { 00629 if (cinfo->dc_huff_tbl_ptrs[i] != NULL) 00630 emit_dht(cinfo, i, FALSE); 00631 if (cinfo->ac_huff_tbl_ptrs[i] != NULL) 00632 emit_dht(cinfo, i, TRUE); 00633 } 00634 } 00635 00636 emit_marker(cinfo, M_EOI); 00637 } |