📄 ebcot_constants.h
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company */
/* All rights reserved */
/* File: "ebcot_constants.h" */
/* Description: Constants which configure the EBCOT encoder and decoder */
/* Author: David Taubman */
/* Affiliation: Hewlett-Packard and */
/* The University of New South Wales, Australia */
/* Version: VM6.1 */
/* Last Revised: 19 February, 2000 */
/*****************************************************************************/
/*****************************************************************************/
/* Modified to incorporate MQ-coder by Mitsubishi Electric Corp. */
/* Copyright 1999, Mitsubishi Electric Corp. */
/* All rights reserved for modified parts */
/*****************************************************************************/
/*****************************************************************************/
/* Modified to combine entropy coders */
/* Copyright 1999 Science Applications International Corporation (SAIC). */
/* Copyright 1999 University of Arizona, Arizona Board of Regents. */
/* All Rights Reserved for modified parts. */
/*****************************************************************************/
/*****************************************************************************/
/* Modified by David Taubman to support interface modifications, arbitrary */
/* changes in coding parameters from component to component and from tile */
/* to tile, packet partitions, rich packet sequencing conventions and 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. */
/*****************************************************************************/
#ifndef EBCOT_CONSTANTS_H
#define EBCOT_CONSTANTS_H
#include <ifc.h>
/* ========================================================================= */
/* ------------------------- Configuration Constants ----------------------- */
/* ========================================================================= */
/* #define EBCOT_COUNT_SYMBOLS */ /* Uncomment this to get the algorithm to
count and report the number of encoded
and decoded binary symbols. */
/* #define REPORT_LENGTH_SIGNALLING_COST */ /* Uncomment this to get a report
of the average number of bits required
to signal the length of each sub-bitplane
coding pass.
NOTE: Reports are meaningful only
with non-scalable or SNR progressive
bit-streams with the -trunc option. */
#define EBCOT_CPU_ITERATIONS 5
/* ========================================================================= */
/* ---------------------------- Context Assignment ------------------------- */
/* ========================================================================= */
#define TL_POS 0 /* Bit-pos for significance of top-left neighbour */
#define TC_POS 1 /* Bit-pos for significance of top-centre neighbour */
#define TR_POS 2 /* Bit-pos for significance of top-right neighbour */
#define CL_POS 3 /* Bit-pos for significance of centre-left neighbour */
#define CR_POS 4 /* Bit-pos for significance of centre-right neighbour */
#define BL_POS 5 /* Bit-pos for significance of bottom-left neighbour */
#define BC_POS 6 /* Bit-pos for significance of bottom-centre neighbour */
#define BR_POS 7 /* Bit-pos for significance of bottom-right neighbour */
#define SELF_POS 9 /* Bit-pos for significance of the current sample. */
#define REFINED_POS 10 /* Bit-pos indicating whether or not the sample has
been refined to the next bit-plane yet. */
#define V_PVE_POS 11 /* Bit-pos indicating >=1 +ve vertical neighbour */
#define V_NVE_POS 12 /* Bit-pos indicating >=1 -ve vertical neighbour */
#define H_PVE_POS 13 /* Bit-pos indicating >=1 +ve horizontal neighbour */
#define H_NVE_POS 14 /* Bit-pos indicating >=1 -ve horizontal neighbour */
#define OUT_OF_BOUNDS_POS 15 /* May be used to identify context words which
lie beyond the boundaries of the code block */
#define TL_SIG ((std_short)(1<<TL_POS))
#define TC_SIG ((std_short)(1<<TC_POS))
#define TR_SIG ((std_short)(1<<TR_POS))
#define CL_SIG ((std_short)(1<<CL_POS))
#define CR_SIG ((std_short)(1<<CR_POS))
#define BL_SIG ((std_short)(1<<BL_POS))
#define BC_SIG ((std_short)(1<<BC_POS))
#define BR_SIG ((std_short)(1<<BR_POS))
#define SELF_SIG ((std_short)(1<<SELF_POS))
#define IS_REFINED ((std_short)(1<<REFINED_POS))
#define V_PVE_SIG ((std_short)(1<<V_PVE_POS))
#define V_NVE_SIG ((std_short)(1<<V_NVE_POS))
#define H_PVE_SIG ((std_short)(1<<H_PVE_POS))
#define H_NVE_SIG ((std_short)(1<<H_NVE_POS))
#define OUT_OF_BOUNDS ((std_short)(1<<OUT_OF_BOUNDS_POS))
#define SIGN_POS V_PVE_POS /* Initial bit-pos for 4-bit sign context word. */
#define ZC_MASK ((std_short)(~((-1) << 8))) /* Zero-coding LUT index mask. */
#define AGG_CONTEXTS 1 /* Num context states devoted to aggregated zeros. */
#define ZC_CONTEXTS 9 /* Num context states devoted to zero coding. */
#define MAG_CONTEXTS 3 /* Num context states devoted to mag refinement. */
#define SC_CONTEXTS 5 /* Num context states devoted to sign coding. */
#define AGG_OFFSET 0
#define ZC_OFFSET (AGG_OFFSET+AGG_CONTEXTS)
#define MAG_OFFSET (ZC_OFFSET + ZC_CONTEXTS)
#define SC_OFFSET (MAG_OFFSET + MAG_CONTEXTS)
#define UNI_CONTEXTS 1 /* Num context states devoted to uniform coding. */
#define UNI_OFFSET (SC_OFFSET + SC_CONTEXTS)
#define EBCOT_TOTAL_CONTEXTS (UNI_OFFSET+UNI_CONTEXTS)
#define INIT_MQSTATE (2*0+0) /* Start of the learning curve. */
#define UNI_INIT_MQSTATE (2*46+0)/* Non-adaptive uniform probability state. */
#define ZERO_INIT_MQSTATE (2*4+0) /* Skewed initial state on learning curve */
#define RUN_INIT_MQSTATE (2*3+0) /* Slightly skewed state on learning curve */
/* ========================================================================= */
/* -------------------------- Block Coding Structure ----------------------- */
/* ========================================================================= */
#define PASSES_PER_BITPLANE 3
#define MAX_PASSES ((IMPLEMENTATION_PRECISION-2)*PASSES_PER_BITPLANE+1)
#define LAZY_TAIL_START 3 /* Number of bit-planes after the first significant
bit-plane for the code-block in which the lazy
coding policy is started. */
/* ========================================================================= */
/* ----------------------------- MSE Computations -------------------------- */
/* ========================================================================= */
#define MSE_LUT_BITS 7
#define MSE_LUT_MASK ((std_short)(~((-1)<<MSE_LUT_BITS)))
/* ========================================================================= */
/* --------------------------- Architecture Specific ----------------------- */
/* ========================================================================= */
/*#define VM_LITTLE_ENDIAN *//* Uncomment if your architecture is LITTLE_ENDIAN. */
#ifndef VM_LITTLE_ENDIAN
# define VM_BIG_ENDIAN
#endif
#ifdef VM_LITTLE_ENDIAN /* Packed context flags for little-endian architectures */
# define TL_POS_0 TL_POS
# define TC_POS_0 TC_POS
# define TR_POS_0 TR_POS
# define CL_POS_0 CL_POS
# define CR_POS_0 CR_POS
# define BL_POS_0 BL_POS
# define BC_POS_0 BC_POS
# define BR_POS_0 BR_POS
# define SELF_POS_0 SELF_POS
# define REFINED_POS_0 REFINED_POS
# define V_PVE_POS_0 V_PVE_POS
# define V_NVE_POS_0 V_NVE_POS
# define H_PVE_POS_0 H_PVE_POS
# define H_NVE_POS_0 H_NVE_POS
# define OUT_OF_BOUNDS_POS_0 OUT_OF_BOUNDS_POS
# define ZC_SHIFT_0 0
# define TL_POS_1 (TL_POS + 16)
# define TC_POS_1 (TC_POS + 16)
# define TR_POS_1 (TR_POS + 16)
# define CL_POS_1 (CL_POS + 16)
# define CR_POS_1 (CR_POS + 16)
# define BL_POS_1 (BL_POS + 16)
# define BC_POS_1 (BC_POS + 16)
# define BR_POS_1 (BR_POS + 16)
# define SELF_POS_1 (SELF_POS + 16)
# define REFINED_POS_1 (REFINED_POS + 16)
# define V_PVE_POS_1 (V_PVE_POS + 16)
# define V_NVE_POS_1 (V_NVE_POS + 16)
# define H_PVE_POS_1 (H_PVE_POS + 16)
# define H_NVE_POS_1 (H_NVE_POS + 16)
# define OUT_OF_BOUNDS_POS_1 (OUT_OF_BOUNDS_POS + 16)
# define ZC_SHIFT_1 16
#endif /* VM_LITTLE_ENDIAN */
#ifdef VM_BIG_ENDIAN /* Packed context flags for big-endian architectures */
# define TL_POS_1 TL_POS
# define TC_POS_1 TC_POS
# define TR_POS_1 TR_POS
# define CL_POS_1 CL_POS
# define CR_POS_1 CR_POS
# define BL_POS_1 BL_POS
# define BC_POS_1 BC_POS
# define BR_POS_1 BR_POS
# define SELF_POS_1 SELF_POS
# define REFINED_POS_1 REFINED_POS
# define V_PVE_POS_1 V_PVE_POS
# define V_NVE_POS_1 V_NVE_POS
# define H_PVE_POS_1 H_PVE_POS
# define H_NVE_POS_1 H_NVE_POS
# define OUT_OF_BOUNDS_POS_1 OUT_OF_BOUNDS_POS
# define ZC_SHIFT_1 0
# define TL_POS_0 (TL_POS + 16)
# define TC_POS_0 (TC_POS + 16)
# define TR_POS_0 (TR_POS + 16)
# define CL_POS_0 (CL_POS + 16)
# define CR_POS_0 (CR_POS + 16)
# define BL_POS_0 (BL_POS + 16)
# define BC_POS_0 (BC_POS + 16)
# define BR_POS_0 (BR_POS + 16)
# define SELF_POS_0 (SELF_POS + 16)
# define REFINED_POS_0 (REFINED_POS + 16)
# define V_PVE_POS_0 (V_PVE_POS + 16)
# define V_NVE_POS_0 (V_NVE_POS + 16)
# define H_PVE_POS_0 (H_PVE_POS + 16)
# define H_NVE_POS_0 (H_NVE_POS + 16)
# define OUT_OF_BOUNDS_POS_0 (OUT_OF_BOUNDS_POS + 16)
# define ZC_SHIFT_0 16
#endif /* VM_BIG_ENDIAN */
#define TL_SIG_0 ((std_int)(1<<TL_POS_0))
#define TC_SIG_0 ((std_int)(1<<TC_POS_0))
#define TR_SIG_0 ((std_int)(1<<TR_POS_0))
#define CL_SIG_0 ((std_int)(1<<CL_POS_0))
#define CR_SIG_0 ((std_int)(1<<CR_POS_0))
#define BL_SIG_0 ((std_int)(1<<BL_POS_0))
#define BC_SIG_0 ((std_int)(1<<BC_POS_0))
#define BR_SIG_0 ((std_int)(1<<BR_POS_0))
#define SELF_SIG_0 ((std_int)(1<<SELF_POS_0))
#define IS_REFINED_0 ((std_int)(1<<REFINED_POS_0))
#define V_PVE_SIG_0 ((std_int)(1<<V_PVE_POS_0))
#define V_NVE_SIG_0 ((std_int)(1<<V_NVE_POS_0))
#define H_PVE_SIG_0 ((std_int)(1<<H_PVE_POS_0))
#define H_NVE_SIG_0 ((std_int)(1<<H_NVE_POS_0))
#define OUT_OF_BOUNDS_0 ((std_int)(1<<OUT_OF_BOUNDS_POS_0))
#define SIGN_POS_0 V_PVE_POS_0
#define ZC_MASK_0 (((std_int) 0x000000FF)<<ZC_SHIFT_0)
#define TL_SIG_1 ((std_int)(1<<TL_POS_1))
#define TC_SIG_1 ((std_int)(1<<TC_POS_1))
#define TR_SIG_1 ((std_int)(1<<TR_POS_1))
#define CL_SIG_1 ((std_int)(1<<CL_POS_1))
#define CR_SIG_1 ((std_int)(1<<CR_POS_1))
#define BL_SIG_1 ((std_int)(1<<BL_POS_1))
#define BC_SIG_1 ((std_int)(1<<BC_POS_1))
#define BR_SIG_1 ((std_int)(1<<BR_POS_1))
#define SELF_SIG_1 ((std_int)(1<<SELF_POS_1))
#define IS_REFINED_1 ((std_int)(1<<REFINED_POS_1))
#define V_PVE_SIG_1 ((std_int)(1<<V_PVE_POS_1))
#define V_NVE_SIG_1 ((std_int)(1<<V_NVE_POS_1))
#define H_PVE_SIG_1 ((std_int)(1<<H_PVE_POS_1))
#define H_NVE_SIG_1 ((std_int)(1<<H_NVE_POS_1))
#define OUT_OF_BOUNDS_1 ((std_int)(1<<OUT_OF_BOUNDS_POS_1))
#define SIGN_POS_1 V_PVE_POS_1
#define ZC_MASK_1 (((std_int) 0x000000FF)<<ZC_SHIFT_1)
/* ========================================================================= */
/* -------------------------------- Mode Flags ----------------------------- */
/* ========================================================================= */
#define MODE_FLAG_LAZY ((std_byte)(1<<0))
#define MODE_FLAG_RESET ((std_byte)(1<<1))
#define MODE_FLAG_TERMINATE ((std_byte)(1<<2))
#define MODE_FLAG_CAUSAL ((std_byte)(1<<3))
#define MODE_FLAG_ERTERM ((std_byte)(1<<4))
#define MODE_FLAG_SEGMARK ((std_byte)(1<<5))
/* ========================================================================= */
/* --------------------------- Available Progressions ---------------------- */
/* ========================================================================= */
#define LAYER_PROGRESSIVE 0
#define RESOLUTION_LAYER_PROGRESSIVE 1
#define RESOLUTION_POSITION_PROGRESSIVE 2
#define POSITION_COMPONENT_PROGRESSIVE 3
#define COMPONENT_POSITION_PROGRESSIVE 4
/* ========================================================================= */
/* ------------------------------- Approximations -------------------------- */
/* ========================================================================= */
#define ESTIMATED_HEADER_BYTES 200
#endif /* EBCOT_CONSTANTS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -