| 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_SYMBOL_DICT_H |
| 21 | #define _JBIG2_SYMBOL_DICT_H |
| 22 | |
| 23 | /* symbol dictionary header */ |
| 24 | |
| 25 | /* the results of decoding a symbol dictionary */ |
| 26 | typedef struct { |
| 27 | uint32_t n_symbols; |
| 28 | Jbig2Image **glyphs; |
| 29 | } Jbig2SymbolDict; |
| 30 | |
| 31 | /* decode a symbol dictionary segment and store the results */ |
| 32 | int jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); |
| 33 | |
| 34 | /* get a particular glyph by index */ |
| 35 | Jbig2Image *jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id); |
| 36 | |
| 37 | /* return a new empty symbol dict */ |
| 38 | Jbig2SymbolDict *jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols); |
| 39 | |
| 40 | /* release the memory associated with a symbol dict */ |
| 41 | void jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict); |
| 42 | |
| 43 | /* generate a new symbol dictionary by concatenating a list of |
| 44 | existing dictionaries */ |
| 45 | Jbig2SymbolDict *jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts); |
| 46 | |
| 47 | /* count the number of dictionary segments referred |
| 48 | to by the given segment */ |
| 49 | uint32_t jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); |
| 50 | |
| 51 | /* return an array of pointers to symbol dictionaries referred |
| 52 | to by a segment */ |
| 53 | Jbig2SymbolDict **jbig2_sd_list_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); |
| 54 | |
| 55 | #endif /* _JBIG2_SYMBOL_DICT_H */ |
| 56 | |