【VC开源代码栏目提醒】:网学会员VC开源代码为您提供dwt.cpp参考,解决您在dwt.cpp学习中工作中的难题,参考学习。
/* $Id: dwt.cpp,v 1.2 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. */
/* */
/* Permission 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 */
/************************************************************/
/* Forward DWT for MPEG-4 Still Texture Coding
Original Coded by Shipeng Li, Sarnoff Corporation, Jan. 1998*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <memory.h>
#include "basic.hpp"
#include "dwt.h"
/* Function: DWT()
Description: Forward DWT for MPEG-4 Still Texture Coding
Input:
InData -- Input Image data of Width x Height size, data type decided by
InDataType;
InMask -- Input Object Mask for InData, if ==1, data inside object,
otherwise outside.
Width -- Width of Image (must be multiples of 2^nLevels);
Height -- Height of Image (must be multiples of 2^nLevels);
nLevels -- number of decomposition level,0 being original image;
InDataType -- 0 - BYTE; 1 -- SHORT
Filter -- Filter Used.
Output:
OutCoeff -- Ouput wavelet coefficients
OutMask -- Output mask corresponding to wavelet coefficients
Return: DWT_OK if success.
*/
Int VTCDWT:: do_DWT(Void *InData, UChar *InMask, Int Width, Int Height, Int nLevels,
Int InDataType, FILTER **Filter, DATA *OutCoeff, UChar *OutMask)
{
Int nBits, MaxCoeff, MinCoeff;
Int level;
double *tempCoeff;
Int ret;
double *a;
Int *b;
UChar *c;
UShort *s;
/* Check filter class first */
for(level=0;level<nLevels;level++) {
if(Filter[level]->DWT_Class != DWT_ODD_SYMMETRIC && Filter