📄 std_forward_info_local.h
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company */
/* All rights reserved */
/* File: "std_forward_info_local.h" */
/* Description: Private definitions for "std_forward_info.c" */
/* Author: David Taubman */
/* Affiliation: Hewlett-Packard and */
/* The University of New South Wales, Australia */
/* Version: VM9.0 */
/* Last Revised: 20 April, 2001 */
/*****************************************************************************/
/*****************************************************************************/
/* Modified by David Taubman to include masking-sensitive distortion */
/* calculations for R-D optimization (`-Cvis' option). Material identified */
/* by "David T Cvis mod" comments has been added by David Taubman; it is */
/* copyrighted by the University of New South Wales (Copyright 1999) with */
/* all rights reserved for the modified parts. */
/*****************************************************************************/
/*****************************************************************************/
/* Modified to include Lagrangian Rate Allocation */
/* Copyright 1999 Fujifilm Software Colifornia Inc. */
/* Copyright 1999 Science Applications International Corporation (SAIC). */
/* Copyright 1995 University of Arizona, Arizona Board of Regents. */
/* All Rights Reserved for modified parts. */
/*****************************************************************************/
/*****************************************************************************/
/* 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 by David Taubman to allow overlapping tiles. 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 for general offset and scalar quantization. */
/* Copyright 2000 The MITRE Corporation. */
/* 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 STD_FORWARD_INFO_LOCAL_H
#define STD_FORWARD_INFO_LOCAL_H
#include <ifc.h>
#include "std_kernel_info_local.h"
/* SAIC/Fuji LRA start */
#include "lra_local.h"
/* SAIC/Fuji LRA end */
#define STEP_EXPONENT_BITS 5 /* These values must be identical in the */
#define STEP_MANTISSA_BITS 11 /* `forward_info' and `reverse_info' objects. */
/*****************************************************************************/
/* std_band_info */
/*****************************************************************************/
typedef
struct std_band_info {
int rel_step_exponent;
int rel_step_mantissa;
float step_wmse;
float nominal_gain;
float nominal_range; /* David T Cvis mod */
float l2_norm;
float csf_weight; /** added by W.Zeng, for visual masking, 4/26/99 **/
/* SAIC/Fuji LRA begin */
int quant_to_zero;
/* SAIC/Fuji LRA end */
/* SAIC General Decomp Begin */
int vert_hp_descent;
int horiz_hp_descent;
int vert_hp_descent_chg[4];
int horiz_hp_descent_chg[4];
int valid_band;
/* SAIC General Decomp End */
float scale_nz; /* MITRE Variable Offset */
} std_band_info, *std_band_info_ptr;
/* This structure manages all information for a particular subband.
`step_exponent', `step_mantissa' and `step_wmse' together provide
all the information required to respond to calls to the
`forward_info__get_quant_info' function, whose definition appears
in "ifc.h". For non-reversible decompositions, the absolute step
size is computed by multiplying 2^{P-G}, the nominal dynamic range for
subband sample values, by 2^{-Se}*(1+2^{-Mbits}*Sm), where Se is the
`rel_step_exponent' value, Sm is the `rel_step_mantissa' value and Mbits
is the STEP_MANTISSA_BITS value. Here, P is the IMPLEMENTATION_PRECISION
value and G is the number of guard bits, maintained in the
`std_forward_info' object. Also, the `extra_lsbs' value, Be, is
computed as Be = P-G-Se. Note that all these quantities are expressed
in terms of integer values which are saved in the bit-stream.
The situation is somewhat different for reversible decompositions.
Here, the absolute step size returned by `get_quant_info' is 1.0. The
`rel_step_mantissa' field is not used and is set to 0. The
`rel_step_exponent' field is given a different interpretation in this
case in order to ensure that the `extra_lsbs' value may still be
computed as Be = P-G-Se. In this case a reasonable value for Se is
calculated from I+ceil(log_2(K)), where K is the value of the
`nominal_gain' field and I is the image bit-depth value.
`nominal_gain' identifies the cumulative gain in nominal range from
the image domain through to the relevant subband samples. For
non-reversible kernels, this will always be 1.0, while the `step_size'
will typically vary significantly from resolution level to resolution
level. For reversible kernels, the `step_size' will always be 1.0, but
the nominal gain will typically vary substantially from level to level.
The `nominal_gain' provides valuable intermediate information for the
computation of the `extra_lsbs' value.
`nominal_range' holds the product of `nominal_gain' and the dynamic
range of the original image samples, i.e. 2^`image_bitdepth'.
`l2_norm' plays a similar role to `nominal_gain', except that it
keeps track of the square root of the expansion in the mean squared error
associated with distortion introduced in the subband's samples. It
holds the L2 norm (root sum of squared tap values) of the relevant
synthesis waveform.
SAIC/Fuji LRA begin
`quant_to_zero' allows for subbands to quantized to value zero,
indicating that bits for such subbands should not be included in the
output bitstream.
SAIC/Fuji LRA end
SAIC General Decomp. Begin
`vert_hp_descent' indicates the level of wavelet tree descent in
the vertical direction for the current sub-band.
`horiz_hp_descent' indicates the level of wavelet tree descent in the
horizontal direction for the current sub-band.
`vert_hp_descent_chg' indicates the change in vert_hp_descent which is
used to determine the path through the wavelet tree for the current
sub-band.
`horiz_hp_descent_chg' indicates the change in vert_hp_descent which is
used to determine the path through the wavelet tree for the current
sub-band.
`valid_band' indicates which bands in the range [min_band, max_band]
are valid for a general decomposition.
SAIC General Decomp. End */
/*****************************************************************************/
/* quant_factor_update_func */
/*****************************************************************************/
typedef void (*quant_factor_update_func)
(std_band_info_ptr band, float factor);
/* This function prototype defines the form of a function which updates
one of the quantization parameters (step size or step WMSE) using the
supplied factor. The prototype is used to construct generic functions
to implement the behaviour of both the `-Fweights' and `-Fsteps'
command line arguments. */
/*****************************************************************************/
/* std_level_info */
/*****************************************************************************/
typedef
struct std_level_info {
/* SAIC General Decomp Begin */
int max_hp_descent;
int *decomp_sequence;
/* SAIC General Decomp End */
char *hor_identifier;
char *vert_identifier;
std_kernel_info hor_kernel;
std_kernel_info vert_kernel;
int hor_kernel_user_defined;
int vert_kernel_user_defined;
frame_info frame;
int min_band, max_band;
std_band_info_ptr bands;
} std_level_info, *std_level_info_ptr;
/* This structure holds information for a given resolution level within an
image component (e.g. within a colour plane). The structure is maintained
in the array referenced by `std_component_info'. Each resolution level
contains the subbands required to construct the next higher resolution
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -