jbig2_arith.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright (C) 2001-2023 Artifex Software, Inc.
  2. All Rights Reserved.
  3. This software is provided AS-IS with no warranty, either express or
  4. implied.
  5. This software is distributed under license and may not be copied,
  6. modified or distributed except as expressly authorized under the terms
  7. of the license contained in the file LICENSE in this distribution.
  8. Refer to licensing information at http://www.artifex.com or contact
  9. Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  10. CA 94129, USA, for further information.
  11. */
  12. /*
  13. jbig2dec
  14. */
  15. #ifndef _JBIG2_ARITH_H
  16. #define _JBIG2_ARITH_H
  17. typedef struct _Jbig2ArithState Jbig2ArithState;
  18. /* An arithmetic coding context is stored as a single byte, with the
  19. index in the low order 7 bits (actually only 6 are used), and the
  20. MPS in the top bit. */
  21. typedef unsigned char Jbig2ArithCx;
  22. /* allocate and initialize a new arithmetic coding state */
  23. Jbig2ArithState *jbig2_arith_new(Jbig2Ctx *ctx, Jbig2WordStream *ws);
  24. /* decode a bit */
  25. /* Normally returns 0 or 1. May return negative in case of error. */
  26. int jbig2_arith_decode(Jbig2Ctx *ctx, Jbig2ArithState *as, Jbig2ArithCx *pcx);
  27. /* returns true if the end of the data stream has been reached (for sanity checks) */
  28. bool jbig2_arith_has_reached_marker(Jbig2ArithState *as);
  29. #endif /* _JBIG2_ARITH_H */