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

📄 lra_local.h

📁 JPEG2000实现的源码
💻 H
字号:
/*****************************************************************************/
/* Copyright 1999, Fujifilm Software California Inc.                         */
/* Copyright 1999 Science Applications International Corporation (SAIC).     */
/* Copyright 1995 University of Arizona, Arizona Board of Regents.           */
/* All rights reserved                                                       */
/* File: "lra_local.h"                                                       */
/* Description: Private definitions for "lra.c"                              */
/* Author: Troy Chinen                                                       */
/* Affiliation: Fujifilm Software California Inc.                            */
/* Version: VM8.0                                                            */
/* Last Revised: 20 July, 2000                                               */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by David Taubman to mesh with changes in "std_forward_info.c".   */
/* 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.                                   */
/*****************************************************************************/

#ifndef LRA_LOCAL_H
#define LRA_LOCAL_H

/*****************************************************************************/
/*                               MACROS                                      */
/*****************************************************************************/
/* Memory Tag */
#define LRA_MEM_KEY "LRA OBJECT MEMORY"

/* Quantization type */
#define LRA_TCQ (1)
#define LRA_SQ  (2)

/* Color transform type */
#define LRA_COLOR_TRANSFORM_NONE (0)
#define LRA_COLOR_TRANSFORM_YUV  (1)

/* Minimum rate in bits/pixel/channel allowed on any sequence */
#define LRA_MINALLOWABLERATE 0.005  

typedef
  struct lra_model_data {

    /* 
     * R(-d') parameters for the five generalized Gaussian pdfs.
     * Used to compute rates.
     * 
     * These represent curve fit parameters in the LRA model.
     * They are arrays because the parameters themselves are 
     * parameterized based on the subband's kurtosis.
     */
    float rmh[5];         /* 'r' preface =>> rate slope  main straight linem sub h page 116 */
    float rbh[5];         /* y intecept of straight line b sub h page 116 */
    float rmlin[5];       /* slope of little correction piece */
    float rblin[5];       /* y intercept of little correctio peice */
    float rpw[5];         /* power p in eq 5.26 */
    float rbs[5];         /* b in eq 5.26 */
    float rzps[5];        /* zeta in eq 5.26 */
    float rlimit[5];      /* where second linear piece kicks in */
    float rhyplim[5];     /* where hyperbolic kicks in */

    /* 
     * Delta(-d') parameters.  Used to compute step sizes.
     *
     * These represent curve fit parameters in the LRA model.
     * They are arrays because the parameters themselves are 
     * parameterized based on the subband's kurtosis.
     */
    float dmh[5];
    float dbh[5];
    float dmlin[5];
    float dblin[5];
    float dpw[5];
    float dbs[5];
    float dzps[5];
    float dlimit[5];
    float dhyplim[5];
    float dmhyp[5];
  } lra_model_data, *lra_model_data_ptr;

/*****************************************************************************/
/*                               lra_band_info                              */
/*****************************************************************************/
/*
 * We pause to point out that in the case of a compiler which only
 * minimally meets the range requirements for data types there could
 * be a problem here for very large images.  The ANSI standard
 * requires long double to support at least 1.0e37.  On an image
 * that I am using for testing the fourth order moment (x^4) reaches
 * this level.  I think it is highly unlikely, however, that any
 * modern compiler would have a limit this low.  See, e.g.,
 * http://www.scit.wlv.ac.uk/cbook/chap4.float.html 
 */
typedef
  struct lra_band_info {
    /* Field of accumulated info for computing stats */
    unsigned long int N;           /* Running total of lines for subband */
    unsigned long pixel_count;     /* Running total of pixels for subband */
    double x1, x2, x3, x4;         /* Running total of moments for subband */

    /* Inputs to LRA */                                             
    float variance;                /* Intensity variance of this subband        */
    float kurtosis;                /* Intensity kurtosis of this subband        */
    float energy_weight;           /* Sum of sqs of DWT^(-1) basis functions    */
    float size_weight;             /* Fraction of the image this sub represents */
    /* Intermediate LRA results */
    int   codebook;                /* One of five parameter sets to use         */
    float neg_dprime;              /* Negative of dprime                        */
    float rate;                    /* Bpp allocated to this subband             */
    /* The final result of LRA */
    float step_size;               /* Quantization step size for this subband   */

    /* SAIC General Decomp. Begin */
    int vert_hp_descent;
    int horiz_hp_descent;
    int valid_band;
    /* SAIC General Decomp. End */

  } lra_band_info, *lra_band_info_ptr;

/*****************************************************************************/
/*                              lra_level_info                               */
/*****************************************************************************/

typedef
  struct lra_level_info {
    int min_band;
    int max_band;
    lra_band_info_ptr bands;
  } lra_level_info, *lra_level_info_ptr;

/*****************************************************************************/
/*                            lra_component_info                             */
/*****************************************************************************/

typedef
  struct lra_component_info {
    int num_levels;
    lra_level_info_ptr levels;
  } lra_component_info, *lra_component_info_ptr;

/*****************************************************************************/
/*                            lra_stats_obj                                  */
/*****************************************************************************/

typedef
  struct lra_stats_obj {
    int num_components;
    lra_component_info_ptr components;
    int color_transform_type;
    /* Fields for accumulating info to compute stats */
    unsigned long pixel_count; /* Running total of pixels in image          */
  } lra_stats_obj, *lra_stats_ref;

extern void
find_step_sizes(lra_stats_ref lra_stats,
                float rate_target_adj,   /* Overall file rate desired - header rate */
                float rate_achieved_adj, /* Rate attained just now - header rate    */
                int   iterations,        /* Current iteration                       */
                int quantizer);          /* LRA_TCQ or LRA_SQ                       */


#endif /* LRA_LOCAL_H */

⌨️ 快捷键说明

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