资源简介
基于FPGA的压缩算法 压缩比1:2里有全套资料,资料里有C代码的压缩代码

代码片段和文件信息
/*
* liblzs.c
*
* Copyright (C) Beijing Soul.
*
* Hu gang
*
* A compatible LZX base compress/uncompress
*
*/
#ifndef __KERNEL__
#include
#include
#include
#include
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
#else
#include
#include
#include
#undef DEBUG
#endif
#include “liblzs.h“
struct sk_buff {
int len;
int data_len;
unsigned char *head;
unsigned char *data;
unsigned char *tail;
unsigned char *end;
};
#ifdef DEBUG
static FILE *fp_debug;
#define dprintf(format arg...) \
do {\
fprintf(fp_debug “%s:%d:“ format __FUNCTION__ \
__LINE__ ## arg); \
} while (0)
#else
#define dprintf(format arg...) \
do {} while (0)
#endif
static void skb_put(struct sk_buff *skb unsigned int len unsigned char byte)
{
dprintf(“%02x %02x\n“ skb->len byte);
*skb->data = byte;
skb->data ++;
skb->len ++;
}
typedef struct _lzs_state {
u32 word;
int left;
u8 *inbuf;
int inlen;
u8 zstuff;
u16 ccnt;
} LZSState;
static int
putBits(LZSState *s struct sk_buff *skbout u32 bits int len)
{
u8 byte;
dprintf(“%04x %x\n“ bits len);
s->word <<= len;
s->word |= bits;
s->left += len;
while(s->left >= 8) {
s->left -= 8;
byte = s->word >> (s->left);
skb_put(skbout 1 byte);
}
if (skbout->len >= skbout->data_len)
return -1;
return 0;
}
static int
putLiteralByte(LZSState *s struct sk_buff *skbout u8 byte)
{
if (putBits(s skbout 0 1) != 0)
return -1;
if (putBits(s skbout byte 8) != 0)
return -1;
return 0;
}
static int
putOffset(LZSState *s struct sk_buff *skbout u32 offs)
{
int off;
if(offs < 128) {
off = 3 << 7 | offs;
dprintf(“%x\n“ off);
if (putBits(s skbout 3 2) != 0)
return -1;
if (putBits(s skbout offs 7) != 0)
return -1;
} else {
off = 2 << 11 | offs;
dprintf(“%x\n“ off);
if (putBits(s skbout 2 2) != 0)
return -1;
if (putBits(s skbout offs 11) != 0)
return -1;
}
return 0;
}
static int
putLen(LZSState *s struct sk_buff *skbout u32 index int len)
{
int res;
switch(len) {
case 2:
res = putBits(s skbout 0 2);
break;
case 3:
res = putBits(s skbout 1 2);
break;
case 4:
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-02-13 08:13 lzs-master\
文件 18011 2013-02-13 08:13 lzs-master\LICENSE.GPL
文件 140 2013-02-13 08:13 lzs-master\Makefile
目录 0 2013-02-13 08:13 lzs-master\common\
文件 12829 2013-02-13 08:13 lzs-master\common\fifo_control.v
文件 5230 2013-02-13 08:13 lzs-master\common\synchronizer_flop.v
文件 12738 2013-02-13 08:13 lzs-master\common\tpram.v
目录 0 2013-02-13 08:13 lzs-master\decode\
目录 0 2013-02-13 08:13 lzs-master\decode\bench\
目录 0 2013-02-13 08:13 lzs-master\decode\bench\verilog\
文件 629 2013-02-13 08:13 lzs-master\decode\bench\verilog\Makefile
文件 1403 2013-02-13 08:13 lzs-master\decode\bench\verilog\tb.dino
文件 5172 2013-02-13 08:13 lzs-master\decode\bench\verilog\tb.v
文件 3786 2013-02-13 08:13 lzs-master\decode\bench\verilog\tb_data.v
目录 0 2013-02-13 08:13 lzs-master\decode\rtl\
目录 0 2013-02-13 08:13 lzs-master\decode\rtl\verilog\
文件 3429 2013-02-13 08:13 lzs-master\decode\rtl\verilog\decode.v
文件 6085 2013-02-13 08:13 lzs-master\decode\rtl\verilog\decode_ctl.v
文件 2728 2013-02-13 08:13 lzs-master\decode\rtl\verilog\decode_in.v
文件 1418 2013-02-13 08:13 lzs-master\decode\rtl\verilog\decode_out.v
文件 9125 2013-02-13 08:13 lzs-master\decode\rtl\verilog\generic_tpram.v
目录 0 2013-02-13 08:13 lzs-master\docs\
文件 149479 2013-02-13 08:13 lzs-master\docs\decode.pdf
文件 2823 2013-02-13 08:13 lzs-master\docs\decode.tex
文件 149588 2013-02-13 08:13 lzs-master\docs\encode.pdf
文件 3712 2013-02-13 08:13 lzs-master\docs\encode.tex
文件 24952 2013-02-13 08:13 lzs-master\docs\lzs.pdf
文件 19573 2013-02-13 08:13 lzs-master\docs\pdl_std.html
文件 45267 2013-02-13 08:13 lzs-master\docs\rfc1974.txt
目录 0 2013-02-13 08:13 lzs-master\edk\
目录 0 2013-02-13 08:13 lzs-master\edk\pcores\
............此处省略87个文件信息
- 上一篇:timer verilog
- 下一篇:stm32DSP 库FFT
相关资源
- 怎样在flex的datagrid中运用checkbox
- 图片存储到数据库保存二进制文件并
- DataGridView财务金额格式显示
- powerdatagrid控件 源码
- In vitro screening of lactobacilli with antago
- WINCC报表(OLE-DB Tag and Alarm Export_V8.x
- ThinkVantage技术白皮书
- 思科力助新西兰Otago大学教育网智能建
- 自制AVR ATmega16 JTAG2008
- ISO18000-6C
- GetDataGraphDigitizer
-
A triphenylamine-ba
sed four-armed molecule - MSP430 JTAGUSB的和并口的与目标板连接的
- Modeling of rapeseed at maturity stage using 3
- 超强amiibo bin资料库 包含TagMo.2.7.0 全
- tgaddsmax缩略图显示插件大全.7z
- getdatagraphdigitizer破解版
- 高分辨率tag36h11
- 恋恋有词思维导图
- datagrid
- AprilTag: A robust and flexible visual fiducia
- sontag_mathematical control theory
- 三辊卷板机
- ADS2009license附件
- Low power Methodology manual
- EasyUI DataGrid及Pagination(源码)
- IEEE 1149.1 标准
- trace32使用手册
- H-JTAG驱动支持usb和并口的驱动
- Infragistics NetAdvantage for Windows Forms 20
评论
共有 条评论