ref: f83d936965f28824360c79822b1c7eefeb3a3e36
parent: b109bd22c74be647631cd12077ad105c179afa12
author: Sebastian Rasmussen <sebras@gmail.com>
date: Sat May 26 10:51:42 EDT 2018
jbig2dec: Create jbig2_page.h with page declarations.
--- a/jbig2.c
+++ b/jbig2.c
@@ -29,6 +29,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
+#include "jbig2_page.h"
static void *
jbig2_default_alloc(Jbig2Allocator *allocator, size_t size)
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -39,6 +39,7 @@
#include "jbig2_arith.h"
#include "jbig2_generic.h"
#include "jbig2_mmr.h"
+#include "jbig2_page.h"
/* return the appropriate context size for the given template */
int
--- a/jbig2_halftone.c
+++ b/jbig2_halftone.c
@@ -33,6 +33,7 @@
#include "jbig2_mmr.h"
#include "jbig2_image.h"
#include "jbig2_halftone.h"
+#include "jbig2_page.h"
/**
* jbig2_hd_new: create a new dictionary from a collective bitmap
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -26,6 +26,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
+#include "jbig2_page.h"
#ifdef OUTPUT_PBM
#include <stdio.h>
--- /dev/null
+++ b/jbig2_page.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_PAGE_H
+#define _JBIG2_PAGE_H
+
+/* the page structure handles decoded page
+ results. it's allocated by a 'page info'
+ segment and marked complete by an 'end of page'
+ segment.
+*/
+typedef enum {
+ JBIG2_PAGE_FREE,
+ JBIG2_PAGE_NEW,
+ JBIG2_PAGE_COMPLETE,
+ JBIG2_PAGE_RETURNED,
+ JBIG2_PAGE_RELEASED
+} Jbig2PageState;
+
+struct _Jbig2Page {
+ Jbig2PageState state;
+ uint32_t number;
+ uint32_t height, width; /* in pixels */
+ uint32_t x_resolution, y_resolution; /* in pixels per meter */
+ uint16_t stripe_size;
+ bool striped;
+ uint32_t end_row;
+ uint8_t flags;
+ Jbig2Image *image;
+};
+
+int jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
+int jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
+int jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
+int jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *src, int x, int y, Jbig2ComposeOp op);
+
+#endif /* _JBIG2_PAGE_H */
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -115,36 +115,7 @@
int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, int32_t seg_idx, const char *fmt, ...);
-/* the page structure handles decoded page
- results. it's allocated by a 'page info'
- segment and marked complete by an 'end of page'
- segment.
-*/
typedef enum {
- JBIG2_PAGE_FREE,
- JBIG2_PAGE_NEW,
- JBIG2_PAGE_COMPLETE,
- JBIG2_PAGE_RETURNED,
- JBIG2_PAGE_RELEASED
-} Jbig2PageState;
-
-struct _Jbig2Page {
- Jbig2PageState state;
- uint32_t number;
- uint32_t height, width; /* in pixels */
- uint32_t x_resolution, y_resolution; /* in pixels per meter */
- uint16_t stripe_size;
- bool striped;
- uint32_t end_row;
- uint8_t flags;
- Jbig2Image *image;
-};
-
-int jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
-int jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
-int jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
-
-typedef enum {
JBIG2_COMPOSE_OR = 0,
JBIG2_COMPOSE_AND = 1,
JBIG2_COMPOSE_XOR = 2,
@@ -153,7 +124,6 @@
} Jbig2ComposeOp;
int jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op);
-int jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *src, int x, int y, Jbig2ComposeOp op);
/* region segment info */
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -36,6 +36,7 @@
#include "jbig2_arith.h"
#include "jbig2_generic.h"
#include "jbig2_image.h"
+#include "jbig2_page.h"
static int
jbig2_decode_refinement_template0_unopt(Jbig2Ctx *ctx,
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -27,6 +27,7 @@
#include "jbig2.h"
#include "jbig2_priv.h"
#include "jbig2_huffman.h"
+#include "jbig2_page.h"
#include "jbig2_symbol_dict.h"
#include "jbig2_metadata.h"
#include "jbig2_arith.h"
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -32,6 +32,7 @@
#include "jbig2_arith_iaid.h"
#include "jbig2_huffman.h"
#include "jbig2_generic.h"
+#include "jbig2_page.h"
#include "jbig2_symbol_dict.h"
#include "jbig2_text.h"