【VC开源代码栏目提醒】:网学会员,鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“ztscanUtil.cpp”一文,供大家参考学习!
/* $Id: ztscanUtil.cpp,v 1.3 2001/04/19 18:32:09 wmay Exp $ */
/****************************************************************************/
/* MPEG4 Visual Texture Coding (VTC) Mode Software */
/* */
/* This software was jointly developed by the following participants: */
/* */
/* Single-quant, multi-quant and flow control */
/* are provided by Sarnoff Corporation */
/* Iraj Sodagar (iraj@sarnoff.com) */
/* Hung-Ju Lee (hjlee@sarnoff.com) */
/* Paul Hatrack (hatrack@sarnoff.com) */
/* Shipeng Li (shipeng@sarnoff.com) */
/* Bing-Bing Chai (bchai@sarnoff.com) */
/* B.S. Srinivas (bsrinivas@sarnoff.com) */
/* */
/* Bi-level is provided by Texas Instruments */
/* Jie Liang (liang@ti.com) */
/* */
/* Shape Coding is provided by OKI Electric Industry Co., Ltd. */
/* Zhixiong Wu (sgo@hlabs.oki.co.jp) */
/* Yoshihiro Ueda (yueda@hlabs.oki.co.jp) */
/* Toshifumi Kanamaru (kanamaru@hlabs.oki.co.jp) */
/* */
/* OKI, Sharp, Sarnoff, TI and Microsoft contributed to bitstream */
/* exchange and bug fixing. */
/* */
/* */
/* In the course of development of the MPEG-4 standard, this software */
/* module is an implementation of a part of one or more MPEG-4 tools as */
/* specified by the MPEG-4 standard. */
/* */
/* The copyright of this software belongs to ISO/IEC. ISO/IEC gives use */
/* of the MPEG-4 standard free license to use this software module or */
/* modifications thereof for hardware or software products claiming */
/* conformance to the MPEG-4 standard. */
/* */
/* Those intending to use this software module in hardware or software */
/* products are advised that use may infringe existing patents. The */
/* original developers of this software module and their companies, the */
/* subsequent editors and their companies, and ISO/IEC have no liability */
/* and ISO/IEC have no liability for use of this software module or */
/* modification thereof in an implementation. */
/* */
/* Per
mission is granted to MPEG members to use, copy, modify, */
/* and distribute the software modules ( or portions thereof ) */
/* for standardization activity within ISO/IEC JTC1/SC29/WG11. */
/* */
/* Copyright 1995, 1996, 1997, 1998 ISO/IEC */
/****************************************************************************/
/************************************************************/
/* Sarnoff Very Low Bit Rate Still Image Coder */
/* Copyright 1995, 1996, 1997, 1998 Sarnoff Corporation */
/************************************************************/
#include <stdio.h>
#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "dataStruct.hpp"
#include "globals.hpp"
//#define ZTSCAN_UTIL // hjlee 0901
#include "ztscan_common.hpp" // hjlee 0901
ac_model acmVZ[NCOLOR], *acm_vz; /* here only for DC */
ac_model acmType[NCOLOR][MAXDECOMPLEV][MAX_NUM_TYPE_CONTEXTS],
*acm_type[MAXDECOMPLEV][MAX_NUM_TYPE_CONTEXTS];
ac_model acmSign[NCOLOR][MAXDECOMPLEV], *acm_sign[MAXDECOMPLEV];
ac_model *acmBPMag[NCOLOR][MAXDECOMPLEV], **acm_bpmag;
ac_model *acmBPRes[NCOLOR][MAXDECOMPLEV], **acm_bpres;
ac_model *acm_bpdc; // 1127
Void CVTCCommon::probModelInitSQ(Int col)
{
SNR_IMAGE *snr_image;
Int i,l;
snr_image=&(mzte_codec.m_SPlayer[col].SNRlayer.snr_image);
for (l=0; l<mzte_codec.m_iWvtDecmpLev;++l)
{
mzte_ac_model_init(&acmType[col][l][CONTEXT_INIT],NUMCHAR_TYPE,NULL,
ADAPT,1);
mzte_ac_model_init(&acmType[col][l][CONTEXT_LINIT],2,NULL,ADAPT,1);
mzte_ac_model_init(&acmSign[col][l],2,NULL,ADAPT,1);
}
for (l=0; l<mzte_codec.m_iWvtDecmpLev;++l)
{
if ((acmBPMag[col][l]
=(ac_model *)calloc(WVTDECOMP_NUMBITPLANES(col,l),sizeof(ac_model)))==NULL)
errorHandler("Can't alloc acmBPMag in probModelInitSQ.");
for(i=0;i<WVTDECOMP_NUMBITPLANES(col,l);i++)
{
mzte_ac_model_init(&acmBPMag[col][l][i],2,NULL,ADAPT,1);
acmBPMag[col][l][i].Max_frequency=Bitplane_Max_frequency;
}
}
}
Void CVTCCommon::probModelFreeSQ(Int col)
{
SNR_IMAGE *snr_image;
Int i,l;
snr_image=&(mzte_codec.m_SPlayer[col].SNRlayer.snr_image);
for (l=0; l<mzte_codec.m_iWvtDecmpLev;++l)
{
mzte_ac_model_done(&acmType[col][l][CONTEXT_INIT]);
mzte_ac_model_done(&acmType[col][l][CONTEXT_LINIT]);
mzte_ac_model_done(&acmSign[col][l]);
}
for (l=0; l<mzte_codec.m_iWvtDecmpLev;++l)
{
for(i=0;i<WVTDECOMP_NUMBITPLANES(col,l);i++