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

📄 dst_arith_coder_common.c

📁 JPEG2000实现的源码
💻 C
字号:
/*****************************************************************************/
/* Copyright 1998, Hewlett-Packard Company                                   */
/* All rights reserved                                                       */
/* File: "dst_arith_coder_common.c"                                          */
/* Description: Common initialization code for arithmetic coding environment */
/* Author: David Taubman                                                     */
/* Affiliation: Hewlett-Packard and                                          */
/*              The University of New South Wales, Australia                 */
/* Version: VM5.1                                                            */
/* Last Revised: 15 August, 1999                                             */
/*****************************************************************************/

/*****************************************************************************/
/* Modified by David Taubman to allow more efficient implementation of the   */
/* MQ coder.  Copyright 1999 by Hewlett-Packard Company with all rights      */
/* reserved for the modified parts.                                          */
/*****************************************************************************/

#include <assert.h>
#include <ifc.h>
#include "dst_arith_coder_common.h"
#include "mq46w.h"

dst_context_state dst_arith_state_to_delta[2*47];
dst_context_state dst_arith_trans_mps[2*47];
dst_context_state dst_arith_trans_lps[2*47];

/*****************************************************************************/
/* STATIC                  initialize_state_to_delta                         */
/*****************************************************************************/

static void
  initialize_state_to_delta(void)
{
  int n;

  for (n=0; n < 47; n++)
    {
      dst_arith_state_to_delta[2*n] =
        (dst_context_state) lszE[n];
      dst_arith_state_to_delta[2*n+1] =
        ((dst_context_state) lszE[n]) | (1<<DST_ARITH_MPS_POS);
    }
}

/*****************************************************************************/
/* STATIC                     initialize_trans_mps                           */
/*****************************************************************************/

static void
  initialize_trans_mps(void)
{
  int n;

  for (n=0; n < 47; n++)
    {
      dst_arith_trans_mps[2*n] =
        (dst_context_state) 2*nmps[n];
      dst_arith_trans_mps[2*n+1] =
        (dst_context_state) (2*nmps[n]+1);
    }
}

/*****************************************************************************/
/* STATIC                     initialize_trans_lps                           */
/*****************************************************************************/

static void
  initialize_trans_lps(void)
{
  int n;

  for (n=0; n < 47; n++)
    if (swtch[n])
      {
        dst_arith_trans_lps[2*n] =
          (dst_context_state)(2*nlps[n]+1);
        dst_arith_trans_lps[2*n+1] =
          (dst_context_state)(2*nlps[n]+0);
      }
    else
      {
        dst_arith_trans_lps[2*n] =
          (dst_context_state)(2*nlps[n]+0);
        dst_arith_trans_lps[2*n+1] =
          (dst_context_state)(2*nlps[n]+1);
      }
}

/*****************************************************************************/
/* EXTERN             dst_arith_coder__initialize_global_luts                */
/*****************************************************************************/

void
  dst_arith_coder__initialize_global_luts(void)
{
  initialize_state_to_delta();
  initialize_trans_mps();
  initialize_trans_lps();
}

⌨️ 快捷键说明

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