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_SEGMENT_H
21#define _JBIG2_SEGMENT_H
22
23/* segment header routines */
24
25struct _Jbig2Segment {
26 uint32_t number;
27 uint8_t flags;
28 uint32_t page_association;
29 size_t data_length;
30 int referred_to_segment_count;
31 uint32_t *referred_to_segments;
32 uint32_t rows;
33 void *result;
34};
35
36Jbig2Segment *jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size);
37int jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
38void jbig2_free_segment(Jbig2Ctx *ctx, Jbig2Segment *segment);
39Jbig2Segment *jbig2_find_segment(Jbig2Ctx *ctx, uint32_t number);
40
41/* region segment info */
42
43typedef struct {
44 uint32_t width;
45 uint32_t height;
46 uint32_t x;
47 uint32_t y;
48 Jbig2ComposeOp op;
49 uint8_t flags;
50} Jbig2RegionSegmentInfo;
51
52void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data);
53
54#endif /* _JBIG2_SEGMENT_H */
55