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

📄 ebcot_common.h

📁 JPEG2000 EBCOT算法源码
💻 H
字号:
/*****************************************************************************/
/* File name: "ebcot_common.h"                                               */
/* Author: David Taubman                                                     */
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/*****************************************************************************/
#ifndef EBCOT_COMMON_H
#define EBCOT_COMMON_H
#include <limits.h>
#include <ebcot_constants.h>

/* ========================================================================= */
/* ---------------------------- Elementary Types --------------------------- */
/* ========================================================================= */

/*****************************************************************************/
/*                                  std_int                                  */
/*****************************************************************************/

#if (INT_MAX == 2147483647)
  typedef int std_int;
#elif (LONG_MAX == 2147483647)
  typedef long int std_int
#else
# error "Platform does not support 32-bit integers"
#endif

/*****************************************************************************/
/*                                 std_short                                 */
/*****************************************************************************/

#if (SHRT_MAX == 32767)
  typedef short int std_short;
#else
# error "Platform does not support 16-bit integers"
#endif

/*****************************************************************************/
/*                                std_ushort                                 */
/*****************************************************************************/

#if (SHRT_MAX == 32767)
  typedef unsigned short int std_ushort;
#else
# error "Platform does not support 16-bit integers"
#endif

/*****************************************************************************/
/*                                  std_byte                                 */
/*****************************************************************************/

typedef unsigned char std_byte;

/* ========================================================================= */
/* ------------------------- Read-Only Lookup Tables ----------------------- */
/* ========================================================================= */

extern std_byte ebcot_main_zc_lut[ZC_MASK+1];
extern std_byte ebcot_diag_zc_lut[ZC_MASK+1];
extern ifc_int ebcot_sc_lut[16];
extern std_short ebcot_p0_lut[(1<<CONTEXT_STATE_BITS)];
extern std_short ebcot_initial_mse_lut[(1<<MSE_LUT_BITS)];
extern std_short ebcot_refinement_mse_lut[(1<<MSE_LUT_BITS)];

#ifdef COUNT_SYMBOLS
extern int ebcot_total_symbol_count;

#define _increment_symbol_count ebcot_total_symbol_count++;
#else
#define _increment_symbol_count
#endif

/* ========================================================================= */
/* ---------------------------- Internal Objects --------------------------- */
/* ========================================================================= */

typedef struct sample_buffer_heap_obj *sample_buffer_heap_ref;

typedef ifc_int *(*sample_buffer_heap__get_buffer__func)
  (sample_buffer_heap_ref self);
typedef void (*sample_buffer_heap__return_buffer__func)
  (sample_buffer_heap_ref self, ifc_int *buffer);
typedef void (*sample_buffer_heap__terminate__func)
  (sample_buffer_heap_ref self);

/*****************************************************************************/
/*                           sample_buffer_heap_obj                          */
/*****************************************************************************/

typedef
  struct sample_buffer_heap_obj {
    sample_buffer_heap__get_buffer__func get_buffer;
    sample_buffer_heap__return_buffer__func return_buffer;
    sample_buffer_heap__terminate__func terminate;
    int max_rows, row_gap;
    int max_buffers, num_buffers, free_buffers;
    ifc_int **buffers;
  } sample_buffer_heap_obj;

  /* This structure represents an object in the same style as those defined
     in the public interface header, "line_block_ifc.h", which is responsible
     for managing allocation and recycling of sample buffers to ensure an
     efficient implementation of the `push_block' and `pull_block' interface
     functions.
         The `buffers' array has `max_buffers' entries, of which the first
     `free_buffers' entries contain valid pointers to sample buffers which
     are not currently in use.  The `num_buffers' field holds the total
     number of buffers which have been allocated. */

/* ========================================================================= */
/* --------------------------- External Functions -------------------------- */
/* ========================================================================= */

extern void
  ebcot_initialize_global_luts(void);

extern sample_buffer_heap_ref
  ebcot_create_sample_buffer_heap(int max_rows, int row_gap);

#endif /* EBCOT_COMMON_H */

⌨️ 快捷键说明

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