Clean up the lossless JPEG feature

- Rename jpeg_simple_lossless() to jpeg_enable_lossless() and modify the
  function so that it stores the lossless parameters directly in the Ss
  and Al fields of jpeg_compress_struct rather than using a scan script.

- Move the cjpeg -lossless switch into "Switches for advanced users".

- Document the libjpeg API and run-time features that are unavailable in
  lossless mode, and ensure that all parameters, functions, and switches
  related to unavailable features are ignored or generate errors in
  lossless mode.

- Defer any action that depends on whether lossless mode is enabled
  until jpeg_start_compress()/jpeg_start_decompress() is called.

- Document the purpose of the point transform value.

- "Codec" stands for coder/decoder, so it is a bit awkward to say
  "lossless compression codec" and "lossless decompression codec".
  Use "lossless compressor" and "lossless decompressor" instead.

- Restore backward API/ABI compatibility with libjpeg v6b:

  * Move the new 'lossless' field from the exposed jpeg_compress_struct
    and jpeg_decompress_struct structures into the opaque
    jpeg_comp_master and jpeg_decomp_master structures, and allocate the
    master structures in the body of jpeg_create_compress() and
    jpeg_create_decompress().

  * Remove the new 'process' field from jpeg_compress_struct and
    jpeg_decompress_struct and replace it with the old
    'progressive_mode' field and the new 'lossless' field.

  * Remove the new 'data_unit' field from jpeg_compress_struct and
    jpeg_decompress_struct and replace it with a locally-computed
    data unit variable.

  * Restore the names of macros and fields that refer to DCT blocks, and
    document that they have a different meaning in lossless mode.  (Most
    of them aren't very meaningful in lossless mode anyhow.)

  * Remove the new alloc_darray() method from jpeg_memory_mgr and
    replace it with an internal macro that wraps the alloc_sarray()
    method.

  * Move the JDIFF* data types from jpeglib.h and jmorecfg.h into
    jpegint.h.

  * Remove the new 'codec' field from jpeg_compress_struct and
    jpeg_decompress_struct and instead reuse the existing internal
    coefficient control, forward/inverse DCT, and entropy
    encoding/decoding structures for lossless compression/decompression.

  * Repurpose existing error codes rather than introducing new ones.
    (The new JERR_BAD_RESTART and JWRN_MUST_DOWNSCALE codes remain,
    although JWRN_MUST_DOWNSCALE will probably be removed in
    libjpeg-turbo, since we have a different way of handling multiple
    data precisions.)

- Automatically enable lossless mode when a scan script with parameters
  that are only valid for lossless mode is detected, and document the
  use of scan scripts to generate lossless JPEG images.

- Move the sequential and shared Huffman routines back into jchuff.c and
  jdhuff.c, and document that those routines are shared with jclhuff.c
  and jdlhuff.c as well as with jcphuff.c and jdphuff.c.

- Move MAX_DIFF_BITS from jchuff.h into jclhuff.c, the only place where
  it is used.

- Move the predictor and scaler code into jclossls.c and jdlossls.c.

- Streamline register usage in the [un]differencers (inspired by similar
  optimizations in the color [de]converters.)

- Restructure the logic in a few places to reduce duplicated code.

- Ensure that all lossless-specific code is guarded by
  C_LOSSLESS_SUPPORTED or D_LOSSLESS_SUPPORTED and that the library can
  be built successfully if either or both of those macros is undefined.

- Remove all short forms of external names introduced by the lossless
  JPEG patch.  (These will not be needed by libjpeg-turbo, so there is
  no use cleaning them up.)

- Various wordsmithing, formatting, and punctuation tweaks

- Eliminate various compiler warnings.
67 files changed
tree: ee349d226cdfafb17f271a4739f3dd1c053c2e66
  1. ansi2knr.1
  2. ansi2knr.c
  3. cderror.h
  4. cdjpeg.c
  5. cdjpeg.h
  6. change.log
  7. cjpeg.1
  8. cjpeg.c
  9. ckconfig.c
  10. coderules.doc
  11. config.guess
  12. config.sub
  13. configure
  14. djpeg.1
  15. djpeg.c
  16. example.c
  17. filelist.doc
  18. install-sh
  19. install.doc
  20. jcapimin.c
  21. jcapistd.c
  22. jccoefct.c
  23. jccolor.c
  24. jcdctmgr.c
  25. jcdiffct.c
  26. jchuff.c
  27. jchuff.h
  28. jcinit.c
  29. jclhuff.c
  30. jclossls.c
  31. jcmainct.c
  32. jcmarker.c
  33. jcmaster.c
  34. jcmaster.h
  35. jcomapi.c
  36. jconfig.bcc
  37. jconfig.cfg
  38. jconfig.dj
  39. jconfig.doc
  40. jconfig.mac
  41. jconfig.manx
  42. jconfig.mc6
  43. jconfig.sas
  44. jconfig.st
  45. jconfig.vc
  46. jconfig.vms
  47. jconfig.wat
  48. jcparam.c
  49. jcphuff.c
  50. jcprepct.c
  51. jcsample.c
  52. jctrans.c
  53. jdapimin.c
  54. jdapistd.c
  55. jdatadst.c
  56. jdatasrc.c
  57. jdcoefct.c
  58. jdcolor.c
  59. jdct.h
  60. jddctmgr.c
  61. jddiffct.c
  62. jdhuff.c
  63. jdhuff.h
  64. jdinput.c
  65. jdlhuff.c
  66. jdlossls.c
  67. jdmainct.c
  68. jdmarker.c
  69. jdmaster.c
  70. jdmaster.h
  71. jdmerge.c
  72. jdphuff.c
  73. jdpostct.c
  74. jdsample.c
  75. jdtrans.c
  76. jerror.c
  77. jerror.h
  78. jfdctflt.c
  79. jfdctfst.c
  80. jfdctint.c
  81. jidctflt.c
  82. jidctfst.c
  83. jidctint.c
  84. jidctred.c
  85. jinclude.h
  86. jlossls.h
  87. jmemansi.c
  88. jmemdos.c
  89. jmemdosa.asm
  90. jmemmac.c
  91. jmemmgr.c
  92. jmemname.c
  93. jmemnobs.c
  94. jmemsys.h
  95. jmorecfg.h
  96. jpegint.h
  97. jpeglib.h
  98. jpegtran.1
  99. jpegtran.c
  100. jquant1.c
  101. jquant2.c
  102. jutils.c
  103. jversion.h
  104. libjpeg.doc
  105. ltconfig
  106. ltmain.sh
  107. makcjpeg.st
  108. makdjpeg.st
  109. makeapps.ds
  110. makefile.ansi
  111. makefile.bcc
  112. makefile.cfg
  113. makefile.dj
  114. makefile.manx
  115. makefile.mc6
  116. makefile.mms
  117. makefile.sas
  118. makefile.unix
  119. makefile.vc
  120. makefile.vms
  121. makefile.wat
  122. makelib.ds
  123. makeproj.mac
  124. makljpeg.st
  125. maktjpeg.st
  126. makvms.opt
  127. rdbmp.c
  128. rdcolmap.c
  129. rdgif.c
  130. rdjpgcom.1
  131. rdjpgcom.c
  132. rdppm.c
  133. rdrle.c
  134. rdswitch.c
  135. rdtarga.c
  136. README
  137. structure.doc
  138. testimg.bmp
  139. testimg.jpg
  140. testimg.ppm
  141. testimgl.jpg
  142. testimgl.ppm
  143. testimgp.jpg
  144. testorig.jpg
  145. testprog.jpg
  146. TODO
  147. transupp.c
  148. transupp.h
  149. usage.doc
  150. wizard.doc
  151. wrbmp.c
  152. wrgif.c
  153. wrjpgcom.1
  154. wrjpgcom.c
  155. wrppm.c
  156. wrrle.c
  157. wrtarga.c