【VC开源代码栏目提醒】:本文主要为网学会员提供wvtpezw_tree_init_decode.cpp,希望对需要wvtpezw_tree_init_decode.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 */
/****************************************************************************/
/****************************************************************************/
/* Texas Instruments Predictive Embedded Zerotree (PEZW) Image Codec */
/* Developed by Jie Liang (liang@ti.com) */
/* */
/* Copyright 1996, 1997, 1998 Texas Instruments */
/****************************************************************************/
/****************************************************************************
File name: wvtpezw_tree_init_decode.c
Author: Jie Liang (liang@ti.com)
Functions: functions for initialization and closing of the
PEZW coder.
Revisions: v1.0 (10/04/98)
*****************************************************************************/
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include "wvtPEZW.hpp"
#include "PEZW_zerotree.hpp"
#include "wvtpezw_tree_codec.hpp"
#include "PEZW_functions.hpp"
/* initialize the global datastructure set up
in wvtpezw_tree_codec.h */
void PEZW_decode_init (Int levels, Int Imgwidth, Int Imgheight)
{
int len;
int i,j;
int x,y;
int adapt=ADAPTATION_MODE;
int contexts;
int pos, bpos;
int hpos_start, hpos_end;
int vpos_start, vpos_end;
int hsize, vsize;
int band;
int npix;
int start,end;
//int IsStream=1;
//int Mbplane=0;
//int NumTree=0;
int nsym = 0, *freq;
#ifdef DEBUG_FILE
fp_debug = fopen("zerotree_debug_decode.txt","w");
if(DEBUG_SYMBOL)
fprintf(fp_debug,"\n\n\n********Decoder*********\n");
#endif
hsize = Imgwidth;
vsize = Imgheight;
/* define the global variables defined in
wvtpezw_tree_codec.h */
tree_depth = levels;
MaxValue=0;
/* positions of each depth within the tree */
len_tree_struct = 0;
level_pos = (short *)calloc(tree_depth,sizeof(short));
level_pos[0]=0;
for (i=1;i<levels;i++){
len_tree_struct += 1<<(2*(i-1));
level_pos[i] = len_tree_struct;
}
len_tree_struct += 1<<(2*(levels-1));
/* mask */
snr_weight = (int *)calloc(tree_depth,sizeof(int));
bitplane = (unsigned char *)calloc(tree_depth,sizeof(char));
/* data structure for the wavelet coefficients */
the_wvt_tree = (WINT *)calloc(len_tree_struct,sizeof(WINT));
abs_wvt_tree = (WINT *)calloc(len_tree_struct,sizeof(WINT));
maskbit=(unsi