Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

669 lines
17 KiB

  1. /*
  2. * jcmarker.c
  3. *
  4. * Copyright (C) 1991-1995, Thomas G. Lane.
  5. * This file is part of the Independent JPEG Group's software.
  6. * For conditions of distribution and use, see the accompanying README file.
  7. *
  8. * This file contains routines to write JPEG datastream markers.
  9. */
  10. /* SCCSID = "@(#)jcmarker.cc 1.3 13:47:47 01/31/97" */
  11. #define JPEG_INTERNALS
  12. #include "jinclude.h"
  13. #include "jpeglib.h"
  14. typedef enum { /* JPEG marker codes */
  15. M_SOF0 = 0xc0,
  16. M_SOF1 = 0xc1,
  17. M_SOF2 = 0xc2,
  18. M_SOF3 = 0xc3,
  19. M_SOF5 = 0xc5,
  20. M_SOF6 = 0xc6,
  21. M_SOF7 = 0xc7,
  22. M_JPG = 0xc8,
  23. M_SOF9 = 0xc9,
  24. M_SOF10 = 0xca,
  25. M_SOF11 = 0xcb,
  26. M_SOF13 = 0xcd,
  27. M_SOF14 = 0xce,
  28. M_SOF15 = 0xcf,
  29. M_DHT = 0xc4,
  30. M_DAC = 0xcc,
  31. M_RST0 = 0xd0,
  32. M_RST1 = 0xd1,
  33. M_RST2 = 0xd2,
  34. M_RST3 = 0xd3,
  35. M_RST4 = 0xd4,
  36. M_RST5 = 0xd5,
  37. M_RST6 = 0xd6,
  38. M_RST7 = 0xd7,
  39. M_SOI = 0xd8,
  40. M_EOI = 0xd9,
  41. M_SOS = 0xda,
  42. M_DQT = 0xdb,
  43. M_DNL = 0xdc,
  44. M_DRI = 0xdd,
  45. M_DHP = 0xde,
  46. M_EXP = 0xdf,
  47. M_APP0 = 0xe0,
  48. M_APP1 = 0xe1,
  49. M_APP2 = 0xe2,
  50. M_APP3 = 0xe3,
  51. M_APP4 = 0xe4,
  52. M_APP5 = 0xe5,
  53. M_APP6 = 0xe6,
  54. M_APP7 = 0xe7,
  55. M_APP8 = 0xe8,
  56. M_APP9 = 0xe9,
  57. M_APP10 = 0xea,
  58. M_APP11 = 0xeb,
  59. M_APP12 = 0xec,
  60. M_APP13 = 0xed,
  61. M_APP14 = 0xee,
  62. M_APP15 = 0xef,
  63. M_JPG0 = 0xf0,
  64. M_JPG13 = 0xfd,
  65. M_COM = 0xfe,
  66. M_TEM = 0x01,
  67. M_ERROR = 0x100
  68. } JPEG_MARKER;
  69. /*
  70. * Basic output routines.
  71. *
  72. * Note that we do not support suspension while writing a marker.
  73. * Therefore, an application using suspension must ensure that there is
  74. * enough buffer space for the initial markers (typ. 600-700 bytes) before
  75. * calling jpeg_start_compress, and enough space to write the trailing EOI
  76. * (a few bytes) before calling jpeg_finish_compress. Multipass compression
  77. * modes are not supported at all with suspension, so those two are the only
  78. * points where markers will be written.
  79. */
  80. LOCAL void
  81. emit_byte (j_compress_ptr cinfo, int val)
  82. /* Emit a byte */
  83. {
  84. struct jpeg_destination_mgr * dest = cinfo->dest;
  85. *(dest->next_output_byte)++ = (JOCTET) val;
  86. if (--dest->free_in_buffer == 0) {
  87. if (! (*dest->empty_output_buffer) (cinfo))
  88. ERREXIT(cinfo, JERR_CANT_SUSPEND);
  89. }
  90. }
  91. LOCAL void
  92. emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
  93. /* Emit a marker code */
  94. {
  95. emit_byte(cinfo, 0xFF);
  96. emit_byte(cinfo, (int) mark);
  97. }
  98. LOCAL void
  99. emit_2bytes (j_compress_ptr cinfo, int value)
  100. /* Emit a 2-byte integer; these are always MSB first in JPEG files */
  101. {
  102. emit_byte(cinfo, (value >> 8) & 0xFF);
  103. emit_byte(cinfo, value & 0xFF);
  104. }
  105. /*
  106. * Routines to write specific marker types.
  107. */
  108. LOCAL int
  109. emit_dqt (j_compress_ptr cinfo, int index)
  110. /* Emit a DQT marker */
  111. /* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
  112. {
  113. JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
  114. int prec;
  115. int i;
  116. if (qtbl == NULL)
  117. ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
  118. prec = 0;
  119. for (i = 0; i < DCTSIZE2; i++) {
  120. if (qtbl->quantval[i] > 255)
  121. prec = 1;
  122. }
  123. if (! qtbl->sent_table) {
  124. emit_marker(cinfo, M_DQT);
  125. emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
  126. emit_byte(cinfo, index + (prec<<4));
  127. for (i = 0; i < DCTSIZE2; i++) {
  128. if (prec)
  129. emit_byte(cinfo, qtbl->quantval[i] >> 8);
  130. emit_byte(cinfo, qtbl->quantval[i] & 0xFF);
  131. }
  132. qtbl->sent_table = TRUE;
  133. }
  134. return prec;
  135. }
  136. LOCAL void
  137. emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
  138. /* Emit a DHT marker */
  139. {
  140. JHUFF_TBL * htbl;
  141. int length, i;
  142. if (is_ac) {
  143. htbl = cinfo->ac_huff_tbl_ptrs[index];
  144. index += 0x10; /* output index has AC bit set */
  145. } else {
  146. htbl = cinfo->dc_huff_tbl_ptrs[index];
  147. }
  148. if (htbl == NULL)
  149. ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
  150. if (! htbl->sent_table) {
  151. emit_marker(cinfo, M_DHT);
  152. length = 0;
  153. for (i = 1; i <= 16; i++)
  154. length += htbl->bits[i];
  155. emit_2bytes(cinfo, length + 2 + 1 + 16);
  156. emit_byte(cinfo, index);
  157. for (i = 1; i <= 16; i++)
  158. emit_byte(cinfo, htbl->bits[i]);
  159. for (i = 0; i < length; i++)
  160. emit_byte(cinfo, htbl->huffval[i]);
  161. htbl->sent_table = TRUE;
  162. }
  163. }
  164. LOCAL void
  165. emit_dac (j_compress_ptr cinfo)
  166. /* Emit a DAC marker */
  167. /* Since the useful info is so small, we want to emit all the tables in */
  168. /* one DAC marker. Therefore this routine does its own scan of the table. */
  169. {
  170. #ifdef C_ARITH_CODING_SUPPORTED
  171. char dc_in_use[NUM_ARITH_TBLS];
  172. char ac_in_use[NUM_ARITH_TBLS];
  173. int length, i;
  174. jpeg_component_info *compptr;
  175. for (i = 0; i < NUM_ARITH_TBLS; i++)
  176. dc_in_use[i] = ac_in_use[i] = 0;
  177. for (i = 0; i < cinfo->comps_in_scan; i++) {
  178. compptr = cinfo->cur_comp_info[i];
  179. dc_in_use[compptr->dc_tbl_no] = 1;
  180. ac_in_use[compptr->ac_tbl_no] = 1;
  181. }
  182. length = 0;
  183. for (i = 0; i < NUM_ARITH_TBLS; i++)
  184. length += dc_in_use[i] + ac_in_use[i];
  185. emit_marker(cinfo, M_DAC);
  186. emit_2bytes(cinfo, length*2 + 2);
  187. for (i = 0; i < NUM_ARITH_TBLS; i++) {
  188. if (dc_in_use[i]) {
  189. emit_byte(cinfo, i);
  190. emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
  191. }
  192. if (ac_in_use[i]) {
  193. emit_byte(cinfo, i + 0x10);
  194. emit_byte(cinfo, cinfo->arith_ac_K[i]);
  195. }
  196. }
  197. #endif /* C_ARITH_CODING_SUPPORTED */
  198. }
  199. LOCAL void
  200. emit_dri (j_compress_ptr cinfo)
  201. /* Emit a DRI marker */
  202. {
  203. emit_marker(cinfo, M_DRI);
  204. emit_2bytes(cinfo, 4); /* fixed length */
  205. emit_2bytes(cinfo, (int) cinfo->restart_interval);
  206. }
  207. LOCAL void
  208. emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
  209. /* Emit a SOF marker */
  210. {
  211. int ci;
  212. jpeg_component_info *compptr;
  213. emit_marker(cinfo, code);
  214. emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
  215. /* Make sure image isn't bigger than SOF field can handle */
  216. if ((long) cinfo->image_height > 65535L ||
  217. (long) cinfo->image_width > 65535L)
  218. ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
  219. emit_byte(cinfo, cinfo->data_precision);
  220. emit_2bytes(cinfo, (int) cinfo->image_height);
  221. emit_2bytes(cinfo, (int) cinfo->image_width);
  222. emit_byte(cinfo, cinfo->num_components);
  223. for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  224. ci++, compptr++) {
  225. emit_byte(cinfo, compptr->component_id);
  226. emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
  227. emit_byte(cinfo, compptr->quant_tbl_no);
  228. }
  229. }
  230. LOCAL void
  231. emit_sos (j_compress_ptr cinfo)
  232. /* Emit a SOS marker */
  233. {
  234. int i, td, ta;
  235. jpeg_component_info *compptr;
  236. emit_marker(cinfo, M_SOS);
  237. emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
  238. emit_byte(cinfo, cinfo->comps_in_scan);
  239. for (i = 0; i < cinfo->comps_in_scan; i++) {
  240. compptr = cinfo->cur_comp_info[i];
  241. emit_byte(cinfo, compptr->component_id);
  242. td = compptr->dc_tbl_no;
  243. ta = compptr->ac_tbl_no;
  244. if (cinfo->progressive_mode) {
  245. /* Progressive mode: only DC or only AC tables are used in one scan;
  246. * furthermore, Huffman coding of DC refinement uses no table at all.
  247. * We emit 0 for unused field(s); this is recommended by the P&M text
  248. * but does not seem to be specified in the standard.
  249. */
  250. if (cinfo->Ss == 0) {
  251. ta = 0; /* DC scan */
  252. if (cinfo->Ah != 0 && !cinfo->arith_code)
  253. td = 0; /* no DC table either */
  254. } else {
  255. td = 0; /* AC scan */
  256. }
  257. }
  258. emit_byte(cinfo, (td << 4) + ta);
  259. }
  260. emit_byte(cinfo, cinfo->Ss);
  261. emit_byte(cinfo, cinfo->Se);
  262. emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
  263. }
  264. LOCAL void
  265. emit_jfif_app0 (j_compress_ptr cinfo)
  266. /* Emit a JFIF-compliant APP0 marker */
  267. {
  268. /*
  269. * Length of APP0 block (2 bytes)
  270. * Block ID (4 bytes - ASCII "JFIF")
  271. * Zero byte (1 byte to terminate the ID string)
  272. * Version Major, Minor (2 bytes - 0x01, 0x01)
  273. * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
  274. * Xdpu (2 bytes - dots per unit horizontal)
  275. * Ydpu (2 bytes - dots per unit vertical)
  276. * Thumbnail X size (1 byte)
  277. * Thumbnail Y size (1 byte)
  278. */
  279. emit_marker(cinfo, M_APP0);
  280. emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
  281. emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
  282. emit_byte(cinfo, 0x46);
  283. emit_byte(cinfo, 0x49);
  284. emit_byte(cinfo, 0x46);
  285. emit_byte(cinfo, 0);
  286. /* We currently emit version code 1.01 since we use no 1.02 features.
  287. * This may avoid complaints from some older decoders.
  288. */
  289. emit_byte(cinfo, 1); /* Major version */
  290. emit_byte(cinfo, 1); /* Minor version */
  291. emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
  292. emit_2bytes(cinfo, (int) cinfo->X_density);
  293. emit_2bytes(cinfo, (int) cinfo->Y_density);
  294. emit_byte(cinfo, 0); /* No thumbnail image */
  295. emit_byte(cinfo, 0);
  296. }
  297. LOCAL void
  298. emit_adobe_app14 (j_compress_ptr cinfo)
  299. /* Emit an Adobe APP14 marker */
  300. {
  301. /*
  302. * Length of APP14 block (2 bytes)
  303. * Block ID (5 bytes - ASCII "Adobe")
  304. * Version Number (2 bytes - currently 100)
  305. * Flags0 (2 bytes - currently 0)
  306. * Flags1 (2 bytes - currently 0)
  307. * Color transform (1 byte)
  308. *
  309. * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
  310. * now in circulation seem to use Version = 100, so that's what we write.
  311. *
  312. * We write the color transform byte as 1 if the JPEG color space is
  313. * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
  314. * whether the encoder performed a transformation, which is pretty useless.
  315. */
  316. emit_marker(cinfo, M_APP14);
  317. emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
  318. emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
  319. emit_byte(cinfo, 0x64);
  320. emit_byte(cinfo, 0x6F);
  321. emit_byte(cinfo, 0x62);
  322. emit_byte(cinfo, 0x65);
  323. emit_2bytes(cinfo, 100); /* Version */
  324. emit_2bytes(cinfo, 0); /* Flags0 */
  325. emit_2bytes(cinfo, 0); /* Flags1 */
  326. switch (cinfo->jpeg_color_space) {
  327. case JCS_YCbCr:
  328. emit_byte(cinfo, 1); /* Color transform = 1 */
  329. break;
  330. case JCS_YCCK:
  331. emit_byte(cinfo, 2); /* Color transform = 2 */
  332. break;
  333. default:
  334. emit_byte(cinfo, 0); /* Color transform = 0 */
  335. break;
  336. }
  337. }
  338. /*
  339. * This routine is exported for possible use by applications.
  340. * The intended use is to emit COM or APPn markers after calling
  341. * jpeg_start_compress() and before the first jpeg_write_scanlines() call
  342. * (hence, after write_file_header but before write_frame_header).
  343. * Other uses are not guaranteed to produce desirable results.
  344. */
  345. METHODDEF void
  346. write_any_marker (j_compress_ptr cinfo, int marker,
  347. const JOCTET *dataptr, unsigned int datalen)
  348. /* Emit an arbitrary marker with parameters */
  349. {
  350. if (datalen <= (unsigned int) 65533) { /* safety check */
  351. emit_marker(cinfo, (JPEG_MARKER) marker);
  352. emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
  353. while (datalen--) {
  354. emit_byte(cinfo, *dataptr);
  355. dataptr++;
  356. }
  357. }
  358. }
  359. /*
  360. * Write datastream header.
  361. * This consists of an SOI and optional APPn markers.
  362. * We recommend use of the JFIF marker, but not the Adobe marker,
  363. * when using YCbCr or grayscale data. The JFIF marker should NOT
  364. * be used for any other JPEG colorspace. The Adobe marker is helpful
  365. * to distinguish RGB, CMYK, and YCCK colorspaces.
  366. * Note that an application can write additional header markers after
  367. * jpeg_start_compress returns.
  368. */
  369. METHODDEF void
  370. write_file_header (j_compress_ptr cinfo)
  371. {
  372. emit_marker(cinfo, M_SOI); /* first the SOI */
  373. if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
  374. emit_jfif_app0(cinfo);
  375. if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
  376. emit_adobe_app14(cinfo);
  377. }
  378. /*
  379. * Write frame header.
  380. * This consists of DQT and SOFn markers.
  381. * Note that we do not emit the SOF until we have emitted the DQT(s).
  382. * This avoids compatibility problems with incorrect implementations that
  383. * try to error-check the quant table numbers as soon as they see the SOF.
  384. */
  385. METHODDEF void
  386. write_frame_header (j_compress_ptr cinfo)
  387. {
  388. int ci, prec;
  389. boolean is_baseline;
  390. jpeg_component_info *compptr;
  391. /* Emit DQT for each quantization table.
  392. * Note that emit_dqt() suppresses any duplicate tables.
  393. */
  394. prec = 0;
  395. for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  396. ci++, compptr++) {
  397. prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  398. }
  399. /* now prec is nonzero iff there are any 16-bit quant tables. */
  400. /* Check for a non-baseline specification.
  401. * Note we assume that Huffman table numbers won't be changed later.
  402. */
  403. if (cinfo->arith_code || cinfo->progressive_mode ||
  404. cinfo->data_precision != 8) {
  405. is_baseline = FALSE;
  406. } else {
  407. is_baseline = TRUE;
  408. for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  409. ci++, compptr++) {
  410. if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
  411. is_baseline = FALSE;
  412. }
  413. if (prec && is_baseline) {
  414. is_baseline = FALSE;
  415. /* If it's baseline except for quantizer size, warn the user */
  416. TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
  417. }
  418. }
  419. /* Emit the proper SOF marker */
  420. if (cinfo->arith_code) {
  421. emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
  422. } else {
  423. if (cinfo->progressive_mode)
  424. emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
  425. else if (is_baseline)
  426. emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
  427. else
  428. emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
  429. }
  430. }
  431. /*
  432. * Write scan header.
  433. * This consists of DHT or DAC markers, optional DRI, and SOS.
  434. * Compressed data will be written following the SOS.
  435. */
  436. METHODDEF void
  437. write_scan_header (j_compress_ptr cinfo)
  438. {
  439. int i;
  440. jpeg_component_info *compptr;
  441. if (cinfo->arith_code) {
  442. /* Emit arith conditioning info. We may have some duplication
  443. * if the file has multiple scans, but it's so small it's hardly
  444. * worth worrying about.
  445. */
  446. emit_dac(cinfo);
  447. } else {
  448. /* Emit Huffman tables.
  449. * Note that emit_dht() suppresses any duplicate tables.
  450. */
  451. for (i = 0; i < cinfo->comps_in_scan; i++) {
  452. compptr = cinfo->cur_comp_info[i];
  453. if (cinfo->progressive_mode) {
  454. /* Progressive mode: only DC or only AC tables are used in one scan */
  455. if (cinfo->Ss == 0) {
  456. if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
  457. emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
  458. } else {
  459. emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
  460. }
  461. } else {
  462. /* Sequential mode: need both DC and AC tables */
  463. emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
  464. emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
  465. }
  466. }
  467. }
  468. /* Emit DRI if required --- note that DRI value could change for each scan.
  469. * If it doesn't, a tiny amount of space is wasted in multiple-scan files.
  470. * We assume DRI will never be nonzero for one scan and zero for a later one.
  471. */
  472. if (cinfo->restart_interval)
  473. emit_dri(cinfo);
  474. emit_sos(cinfo);
  475. }
  476. /*
  477. * Write datastream trailer.
  478. */
  479. METHODDEF void
  480. write_file_trailer (j_compress_ptr cinfo)
  481. {
  482. emit_marker(cinfo, M_EOI);
  483. }
  484. /*
  485. * Write an abbreviated table-specification datastream.
  486. * This consists of SOI, DQT and DHT tables, and EOI.
  487. * Any table that is defined and not marked sent_table = TRUE will be
  488. * emitted. Note that all tables will be marked sent_table = TRUE at exit.
  489. */
  490. METHODDEF void
  491. write_tables_only (j_compress_ptr cinfo)
  492. {
  493. int i;
  494. #ifdef NIFTY
  495. int ci, prec;
  496. jpeg_component_info *compptr;
  497. emit_marker(cinfo, M_SOI);
  498. /* Emit DQT for each quantization table.
  499. * Only emit those tables that are actually associated with image components.
  500. * Note that emit_dqt() suppresses any duplicate tables.
  501. */
  502. prec = 0;
  503. for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  504. ci++, compptr++) {
  505. prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  506. }
  507. if (! cinfo->arith_code) {
  508. for (i = 0; i < NUM_HUFF_TBLS; i++) {
  509. if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
  510. emit_dht(cinfo, i, FALSE);
  511. if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
  512. emit_dht(cinfo, i, TRUE);
  513. }
  514. }
  515. emit_marker(cinfo, M_EOI);
  516. #else
  517. emit_marker(cinfo, M_SOI);
  518. for (i = 0; i < NUM_QUANT_TBLS; i++) {
  519. if (cinfo->quant_tbl_ptrs[i] != NULL)
  520. (void) emit_dqt(cinfo, i);
  521. }
  522. if (! cinfo->arith_code) {
  523. for (i = 0; i < NUM_HUFF_TBLS; i++) {
  524. if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
  525. emit_dht(cinfo, i, FALSE);
  526. if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
  527. emit_dht(cinfo, i, TRUE);
  528. }
  529. }
  530. emit_marker(cinfo, M_EOI);
  531. #endif
  532. }
  533. /*
  534. * Initialize the marker writer module.
  535. */
  536. GLOBAL void
  537. jinit_marker_writer (j_compress_ptr cinfo)
  538. {
  539. /* Create the subobject */
  540. cinfo->marker = (struct jpeg_marker_writer *)
  541. (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
  542. SIZEOF(struct jpeg_marker_writer));
  543. /* Initialize method pointers */
  544. cinfo->marker->write_any_marker = write_any_marker;
  545. cinfo->marker->write_file_header = write_file_header;
  546. cinfo->marker->write_frame_header = write_frame_header;
  547. cinfo->marker->write_scan_header = write_scan_header;
  548. cinfo->marker->write_file_trailer = write_file_trailer;
  549. cinfo->marker->write_tables_only = write_tables_only;
  550. }