| 1 | /* Copyright (C) 2001-2019 Artifex Software, Inc. |
| 2 | All Rights Reserved. |
| 3 | |
| 4 | This software is provided AS-IS with no warranty, either express or |
| 5 | implied. |
| 6 | |
| 7 | This software is distributed under license and may not be copied, |
| 8 | modified or distributed except as expressly authorized under the terms |
| 9 | of the license contained in the file LICENSE in this distribution. |
| 10 | |
| 11 | Refer to licensing information at http://www.artifex.com or contact |
| 12 | Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, |
| 13 | CA 94945, U.S.A., +1(415)492-9861, for further information. |
| 14 | */ |
| 15 | |
| 16 | /* |
| 17 | jbig2dec |
| 18 | */ |
| 19 | |
| 20 | #ifndef _JBIG2_ARITH_H |
| 21 | #define _JBIG2_ARITH_H |
| 22 | |
| 23 | typedef struct _Jbig2ArithState Jbig2ArithState; |
| 24 | |
| 25 | /* An arithmetic coding context is stored as a single byte, with the |
| 26 | index in the low order 7 bits (actually only 6 are used), and the |
| 27 | MPS in the top bit. */ |
| 28 | typedef unsigned char Jbig2ArithCx; |
| 29 | |
| 30 | /* allocate and initialize a new arithmetic coding state */ |
| 31 | Jbig2ArithState *jbig2_arith_new(Jbig2Ctx *ctx, Jbig2WordStream *ws); |
| 32 | |
| 33 | /* decode a bit */ |
| 34 | bool jbig2_arith_decode(Jbig2ArithState *as, Jbig2ArithCx *pcx, int *code); |
| 35 | |
| 36 | /* returns true if the end of the data stream has been reached (for sanity checks) */ |
| 37 | bool jbig2_arith_has_reached_marker(Jbig2ArithState *as); |
| 38 | |
| 39 | #endif /* _JBIG2_ARITH_H */ |
| 40 | |