ref: 64763d5e222479931ae569f3db0adf7588147233
parent: cdf26701fbd0fef2ef9f915aed0d76fc180fc47e
author: Sebastian Rasmussen <[email protected]>
date: Sat May 26 15:12:28 EDT 2018
jbig2dec: Create jbig2_segment.h with segment declarations.
--- a/jbig2.c
+++ b/jbig2.c
@@ -30,6 +30,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_page.h"
+#include "jbig2_segment.h"
static void *
jbig2_default_alloc(Jbig2Allocator *allocator, size_t size)
--- a/jbig2.h
+++ b/jbig2.h
@@ -108,24 +108,6 @@
/* mark the current page as complete, simulating an end-of-page segment (for broken streams) */
int jbig2_complete_page(Jbig2Ctx *ctx);
-/* segment header routines */
-
-struct _Jbig2Segment {
- uint32_t number;
- uint8_t flags;
- uint32_t page_association;
- size_t data_length;
- int referred_to_segment_count;
- uint32_t *referred_to_segments;
- void *result;
-};
-
-Jbig2Segment *jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size);
-int jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
-void jbig2_free_segment(Jbig2Ctx *ctx, Jbig2Segment *segment);
-
-Jbig2Segment *jbig2_find_segment(Jbig2Ctx *ctx, uint32_t number);
-
#endif /* _JBIG2_H */
#ifdef __cplusplus
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -40,6 +40,7 @@
#include "jbig2_generic.h"
#include "jbig2_mmr.h"
#include "jbig2_page.h"
+#include "jbig2_segment.h"
/* return the appropriate context size for the given template */
int
--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -34,6 +34,7 @@
#include "jbig2_image.h"
#include "jbig2_halftone.h"
#include "jbig2_page.h"
+#include "jbig2_segment.h"
/**
* jbig2_hd_new: create a new dictionary from a collective bitmap
--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -36,6 +36,7 @@
#include "jbig2_priv.h"
#include "jbig2_huffman.h"
#include "jbig2_hufftab.h"
+#include "jbig2_segment.h"
#define JBIG2_HUFFMAN_FLAGS_ISOOB 1
#define JBIG2_HUFFMAN_FLAGS_ISLOW 2
--- a/jbig2_metadata.c
+++ b/jbig2_metadata.c
@@ -28,6 +28,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_metadata.h"
+#include "jbig2_segment.h"
/* metadata key,value list object */
Jbig2Metadata *
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -27,6 +27,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_page.h"
+#include "jbig2_segment.h"
#ifdef OUTPUT_PBM
#include <stdio.h>
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -124,19 +124,6 @@
} Jbig2ComposeOp;
int jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op);
-
-/* region segment info */
-
-typedef struct {
- int32_t width;
- int32_t height;
- int32_t x;
- int32_t y;
- Jbig2ComposeOp op;
- uint8_t flags;
-} Jbig2RegionSegmentInfo;
-
-void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data);
int jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
/* 7.4 */
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -38,6 +38,7 @@
#include "jbig2_image.h"
#include "jbig2_page.h"
#include "jbig2_refinement.h"
+#include "jbig2_segment.h"
static int
jbig2_decode_refinement_template0_unopt(Jbig2Ctx *ctx,
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -33,6 +33,7 @@
#include "jbig2_arith.h"
#include "jbig2_halftone.h"
#include "jbig2_refinement.h"
+#include "jbig2_segment.h"
Jbig2Segment *
jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size)
--- /dev/null
+++ b/jbig2_segment.h
@@ -1,0 +1,53 @@
+/* Copyright (C) 2001-2018 Artifex Software, Inc.
+ All Rights Reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+ implied.
+
+ This software is distributed under license and may not be copied,
+ modified or distributed except as expressly authorized under the terms
+ of the license contained in the file LICENSE in this distribution.
+
+ Refer to licensing information at http://www.artifex.com or contact
+ Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
+ CA 94945, U.S.A., +1(415)492-9861, for further information.
+*/
+
+/*
+ jbig2dec
+*/
+
+#ifndef _JBIG2_SEGMENT_H
+#define _JBIG2_SEGMENT_H
+
+/* segment header routines */
+
+struct _Jbig2Segment {
+ uint32_t number;
+ uint8_t flags;
+ uint32_t page_association;
+ size_t data_length;
+ int referred_to_segment_count;
+ uint32_t *referred_to_segments;
+ void *result;
+};
+
+Jbig2Segment *jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size);
+int jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
+void jbig2_free_segment(Jbig2Ctx *ctx, Jbig2Segment *segment);
+Jbig2Segment *jbig2_find_segment(Jbig2Ctx *ctx, uint32_t number);
+
+/* region segment info */
+
+typedef struct {
+ int32_t width;
+ int32_t height;
+ int32_t x;
+ int32_t y;
+ Jbig2ComposeOp op;
+ uint8_t flags;
+} Jbig2RegionSegmentInfo;
+
+void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data);
+
+#endif /* _JBIG2_SEGMENT_H */
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -38,6 +38,7 @@
#include "jbig2_symbol_dict.h"
#include "jbig2_text.h"
#include "jbig2_refinement.h"
+#include "jbig2_segment.h"
#if defined(OUTPUT_PBM) || defined(DUMP_SYMDICT)
#include <stdio.h>
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -34,6 +34,7 @@
#include "jbig2_generic.h"
#include "jbig2_page.h"
#include "jbig2_refinement.h"
+#include "jbig2_segment.h"
#include "jbig2_symbol_dict.h"
#include "jbig2_text.h"