📄 ebcot_constants.h
字号:
/*****************************************************************************/
/* File name: "ebcot_constants.h" */
/* Author: David Taubman */
/* Copyright 1998, Hewlett-Packard Company */
/* All rights reserved */
/*****************************************************************************/
#ifndef EBCOT_CONSTANTS_H
#define EBCOT_CONSTANTS_H
#include <line_block_ifc.h>
/* ========================================================================= */
/* ---------------------------- 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 FAR_POS 8 /* Bit-pos for significance of far-left 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 FAR_SIG ((std_short)(1<<FAR_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) << 9))) /* Zero-coding LUT index mask. */
#define AGG_CONTEXTS 1 /* Num context states devoted to aggregated zeros. */
#define ZC_CONTEXTS 10 /* 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 TOTAL_CONTEXTS (AGG_CONTEXTS+ZC_CONTEXTS+SC_CONTEXTS+MAG_CONTEXTS)
/* ========================================================================= */
/* ----------------------------- Arithmetic Coder -------------------------- */
/* ========================================================================= */
/* #define LOG_SYMBOLS */
#define W_BITS 16 /* Number of bits used to represent A register */
#define P_BITS 15 /* Number of bits used to represent probabilities
NB: Must have P_bits+W_bits=31 and P_bits<=15 */
#define S_BITS 9 /* Number of context state bits used for counting symbols. */
#define N_BITS 4 /* Number of context state bits used for counting 1's. */
#define S_MASK ((std_short)(~((-1)<<S_BITS)))
#define S_MSB ((std_short)(1<<(S_BITS-1)))
#define CONTEXT_STATE_BITS (S_BITS+N_BITS)
#define N_OVFL ((std_short)(1<<CONTEXT_STATE_BITS))
/* ========================================================================= */
/* --------------------------- Quad-Tree Structure ------------------------- */
/* ========================================================================= */
#define QUAD_LEAVES ((std_short) 1)
#define QUAD_PARENT_SIGNIFICANT ((std_short) 2)
#define QUAD_NODE_SIGNIFICANT ((std_short) 4)
/* ========================================================================= */
/* -------------------------- Block Coding Structure ----------------------- */
/* ========================================================================= */
#define PASSES_PER_BITPLANE 4
#define MAX_PASSES ((IMPLEMENTATION_PRECISION-2)*PASSES_PER_BITPLANE+1)
/* ========================================================================= */
/* ----------------------------- MSE Computations -------------------------- */
/* ========================================================================= */
#define MSE_LUT_BITS 7
#define MSE_LUT_MASK ((std_short)(~((-1)<<MSE_LUT_BITS)))
/* ========================================================================= */
/* ----------------------------- Handy Constants --------------------------- */
/* ========================================================================= */
#define MIN_IFC_INT ((ifc_int)(((ifc_int) 1) << (IMPLEMENTATION_PRECISION-1)))
#define MAX_IFC_INT (~MIN_IFC_INT)
#endif /* EBCOT_CONSTANTS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -