iljpgdecodeint.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: iljpgdecodeint.h /main/3 1995/10/23 15:54:54 rswiston $ */
  24. /**---------------------------------------------------------------------
  25. ***
  26. *** (c)Copyright 1992 Hewlett-Packard Co.
  27. ***
  28. *** RESTRICTED RIGHTS LEGEND
  29. *** Use, duplication, or disclosure by the U.S. Government is subject to
  30. *** restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
  31. *** Technical Data and Computer Software clause in DFARS 252.227-7013.
  32. *** Hewlett-Packard Company
  33. *** 3000 Hanover Street
  34. *** Palo Alto, CA 94304 U.S.A.
  35. *** Rights for non-DOD U.S. Government Departments and Agencies are as set
  36. *** forth in FAR 52.227-19(c)(1,2).
  37. ***
  38. ***-------------------------------------------------------------------*/
  39. #ifndef ILJPGDECODEINT_H
  40. #define ILJPGDECODEINT_H
  41. #ifndef ILJPGDECODE_H
  42. #include "iljpgdecode.h"
  43. #endif
  44. #ifndef ILJPGINT_H
  45. #include "iljpgint.h"
  46. #endif
  47. /* Codes returned from _iljpgHuffmanDecode() indicating which coefficients
  48. of the 8x8 block are non-zero.
  49. */
  50. #define HUFF_DC_ONLY 0 /* only DCT non-zero */
  51. #define HUFF_FOURX4 1 /* only top-left 4x4 matrix non-zero */
  52. #define HUFF_FULL 2 /* "whole" 8x8 non-zero */
  53. /* Private data for decoding JPEG (not JIF), e.g.
  54. _iljpgDecodeInit/Execute/Cleanup().
  55. */
  56. typedef struct {
  57. float *pRevScale; /* built from DCT Q table */
  58. int horiFactor, vertFactor; /* copied from iljpgDataRec */
  59. long width, height; /* size of output buffer */
  60. int mcuXInc, mcuYInc; /* value to inc (x,y) by, each MCU */
  61. long x, y; /* where to store next MCU */
  62. int lastDC; /* DC from previous 8x8 block */
  63. } iljpgCompRec, *iljpgCompPtr;
  64. typedef struct {
  65. iljpgDataPtr pData; /* data passed to _iljpgDecodeInit() */
  66. int mcuRestartCount; /* # of mcu's since last restart */
  67. iljpgPtr pHuffPriv; /* owned by iljpgdehuff.c */
  68. float *DCTRevScaleTables[4]; /* owned by iljpgdedct.c */
  69. iljpgCompRec compData[ILJPG_MAX_COMPS]; /* owned by iljpgdecode.c */
  70. } iljpgDecodePrivRec, *iljpgDecodePrivPtr;
  71. /* Functions in iljpgdehuff.c */
  72. ILJPG_PRIVATE_EXTERN
  73. iljpgError _iljpgDehuffInit (
  74. iljpgDecodePrivPtr pPriv
  75. );
  76. ILJPG_PRIVATE_EXTERN
  77. iljpgError _iljpgDehuffCleanup (
  78. iljpgDecodePrivPtr pPriv
  79. );
  80. ILJPG_PRIVATE_EXTERN
  81. iljpgError _iljpgDehuffReset (
  82. iljpgDecodePrivPtr pPriv
  83. );
  84. ILJPG_PRIVATE_EXTERN
  85. iljpgError _iljpgDehuffExecute (
  86. iljpgDecodePrivPtr pPriv,
  87. ILJPG_DECODE_STREAM stream,
  88. int comp,
  89. int *pOut,
  90. unsigned int *pBlockType
  91. );
  92. /* Functions in iljpgdedct.c */
  93. ILJPG_PRIVATE_EXTERN
  94. iljpgError _iljpgDeDCTInit (
  95. iljpgDecodePrivPtr pPriv
  96. );
  97. ILJPG_PRIVATE_EXTERN
  98. iljpgError _iljpgDeDCTCleanup (
  99. iljpgDecodePrivPtr pPriv
  100. );
  101. ILJPG_PRIVATE_EXTERN
  102. void _iljpgDeDCTFull (
  103. int *pSrc,
  104. long nBytesPerRow,
  105. iljpgPtr ix, /* RETURNED */
  106. float *pRevScale
  107. );
  108. ILJPG_PRIVATE_EXTERN
  109. void _iljpgDeDCT4x4 (
  110. int *pSrc,
  111. long nBytesPerRow,
  112. iljpgPtr ix, /* RETURNED */
  113. float *pRevScale
  114. );
  115. ILJPG_PRIVATE_EXTERN
  116. void _iljpgDeDCTDCOnly (
  117. int *pSrc,
  118. long nBytesPerRow,
  119. iljpgPtr pDst, /* RETURNED */
  120. float *pRevScale
  121. );
  122. #endif