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

📄 dst_codeword_heap.h

📁 JPEG2000实现的源码
💻 H
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/* File: "dst_codeword_heap.h"                                               */
/* Description: Defines the `dst_codeword_heap' object, which is required to */
/*              efficiently manage dynamic resizing and recycling of         */
/*              storage for compressed code words.                           */
/* Author: David Taubman                                                     */
/* Affiliation: Hewlett-Packard and                                          */
/*              The University of New South Wales, Australia                 */
/* Version: VM7.0                                                            */
/* Last Revised: 7 April, 2000                                               */
/*****************************************************************************/

/*****************************************************************************/
/* Modified to incorporate scan based rate control.  Material identified  by */
/* "CRIL Technology/SAIC Scan Buffer" comments has been added by Fabrice     */
/* Pelleau and Olivier Duffez of CRIL Technology and Tom Flohr of SAIC.      */
/* Copyright 2000 CRIL Technology                                            */
/* Copyright 2000 CNES                                                       */
/* Copyright 2000 Science Applications International Corporation (SAIC).     */
/* All Rights Reserved for modified parts.                                   */
/*****************************************************************************/

#ifndef DST_CODEWORD_HEAP_H
#define DST_CODEWORD_HEAP_H
#include <ifc.h>

#define DST_CODE_MEM_KEY "COMPRESSED CODEWORD MEMORY"

/* ========================================================================= */
/* ---------------------------- Type Definitions --------------------------- */
/* ========================================================================= */

#define DST_HEAP_WORDS 8
#define DST_HEAP_BYTES (DST_HEAP_WORDS*4)
#define DST_HEAP_GROUP_UNITS 64

/*****************************************************************************/
/*                                dst_heap_unit                              */
/*****************************************************************************/

typedef
  struct dst_heap_unit {
    std_int words[DST_HEAP_WORDS];

    /* CRIL Technology/SAIC Scan Buffer begin */
    std_byte released[DST_HEAP_WORDS];
    /* CRIL Technology/SAIC Scan Buffer end */

    struct dst_heap_unit *next;
    struct dst_heap_group *group;
  } dst_heap_unit, *dst_heap_unit_ptr;

  /* This structure is used to manage the dynamic memory consumption
     associated with compressed bit-streams.  Heap units are managed
     within larger `heap_group' structures to minimize the impact of
     dynamic memory allocation on implementation efficiency.  The
     `group' field points to the group to which the heap unit belongs.
     If the heap unit is not currently in use, this field is set to
     NULL; it is only set to point to the relevant group once the unit
     is allocated to a client via the `dst_codeword_heap__get_unit' function.
         The `next' field is available to the user and will generally be
     used to create a linked list of heap units which are associated with
     a common store.

     CRIL Technology/SAIC Scan Buffer begin
         The `released' field is used for the reduced memory scan buffer to
     detect partial heaps which can be recycled with the new __return_units()
     fucntion.
     CRIL Technology/SAIC Scan Buffer end */


/*****************************************************************************/
/*                                dst_heap_group                             */
/*****************************************************************************/

typedef
  struct dst_heap_group {
    dst_heap_unit units[DST_HEAP_GROUP_UNITS];
    std_int free_units;
    struct dst_heap_group *next;
  } dst_heap_group, *dst_heap_group_ptr;

  /* This structure is used to allocate and manage multiple heap units
     at once for improved efficiency.  All heap units managed by the
     encoder/decoder are chained via their `next' fields. */

/*****************************************************************************/
/*                               dst_codeword_heap                           */
/*****************************************************************************/

typedef struct dst_codeword_heap_obj *dst_codeword_heap_ref;

typedef dst_heap_unit_ptr (*dst_codeword_heap__get_unit__func)
  (dst_codeword_heap_ref self);
typedef void (*dst_codeword_heap__return_unit__func)
  (dst_codeword_heap_ref self, dst_heap_unit_ptr unit);

/* CRIL Technology/SAIC Scan Buffer begin */
typedef void (*dst_codeword_heap__return_units__func)
  (dst_codeword_heap_ref self, dst_heap_unit_ptr first_unit, int first_pos,
   dst_heap_unit_ptr last_unit, int last_unit_used);
/* CRIL Technology/SAIC Scan Buffer end */

typedef void (*dst_codeword_heap__terminate__func)
  (dst_codeword_heap_ref self);

typedef
  struct dst_codeword_heap_obj {
    dst_codeword_heap__get_unit__func get_unit;
    dst_codeword_heap__return_unit__func return_unit;

    /* CRIL Technology/SAIC Scan Buffer begin */
    dst_codeword_heap__return_units__func return_units;
    /* CRIL Technology/SAIC Scan Buffer end */

    dst_codeword_heap__terminate__func terminate;
    dst_heap_group_ptr heap;
  } dst_codeword_heap_obj;

  /* This structure represents an object in the same style as those defined
     in the public interface header, "ifc.h", which is responsible
     for managing the codeword heap.  The arithmetic coding engine requires
     a reference to this object. */


/* ========================================================================= */
/* --------------------------- Exported Functions -------------------------- */
/* ========================================================================= */

extern dst_codeword_heap_ref
  create_dst_codeword_heap(void);

#endif /* DST_CODEWORD_HEAP_H */

⌨️ 快捷键说明

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