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

📄 hplx_synthesis_local.h

📁 JPEG2000实现的源码
💻 H
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/* File: "hplx_synthesis_local.h"                                            */
/* Description: Private definitions for "hplx_synthesis.c"                   */
/* Author: David Taubman                                                     */
/* Affiliation: Hewlett-Packard and                                          */
/*              The University of New South Wales, Australia                 */
/* Acknowledgements: Partly developed in collaboration with                  */
/*                   Christos Chrysafix of HP Labs                           */
/* Version: VM9.0                                                            */
/* Last Revised: 20 April, 2001                                              */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by David Taubman to support arbitrary reference points for the   */
/* transform and the various regular partitions, so as to facilitate         */
/* cropping and geometric transformations in the compressed domain and to    */
/* enable full support for CRF's single-sample overlap Wavelet transform,    */
/* as originally documented in Seoul.  Changes are too numerous to flag      */
/* individually within the code.  Changes copyrighted by HP with all rights  */
/* reserved for the modified parts.                                          */
/*****************************************************************************/

/*****************************************************************************/
/* 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 for general wavelet decompositions.                              */
/* Copyright 2000 Science Applications International Corporation (SAIC).     */
/* Copyright 1995 University of Arizona, Arizona Board of Regents.           */
/* All Rights Reserved for modified parts.                                   */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by Jianxin Wei, Australian Defence Force Academy (ADFA)          */
/* to implement the Odd Tile-Size Low-Pass First Convention (OTLPF_Convention)*/
/* Copyright 2000 University of New South Wales, Australia.                  */
/* All rights reserved for modified parts.                                   */
/*****************************************************************************/

#ifndef HPLX_SYNTHESIS_LOCAL_H
#define HPLX_SYNTHESIS_LOCAL_H
#include <ifc.h>
#include "hplx_common.h"

/* Christos Chrysafis (HPL) */
extern int symmetric_extension_type(int evenFilter,
                                    int oddSignal,
                                    int Highpass_Not_LowPass,
                                    int right_Not_left);

/* ========================================================================= */
/* -------------------------- Forward Declarations ------------------------- */
/* ========================================================================= */

typedef struct hplx_synthesis_obj *hplx_synthesis_ref;
typedef struct hplx_synthesis_stage_obj *hplx_synthesis_stage_ref;


/*****************************************************************************/
/*                           hplx_synthesis_stage_obj                        */
/*****************************************************************************/

typedef void (*hplx_synthesis_stage__initialize__func)
  (hplx_synthesis_stage_ref self, reverse_info_ref info,
   canvas_dims_ptr dims, canvas_dims_ptr frame_dims);
    /* Initializes the synthesis stage object.  Within this call, the relevant
       kernel coefficients should be installed by calling the appropriate
       interface functions on the `info' object.  Also, the function is
       responsible for invoking the `initialize' functions on all descendant
       `hplx_synthesis_stage' objects, i.e. those identified by non-NULL
       entries in the object's `branches' array.
           The dimensions and location of the tile, as well as framing
       information refer to the tile-component whose lines are being pushed
       into the analysis stage.  The `frame_dims' argument points to a
       structure which holds the nominal frame dimensions at the input to
       the analysis stage object as well as the coordinates of the framing
       anchor point.  The transform may need to be modified at frame
       boundaries, depending on whether or not the SSO-DWT is being used.
       At any rate, the frame dimensions and reference point must be
       converted as appropriate before recursively passing them to descendant
       stages. */

typedef void (*hplx_synthesis_stage__pull_line_fixed__func)
  (hplx_synthesis_stage_ref self, ifc_int *line_buf, int width);
    /* Pulls a new line of samples from the object.  The function will
       invoke whatever other `pull_line...' functions are required to
       obtain the raw material required to satisfy the request.
       The `width' argument is provided for consistency checking only.
           It should be noted that there are two `pull_line_xxx' functions.
       This function retrieves fixed-point data, which must be converted
       internally from floating point data if the transform is
       implemented in floating point. */

typedef void (*hplx_synthesis_stage__pull_line_float__func)
  (hplx_synthesis_stage_ref self, float *line_buf, int width);
    /* Exhibits the same behaviour as the `pull_line_fixed' interface
       function, except that the data type is floating point.  The
       implementor can be certain that this function will only be called
       if the decomposition is non-reversible. */

typedef void (*hplx_synthesis_stage__terminate__func)
  (hplx_synthesis_stage_ref self);
    /* Destroys the object and all allocated storage; also recursively
       propagates the destruction operation to all descendant
       synthesis stage objects. */

