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

📄 dwt.h

📁 基于嵌入式零树小波编码的C语言程序实现。
💻 H
字号:
/*--------------------------------------------------------------------------------------------*/
/* Copyright Notice */
/*--------------------------------------------------------------------------------------------*/
/* Copyright (c) 2003 Mow-Song, Ng
 *
 * This program is Copyright (c) 2003 Mow-Song, Ng
 * It may be freely redistributed in its entirety provided that this copyright notice
 * is not removed. It may not be sold for profit or incorporated in commercial 
 * programs without the written permission of the copyright
 * holder. This program is provided as is, without any express or
 * implied warranty, without even the warranty of fitness for a
 * particular purpose.
 *
 */
/*--------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------*/
/* 
 * Subband Transform (Dyadic Decomposition)
 *
 * - I wrote the code after looking at B. Banister code for his QT-TCQ.
 * - The main structure is simialr and the original copyright belongs to 
 *   V. Crump and B. Banister (see below).
 * - While the original code is for odd length Daubechies 9/7 filters, I have modified 
 *   it for even lenth filters (Villasenor 10/18 filters).
 * - The symmetic extension for analysis is moved to the filtering ruotine to make it
 *   easier for 1-D program.
 * - Banister's code does not work for any signal lengths. 
 *   My symmetric extension works for any signal lengths for even length filters, and 
 *   2 for odd length filters (How to do W extension on one sample? Undefined? Use Haar?). 
 *   I read this from Dr. David S. Taubman lecture notes. 
 *   So I claim the copyright to that part of the code.
 *
 * - The part on subband structure organization is from:
 *   G. Davis "Wavelet Compression Construction Kit"
 *
 * msng@mmu.edu.my 
 * Date: Aug. 2003
 * Revised: 26 Oct. 2003
 *
 */
/*--------------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------------*/
/* Original Copyright Notice */
/*--------------------------------------------------------------------------------------------*/
/* Copyright (c) 2002 Brian Banister and Valerie Crump
 *
 * This program is Copyright (c) 2002 by Brian Banister and Valerie Crump.  
 * It may be freely redistributed in its entirety provided that this copyright notice
 * is not removed. It may not be sold for profit or incorporated in commercial 
 * programs without the written permission of the copyright
 * holder. This program is provided as is, without any express or
 * implied warranty, without even the warranty of fitness for a
 * particular purpose.
 *
 */
/*--------------------------------------------------------------------------------------------*/

#ifndef __DWT_H_
#define __DWT_H_

#ifdef __cplusplus
extern "C" {
#endif

/*--------------------------------------------------------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include "global.h"

/*--------------------------------------------------------------------------------------------*/
int SubbandMaxScales(int n);

void InitializeSubbandBuffers(int rows, int cols);
void FreeSubbandBuffers(void);

void Subband1DAnal(REAL *in, int cols, int nLevels, int WaveletIndex);
void Subband1DSynt(REAL *in, int cols, int nLevels, int WaveletIndex);
void Subband2DAnal(REAL *in, int rows, int cols, int nLevels, int WaveletIndex);
void Subband2DSynt(REAL *in, int rows, int cols, int nLevels, int WaveletIndex);

/*--------------------------------------------------------------------------------------------*/
void SubbandAnal97(REAL *in, int n);
void SubbandSynt97(REAL *in, int n);

/*--------------------------------------------------------------------------------------------*/
void SubbandAnal53(REAL *in, int n);
void SubbandSynt53(REAL *in, int n);

/*--------------------------------------------------------------------------------------------*/
void SubbandAnal137(REAL *in, int n);
void SubbandSynt137(REAL *in, int n);

/*--------------------------------------------------------------------------------------------*/
void SubbandAnal1018(REAL *in, int n);
void SubbandSynt1018(REAL *in, int n);

/*--------------------------------------------------------------------------------------------*/
/* - Structure for holding the DWT subband coeff in Linear arrays.
 * - No transformation is taking place, we got to use the functions above for transform.
 * - This structure is obtained from G. Davis "Wavelet Image Compression Kit" 
 *
 *  Subband index : {0}, {1,2,3}, {4,5,6}, {7,8,9}, ...
 *  Subband dir	: {0}, {0,1,2}, {0,1,2}, {0,1,2}, ...
 *  Subband scale	: {0}, {1,1,1}, {2,2,2}, {3,3,3}, ...
 *
 * - Dir: 0 = HL, 1 = LH, 2 = HH
 * - HL => horizontal high-pass (H) follow by vertical low-pass (L).
 *
 */

typedef struct DWTransformStruct{
	int XSize, YSize;
	REAL *Coeff;
	int nLevels;
	int nSubbands;
	int *SubbandSize;
	int *SubbandXSize;
	int *SubbandYSize;
	int *SubbandScale;
	int *SubbandDir;
	REAL **SubbandPtr;
} DWTransform;

/*--------------------------------------------------------------------------------------------*/
DWTransform *DWTransformAlloc(int XSize, int YSize, int nLevels);
void DWTransformDealloc(DWTransform *t);

REAL DWTransformGetValue(DWTransform *t, int scale, int dir, int x, int y);
void DWTransformSetValue(DWTransform *t, int scale, int dir, int x, int y, REAL val);

void DWTransformInputFromMallat(DWTransform *t, REAL *in);
void DWTransformOutputToMallat(DWTransform *t, REAL *out);
void DWTransformScale(DWTransform *t, int scale_all);

void DWTransformError(char *fmt, ...);
void DWTransformWarning(char *fmt, ...);

/*--------------------------------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif

/*--------------------------------------------------------------------------------------------*/

#endif

⌨️ 快捷键说明

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