【VC开源代码栏目提醒】:本文主要为网学会员提供vtcdec.cpp,希望对需要vtcdec.cpp网友有所帮助,学习一下!
/****************************************************************************/
/* 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 <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifdef _VTC_DECODER_
#define DEFINE_GLOBALS
#endif
#include "basic.hpp"
#include "dataStruct.hpp"
#include "startcode.hpp"
#include "bitpack.hpp"
#include "msg.hpp"
#include "globals.hpp"
extern FILTER DefaultSynthesisFilterInt;
extern FILTER DefaultSynthesisFilterDbl;
CVTCDecoder::CVTCDecoder()
{
m_cInBitsFile = new Char [80];
m_cRecImageFile = new Char [80];
}
CVTCDecoder::~CVTCDecoder()
{
delete m_cInBitsFile;
delete m_cRecImageFile;
}
void CVTCCommon::getSpatialLayerDims()
{
Int i, shift;
/* Calc widths and heights for all spatial layers */
for (i=0; i<mzte_codec.m_iSpatialLev; ++i)
{
shift=mzte_codec.m_iWvtDecmpLev-mzte_codec.m_lastWvtDecompInSpaLayer[i][0]-1;
mzte_codec.m_spaLayerWidth[i][0]=mzte_codec.m_iWidth>>shift;
mzte_codec.m_spaLayerHeight[i][0]=mzte_codec.m_iHeight>>shift;
if (mzte_codec.m_lastWvtDecompInSpaLayer[i][1]<0)
{
mzte_codec.m_spaLayerWidth[i][1]=mzte_codec.m_iDCWidth;
mzte_codec.m_spaLayerHeight[i][1]=mzte_codec.m_iDCHeight;
}
else
{
shift=mzte_codec.m_iWvtDecmpLev-mzte_codec.m_lastWvtDecompInSpaLayer[i][1]-1;
mzte_codec.m_spaLayerWidth[i][1]=mzte_codec.m_iWidth>>shift;
mzte_codec.m_spaLayerHeight[i][1]=mzte_codec.m_iHeight>>shift;
}
if (mzte_codec.m_lastWvtDecompInSpaLayer[i][2]<0)
{
mzte_codec.m_spaLayerWidth[i][2]=mzte_codec.m_iDCWidth;
mzte_codec.m_spaLayerHeight[i][2]=mzte_codec.m_iDCHeight;
}
else
{
shift=mzte_codec.m_iWvtDecmpLev-mzte_codec.m_lastWvtDecompInSpaLayer[i][2]-1;
mzte_codec.m_spaLayerWidth[i][2]=mzte_codec.m_iWidth>>shift;
mzte_codec.m_spaLayerHeight[i][2]=mzte_codec.m_iHeight>>shift;
}
}
}
void CVTCCommon::setSpatialLayerDimsSQ(Int band)
{
/* added for compatability for new MQ spatial layer flexability - ph 7/16 */
Int i;
if (band) /* BAND - wvtDecompLev spatial layers */
{
for (i=0; i<mzte_codec.m_iWvtDecmpLev; ++i)
{
mzte_codec.m_lastWvtDecompInSpaLayer[i][0] = i;
mzte_