📄 hpbit_stream_in_local.h
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company */
/* All rights reserved */
/* File: "hpbit_stream_in_local.h" */
/* Description: Private definitions for "hpbit_stream_in.c" */
/* Author: David Taubman */
/* Affiliation: Hewlett-Packard and */
/* The University of New South Wales, Australia */
/* Acknowledgements: Partly developed in collaboration with Salma Soudagar */
/* of Motorola, Switzerland, and her colleagues */
/* Version: VM9.0 */
/* Last Revised: 27 April, 2001 */
/*****************************************************************************/
/*****************************************************************************/
/* Modified by David Taubman to support interface modifications, arbitrary */
/* changes in coding parameters from component to component and from tile */
/* to tile, to support the full generality of PART-1 of the JPEG2000 */
/* standard, and to support most anticipated generality of PART-2. Changes */
/* are too numerous to flag individually within the code, which in some */
/* places has been completely rewritten. All changes copyrighted by HP with */
/* all rights reserved for the modified parts. */
/*****************************************************************************/
#ifndef HPBIT_STREAM_IN_LOCAL_H
#define HPBIT_STREAM_IN_LOCAL_H
#include <ifc.h>
#include <stdio.h>
#define HPBIT_MEM_KEY "STREAM IN/OUT OBJECT MEMORY"
/*****************************************************************************/
/* hpbit_packed_head */
/*****************************************************************************/
typedef
struct hpbit_packed_head {
int bytes_left;
std_byte *data;
std_byte *data_handle;
struct hpbit_packed_head *next;
} hpbit_packed_head, *hpbit_packed_head_ptr;
/* This structure manages a linked list of packed packet header buffers.
Each tile-part contains a pointer to such a structure which is NULL
unless PPT or PPM markers are in use. The `bytes_left' field indicates
the number of remaining bytes of packed header information, while the
`data' field points to the next available byte of packet header
information. `data_handle' is used to deallocate the buffer when we
are done; it may be NULL, meaning that the buffer is being shared with
another `hpbit_packed_head' structure and should not be deallocated
until all header information has been consumed; this is useful in
moving information from a PPM marker into individual tile-part
headers. */
/*****************************************************************************/
/* hpbit_stored_heads */
/*****************************************************************************/
typedef
struct hpbit_stored_heads {
hpbit_packed_head_ptr packed_heads;
struct hpbit_stored_heads *next;
} hpbit_stored_heads, *hpbit_stored_heads_ptr;
/* This structure manages packed-packet header information for a single
tile-part in a list with one entry for each tile-part in sequence, until
that tile-part is created. The list is created when a PPM marker is
encountered in the global header. */
/*****************************************************************************/
/* hpbit_marker_elt */
/*****************************************************************************/
typedef
struct hpbit_marker_elt {
int marker_id;
int element_id;
const char *description;
int size;
/* Begin Aerospace MCT mods (TSW) */
int data_size_indirect;
/* End Aerospace MCT mods */
std_uint *buf;
struct hpbit_marker_elt *next;
} hpbit_marker_elt, *hpbit_marker_elt_ptr;
/* This structure is used to build a linked list of elements for each
`hpbit_pre_marker' structure. These are the elements declared using
the `stream_out__declare_marker_elt' interface function. The
`marker_id' and `element_id' fields hold the value of the first and
second byte in the element ID string passed across that interface
function (see "ifc.h" for an explanation); these are 1-byte quantities.
The `buf' field points to an array with `size' entries, which is
dynamically allocated and hence must be deallocated upon termination.
No element has a `size' of 0. */
/* Begin Aerospace MCT mods (TSW)
The data_size_indirect field is added to facilitate handling of very
large data structures in the marker paradigm. If the field is non-zero,
then the buf field points to a memory location containing that number
of bytes of data. In this case, the size field is set to 1.
End Aerospace MCT mods */
/*****************************************************************************/
/* hpbit_pre_marker */
/*****************************************************************************/
typedef
struct hpbit_pre_marker {
int id;
int instance;
hpbit_marker_elt_ptr elements;
struct hpbit_pre_marker *next;
} hpbit_pre_marker, *hpbit_pre_marker_ptr;
/* This structure is used to build a linked list of so-called pre-markers;
these contain the information retrieved via the
`stream_in__size_marker_elt' and `stream_in__get_marker_val'
interface functions. The actual codestream markers can be significantly
different; it is the role of the `stream_in' object to provide
translation between code-stream markers and pre-markers. The `id' field
is identical to the `marker_id' field of all elements in the list
referenced by the `elements' field. */
/*****************************************************************************/
/* hpbit_codestream_marker */
/*****************************************************************************/
typedef
struct hpbit_codestream_marker {
int num_bytes;
std_byte *buf;
int accesses;
struct hpbit_codestream_marker *next;
} hpbit_codestream_marker, *hpbit_codestream_marker_ptr;
/* This structure is used to manage a linked list of codestream markers.
Codestream markers are retrieved from the codestream and stored in these
structures pending direct access and/or conversion to pre-markers.
The `buf' field contains `num_bytes' bytes which span the entire scope
of the marker, as it appears in the codestream. The buffer is typically
typecast to a meaningful structure, whose fields correspond to the
marker contents. The first two bytes of the `buf' buffer always contain
the marker code itself (i.e. an FF, followed by an identifying byte).
The third and fourth bytes of the `buf' buffer usually contain the value
of `num_bytes'-2 in Big Endian byte order.
The `accesses' field counts the number of times the marker has
been accessed. This information can be useful, particularly in
flagging markers which were not accessed at all. More importantly,
if the architecture uses the Little Endian byte order, the first
access may cause internal multi-word quantities to undergo byte
order reversal and we want to ensure that this occurs only once. */
/*****************************************************************************/
/* hpbit_component_params */
/*****************************************************************************/
typedef
struct hpbit_component_params {
int num_levels;
int num_bands;
} hpbit_component_params, *hpbit_component_params_ptr;
/* This structure manages the limited set of component-specific coding
parameters which are required for correct translation of markers. The
`num_levels' field holds the number of decomposition levels available
in the relevant tile-component. The `num_bands' field holds the total
number of subbands, which is, of course, dependent upon the decomposition
structure, as well as he number of decomposition levels. */
/*****************************************************************************/
/* hpbit_params */
/*****************************************************************************/
typedef
struct hpbit_params {
int num_components;
hpbit_component_params_ptr components;
} hpbit_params, *hpbit_params_ptr;
/* This structure maintains parameters which are needed to correctly
translate codestream markers. These parameters are fairly limited
and readily extracted from simple markers. Currently, we expect
these parameters to be limited to the number of components, and the
number of decomposition levels and the number of subbands in each
component. A separate structure is managed within each `hpbit_markers'
structure; however, only the fields are meaningful only in the global
header and in the first tile-part header of each tile. */
/*****************************************************************************/
/* hpbit_markers */
/*****************************************************************************/
typedef
struct hpbit_markers {
hpbit_pre_marker_ptr pre_markers;
hpbit_codestream_marker_ptr codestream_markers;
int total_codestream_bytes;
hpbit_params params;
} hpbit_markers, *hpbit_markers_ptr;
/* This structure manages a complete set of marker information,
corresponding to either the global header, or a tile header.
Markers always start on the codestream list, but most markers are
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -