iljpgdecodedefs.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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: iljpgdecodedefs.h /main/3 1995/10/23 15:54:41 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 ILJPGDECODEDEFS_H
  40. #define ILJPGDECODEDEFS_H
  41. #include "ilint.h"
  42. #include "ilerrors.h"
  43. /* Equate ILJPG errors to IL errors */
  44. #define ILJPG_ERROR_DECODE_MALLOC IL_ERROR_MALLOC
  45. #define ILJPG_ERROR_DECODE_JIF IL_ERROR_COMPRESSED_DATA
  46. #define ILJPG_ERROR_DECODE_DATA IL_ERROR_COMPRESSED_DATA
  47. #define ILJPG_ERROR_DECODE_INTERNAL IL_ERROR_COMPRESSED_DATA
  48. #define ILJPG_ERROR_DECODE_EOD IL_ERROR_COMPRESSED_DATA
  49. #define ILJPG_ERROR_DECODE_DCAC_TABLE IL_ERROR_COMPRESSED_DATA
  50. #define ILJPG_ERROR_DECODE_PARS IL_ERROR_COMPRESSED_DATA
  51. /* Define a JPEG stream: ptr to data in memory and # bytes left */
  52. typedef struct {
  53. ilPtr pData;
  54. long nBytesLeft;
  55. } ilJPEGDecodeStream, *ilJPEGDecodeStreamPtr;
  56. #define ILJPG_DECODE_STREAM ilJPEGDecodeStreamPtr
  57. /* Macro to get next byte from a stream. Return ILJPG_ERROR_DECODE_EOD
  58. error if no more data.
  59. */
  60. #define ILJPG_DECODE_GET_BYTE(_stream, _byte, _error) ( \
  61. (--_stream->nBytesLeft < 0) ? \
  62. (_error = ILJPG_ERROR_DECODE_EOD, 0) : \
  63. (_byte = *_stream->pData++, 1) )
  64. #endif