typedef
  struct hplx_synthesis_stage_obj {
    hplx_synthesis_stage__initialize__func initialize;
    hplx_synthesis_stage__pull_line_fixed__func pull_line_fixed;
    hplx_synthesis_stage__pull_line_float__func pull_line_float;
    hplx_synthesis_stage__terminate__func terminate;
    int direction, use_floats;
    int component_idx, level_idx, band_idx;
    hplx_synthesis_stage_ref branches[2];
    dequantizer_ref dequant;
    int usePsExtension;

    /* OTLPF_CONVENTION begin; JX Wei ADFA, WJ Zeng Sharp */
    int otlpf_convention;
    /* OTLPF_CONVENTION end; JX Wei ADFA, WJ Zeng Sharp */

    /* SAIC/Sharp/Fuji Xmask begin */
    decoder_ref decoder;
    float alpha;
    float beta;
    float *lut_alpha;
    float *lut_beta_alpha;
    int minlevel;
    int win_width;
    int bits_retained;
    int block_height;
    int block_width;
    int respect_block_boundaries;
    int lowest_ht_limit;
    reverse_info_ref info;
    float **prev_rows;
    /* SAIC/Sharp/Fuji Xmask end */

    int sso_ext;

    /* SAIC General Decomp. Begin */
    int vert_limit;
    int horiz_limit;
    int count;
    /* SAIC General Decomp. End */

  } hplx_synthesis_stage_obj;
  /* This structure identifies the member functions and variables exposed
     by the `hplx_synthesis_stage' object, which is the base of the
     `hplx_vert_synthesis_by_convolution_obj',
     `hplx_vert_synthesis_by_lifting', `hplx_hor_synthesis_by_convolution' and
     `hplx_hor_synthesis_by_lifting' objects.  For convenience, this internal
     object (i.e. not exposed at the top level in "ifc.h") is allowed to have
     some well-defined member variables, as well as interface functions.
         The idea is that a tree-structure of synthesis stage objects is
     created at the top level for each image component.  Each stage
     synthesizes a new image from two sub-images, corresponding to low and high
     pass subbands in the relevant directions.  Accordingly, the
     `direction' field must hold one of INFO__HORIZONTAL or INFO__VERTICAL.
         New lines of subband samples which are required by the synthesis stage
     should be obtained from the next `hplx_synthesis_stage' objects
     referenced by the entries of the `branches' array.  The recursive
     synthesis operation terminates at special `hplx_synthesis_leaf' objects,
     which are extended from `hplx_synthesis_stage' but do not actually
     perform any synthesis operations; they exist simply to recover rows of
     subband samples from the dequantizer referenced by the `dequant' field.
     All other synthesis stage objects should have their `dequant' field set
     to NULL, but have non-NULL `branches' entries, while the leaf objects
     should have NULL entries in their `branches' array.  The `branch_idx'
     field is valid only for these terminating leaf objects, for which it
     holds the `band_idx' value which must be passed to the
     relevant `pull_line_xxx' interface function of the dequantizer
     object.
         As for the other fields, the interpretation should be reasonably
     clear.  The `use_floats' field indicates whether or not the relevant
     synthesis stage object is expected to process floating point subband
     samples.  The component and level indices are valid for all synthesis
     stage objects; the initialization function usually requires these values
     to recover information from the `reverse_info' object whose reference
     it is passed.  For terminating `hplx_synthesis_leaf' objects, these
     values are used to construct the appropriate call to
     `dequantizer__pull_line_float' or `dequantizer__pull_line_fixed'.

     SAIC General Decomp. Begin
         `vert_limit' indicates the number of vertical wavelet splits for
     the current stage.  The normal value for this field is 2 and would result
     in vertically lowpass and highpass downsampled versions of the input to
     this stage.  A value of 1 indicates that filtering and downsampling
     should not be performed in the vertical direction in this stage.
         `horiz_limit' indicates the number of horizontal wavelet splits for
     the current stage.  The normal value for this field is 2 and would result
     in horizontally lowpass and highpass downsampled versions of the input to
     this stage.  A value of 1 indicates that filtering and downsampling
     should not be performed in the horizontal direction in this stage.
     SAIC General Decomp. End */

/*****************************************************************************/
/*                           hplx_synthesis_leaf_obj                         */
/*****************************************************************************/

typedef
  struct hplx_synthesis_leaf_obj {
    hplx_synthesis_stage_obj base;
    float *conversion_buf;
  } hplx_synthesis_leaf_obj, *hplx_synthesis_leaf_ref;
  /* This structure defines the state of the `hplx_synthesis_leaf' object,
     which extends the `hplx_synthesis_stage' object and appears at the leaf
     nodes of all decomposition trees, as discussed in the comments appearing
     with the definition of `hplx_synthesis_stage_obj'.  The object has a
     single extra member variable, `conversion_buf' which points to a buffer
     used to perform fixed to floating point conversions; the buffer is
     allocated only on demand. */

/*****************************************************************************/
/*                              hplx_synthesis_obj                           */
/*****************************************************************************/

typedef
  struct hplx_synthesis_obj {
    synthesis_obj base;
    reverse_info_ref info;
    dequantizer_ref dequantizer;
    stream_in_ref stream;
    int current_tnum;
    int discard_levels;
    int num_components;
    hplx_synthesis_stage_ref *components;
    int usePsExtension;

    /* OTLPF_CONVENTION begin; JX Wei ADFA, WJ Zeng Sharp */
    int otlpf_convention;
    /* OTLPF_CONVENTION end; JX Wei ADFA, WJ Zeng Sharp */

    /* SAIC/Sharp/Fuji Xmask begin */
    decoder_ref decoder;
    float alpha;
    int block_height;
    int block_width;
    /* SAIC/Sharp/Fuji Xmask end */

  } hplx_synthesis_obj;
  /* Manages state for the externally visible `synthesis' object.
         The `components' array holds one entry for each image component.
     Even if the component has no decomposition at all, the entry will not
     be NULL; in this case, it will reference a single `hplx_synthesis_leaf'
     object which is responsible for pulling lines of subband samples from
     the dequantizer directly. */

#endif /* HPLX_SYNTHESIS_LOCAL_H */

⌨️ 快捷键说明

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