home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume29 / jpeg / part17 < prev    next >
Text File  |  1992-03-28  |  55KB  |  1,543 lines

  1. Newsgroups: comp.sources.misc
  2. From: jpeg-info@uunet.uu.net (Independent JPEG Group)
  3. Subject:  v29i017:  jpeg - JPEG image compression, Part17/18
  4. Message-ID: <1992Mar25.145500.894@sparky.imd.sterling.com>
  5. X-Md4-Signature: 5b5d61f034203cb46524dcff2236363e
  6. Date: Wed, 25 Mar 1992 14:55:00 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jpeg-info@uunet.uu.net (Independent JPEG Group)
  10. Posting-number: Volume 29, Issue 17
  11. Archive-name: jpeg/part17
  12. Environment: UNIX, VMS, MS-DOS, Mac, Amiga, Cray
  13.  
  14. #! /bin/sh
  15. # into a shell via "sh file" or similar.  To overwrite existing files,
  16. # type "sh file -c".
  17. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  18. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  19. # Contents:  cjpeg.1 jcmaster.c jcmcu.c jdmaster.c jmemdos.h jmemsys.h
  20. #   jwrppm.c makcjpeg.cf makcjpeg.lst makdjpeg.lst makefile.mc6
  21. #   makefile.pwc
  22. # Wrapped by kent@sparky on Mon Mar 23 16:02:57 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 17 (of 18)."'
  26. if test -f 'cjpeg.1' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'cjpeg.1'\"
  28. else
  29.   echo shar: Extracting \"'cjpeg.1'\" \(4126 characters\)
  30.   sed "s/^X//" >'cjpeg.1' <<'END_OF_FILE'
  31. X.TH CJPEG 1 "28 February 1992"
  32. X.SH NAME
  33. Xcjpeg \- compress an image file to a JPEG file
  34. X.SH SYNOPSIS
  35. X.B cjpeg
  36. X[
  37. X.BI \-Q " quality"
  38. X]
  39. X[
  40. X.B \-oTIad
  41. X]
  42. X[
  43. X.BI \-m " memory"
  44. X]
  45. X[
  46. X.I filename
  47. X]
  48. X.LP
  49. X.SH DESCRIPTION
  50. X.LP
  51. X.B cjpeg
  52. Xcompresses the named image file, or the standard input if no file is
  53. Xnamed, and produces a JPEG/JFIF file on the standard output.
  54. XThe currently supported image file formats are: PPM (PBMPLUS color
  55. Xformat), PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster
  56. XToolkit format).  (RLE is supported only if the URT library is available.)
  57. X.SH OPTIONS
  58. X.TP
  59. X.BI \-Q " quality"
  60. XScale quantization tables to adjust image quality.  Quality is 0 (worst) to
  61. X100 (best); default is 75.  (See below for more info.)
  62. X.TP
  63. X.B \-o
  64. XPerform optimization of entropy encoding parameters.  Without this, default
  65. Xencoding parameters are used.
  66. X.B \-o
  67. Xusually makes the JPEG file a little smaller, but
  68. X.B cjpeg
  69. Xruns somewhat slower and needs much more memory.  Image quality and speed of
  70. Xdecompression are unaffected by
  71. X.BR \-o .
  72. X.TP
  73. X.B \-T
  74. XInput file is Targa format.  Targa files that contain an "identification"
  75. Xfield will not be automatically recognized by
  76. X.BR cjpeg ;
  77. Xfor such files you must specify
  78. X.B \-T
  79. Xto force
  80. X.B cjpeg
  81. Xto treat the input as Targa format.
  82. X.TP
  83. X.B \-I
  84. XGenerate noninterleaved JPEG file (not yet supported).
  85. X.TP
  86. X.B \-a
  87. XUse arithmetic coding rather than Huffman coding (not currently
  88. Xsupported for legal reasons).
  89. X.TP
  90. X.B \-d
  91. XEnable debug printout.  More
  92. X.BR \-d 's
  93. Xgive more output.  Also, version information is printed at startup.
  94. X.TP
  95. X.BI \-m " memory"
  96. XSet limit for amount of memory to use in processing large images.  Value is
  97. Xin thousands of bytes, or millions of bytes if "M" is attached to the
  98. Xnumber.  For example,
  99. X.B \-m 4m
  100. Xselects 4000000 bytes.  If more space is needed, temporary files will be used.
  101. X.PP
  102. XThe
  103. X.B \-Q
  104. Xswitch lets you trade off compressed file size against quality of the
  105. Xreconstructed image: the higher the
  106. X.B \-Q
  107. Xsetting, the larger the JPEG file, and the closer the output image will be to
  108. Xthe original input.  Normally you want to use the lowest
  109. X.B \-Q
  110. Xsetting (smallest file) that decompresses into something visually
  111. Xindistinguishable from the original image.  For this purpose the
  112. X.B \-Q
  113. Xsetting should be between 50 and 95; the default of 75 is often about right.
  114. XIf you see defects at 
  115. X.B \-Q
  116. X75, then go up 5 or 10 counts at a time until you are happy with the output
  117. Ximage.  (The optimal setting will vary from one image to another.)
  118. X.PP
  119. X.B \-Q
  120. X100 will generate a quantization table of all 1's, eliminating loss in the
  121. Xquantization step (but there is still information loss in subsampling, as well
  122. Xas roundoff error).  This setting is mainly of interest for experimental
  123. Xpurposes.  
  124. X.B \-Q
  125. Xvalues above about 95 are
  126. X.B not
  127. Xrecommended for normal use; the compressed file size goes up dramatically for
  128. Xhardly any gain in output image quality.
  129. X.PP
  130. XIn the other direction, 
  131. X.B \-Q
  132. Xvalues below 50 will produce very small files of low image quality.  Settings
  133. Xaround 5 to 10 might be useful in preparing an index of a large image library,
  134. Xfor example.  Try
  135. X.B \-Q
  136. X2 (or so) for some amusing Cubist effects.  (Note: 
  137. X.B \-Q
  138. Xvalues below about 25 generate 2-byte quantization tables, which are
  139. Xconsidered optional in the JPEG standard.  
  140. X.B cjpeg
  141. Xemits a warning message when you give such a
  142. X.B \-Q
  143. Xvalue, because some commercial JPEG programs may be unable to decode the
  144. Xresulting file.)
  145. X.SH EXAMPLES
  146. X.LP
  147. XThis example compresses the PPM file foo.ppm with a quality factor of
  148. X60 and saves the output as foo.jpg:
  149. X.IP
  150. X.B cjpeg \-Q
  151. X.I 60 foo.ppm
  152. X.B >
  153. X.I foo.jpg
  154. X.SH SEE ALSO
  155. X.BR djpeg (1)
  156. X.br
  157. X.BR ppm (5),
  158. X.BR pgm (5)
  159. X.br
  160. XWallace, Gregory K.  "The JPEG Still Picture Compression Standard",
  161. XCommunications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
  162. X.SH AUTHOR
  163. XIndependent JPEG Group
  164. X.SH BUGS
  165. XArithmetic coding and interleaved output not yet supported.
  166. X.PP
  167. XNot all variants of Targa file format are supported.
  168. X.PP
  169. XThe
  170. X.B -T
  171. Xswitch is not a bug, it's a feature.  (It would be a bug if the Targa format
  172. Xdesigners had not been clueless.)
  173. X.PP
  174. XNot as fast as we'd like.
  175. END_OF_FILE
  176.   if test 4126 -ne `wc -c <'cjpeg.1'`; then
  177.     echo shar: \"'cjpeg.1'\" unpacked with wrong size!
  178.   fi
  179.   # end of 'cjpeg.1'
  180. fi
  181. if test -f 'jcmaster.c' -a "${1}" != "-c" ; then 
  182.   echo shar: Will not clobber existing file \"'jcmaster.c'\"
  183. else
  184.   echo shar: Extracting \"'jcmaster.c'\" \(4201 characters\)
  185.   sed "s/^X//" >'jcmaster.c' <<'END_OF_FILE'
  186. X/*
  187. X * jcmaster.c
  188. X *
  189. X * Copyright (C) 1991, 1992, Thomas G. Lane.
  190. X * This file is part of the Independent JPEG Group's software.
  191. X * For conditions of distribution and use, see the accompanying README file.
  192. X *
  193. X * This file contains the main control for the JPEG compressor.
  194. X * The system-dependent (user interface) code should call jpeg_compress()
  195. X * after doing appropriate setup of the compress_info_struct parameter.
  196. X */
  197. X
  198. X#include "jinclude.h"
  199. X
  200. X
  201. XMETHODDEF void
  202. Xc_per_scan_method_selection (compress_info_ptr cinfo)
  203. X/* Central point for per-scan method selection */
  204. X{
  205. X  /* Edge expansion */
  206. X  jselexpand(cinfo);
  207. X  /* Subsampling of pixels */
  208. X  jselsubsample(cinfo);
  209. X  /* MCU extraction */
  210. X  jselcmcu(cinfo);
  211. X}
  212. X
  213. X
  214. XLOCAL void
  215. Xc_initial_method_selection (compress_info_ptr cinfo)
  216. X/* Central point for initial method selection */
  217. X{
  218. X  /* Input image reading method selection is already done. */
  219. X  /* So is output file header formatting (both are done by user interface). */
  220. X
  221. X  /* Gamma and color space conversion */
  222. X  jselccolor(cinfo);
  223. X  /* Entropy encoding: either Huffman or arithmetic coding. */
  224. X#ifdef ARITH_CODING_SUPPORTED
  225. X  jselcarithmetic(cinfo);
  226. X#else
  227. X  cinfo->arith_code = FALSE;    /* force Huffman mode */
  228. X#endif
  229. X  jselchuffman(cinfo);
  230. X  /* Pipeline control */
  231. X  jselcpipeline(cinfo);
  232. X  /* Overall control (that's me!) */
  233. X  cinfo->methods->c_per_scan_method_selection = c_per_scan_method_selection;
  234. X}
  235. X
  236. X
  237. XLOCAL void
  238. Xinitial_setup (compress_info_ptr cinfo)
  239. X/* Do computations that are needed before initial method selection */
  240. X{
  241. X  short ci;
  242. X  jpeg_component_info *compptr;
  243. X
  244. X  /* Compute maximum sampling factors; check factor validity */
  245. X  cinfo->max_h_samp_factor = 1;
  246. X  cinfo->max_v_samp_factor = 1;
  247. X  for (ci = 0; ci < cinfo->num_components; ci++) {
  248. X    compptr = &cinfo->comp_info[ci];
  249. X    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
  250. X    compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
  251. X      ERREXIT(cinfo->emethods, "Bogus sampling factors");
  252. X    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  253. X                   compptr->h_samp_factor);
  254. X    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  255. X                   compptr->v_samp_factor);
  256. X
  257. X  }
  258. X
  259. X  /* Compute logical subsampled dimensions of components */
  260. X  for (ci = 0; ci < cinfo->num_components; ci++) {
  261. X    compptr = &cinfo->comp_info[ci];
  262. X    compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor
  263. X                + cinfo->max_h_samp_factor - 1)
  264. X                / cinfo->max_h_samp_factor;
  265. X    compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor
  266. X                 + cinfo->max_v_samp_factor - 1)
  267. X                 / cinfo->max_v_samp_factor;
  268. X  }
  269. X}
  270. X
  271. X
  272. X/*
  273. X * This is the main entry point to the JPEG compressor.
  274. X */
  275. X
  276. X
  277. XGLOBAL void
  278. Xjpeg_compress (compress_info_ptr cinfo)
  279. X{
  280. X  /* Init pass counts to 0 --- total_passes is adjusted in method selection */
  281. X  cinfo->total_passes = 0;
  282. X  cinfo->completed_passes = 0;
  283. X
  284. X  /* Read the input file header: determine image size & component count.
  285. X   * NOTE: the user interface must have initialized the input_init method
  286. X   * pointer (eg, by calling jselrppm) before calling me.
  287. X   * The other file reading methods (get_input_row etc.) were probably
  288. X   * set at the same time, but could be set up by input_init itself,
  289. X   * or by c_ui_method_selection.
  290. X   */
  291. X  (*cinfo->methods->input_init) (cinfo);
  292. X
  293. X  /* Give UI a chance to adjust compression parameters and select */
  294. X  /* output file format based on results of input_init. */
  295. X  (*cinfo->methods->c_ui_method_selection) (cinfo);
  296. X
  297. X  /* Now select methods for compression steps. */
  298. X  initial_setup(cinfo);
  299. X  c_initial_method_selection(cinfo);
  300. X
  301. X  /* Initialize the output file & other modules as needed */
  302. X  /* (entropy_encoder is inited by pipeline controller) */
  303. X
  304. X  (*cinfo->methods->colorin_init) (cinfo);
  305. X  (*cinfo->methods->write_file_header) (cinfo);
  306. X
  307. X  /* And let the pipeline controller do the rest. */
  308. X  (*cinfo->methods->c_pipeline_controller) (cinfo);
  309. X
  310. X  /* Finish output file, release working storage, etc */
  311. X  (*cinfo->methods->write_file_trailer) (cinfo);
  312. X  (*cinfo->methods->colorin_term) (cinfo);
  313. X  (*cinfo->methods->input_term) (cinfo);
  314. X
  315. X  (*cinfo->emethods->free_all) ();
  316. X
  317. X  /* My, that was easy, wasn't it? */
  318. X}
  319. END_OF_FILE
  320.   if test 4201 -ne `wc -c <'jcmaster.c'`; then
  321.     echo shar: \"'jcmaster.c'\" unpacked with wrong size!
  322.   fi
  323.   # end of 'jcmaster.c'
  324. fi
  325. if test -f 'jcmcu.c' -a "${1}" != "-c" ; then 
  326.   echo shar: Will not clobber existing file \"'jcmcu.c'\"
  327. else
  328.   echo shar: Extracting \"'jcmcu.c'\" \(5804 characters\)
  329.   sed "s/^X//" >'jcmcu.c' <<'END_OF_FILE'
  330. X/*
  331. X * jcmcu.c
  332. X *
  333. X * Copyright (C) 1991, 1992, Thomas G. Lane.
  334. X * This file is part of the Independent JPEG Group's software.
  335. X * For conditions of distribution and use, see the accompanying README file.
  336. X *
  337. X * This file contains MCU extraction routines and quantization scaling.
  338. X * These routines are invoked via the extract_MCUs and
  339. X * extract_init/term methods.
  340. X */
  341. X
  342. X#include "jinclude.h"
  343. X
  344. X
  345. X/*
  346. X * If this file is compiled with -DDCT_ERR_STATS, it will reverse-DCT each
  347. X * block and sum the total errors across the whole picture.  This provides
  348. X * a convenient method of using real picture data to test the roundoff error
  349. X * of a DCT algorithm.  DCT_ERR_STATS should *not* be defined for a production
  350. X * compression program, since compression is much slower with it defined.
  351. X * Also note that jrevdct.o must be linked into the compressor when this
  352. X * switch is defined.
  353. X */
  354. X
  355. X#ifdef DCT_ERR_STATS
  356. Xstatic int dcterrorsum;        /* these hold the error statistics */
  357. Xstatic int dcterrormax;
  358. Xstatic int dctcoefcount;    /* This will probably overflow on a 16-bit-int machine */
  359. X#endif
  360. X
  361. X
  362. X/* ZAG[i] is the natural-order position of the i'th element of zigzag order. */
  363. X
  364. Xstatic const short ZAG[DCTSIZE2] = {
  365. X  0,  1,  8, 16,  9,  2,  3, 10,
  366. X 17, 24, 32, 25, 18, 11,  4,  5,
  367. X 12, 19, 26, 33, 40, 48, 41, 34,
  368. X 27, 20, 13,  6,  7, 14, 21, 28,
  369. X 35, 42, 49, 56, 57, 50, 43, 36,
  370. X 29, 22, 15, 23, 30, 37, 44, 51,
  371. X 58, 59, 52, 45, 38, 31, 39, 46,
  372. X 53, 60, 61, 54, 47, 55, 62, 63
  373. X};
  374. X
  375. X
  376. XLOCAL void
  377. Xextract_block (JSAMPARRAY input_data, int start_row, long start_col,
  378. X           JBLOCK output_data, QUANT_TBL_PTR quanttbl)
  379. X/* Extract one 8x8 block from the specified location in the sample array; */
  380. X/* perform forward DCT, quantization scaling, and zigzag reordering on it. */
  381. X{
  382. X  /* This routine is heavily used, so it's worth coding it tightly. */
  383. X  DCTBLOCK block;
  384. X#ifdef DCT_ERR_STATS
  385. X  DCTBLOCK svblock;        /* saves input data for comparison */
  386. X#endif
  387. X
  388. X  { register JSAMPROW elemptr;
  389. X    register DCTELEM *localblkptr = block;
  390. X#if DCTSIZE != 8
  391. X    register short elemc;
  392. X#endif
  393. X    register short elemr;
  394. X
  395. X    for (elemr = DCTSIZE; elemr > 0; elemr--) {
  396. X      elemptr = input_data[start_row++] + start_col;
  397. X#if DCTSIZE == 8        /* unroll the inner loop */
  398. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  399. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  400. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  401. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  402. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  403. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  404. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  405. X      *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  406. X#else
  407. X      for (elemc = DCTSIZE; elemc > 0; elemc--) {
  408. X    *localblkptr++ = (DCTELEM) GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
  409. X      }
  410. X#endif
  411. X    }
  412. X  }
  413. X
  414. X#ifdef DCT_ERR_STATS
  415. X  memcpy((void *) svblock, (void *) block, SIZEOF(DCTBLOCK));
  416. X#endif
  417. X
  418. X  j_fwd_dct(block);
  419. X
  420. X  { register JCOEF temp;
  421. X    register short i;
  422. X
  423. X    for (i = 0; i < DCTSIZE2; i++) {
  424. X      temp = (JCOEF) block[ZAG[i]];
  425. X      /* divide by *quanttbl, ensuring proper rounding */
  426. X      if (temp < 0) {
  427. X    temp = -temp;
  428. X    temp += *quanttbl>>1;
  429. X    temp /= *quanttbl;
  430. X    temp = -temp;
  431. X      } else {
  432. X    temp += *quanttbl>>1;
  433. X    temp /= *quanttbl;
  434. X      }
  435. X      *output_data++ = temp;
  436. X      quanttbl++;
  437. X    }
  438. X  }
  439. X
  440. X#ifdef DCT_ERR_STATS
  441. X  j_rev_dct(block);
  442. X
  443. X  { register int diff;
  444. X    register short i;
  445. X
  446. X    for (i = 0; i < DCTSIZE2; i++) {
  447. X      diff = block[i] - svblock[i];
  448. X      if (diff < 0) diff = -diff;
  449. X      dcterrorsum += diff;
  450. X      if (dcterrormax < diff) dcterrormax = diff;
  451. X    }
  452. X    dctcoefcount += DCTSIZE2;
  453. X  }
  454. X#endif
  455. X}
  456. X
  457. X
  458. X/*
  459. X * Extract samples in MCU order, process & hand off to output_method.
  460. X * The input is always exactly N MCU rows worth of data.
  461. X */
  462. X
  463. XMETHODDEF void
  464. Xextract_MCUs (compress_info_ptr cinfo,
  465. X          JSAMPIMAGE image_data,
  466. X          int num_mcu_rows,
  467. X          MCU_output_method_ptr output_method)
  468. X{
  469. X  JBLOCK MCU_data[MAX_BLOCKS_IN_MCU];
  470. X  int mcurow;
  471. X  long mcuindex;
  472. X  short blkn, ci, xpos, ypos;
  473. X  jpeg_component_info * compptr;
  474. X  QUANT_TBL_PTR quant_ptr;
  475. X
  476. X  for (mcurow = 0; mcurow < num_mcu_rows; mcurow++) {
  477. X    for (mcuindex = 0; mcuindex < cinfo->MCUs_per_row; mcuindex++) {
  478. X      /* Extract data from the image array, DCT it, and quantize it */
  479. X      blkn = 0;
  480. X      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  481. X    compptr = cinfo->cur_comp_info[ci];
  482. X    quant_ptr = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no];
  483. X    for (ypos = 0; ypos < compptr->MCU_height; ypos++) {
  484. X      for (xpos = 0; xpos < compptr->MCU_width; xpos++) {
  485. X        extract_block(image_data[ci],
  486. X              (mcurow * compptr->MCU_height + ypos)*DCTSIZE,
  487. X              (mcuindex * compptr->MCU_width + xpos)*DCTSIZE,
  488. X              MCU_data[blkn], quant_ptr);
  489. X        blkn++;
  490. X      }
  491. X    }
  492. X      }
  493. X      /* Send the MCU whereever the pipeline controller wants it to go */
  494. X      (*output_method) (cinfo, MCU_data);
  495. X    }
  496. X  }
  497. X}
  498. X
  499. X
  500. X/*
  501. X * Initialize for processing a scan.
  502. X */
  503. X
  504. XMETHODDEF void
  505. Xextract_init (compress_info_ptr cinfo)
  506. X{
  507. X  /* no work for now */
  508. X#ifdef DCT_ERR_STATS
  509. X  dcterrorsum = dcterrormax = dctcoefcount = 0;
  510. X#endif
  511. X}
  512. X
  513. X
  514. X/*
  515. X * Clean up after a scan.
  516. X */
  517. X
  518. XMETHODDEF void
  519. Xextract_term (compress_info_ptr cinfo)
  520. X{
  521. X  /* no work for now */
  522. X#ifdef DCT_ERR_STATS
  523. X  TRACEMS3(cinfo->emethods, 0, "DCT roundoff errors = %d/%d,  max = %d",
  524. X       dcterrorsum, dctcoefcount, dcterrormax);
  525. X#endif
  526. X}
  527. X
  528. X
  529. X
  530. X/*
  531. X * The method selection routine for MCU extraction.
  532. X */
  533. X
  534. XGLOBAL void
  535. Xjselcmcu (compress_info_ptr cinfo)
  536. X{
  537. X  /* just one implementation for now */
  538. X  cinfo->methods->extract_init = extract_init;
  539. X  cinfo->methods->extract_MCUs = extract_MCUs;
  540. X  cinfo->methods->extract_term = extract_term;
  541. X}
  542. END_OF_FILE
  543.   if test 5804 -ne `wc -c <'jcmcu.c'`; then
  544.     echo shar: \"'jcmcu.c'\" unpacked with wrong size!
  545.   fi
  546.   # end of 'jcmcu.c'
  547. fi
  548. if test -f 'jdmaster.c' -a "${1}" != "-c" ; then 
  549.   echo shar: Will not clobber existing file \"'jdmaster.c'\"
  550. else
  551.   echo shar: Extracting \"'jdmaster.c'\" \(5627 characters\)
  552.   sed "s/^X//" >'jdmaster.c' <<'END_OF_FILE'
  553. X/*
  554. X * jdmaster.c
  555. X *
  556. X * Copyright (C) 1991, 1992, Thomas G. Lane.
  557. X * This file is part of the Independent JPEG Group's software.
  558. X * For conditions of distribution and use, see the accompanying README file.
  559. X *
  560. X * This file contains the main control for the JPEG decompressor.
  561. X * The system-dependent (user interface) code should call jpeg_decompress()
  562. X * after doing appropriate setup of the decompress_info_struct parameter.
  563. X */
  564. X
  565. X#include "jinclude.h"
  566. X
  567. X
  568. XMETHODDEF void
  569. Xd_per_scan_method_selection (decompress_info_ptr cinfo)
  570. X/* Central point for per-scan method selection */
  571. X{
  572. X  /* MCU disassembly */
  573. X  jseldmcu(cinfo);
  574. X  /* Un-subsampling of pixels */
  575. X  jselunsubsample(cinfo);
  576. X}
  577. X
  578. X
  579. XLOCAL void
  580. Xd_initial_method_selection (decompress_info_ptr cinfo)
  581. X/* Central point for initial method selection (after reading file header) */
  582. X{
  583. X  /* JPEG file scanning method selection is already done. */
  584. X  /* So is output file format selection (both are done by user interface). */
  585. X
  586. X  /* Entropy decoding: either Huffman or arithmetic coding. */
  587. X#ifdef ARITH_CODING_SUPPORTED
  588. X  jseldarithmetic(cinfo);
  589. X#else
  590. X  if (cinfo->arith_code) {
  591. X    ERREXIT(cinfo->emethods, "Arithmetic coding not supported");
  592. X  }
  593. X#endif
  594. X  jseldhuffman(cinfo);
  595. X  /* Cross-block smoothing */
  596. X#ifdef BLOCK_SMOOTHING_SUPPORTED
  597. X  jselbsmooth(cinfo);
  598. X#else
  599. X  cinfo->do_block_smoothing = FALSE;
  600. X#endif
  601. X  /* Gamma and color space conversion */
  602. X  jseldcolor(cinfo);
  603. X
  604. X  /* Color quantization selection rules */
  605. X#ifdef QUANT_1PASS_SUPPORTED
  606. X#ifdef QUANT_2PASS_SUPPORTED
  607. X  /* We have both, check for conditions in which 1-pass should be used */
  608. X  if (cinfo->num_components != 3 || cinfo->jpeg_color_space != CS_YCbCr)
  609. X    cinfo->two_pass_quantize = FALSE; /* 2-pass only handles YCbCr input */
  610. X  if (cinfo->out_color_space == CS_GRAYSCALE)
  611. X    cinfo->two_pass_quantize = FALSE; /* Should use 1-pass for grayscale out */
  612. X#else /* not QUANT_2PASS_SUPPORTED */
  613. X  cinfo->two_pass_quantize = FALSE; /* only have 1-pass */
  614. X#endif
  615. X#else /* not QUANT_1PASS_SUPPORTED */
  616. X#ifdef QUANT_2PASS_SUPPORTED
  617. X  cinfo->two_pass_quantize = TRUE; /* only have 2-pass */
  618. X#else /* not QUANT_2PASS_SUPPORTED */
  619. X  if (cinfo->quantize_colors) {
  620. X    ERREXIT(cinfo->emethods, "Color quantization was not compiled");
  621. X  }
  622. X#endif
  623. X#endif
  624. X
  625. X#ifdef QUANT_1PASS_SUPPORTED
  626. X  jsel1quantize(cinfo);
  627. X#endif
  628. X#ifdef QUANT_2PASS_SUPPORTED
  629. X  jsel2quantize(cinfo);
  630. X#endif
  631. X
  632. X  /* Pipeline control */
  633. X  jseldpipeline(cinfo);
  634. X  /* Overall control (that's me!) */
  635. X  cinfo->methods->d_per_scan_method_selection = d_per_scan_method_selection;
  636. X}
  637. X
  638. X
  639. XLOCAL void
  640. Xinitial_setup (decompress_info_ptr cinfo)
  641. X/* Do computations that are needed before initial method selection */
  642. X{
  643. X  short ci;
  644. X  jpeg_component_info *compptr;
  645. X
  646. X  /* Compute maximum sampling factors; check factor validity */
  647. X  cinfo->max_h_samp_factor = 1;
  648. X  cinfo->max_v_samp_factor = 1;
  649. X  for (ci = 0; ci < cinfo->num_components; ci++) {
  650. X    compptr = &cinfo->comp_info[ci];
  651. X    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
  652. X    compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
  653. X      ERREXIT(cinfo->emethods, "Bogus sampling factors");
  654. X    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  655. X                   compptr->h_samp_factor);
  656. X    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  657. X                   compptr->v_samp_factor);
  658. X
  659. X  }
  660. X
  661. X  /* Compute logical subsampled dimensions of components */
  662. X  for (ci = 0; ci < cinfo->num_components; ci++) {
  663. X    compptr = &cinfo->comp_info[ci];
  664. X    compptr->true_comp_width = (cinfo->image_width * compptr->h_samp_factor
  665. X                + cinfo->max_h_samp_factor - 1)
  666. X                / cinfo->max_h_samp_factor;
  667. X    compptr->true_comp_height = (cinfo->image_height * compptr->v_samp_factor
  668. X                 + cinfo->max_v_samp_factor - 1)
  669. X                 / cinfo->max_v_samp_factor;
  670. X  }
  671. X}
  672. X
  673. X
  674. X/*
  675. X * This is the main entry point to the JPEG decompressor.
  676. X */
  677. X
  678. X
  679. XGLOBAL void
  680. Xjpeg_decompress (decompress_info_ptr cinfo)
  681. X{
  682. X  /* Init pass counts to 0 --- total_passes is adjusted in method selection */
  683. X  cinfo->total_passes = 0;
  684. X  cinfo->completed_passes = 0;
  685. X
  686. X  /* Read the JPEG file header markers; everything up through the first SOS
  687. X   * marker is read now.  NOTE: the user interface must have initialized the
  688. X   * read_file_header method pointer (eg, by calling jselrjfif or jselrtiff).
  689. X   * The other file reading methods (read_scan_header etc.) were probably
  690. X   * set at the same time, but could be set up by read_file_header itself.
  691. X   */
  692. X  (*cinfo->methods->read_file_header) (cinfo);
  693. X  if (! ((*cinfo->methods->read_scan_header) (cinfo)))
  694. X    ERREXIT(cinfo->emethods, "Empty JPEG file");
  695. X
  696. X  /* Give UI a chance to adjust decompression parameters and select */
  697. X  /* output file format based on info from file header. */
  698. X  (*cinfo->methods->d_ui_method_selection) (cinfo);
  699. X
  700. X  /* Now select methods for decompression steps. */
  701. X  initial_setup(cinfo);
  702. X  d_initial_method_selection(cinfo);
  703. X
  704. X  /* Initialize the output file & other modules as needed */
  705. X  /* (modules needing per-scan init are called by pipeline controller) */
  706. X
  707. X  (*cinfo->methods->output_init) (cinfo);
  708. X  (*cinfo->methods->colorout_init) (cinfo);
  709. X  if (cinfo->quantize_colors)
  710. X    (*cinfo->methods->color_quant_init) (cinfo);
  711. X
  712. X  /* And let the pipeline controller do the rest. */
  713. X  (*cinfo->methods->d_pipeline_controller) (cinfo);
  714. X
  715. X  /* Finish output file, release working storage, etc */
  716. X  if (cinfo->quantize_colors)
  717. X    (*cinfo->methods->color_quant_term) (cinfo);
  718. X  (*cinfo->methods->colorout_term) (cinfo);
  719. X  (*cinfo->methods->output_term) (cinfo);
  720. X  (*cinfo->methods->read_file_trailer) (cinfo);
  721. X
  722. X  (*cinfo->emethods->free_all) ();
  723. X
  724. X  /* My, that was easy, wasn't it? */
  725. X}
  726. END_OF_FILE
  727.   if test 5627 -ne `wc -c <'jdmaster.c'`; then
  728.     echo shar: \"'jdmaster.c'\" unpacked with wrong size!
  729.   fi
  730.   # end of 'jdmaster.c'
  731. fi
  732. if test -f 'jmemdos.h' -a "${1}" != "-c" ; then 
  733.   echo shar: Will not clobber existing file \"'jmemdos.h'\"
  734. else
  735.   echo shar: Extracting \"'jmemdos.h'\" \(5657 characters\)
  736.   sed "s/^X//" >'jmemdos.h' <<'END_OF_FILE'
  737. X/*
  738. X * jmemdos.h  (jmemsys.h)
  739. X *
  740. X * Copyright (C) 1992, Thomas G. Lane.
  741. X * This file is part of the Independent JPEG Group's software.
  742. X * For conditions of distribution and use, see the accompanying README file.
  743. X *
  744. X * This include file defines the interface between the system-independent
  745. X * and system-dependent portions of the JPEG memory manager.  (The system-
  746. X * independent portion is jmemmgr.c; there are several different versions
  747. X * of the system-dependent portion, and of this file for that matter.)
  748. X *
  749. X * This version is suitable for MS-DOS (80x86) implementations.
  750. X */
  751. X
  752. X
  753. X/*
  754. X * These two functions are used to allocate and release small chunks of
  755. X * memory (typically the total amount requested through jget_small is
  756. X * no more than 20Kb or so).  Behavior should be the same as for the
  757. X * standard library functions malloc and free; in particular, jget_small
  758. X * returns NULL on failure.  On most systems, these ARE malloc and free.
  759. X * On an 80x86 machine using small-data memory model, these manage near heap.
  760. X */
  761. X
  762. XEXTERN void * jget_small PP((size_t sizeofobject));
  763. XEXTERN void jfree_small PP((void * object));
  764. X
  765. X/*
  766. X * These two functions are used to allocate and release large chunks of
  767. X * memory (up to the total free space designated by jmem_available).
  768. X * The interface is the same as above, except that on an 80x86 machine,
  769. X * far pointers are used.  On other systems these ARE the same as above.
  770. X */
  771. X
  772. X#ifdef NEED_FAR_POINTERS    /* typically not needed except on 80x86 */
  773. XEXTERN void FAR * jget_large PP((size_t sizeofobject));
  774. XEXTERN void jfree_large PP((void FAR * object));
  775. X#else
  776. X#define jget_large(sizeofobject)    jget_small(sizeofobject)
  777. X#define jfree_large(object)        jfree_small(object)
  778. X#endif
  779. X
  780. X/*
  781. X * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
  782. X * be requested in a single call on jget_large (and jget_small for that
  783. X * matter, but that case should never come into play).  This macro is needed
  784. X * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
  785. X * On machines with flat address spaces, any large constant may be used here.
  786. X */
  787. X
  788. X#define MAX_ALLOC_CHUNK        65400L
  789. X
  790. X/*
  791. X * This routine computes the total space available for allocation by
  792. X * jget_large.  If more space than this is needed, backing store will be used.
  793. X * NOTE: any memory already allocated must not be counted.
  794. X *
  795. X * There is a minimum space requirement, corresponding to the minimum
  796. X * feasible buffer sizes; jmemmgr.c will request that much space even if
  797. X * jmem_available returns zero.  The maximum space needed, enough to hold
  798. X * all working storage in memory, is also passed in case it is useful.
  799. X *
  800. X * It is OK for jmem_available to underestimate the space available (that'll
  801. X * just lead to more backing-store access than is really necessary).
  802. X * However, an overestimate will lead to failure.  Hence it's wise to subtract
  803. X * a slop factor from the true available space, especially if jget_small space
  804. X * comes from the same pool.  5% should be enough.
  805. X *
  806. X * On machines with lots of virtual memory, any large constant may be returned.
  807. X * Conversely, zero may be returned to always use the minimum amount of memory.
  808. X */
  809. X
  810. XEXTERN long jmem_available PP((long min_bytes_needed, long max_bytes_needed));
  811. X
  812. X
  813. X/*
  814. X * This structure holds whatever state is needed to access a single
  815. X * backing-store object.  The read/write/close method pointers are called
  816. X * by jmemmgr.c to manipulate the backing-store object; all other fields
  817. X * are private to the system-dependent backing store routines.
  818. X */
  819. X
  820. X#define TEMP_NAME_LENGTH   64    /* max length of a temporary file's name */
  821. X
  822. Xtypedef unsigned short XMSH;    /* type of extended-memory handles */
  823. Xtypedef unsigned short EMSH;    /* type of expanded-memory handles */
  824. X
  825. Xtypedef union {
  826. X    short file_handle;    /* DOS file handle if it's a temp file */
  827. X    XMSH xms_handle;    /* handle if it's a chunk of XMS */
  828. X    EMSH ems_handle;    /* handle if it's a chunk of EMS */
  829. X      } handle_union;
  830. X
  831. Xtypedef struct backing_store_struct * backing_store_ptr;
  832. X
  833. Xtypedef struct backing_store_struct {
  834. X    /* Methods for reading/writing/closing this backing-store object */
  835. X    METHOD(void, read_backing_store, (backing_store_ptr info,
  836. X                      void FAR * buffer_address,
  837. X                      long file_offset, long byte_count));
  838. X    METHOD(void, write_backing_store, (backing_store_ptr info,
  839. X                       void FAR * buffer_address,
  840. X                       long file_offset, long byte_count));
  841. X    METHOD(void, close_backing_store, (backing_store_ptr info));
  842. X    /* Private fields for system-dependent backing-store management */
  843. X    /* For the MS-DOS environment, we need: */
  844. X    handle_union handle;    /* reference to backing-store storage object */
  845. X    char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
  846. X      } backing_store_info;
  847. X
  848. X/*
  849. X * Initial opening of a backing-store object.  This must fill in the
  850. X * read/write/close pointers in the object.  The read/write routines
  851. X * may take an error exit if the specified maximum file size is exceeded.
  852. X * (If jmem_available always returns a large value, this routine can just
  853. X * take an error exit.)
  854. X */
  855. X
  856. XEXTERN void jopen_backing_store PP((backing_store_ptr info,
  857. X                    long total_bytes_needed));
  858. X
  859. X
  860. X/*
  861. X * These routines take care of any system-dependent initialization and
  862. X * cleanup required.  The system methods struct address should be saved
  863. X * by jmem_init in case an error exit must be taken.  jmem_term may assume
  864. X * that all requested memory has been freed and that all opened backing-
  865. X * store objects have been closed.
  866. X * NB: jmem_term may be called more than once, and must behave reasonably
  867. X * if that happens.
  868. X */
  869. X
  870. XEXTERN void jmem_init PP((external_methods_ptr emethods));
  871. XEXTERN void jmem_term PP((void));
  872. END_OF_FILE
  873.   if test 5657 -ne `wc -c <'jmemdos.h'`; then
  874.     echo shar: \"'jmemdos.h'\" unpacked with wrong size!
  875.   fi
  876.   # end of 'jmemdos.h'
  877. fi
  878. if test -f 'jmemsys.h' -a "${1}" != "-c" ; then 
  879.   echo shar: Will not clobber existing file \"'jmemsys.h'\"
  880. else
  881.   echo shar: Extracting \"'jmemsys.h'\" \(5401 characters\)
  882.   sed "s/^X//" >'jmemsys.h' <<'END_OF_FILE'
  883. X/*
  884. X * jmemsys.h
  885. X *
  886. X * Copyright (C) 1992, Thomas G. Lane.
  887. X * This file is part of the Independent JPEG Group's software.
  888. X * For conditions of distribution and use, see the accompanying README file.
  889. X *
  890. X * This include file defines the interface between the system-independent
  891. X * and system-dependent portions of the JPEG memory manager.  (The system-
  892. X * independent portion is jmemmgr.c; there are several different versions
  893. X * of the system-dependent portion, and of this file for that matter.)
  894. X *
  895. X * This is a "generic" skeleton that may need to be modified for particular
  896. X * systems.  It should be usable as-is on the majority of non-MSDOS machines.
  897. X */
  898. X
  899. X
  900. X/*
  901. X * These two functions are used to allocate and release small chunks of
  902. X * memory (typically the total amount requested through jget_small is
  903. X * no more than 20Kb or so).  Behavior should be the same as for the
  904. X * standard library functions malloc and free; in particular, jget_small
  905. X * returns NULL on failure.  On most systems, these ARE malloc and free.
  906. X * On an 80x86 machine using small-data memory model, these manage near heap.
  907. X */
  908. X
  909. XEXTERN void * jget_small PP((size_t sizeofobject));
  910. XEXTERN void jfree_small PP((void * object));
  911. X
  912. X/*
  913. X * These two functions are used to allocate and release large chunks of
  914. X * memory (up to the total free space designated by jmem_available).
  915. X * The interface is the same as above, except that on an 80x86 machine,
  916. X * far pointers are used.  On other systems these ARE the same as above.
  917. X */
  918. X
  919. X#ifdef NEED_FAR_POINTERS    /* typically not needed except on 80x86 */
  920. XEXTERN void FAR * jget_large PP((size_t sizeofobject));
  921. XEXTERN void jfree_large PP((void FAR * object));
  922. X#else
  923. X#define jget_large(sizeofobject)    jget_small(sizeofobject)
  924. X#define jfree_large(object)        jfree_small(object)
  925. X#endif
  926. X
  927. X/*
  928. X * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
  929. X * be requested in a single call on jget_large (and jget_small for that
  930. X * matter, but that case should never come into play).  This macro is needed
  931. X * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
  932. X * On machines with flat address spaces, any large constant may be used here.
  933. X */
  934. X
  935. X#define MAX_ALLOC_CHUNK        1000000000L
  936. X
  937. X/*
  938. X * This routine computes the total space available for allocation by
  939. X * jget_large.  If more space than this is needed, backing store will be used.
  940. X * NOTE: any memory already allocated must not be counted.
  941. X *
  942. X * There is a minimum space requirement, corresponding to the minimum
  943. X * feasible buffer sizes; jmemmgr.c will request that much space even if
  944. X * jmem_available returns zero.  The maximum space needed, enough to hold
  945. X * all working storage in memory, is also passed in case it is useful.
  946. X *
  947. X * It is OK for jmem_available to underestimate the space available (that'll
  948. X * just lead to more backing-store access than is really necessary).
  949. X * However, an overestimate will lead to failure.  Hence it's wise to subtract
  950. X * a slop factor from the true available space, especially if jget_small space
  951. X * comes from the same pool.  5% should be enough.
  952. X *
  953. X * On machines with lots of virtual memory, any large constant may be returned.
  954. X * Conversely, zero may be returned to always use the minimum amount of memory.
  955. X */
  956. X
  957. XEXTERN long jmem_available PP((long min_bytes_needed, long max_bytes_needed));
  958. X
  959. X
  960. X/*
  961. X * This structure holds whatever state is needed to access a single
  962. X * backing-store object.  The read/write/close method pointers are called
  963. X * by jmemmgr.c to manipulate the backing-store object; all other fields
  964. X * are private to the system-dependent backing store routines.
  965. X */
  966. X
  967. X#define TEMP_NAME_LENGTH   64    /* max length of a temporary file's name */
  968. X
  969. Xtypedef struct backing_store_struct * backing_store_ptr;
  970. X
  971. Xtypedef struct backing_store_struct {
  972. X    /* Methods for reading/writing/closing this backing-store object */
  973. X    METHOD(void, read_backing_store, (backing_store_ptr info,
  974. X                      void FAR * buffer_address,
  975. X                      long file_offset, long byte_count));
  976. X    METHOD(void, write_backing_store, (backing_store_ptr info,
  977. X                       void FAR * buffer_address,
  978. X                       long file_offset, long byte_count));
  979. X    METHOD(void, close_backing_store, (backing_store_ptr info));
  980. X    /* Private fields for system-dependent backing-store management */
  981. X    /* For a typical implementation with temp files, we might need: */
  982. X    FILE * temp_file;    /* stdio reference to temp file */
  983. X    char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
  984. X      } backing_store_info;
  985. X
  986. X/*
  987. X * Initial opening of a backing-store object.  This must fill in the
  988. X * read/write/close pointers in the object.  The read/write routines
  989. X * may take an error exit if the specified maximum file size is exceeded.
  990. X * (If jmem_available always returns a large value, this routine can just
  991. X * take an error exit.)
  992. X */
  993. X
  994. XEXTERN void jopen_backing_store PP((backing_store_ptr info,
  995. X                    long total_bytes_needed));
  996. X
  997. X
  998. X/*
  999. X * These routines take care of any system-dependent initialization and
  1000. X * cleanup required.  The system methods struct address should be saved
  1001. X * by jmem_init in case an error exit must be taken.  jmem_term may assume
  1002. X * that all requested memory has been freed and that all opened backing-
  1003. X * store objects have been closed.
  1004. X * NB: jmem_term may be called more than once, and must behave reasonably
  1005. X * if that happens.
  1006. X */
  1007. X
  1008. XEXTERN void jmem_init PP((external_methods_ptr emethods));
  1009. XEXTERN void jmem_term PP((void));
  1010. END_OF_FILE
  1011.   if test 5401 -ne `wc -c <'jmemsys.h'`; then
  1012.     echo shar: \"'jmemsys.h'\" unpacked with wrong size!
  1013.   fi
  1014.   # end of 'jmemsys.h'
  1015. fi
  1016. if test -f 'jwrppm.c' -a "${1}" != "-c" ; then 
  1017.   echo shar: Will not clobber existing file \"'jwrppm.c'\"
  1018. else
  1019.   echo shar: Extracting \"'jwrppm.c'\" \(4269 characters\)
  1020.   sed "s/^X//" >'jwrppm.c' <<'END_OF_FILE'
  1021. X/*
  1022. X * jwrppm.c
  1023. X *
  1024. X * Copyright (C) 1991, 1992, Thomas G. Lane.
  1025. X * This file is part of the Independent JPEG Group's software.
  1026. X * For conditions of distribution and use, see the accompanying README file.
  1027. X *
  1028. X * This file contains routines to write output images in PPM format.
  1029. X * The PBMPLUS library is required (well, it will be in the real version).
  1030. X *
  1031. X * These routines may need modification for non-Unix environments or
  1032. X * specialized applications.  As they stand, they assume output to
  1033. X * an ordinary stdio stream.
  1034. X *
  1035. X * These routines are invoked via the methods put_pixel_rows, put_color_map,
  1036. X * and output_init/term.
  1037. X */
  1038. X
  1039. X#include "jinclude.h"
  1040. X
  1041. X#ifdef PPM_SUPPORTED
  1042. X
  1043. X
  1044. X/*
  1045. X * Haven't yet got around to making this work with text-format output,
  1046. X * hence cannot handle pixels wider than 8 bits.
  1047. X */
  1048. X
  1049. X#ifndef EIGHT_BIT_SAMPLES
  1050. X  Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
  1051. X#endif
  1052. X
  1053. X
  1054. X/*
  1055. X * Write the file header.
  1056. X */
  1057. X
  1058. XMETHODDEF void
  1059. Xoutput_init (decompress_info_ptr cinfo)
  1060. X{
  1061. X  if (cinfo->out_color_space == CS_GRAYSCALE) {
  1062. X    /* emit header for raw PGM format */
  1063. X    fprintf(cinfo->output_file, "P5\n%ld %ld\n%d\n",
  1064. X        cinfo->image_width, cinfo->image_height, 255);
  1065. X  } else if (cinfo->out_color_space == CS_RGB) {
  1066. X    /* emit header for raw PPM format */
  1067. X    fprintf(cinfo->output_file, "P6\n%ld %ld\n%d\n",
  1068. X        cinfo->image_width, cinfo->image_height, 255);
  1069. X  } else {
  1070. X    ERREXIT(cinfo->emethods, "PPM output must be grayscale or RGB");
  1071. X  }
  1072. X}
  1073. X
  1074. X
  1075. X/*
  1076. X * Write some pixel data.
  1077. X */
  1078. X
  1079. XMETHODDEF void
  1080. Xput_pixel_rows (decompress_info_ptr cinfo, int num_rows,
  1081. X        JSAMPIMAGE pixel_data)
  1082. X{
  1083. X  register FILE * outfile = cinfo->output_file;
  1084. X  register JSAMPROW ptr0, ptr1, ptr2;
  1085. X  register long col;
  1086. X  register long width = cinfo->image_width;
  1087. X  register int row;
  1088. X  
  1089. X  if (cinfo->out_color_space == CS_GRAYSCALE) {
  1090. X    for (row = 0; row < num_rows; row++) {
  1091. X      ptr0 = pixel_data[0][row];
  1092. X      for (col = width; col > 0; col--) {
  1093. X    putc(GETJSAMPLE(*ptr0), outfile);
  1094. X    ptr0++;
  1095. X      }
  1096. X    }
  1097. X  } else {
  1098. X    for (row = 0; row < num_rows; row++) {
  1099. X      ptr0 = pixel_data[0][row];
  1100. X      ptr1 = pixel_data[1][row];
  1101. X      ptr2 = pixel_data[2][row];
  1102. X      for (col = width; col > 0; col--) {
  1103. X    putc(GETJSAMPLE(*ptr0), outfile);
  1104. X    ptr0++;
  1105. X    putc(GETJSAMPLE(*ptr1), outfile);
  1106. X    ptr1++;
  1107. X    putc(GETJSAMPLE(*ptr2), outfile);
  1108. X    ptr2++;
  1109. X      }
  1110. X    }
  1111. X  }
  1112. X}
  1113. X
  1114. X
  1115. X/*
  1116. X * Write some pixel data when color quantization is in effect.
  1117. X */
  1118. X
  1119. XMETHODDEF void
  1120. Xput_demapped_rows (decompress_info_ptr cinfo, int num_rows,
  1121. X           JSAMPIMAGE pixel_data)
  1122. X{
  1123. X  register FILE * outfile = cinfo->output_file;
  1124. X  register JSAMPARRAY color_map = cinfo->colormap;
  1125. X  register JSAMPROW ptr;
  1126. X  register long col;
  1127. X  long width = cinfo->image_width;
  1128. X  int row;
  1129. X  
  1130. X  if (cinfo->out_color_space == CS_GRAYSCALE) {
  1131. X    for (row = 0; row < num_rows; row++) {
  1132. X      ptr = pixel_data[0][row];
  1133. X      for (col = width; col > 0; col--) {
  1134. X    putc(GETJSAMPLE(color_map[0][GETJSAMPLE(*ptr)]), outfile);
  1135. X    ptr++;
  1136. X      }
  1137. X    }
  1138. X  } else {
  1139. X    for (row = 0; row < num_rows; row++) {
  1140. X      ptr = pixel_data[0][row];
  1141. X      for (col = width; col > 0; col--) {
  1142. X    register int pixval = GETJSAMPLE(*ptr);
  1143. X
  1144. X    putc(GETJSAMPLE(color_map[0][pixval]), outfile);
  1145. X    putc(GETJSAMPLE(color_map[1][pixval]), outfile);
  1146. X    putc(GETJSAMPLE(color_map[2][pixval]), outfile);
  1147. X    ptr++;
  1148. X      }
  1149. X    }
  1150. X  }
  1151. X}
  1152. X
  1153. X
  1154. X/*
  1155. X * Write the color map.
  1156. X * For PPM output, we just demap the output data!
  1157. X */
  1158. X
  1159. XMETHODDEF void
  1160. Xput_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap)
  1161. X{
  1162. X  cinfo->methods->put_pixel_rows = put_demapped_rows;
  1163. X}
  1164. X
  1165. X
  1166. X/*
  1167. X * Finish up at the end of the file.
  1168. X */
  1169. X
  1170. XMETHODDEF void
  1171. Xoutput_term (decompress_info_ptr cinfo)
  1172. X{
  1173. X  /* No work except to make sure we wrote the output file OK */
  1174. X  fflush(cinfo->output_file);
  1175. X  if (ferror(cinfo->output_file))
  1176. X    ERREXIT(cinfo->emethods, "Output file write error");
  1177. X}
  1178. X
  1179. X
  1180. X/*
  1181. X * The method selection routine for PPM format output.
  1182. X * This should be called from d_ui_method_selection if PPM output is wanted.
  1183. X */
  1184. X
  1185. XGLOBAL void
  1186. Xjselwppm (decompress_info_ptr cinfo)
  1187. X{
  1188. X  cinfo->methods->output_init = output_init;
  1189. X  cinfo->methods->put_color_map = put_color_map;
  1190. X  cinfo->methods->put_pixel_rows = put_pixel_rows;
  1191. X  cinfo->methods->output_term = output_term;
  1192. X}
  1193. X
  1194. X#endif /* PPM_SUPPORTED */
  1195. END_OF_FILE
  1196.   if test 4269 -ne `wc -c <'jwrppm.c'`; then
  1197.     echo shar: \"'jwrppm.c'\" unpacked with wrong size!
  1198.   fi
  1199.   # end of 'jwrppm.c'
  1200. fi
  1201. if test -f 'makcjpeg.cf' -a "${1}" != "-c" ; then 
  1202.   echo shar: Will not clobber existing file \"'makcjpeg.cf'\"
  1203. else
  1204.   echo shar: Extracting \"'makcjpeg.cf'\" \(276 characters\)
  1205.   sed "s/^X//" >'makcjpeg.cf' <<'END_OF_FILE'
  1206. XL jcmain.mix jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix
  1207. XL jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix
  1208. XL jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix jutils.mix jerror.mix
  1209. XL jmemmgr.mix jmemsys.mix jmemdosa.mix
  1210. Xfa;
  1211. Xb cjpeg,8K,48K,
  1212. END_OF_FILE
  1213.   if test 276 -ne `wc -c <'makcjpeg.cf'`; then
  1214.     echo shar: \"'makcjpeg.cf'\" unpacked with wrong size!
  1215.   fi
  1216.   # end of 'makcjpeg.cf'
  1217. fi
  1218. if test -f 'makcjpeg.lst' -a "${1}" != "-c" ; then 
  1219.   echo shar: Will not clobber existing file \"'makcjpeg.lst'\"
  1220. else
  1221.   echo shar: Extracting \"'makcjpeg.lst'\" \(248 characters\)
  1222.   sed "s/^X//" >'makcjpeg.lst' <<'END_OF_FILE'
  1223. Xjcmain.obj jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj
  1224. Xjchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj jwrjfif.obj
  1225. Xjrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj jutils.obj jerror.obj
  1226. Xjmemmgr.obj jmemsys.obj jmemdosa.obj
  1227. END_OF_FILE
  1228.   if test 248 -ne `wc -c <'makcjpeg.lst'`; then
  1229.     echo shar: \"'makcjpeg.lst'\" unpacked with wrong size!
  1230.   fi
  1231.   # end of 'makcjpeg.lst'
  1232. fi
  1233. if test -f 'makdjpeg.lst' -a "${1}" != "-c" ; then 
  1234.   echo shar: Will not clobber existing file \"'makdjpeg.lst'\"
  1235. else
  1236.   echo shar: Extracting \"'makdjpeg.lst'\" \(272 characters\)
  1237.   sed "s/^X//" >'makdjpeg.lst' <<'END_OF_FILE'
  1238. Xjdmain.obj jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj
  1239. Xjdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj jquant2.obj
  1240. Xjrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj jwrrle.obj jwrtarga.obj
  1241. Xjutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
  1242. END_OF_FILE
  1243.   if test 272 -ne `wc -c <'makdjpeg.lst'`; then
  1244.     echo shar: \"'makdjpeg.lst'\" unpacked with wrong size!
  1245.   fi
  1246.   # end of 'makdjpeg.lst'
  1247. fi
  1248. if test -f 'makefile.mc6' -a "${1}" != "-c" ; then 
  1249.   echo shar: Will not clobber existing file \"'makefile.mc6'\"
  1250. else
  1251.   echo shar: Extracting \"'makefile.mc6'\" \(5933 characters\)
  1252.   sed "s/^X//" >'makefile.mc6' <<'END_OF_FILE'
  1253. X# Makefile for Independent JPEG Group's software
  1254. X
  1255. X# This makefile is for Microsoft C for MS-DOS, version 6.x (use NMAKE).
  1256. X# Thanks to Alan Wright and Chris Turner of Olivetti Research Ltd.
  1257. X
  1258. X# Read SETUP instructions before saying "make" !!
  1259. X
  1260. X# compiler flags. -D gives a #define to the sources:
  1261. X#       -O              default optimisation
  1262. X#       -W3             warning level 3
  1263. X#       -Za             ANSI conformance, defines __STDC__ but undefines far
  1264. X#                       and near, so we DON'T use it.
  1265. X#       -DHAVE_STDC     indicate we do have all the ANSI language features
  1266. X#       -DINCLUDES_ARE_ANSI    and all the ANSI include files.
  1267. X#       -DMSDOS         we are on an MSDOS machine
  1268. X#       -DMEM_STATS     enable memory usage statistics (optional)
  1269. X#       -c              compile, don't link (implicit in inference rules)
  1270. X# You might also want to add -G2 if you have an 80286, etc.
  1271. X
  1272. XCFLAGS = -c -O -W3 -DHAVE_STDC -DINCLUDES_ARE_ANSI -DMSDOS
  1273. X
  1274. X
  1275. X# source files (independently compilable files)
  1276. XSOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c \
  1277. X        jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c \
  1278. X        jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c \
  1279. X        jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c \
  1280. X        jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c \
  1281. X        jwrppm.c jwrrle.c jwrtarga.c
  1282. X# virtual source files (not present in distribution file)
  1283. XVIRTSOURCES= jmemsys.c
  1284. X# system-dependent implementations of source files
  1285. XSYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h \
  1286. X        jmemdosa.asm
  1287. X# files included by source files
  1288. XINCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
  1289. X# documentation, test, and support files
  1290. XDOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules
  1291. XMAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas \
  1292. X        makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc \
  1293. X        makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf \
  1294. X        makljpeg.cf makefile.mms makefile.vms makvms.opt
  1295. XOTHERFILES= ansi2knr.c ckconfig.c example.c
  1296. XTESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg
  1297. XDISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) \
  1298. X        $(OTHERFILES) $(TESTFILES)
  1299. X# objectfiles common to cjpeg and djpeg
  1300. XCOMOBJECTS= jutils.obj jerror.obj jmemmgr.obj jmemsys.obj jmemdosa.obj
  1301. X# compression objectfiles
  1302. XCLIBOBJECTS= jcmaster.obj jcdeflts.obj jcarith.obj jccolor.obj jcexpand.obj \
  1303. X        jchuff.obj jcmcu.obj jcpipe.obj jcsample.obj jfwddct.obj \
  1304. X        jwrjfif.obj jrdgif.obj jrdppm.obj jrdrle.obj jrdtarga.obj
  1305. XCOBJECTS= jcmain.obj $(CLIBOBJECTS) $(COMOBJECTS)
  1306. X# decompression objectfiles
  1307. XDLIBOBJECTS= jdmaster.obj jddeflts.obj jbsmooth.obj jdarith.obj jdcolor.obj \
  1308. X        jdhuff.obj jdmcu.obj jdpipe.obj jdsample.obj jquant1.obj \
  1309. X        jquant2.obj jrevdct.obj jrdjfif.obj jwrgif.obj jwrppm.obj \
  1310. X        jwrrle.obj jwrtarga.obj
  1311. XDOBJECTS= jdmain.obj $(DLIBOBJECTS) $(COMOBJECTS)
  1312. X# These objectfiles are included in libjpeg.lib
  1313. XLIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
  1314. X
  1315. X
  1316. Xall: cjpeg.exe djpeg.exe
  1317. X
  1318. X# default rules in nmake will use cflags and compile the list below
  1319. X
  1320. Xjbsmooth.obj : jbsmooth.c jinclude.h jconfig.h jpegdata.h
  1321. Xjcarith.obj : jcarith.c jinclude.h jconfig.h jpegdata.h
  1322. Xjccolor.obj : jccolor.c jinclude.h jconfig.h jpegdata.h
  1323. Xjcdeflts.obj : jcdeflts.c jinclude.h jconfig.h jpegdata.h
  1324. Xjcexpand.obj : jcexpand.c jinclude.h jconfig.h jpegdata.h
  1325. Xjchuff.obj : jchuff.c jinclude.h jconfig.h jpegdata.h
  1326. Xjcmain.obj : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
  1327. Xjcmaster.obj : jcmaster.c jinclude.h jconfig.h jpegdata.h
  1328. Xjcmcu.obj : jcmcu.c jinclude.h jconfig.h jpegdata.h
  1329. Xjcpipe.obj : jcpipe.c jinclude.h jconfig.h jpegdata.h
  1330. Xjcsample.obj : jcsample.c jinclude.h jconfig.h jpegdata.h
  1331. Xjdarith.obj : jdarith.c jinclude.h jconfig.h jpegdata.h
  1332. Xjdcolor.obj : jdcolor.c jinclude.h jconfig.h jpegdata.h
  1333. Xjddeflts.obj : jddeflts.c jinclude.h jconfig.h jpegdata.h
  1334. Xjdhuff.obj : jdhuff.c jinclude.h jconfig.h jpegdata.h
  1335. Xjdmain.obj : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
  1336. Xjdmaster.obj : jdmaster.c jinclude.h jconfig.h jpegdata.h
  1337. Xjdmcu.obj : jdmcu.c jinclude.h jconfig.h jpegdata.h
  1338. Xjdpipe.obj : jdpipe.c jinclude.h jconfig.h jpegdata.h
  1339. Xjdsample.obj : jdsample.c jinclude.h jconfig.h jpegdata.h
  1340. Xjerror.obj : jerror.c jinclude.h jconfig.h jpegdata.h
  1341. Xjquant1.obj : jquant1.c jinclude.h jconfig.h jpegdata.h
  1342. Xjquant2.obj : jquant2.c jinclude.h jconfig.h jpegdata.h
  1343. Xjfwddct.obj : jfwddct.c jinclude.h jconfig.h jpegdata.h
  1344. Xjrevdct.obj : jrevdct.c jinclude.h jconfig.h jpegdata.h
  1345. Xjutils.obj : jutils.c jinclude.h jconfig.h jpegdata.h
  1346. Xjmemmgr.obj : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
  1347. Xjrdjfif.obj : jrdjfif.c jinclude.h jconfig.h jpegdata.h
  1348. Xjrdgif.obj : jrdgif.c jinclude.h jconfig.h jpegdata.h
  1349. Xjrdppm.obj : jrdppm.c jinclude.h jconfig.h jpegdata.h
  1350. Xjrdrle.obj : jrdrle.c jinclude.h jconfig.h jpegdata.h
  1351. Xjrdtarga.obj : jrdtarga.c jinclude.h jconfig.h jpegdata.h
  1352. Xjwrjfif.obj : jwrjfif.c jinclude.h jconfig.h jpegdata.h
  1353. Xjwrgif.obj : jwrgif.c jinclude.h jconfig.h jpegdata.h
  1354. Xjwrppm.obj : jwrppm.c jinclude.h jconfig.h jpegdata.h
  1355. Xjwrrle.obj : jwrrle.c jinclude.h jconfig.h jpegdata.h
  1356. Xjwrtarga.obj : jwrtarga.c jinclude.h jconfig.h jpegdata.h
  1357. Xjmemsys.obj : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
  1358. X
  1359. Xjmemdosa.obj : jmemdosa.asm
  1360. X    masm /mx $*;
  1361. X
  1362. X
  1363. X# use linker response files because file list > 128 chars
  1364. X
  1365. Xcjpeg.exe: $(COBJECTS)
  1366. X        link /STACK:8192 @makcjpeg.lnk
  1367. X
  1368. Xdjpeg.exe: $(DOBJECTS)
  1369. X        link /STACK:8192 @makdjpeg.lnk
  1370. X
  1371. Xtest:
  1372. X        del testout.*
  1373. X        djpeg testorig.jpg testout.ppm
  1374. X        djpeg -G testorig.jpg testout.gif
  1375. X        cjpeg testimg.ppm testout.jpg
  1376. X        fc testimg.ppm testout.ppm
  1377. X        fc testimg.gif testout.gif
  1378. X        fc testimg.jpg testout.jpg
  1379. END_OF_FILE
  1380.   if test 5933 -ne `wc -c <'makefile.mc6'`; then
  1381.     echo shar: \"'makefile.mc6'\" unpacked with wrong size!
  1382.   fi
  1383.   # end of 'makefile.mc6'
  1384. fi
  1385. if test -f 'makefile.pwc' -a "${1}" != "-c" ; then 
  1386.   echo shar: Will not clobber existing file \"'makefile.pwc'\"
  1387. else
  1388.   echo shar: Extracting \"'makefile.pwc'\" \(5907 characters\)
  1389.   sed "s/^X//" >'makefile.pwc' <<'END_OF_FILE'
  1390. X# Makefile for Independent JPEG Group's software
  1391. X
  1392. X# This makefile is for Mix Software's Power C, v2.1.1
  1393. X# and Dan Grayson's pd make 2.14 under MS-DOS.
  1394. X# This file assumes that you have Microsoft's MASM or a compatible assembler
  1395. X# to handle the jmemdosa.asm file.  If not, you will need to use jmemname.c
  1396. X# and go to a large-data memory model.
  1397. X# Thanks to Bob Hardy for this version.
  1398. X
  1399. X# Read SETUP instructions before saying "make" !!
  1400. X
  1401. X# The name of your C compiler:
  1402. XCC=pc
  1403. X
  1404. X# You may need to adjust these cc options:
  1405. XMODEL=m
  1406. XCFLAGS= -dMSDOS -m$(MODEL)
  1407. X# In particular:
  1408. X#   Add -dMEM_STATS to enable gathering of memory usage statistics.
  1409. X
  1410. X# Link-time cc options:
  1411. XLDFLAGS=
  1412. XLDLIBS=
  1413. X
  1414. X# miscellaneous OS-dependent stuff
  1415. X# linker
  1416. XLN=pcl
  1417. X# file deletion command
  1418. XRM=del
  1419. X# library (.mix) file creation command
  1420. XAR=merge
  1421. X
  1422. X
  1423. X# source files (independently compilable files)
  1424. XSOURCES= jbsmooth.c jcarith.c jccolor.c jcdeflts.c jcexpand.c jchuff.c jcmain.c jcmaster.c jcmcu.c jcpipe.c jcsample.c jdarith.c jdcolor.c jddeflts.c jdhuff.c jdmain.c jdmaster.c jdmcu.c jdpipe.c jdsample.c jerror.c jquant1.c jquant2.c jfwddct.c jrevdct.c jutils.c jmemmgr.c jrdjfif.c jrdgif.c jrdppm.c jrdrle.c jrdtarga.c jwrjfif.c jwrgif.c jwrppm.c jwrrle.c jwrtarga.c
  1425. X# virtual source files (not present in distribution file)
  1426. XVIRTSOURCES= jmemsys.c
  1427. X# system-dependent implementations of source files
  1428. XSYSDEPFILES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemdos.h jmemdosa.asm
  1429. X# files included by source files
  1430. XINCLUDES= jinclude.h jconfig.h jpegdata.h jversion.h jmemsys.h egetopt.c
  1431. X# documentation, test, and support files
  1432. XDOCS= README SETUP USAGE CHANGELOG cjpeg.1 djpeg.1 architecture codingrules
  1433. XMAKEFILES= makefile.ansi makefile.unix makefile.manx makefile.sas makefile.mc5 makefile.mc6 makcjpeg.lnk makdjpeg.lnk makefile.bcc makcjpeg.lst makdjpeg.lst makefile.pwc makcjpeg.cf makdjpeg.cf makljpeg.cf makefile.mms makefile.vms makvms.opt
  1434. XOTHERFILES= ansi2knr.c ckconfig.c example.c
  1435. XTESTFILES= testorig.jpg testimg.ppm testimg.gif testimg.jpg
  1436. XDISTFILES= $(DOCS) $(MAKEFILES) $(SOURCES) $(SYSDEPFILES) $(INCLUDES) $(OTHERFILES) $(TESTFILES)
  1437. X# objectfiles common to cjpeg and djpeg
  1438. XCOMOBJECTS= jutils.mix jerror.mix jmemmgr.mix jmemsys.mix jmemdosa.mix
  1439. X# compression objectfiles
  1440. XCLIBOBJECTS= jcmaster.mix jcdeflts.mix jcarith.mix jccolor.mix jcexpand.mix jchuff.mix jcmcu.mix jcpipe.mix jcsample.mix jfwddct.mix jwrjfif.mix jrdgif.mix jrdppm.mix jrdrle.mix jrdtarga.mix
  1441. XCOBJECTS= jcmain.mix $(CLIBOBJECTS) $(COMOBJECTS)
  1442. X# decompression objectfiles
  1443. XDLIBOBJECTS= jdmaster.mix jddeflts.mix jbsmooth.mix jdarith.mix jdcolor.mix jdhuff.mix jdmcu.mix jdpipe.mix jdsample.mix jquant1.mix jquant2.mix jrevdct.mix jrdjfif.mix jwrgif.mix jwrppm.mix jwrrle.mix jwrtarga.mix
  1444. XDOBJECTS= jdmain.mix $(DLIBOBJECTS) $(COMOBJECTS)
  1445. X# These objectfiles are included in libjpeg.mix
  1446. XLIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
  1447. X
  1448. X
  1449. Xall: cjpeg.exe djpeg.exe
  1450. X# By default, libjpeg.mix is not built unless you explicitly request it.
  1451. X# You can add libjpeg.mix to the line above if you want it built by default.
  1452. X
  1453. X
  1454. Xcjpeg.exe: $(COBJECTS)
  1455. X    $(LN) $(LDFLAGS) @makcjpeg.cf
  1456. X
  1457. Xdjpeg.exe: $(DOBJECTS)
  1458. X    $(LN) $(LDFLAGS) @makdjpeg.cf
  1459. X
  1460. X# libjpeg.mix is useful if you are including the JPEG software in a larger
  1461. X# program; you'd include it in your link, rather than the individual modules.
  1462. Xlibjpeg.mix: $(LIBOBJECTS)
  1463. X    @$(RM) libjpeg.mix
  1464. X    $(AR) libjpeg.mix @makljpeg.cf
  1465. X
  1466. Xclean:
  1467. X    $(RM) *.mix cjpeg.exe djpeg.exe testout.*
  1468. X
  1469. Xtest:
  1470. X    @$(RM) testout.*
  1471. X    +djpeg testorig.jpg testout.ppm
  1472. X    +djpeg -G testorig.jpg testout.gif
  1473. X    +cjpeg testimg.ppm testout.jpg
  1474. X    fc testimg.ppm testout.ppm
  1475. X    fc testimg.gif testout.gif
  1476. X    fc testimg.jpg testout.jpg
  1477. X
  1478. X
  1479. Xjbsmooth.mix : jbsmooth.c jinclude.h jconfig.h jpegdata.h
  1480. Xjcarith.mix : jcarith.c jinclude.h jconfig.h jpegdata.h
  1481. Xjccolor.mix : jccolor.c jinclude.h jconfig.h jpegdata.h
  1482. Xjcdeflts.mix : jcdeflts.c jinclude.h jconfig.h jpegdata.h
  1483. Xjcexpand.mix : jcexpand.c jinclude.h jconfig.h jpegdata.h
  1484. Xjchuff.mix : jchuff.c jinclude.h jconfig.h jpegdata.h
  1485. Xjcmain.mix : jcmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
  1486. Xjcmaster.mix : jcmaster.c jinclude.h jconfig.h jpegdata.h
  1487. Xjcmcu.mix : jcmcu.c jinclude.h jconfig.h jpegdata.h
  1488. Xjcpipe.mix : jcpipe.c jinclude.h jconfig.h jpegdata.h
  1489. Xjcsample.mix : jcsample.c jinclude.h jconfig.h jpegdata.h
  1490. Xjdarith.mix : jdarith.c jinclude.h jconfig.h jpegdata.h
  1491. Xjdcolor.mix : jdcolor.c jinclude.h jconfig.h jpegdata.h
  1492. Xjddeflts.mix : jddeflts.c jinclude.h jconfig.h jpegdata.h
  1493. Xjdhuff.mix : jdhuff.c jinclude.h jconfig.h jpegdata.h
  1494. Xjdmain.mix : jdmain.c jinclude.h jconfig.h jpegdata.h jversion.h egetopt.c
  1495. Xjdmaster.mix : jdmaster.c jinclude.h jconfig.h jpegdata.h
  1496. Xjdmcu.mix : jdmcu.c jinclude.h jconfig.h jpegdata.h
  1497. Xjdpipe.mix : jdpipe.c jinclude.h jconfig.h jpegdata.h
  1498. Xjdsample.mix : jdsample.c jinclude.h jconfig.h jpegdata.h
  1499. Xjerror.mix : jerror.c jinclude.h jconfig.h jpegdata.h
  1500. Xjquant1.mix : jquant1.c jinclude.h jconfig.h jpegdata.h
  1501. Xjquant2.mix : jquant2.c jinclude.h jconfig.h jpegdata.h
  1502. Xjfwddct.mix : jfwddct.c jinclude.h jconfig.h jpegdata.h
  1503. Xjrevdct.mix : jrevdct.c jinclude.h jconfig.h jpegdata.h
  1504. Xjutils.mix : jutils.c jinclude.h jconfig.h jpegdata.h
  1505. Xjmemmgr.mix : jmemmgr.c jinclude.h jconfig.h jpegdata.h jmemsys.h
  1506. Xjrdjfif.mix : jrdjfif.c jinclude.h jconfig.h jpegdata.h
  1507. Xjrdgif.mix : jrdgif.c jinclude.h jconfig.h jpegdata.h
  1508. Xjrdppm.mix : jrdppm.c jinclude.h jconfig.h jpegdata.h
  1509. Xjrdrle.mix : jrdrle.c jinclude.h jconfig.h jpegdata.h
  1510. Xjrdtarga.mix : jrdtarga.c jinclude.h jconfig.h jpegdata.h
  1511. Xjwrjfif.mix : jwrjfif.c jinclude.h jconfig.h jpegdata.h
  1512. Xjwrgif.mix : jwrgif.c jinclude.h jconfig.h jpegdata.h
  1513. Xjwrppm.mix : jwrppm.c jinclude.h jconfig.h jpegdata.h
  1514. Xjwrrle.mix : jwrrle.c jinclude.h jconfig.h jpegdata.h
  1515. Xjwrtarga.mix : jwrtarga.c jinclude.h jconfig.h jpegdata.h
  1516. Xjmemsys.mix : jmemsys.c jinclude.h jconfig.h jpegdata.h jmemsys.h
  1517. Xjmemdosa.mix : jmemdosa.asm
  1518. X    masm /mx jmemdosa;
  1519. X    mix jmemdosa.obj
  1520. END_OF_FILE
  1521.   if test 5907 -ne `wc -c <'makefile.pwc'`; then
  1522.     echo shar: \"'makefile.pwc'\" unpacked with wrong size!
  1523.   fi
  1524.   # end of 'makefile.pwc'
  1525. fi
  1526. echo shar: End of archive 17 \(of 18\).
  1527. cp /dev/null ark17isdone
  1528. MISSING=""
  1529. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  1530.     if test ! -f ark${I}isdone ; then
  1531.     MISSING="${MISSING} ${I}"
  1532.     fi
  1533. done
  1534. if test "${MISSING}" = "" ; then
  1535.     echo You have unpacked all 18 archives.
  1536.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1537. else
  1538.     echo You still must unpack the following archives:
  1539.     echo "        " ${MISSING}
  1540. fi
  1541. exit 0
  1542. exit 0 # Just in case...
  1543.