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

📄 std_kernel_info_local.h

📁 JPEG2000实现的源码
💻 H
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/* File: "std_kernel_info_local.h"                                           */
/* Description: Private definitions for "std_kernel_info.c",                 */
/*              "std_forward_info.c" and "std_reverse_info.c", pertaining    */
/*              to the decomposition kernels themselves.                     */
/* Author: David Taubman                                                     */
/* Affiliation: Hewlett-Packard and                                          */
/*              The University of New South Wales, Australia                 */
/* Version: VM6.0                                                            */
/* Last Revised: 27 December, 1999                                           */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by David Taubman to remove convolution as a means of importing   */
/* coefficients and to restore full support for different kernel types in    */
/* different directions and resolution levels.  Convolution is now a matter  */
/* of implementation choice, but has nothing to do with representation of    */
/* kernels in the codestream or import format.                               */
/*****************************************************************************/

#ifndef STD_KERNEL_INFO_LOCAL_H
#define STD_KERNEL_INFO_LOCAL_H

#define INFO_MEM_KEY "FORWARD/REVERSE INFO OBJECT MEMORY"


#define INFO__LIFTING_FRACTION 10 /* Number of fractional bits used to
                                     represent non-reversible lifting steps. */


/*****************************************************************************/
/*                               std_tap_info                                */
/*****************************************************************************/

typedef
  struct std_tap_info {
    int neg_support;
    int pos_support;
    float *taps;
    int *int_taps;
    int int_rdx;
  } std_tap_info, *std_tap_info_ptr;
  /* For the interpretation of negative and positive supports,
     consult the definition of `forward_info__get_kernel_info' in "ifc.h".
     For analysis and lifting step filters, the array of taps appears in
     inner-product order, which is the reverse of the order associated with
     the filter's impulse response.
         `int_taps' is non-NULL if and only if the structure is used to
     represent integer lifting coefficients, in which case the array
     contains a copy of the entries in the `taps' array, which have been
     scaled by 2^`int_rdx' and rounded to integers. */

/*****************************************************************************/
/*                            std_lifting_info                               */
/*****************************************************************************/

typedef
  struct std_lifting_info {
    int num_steps;
    std_tap_info_ptr steps;
    float lp_scale, hp_scale;
  } std_lifting_info, *std_lifting_info_ptr;
  /* This structure maintains all information required for a 1-D Wavelet
     kernel implementation via lifting.
         `num_steps' holds the total number of lifting steps (prediction, plus
     update steps), which must appear within the `steps' array in the order
     predict, update, predict, ...
         `steps' points to an array of precition steps, starting with the
     first prediction step, with update steps interleaved between prediction
     steps.  For synthesis, the order in which lifting steps must actually
     be applied is the reverse of that in which they appear in this array.
         `lp_scale' and `hp_scale' are used only for non-reversible lifting
     implementations.  In this case, the low-pass and high-pass sub-sequences
     produced by the various lifting steps must be scaled by `lp_scale'
     and `hp_scale' respectively to generate appropriately normalized
     coefficients.  For synthesis, of course, these scale factors must be
     inverted and applied before undoing any of the lifting steps. */

/*****************************************************************************/
/*                            std_kernel_info                                */
/*****************************************************************************/

typedef
  struct std_kernel_info {
    int kernel_type;
    std_lifting_info lifting;
    std_tap_info low[2];
    std_tap_info high[2];
  } std_kernel_info, *std_kernel_info_ptr;
  /* This structure manages the elements which together fully describe
     a 1D Wavelet transform kernel.
         `kernel_type' holds one of INFO__INT_LIFTING, INFO__FLOAT_LIFTING
     or INFO__CONVOLUTION.
         The `lifting' field is fully filled out, regardless of whether or
     not the kernel is to be implemented using lifting.
         The `low' and `high' arrays contain the analysis and synthesis
     filter taps.  Analysis taps are in the first element of each array and
     appear in inner-product (not convolution) order.  The synthesis taps
     appear in convolution order in the second entry of each array.
     The arrays are completely filled out regardless of whether or not
     convolution is to be used in implementing the kernel. */

/*****************************************************************************/
/*                            std_user_defined                               */
/*****************************************************************************/

typedef
  struct std_user_defined {
    int num_steps;
    int step_supports[8];
    int downshifts[8];
    int taps[8][7];
    struct std_user_defined *next;
  } std_user_defined, *std_user_defined_ptr;
  /* This structure is used to store the summary information which
     is actually recorded in the COD/COC marker for anything other than
     the two special Wavelet kernels, W9X7 and W5X3.  When multiple
     user-defined kernels are involved it can be convenient to build a
     linked list of these structures, which is why the `next' field is
     provided.
         `num_steps' identifies the number of lifting steps; note that
     Wavelet kernels are always specified in terms of lifting -- convolution
     kernels may be derived for particular implementations from the lifting
     steps.  At most 8 lifting steps are allowed.
         The `step_supports' array holds the number of taps for each of the
     lifting steps.
         The `downshifts' array holds the amount of downshift to be applied
     to each of the tap values in each successive lifting step to recover the
     floating point lifting step taps (non-reversible case).  For reversible
     decompositions, the integer tap values are used as-is and the downshift
     is applied to the result and rounded once in each lifting step.
         The `taps' array holds each of the integer-valued lifting step
     taps. */


/* ========================================================================= */
/* -------------------- External Function Definitions ---------------------- */
/* ========================================================================= */

extern int
  std_load_kernel(char *id, char *kernels_dir, std_kernel_info_ptr kernel);
  /* This function fills out the contents of the supplied `kernel' structure
     to reflect the implementation of the decomposition kernel identified by
     the first two arguments, together with the `kernel_type' field of the
     `kernel' structure, which must be filled out by the caller.
         The `id' argument is either one of the two standard built-in kernel
     identifiers, "W9X7" or "W5X3", or else it is a character string
     representing a decimal number in the range 0 to 255, which is expanded
     into a loading path, with the aid of the `kernels_dir' string which
     holds the root path from which to expand user-defined kernel file path
     names.
         The function returns 0 if the kernel is a built-in one (these
     are the kernels whose coefficients need not be explicitly included
     in the code-stream); otherwise, the function returns 1. */

extern std_user_defined_ptr
  std_user_defined_summary(std_kernel_info_ptr kernel);
   /* Creates a `std_user_defined' structure to hold summary information
      for a user-defined Wavelet kernel, which can easily be interchanged
      with the relevant marker in the codestream syntax.  Only the
      `lifting' and `kernel_type' fields of the supplied `kernel' structure
      are actually used. */

extern void
  std_translate_kernel(char *id, std_user_defined_ptr user,
                       std_kernel_info_ptr kernel);
   /* Plays the same role as `std_load_kernel', except that user-defined
      kernels are identified by a NULL `id' argument and the relevant
      parameters are recovered from the `user' structure instead of the
      local file system.  The `user' structure should be identical to that
      filled out by the corresponding call to `std_user_defined_summary'
      during compression, whose entries should have been saved in the
      relevant codestream marker.  The `user' argument may be, but need not
      be NULL, if `id' points to a string containing one of the valid
      built-in kernel identifiers, "W9X7" or "W5X3". */

#endif /* STD_KERNEL_INFO_LOCAL__H */

⌨️ 快捷键说明

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