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

📄 wavelet.h

📁 c++ Builder中网络图象渐进传输实例
💻 H
字号:
#ifdef __cplusplus // C++
extern "C" {
#endif

#ifndef _WAVELET_H_INCLUDED
#define _WAVELET_H_INCLUDED

#include "bit.h"

#ifndef min
#define min(a, b)  (((a) < (b)) ? (a) : (b))
#define max(a, b)  (((a) > (b)) ? (a) : (b))
#endif

// this is the basic "pixel" type. should not be less than 15 bits + sign
typedef short int wv_pel;

#define wv_MAX_CHANNELS 16

#pragma pack(push, 1)

typedef struct {
	int		compressed_size;
	float	mse;
} t_wv_quantised_block;

typedef struct { // one (rice-encoded) block
	int		max_value, max_bpp, max_quant;
	int		size, offset;
	int		best_bits; // at this level
	float	best_mse; // at this level
	int		best_quant;
	t_wv_quantised_block*	quant;
} t_wv_cblock;

typedef struct {
	int		width, owidth;
	int		height, oheight;
	int		size;
	int		max_levels;		// of the Wavelet transform
	wv_pel*	channel;
	wv_pel*	reordered_channel; // Wavelet transform Coefficients in zig-zag'ed order
	int**	reorder_table;	// used for ordering blocks quickly
	int		max_bits;		// Maximum size of the compressed Image in Bits
	float	max_mse, final_mse;
	int		size_min_block; // smallest (start) block
	int		num_blocks;
	t_wv_cblock*	blocks;
} t_wv_cchannel;

typedef void (*wv_progress_function) (int Current, int End, void* UserData);

typedef struct {
	int		max_bpp;
	int		quant;
	int		num_bits;
} t_wv_cblock_settings;

typedef struct {
	t_wv_cchannel*	cchannel;
	int		num_bits;
	int		size_min_block;
	float	emse;
	int		num_blocks;
	t_wv_cblock_settings*	blocks;
} t_wv_csettings;

typedef struct {
	int			num_channels;
	int			width, height; // size "stored" (dimension are power of 2)
	int			owidth, oheight; // original width & height
	int			num_blocks;
	int			size_min_block;
	int			header_version, bitstream_version;
} t_wv_header;

typedef struct {
	t_wv_header	hdr;
	wv_pel**	channels;
} t_wv_dchannels;

#pragma pack(pop)

WAVELET_DLL_API int WAVELET_DLL_CC wv_log2i(int max_val);
WAVELET_DLL_API float WAVELET_DLL_CC wv_mse_to_psnr(const float mse);
WAVELET_DLL_API float WAVELET_DLL_CC wv_psnr_to_mse(const float psnr);
WAVELET_DLL_API float WAVELET_DLL_CC wv_calc_psnr(const wv_pel *a, const wv_pel *b, const int width, const int height, const int pitch, float *pmse);

WAVELET_DLL_API t_wv_cchannel* WAVELET_DLL_CC wv_init_channel(const int Width, const int Height, const wv_pel* Channel,
	const int Lossless, int*** ReorderTable, wv_progress_function Progress, void* UserData);
WAVELET_DLL_API void WAVELET_DLL_CC wv_done_channel(t_wv_cchannel* CC, const int FreeReorderTable);

WAVELET_DLL_API int WAVELET_DLL_CC wv_init_channel_settings(t_wv_cchannel* CC, const int MaxBits, const float MaxMSE, t_wv_csettings** Settings);
WAVELET_DLL_API void WAVELET_DLL_CC wv_done_channel_settings(t_wv_csettings* Settings);

WAVELET_DLL_API int WAVELET_DLL_CC wv_encode_channels(const int NumChannels, t_wv_csettings** ChannelSettings, t_bit_file* BF);

WAVELET_DLL_API t_wv_header* WAVELET_DLL_CC wv_read_header(t_wv_header* Header, t_bit_file* BF);
WAVELET_DLL_API t_wv_dchannels* WAVELET_DLL_CC wv_init_decode_channels(int Reduction, t_bit_file* BF);
WAVELET_DLL_API void WAVELET_DLL_CC wv_done_decode_channels(t_wv_dchannels* dc);

#endif // _WAVELET_H_INCLUDED

#ifdef __cplusplus // C++
}
#endif

⌨️ 快捷键说明

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