⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hpbit_stream_out_local.h

📁 JPEG2000实现的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/* File: "hpbit_stream_out_local.h"                                          */
/* Description: Private definitions for "hpbit_stream_out.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.                               */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by David Taubman to incorporate changes to the POC marker (used  */
/* to be POD).  Changes are quite extensive and not always explicitly        */
/* When flagged, the relevant comment string is "DST POC mod".               */
/* Generally, any reference to tile-parts (e.g. through variable names       */
/* containing the string `tpart' are part of this modification, since the    */
/* compressor did not previously need to be tile-part aware.                 */
/* Copyright 2000 The University of New South Wales.                         */
/* All rights reserved for the modified parts.                               */
/*****************************************************************************/

#ifndef HPBIT_STREAM_OUT_LOCAL_H
#define HPBIT_STREAM_OUT_LOCAL_H
#include <ifc.h>
#include <stdio.h>

#define HPBIT_MEM_KEY "STREAM IN/OUT OBJECT MEMORY"


/*****************************************************************************/
/*                            hpbit_marker_elt                               */
/*****************************************************************************/

typedef
  struct hpbit_marker_elt {
    int marker_id;
    int element_id;
    char *description;
    int precision;
    int size;
    /* Begin Aerospace MCT mods (TSW) */
    int copied_on_set;
    long int data_size_indirect;
    /* End Aerospace MCT mods */
    std_uint *buf;
    int *set_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 `description' string is also derived from the element ID string;
     it is a pointer into the constant string resource supplied by the
     original caller and does not point to memory to be deallocated.
     The `precision' and `size' fields play identical roles to their namesakes
     in the `stream_out__declare_marker_elt' interface function.  The `buf'
     field points to an array with `size' entries, which is dynamically
     allocated and hence must be deallocated upon termination.  The `set_buf'
     field points to a dynamically allocated array with `size' entries,
     identifying the number of times the corresponding element in the
     `buf' array has been set by a call to `stream_out__set_marker_val'.
     Elements with a `size' of 0 have NULL `buf' and `set_buf' fields. */
  /* Begin Aerospace MCT mods (TSW) */
  /* Two extra fields added to simplify handling of very large pieces of
     data that may be required (particularly for multi-component transforms.
     copied_on_set is a flag that indicates whether or not the relevant data
     values were copied from the source into buf when the marker element
     value was set. data_size_indirect is a value: when it is zero, the
     marker element structure behaves just as it always has. When the value
     is greatern than zero, it indicates the true length of the marker
     element value in bytes. Also, in this case the set_buf array will
     contain only one element, indicating that the all marker value bytes
     pointed to by buf have been set. This simplifies the bookeeping required
     for very large arrays which appear in marker segments. */
  /* 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 *link_prev, *link_next;
    int potentially_redundant;
    int translated;
    struct hpbit_pre_marker *prev, *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 delivered across the
     `stream_out__declare_marker_elt' and `stream_out__set_marker_val'
     interface functions.  The actual codestream markers can be significantly
     different; it is the role of the `stream_out' object to provide
     translation between pre-markers and codestream markers.  The `id' field
     is identical to the `marker_id' field of all elements in the list
     referenced by the `elements' field.
         The `potentially_redundant', `link_prev' and `link_next' fields are
     used together to determine whether or not a pre-marker or a collection
     of pre-markers which appear in a tile header are redundant because they
     do not convey any different information to that available from the
     global header.  They work as follows: the `link_prev' and `link_next'
     fields are used to build a doubly linked list of pre-markers which
     must all be identical to a corresponding list of pre-markers in the
     global header for the collection of pre-markers in the tile-header to
     be considered redundant.  The `potentially_redundant' flag indicates
     whether or not a particular pre-marker is identical to one with the
     same instance and marker ID in the global header.  Detection and
     elimination of redundant markers proceeds in three phases.  Pre-markers
     first inherit any elements from a corresponding global pre-marker which
     they do not have in common.  Next, we identify the potentially redundant
     pre-markers by direct comparison.  Finally, we scan the list of
     pre-markers for groups of dependent pre-markers which are entirely
     redundant, eliminating the entire group whenever this happens. */

/*****************************************************************************/
/*                          hpbit_codestream_marker                          */
/*****************************************************************************/

typedef
  struct hpbit_codestream_marker {
    int instance;
    int tpart; /* DST POC mod */
    int num_bytes;
    std_byte *buf;
    struct hpbit_codestream_marker *next;
  } hpbit_codestream_marker, *hpbit_codestream_marker_ptr;
  /* This structure is used to manage a linked list of codestream markers.
     The codestream marker is actually written into the codestream as-is at
     the appropriate juncture.  Specifically, the `buf' field contains
     `num_bytes' bytes which must simply be written to the codestream.
     The buffer is typically typecast from a meaningful structure whose
     entries define 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 `instance' field must be identical to the `instance' field
     of the corresponding pre-marker if any; if non-zero, it can be expected
     to be found somewhere in the marker bytes themselves, but explicit
     inclusion of this field simplifies testing for tile-header markers which

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -