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

📄 huff.h

📁 mp3解码源代码
💻 H
字号:
/****************************************************************************//* *	huff.h -- Definition of Huffman Codes handling * *	Author  :   St閜hane TAVENARD * *	(C) Copyright 1997-1997 St閜hane TAVENARD *	    All Rights Reserved * *	This program is free software; you can redistribute it and/or modify *	it under the terms of the GNU General Public License as published by *	the Free Software Foundation; either version 2 of the License, or *	(at your option) any later version. *	 *	This program is distributed in the hope that it will be useful, *	but WITHOUT ANY WARRANTY; without even the implied warranty of *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *	GNU General Public License for more details. *	 *	You should have received a copy of the GNU General Public License *	along with this program; if not, write to the Free Software *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//****************************************************************************/#ifndef HUFF_H#define HUFF_H/****************************************************************************/#define	HUFF_BUFFER_SIZE	4096#define	HUFF_MAX_BITS		32typedef struct {	int		buffer_size;	unsigned char	*buffer;	int		write_index;	int		read_index;	unsigned long	bit_cache;	int		cache_size;	unsigned long	bits;	INT16		nul_begin; // begin of last null zone} HUFFMAN;/* *	HUFF macros. */#define HUFF_pos(h) \	((((h->read_index<<3) - h->cache_size) < 0) ? \	 (((h->read_index<<3) - h->cache_size) + (HUFF_BUFFER_SIZE<<3)) : \	 ((h->read_index<<3) - h->cache_size))#define HUFF_diff(s,e) \	((s <= e) ? (e - s) : ((HUFF_BUFFER_SIZE<<3) + e - s))#define HUFF_fill_byte(h,b) \	(h->buffer[h->write_index++] = b, \	 h->write_index &= HUFF_BUFFER_SIZE-1)#define HUFF_read_bit(h) \	((h->cache_size-- > 0) ? \	 (h->bits = (h->bit_cache & 0x80000000) ? 1 : 0, \	 h->bit_cache <<= 1, h->bits) : \	 HUFF_read_bit_cache(h))#define HUFF_read_bits(h,c) \	(((c) <= 0) ? 0 : (h->cache_size >= (c)) ? \	 (h->cache_size -= (c), h->bits = h->bit_cache >> (32-(c)), \	 h->bit_cache <<= (c), h->bits) : HUFF_read_bits_cache(h, c))/* *	Exported functions. */extern HUFFMAN	*HUFF_open(void);extern void	HUFF_close(HUFFMAN *h);extern int	HUFF_reset(HUFFMAN *h);extern void	HUFF_fill_bytes(HUFFMAN *h, unsigned int count, char *buffer);extern int	HUFF_set_start(HUFFMAN *h, int start_pos);extern int	HUFF_seek(HUFFMAN *h, int seek_pos);extern int	HUFF_decode_pair(HUFFMAN *h, INT16 table, INT16 count,			INT16 *x);extern int	HUFF_decode_quad(HUFFMAN *h, INT16 table, INT16 max_bits,			INT16 val_count, INT16 val_top, INT16 *x);extern unsigned long	HUFF_read_bit_cache(HUFFMAN *h);extern unsigned long	HUFF_read_bits_cache(HUFFMAN *h, unsigned int count);/****************************************************************************/#endif /* HUFF_H */

⌨️ 快捷键说明

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