Gif图象中的数据使用LZW压缩算法的,如何解压该数据?

fixopen 2003-08-21 11:09:06
找到很多LZW算法的实现,都是基于文件的,而且听说Gif的LZW跟标准的LZW有一点小小的不同。清高手指点。
...全文
81 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mydup 2003-08-23
  • 打赏
  • 举报
回复
我知道基本的算法,不知道怎么实现:(

压缩
// STRING = get input character
// WHILE there are still input characters DO
// CHARACTER = get input character
// IF STRING+CHARACTER is in the string table then
// STRING = STRING+character
// ELSE
// output the code for STRING
// add STRING+CHARACTER to the string table
// STRING = CHARACTER
// END of IF
// END of WHILE
// output the code for STRING

解压缩
//Read OLD_CODE
//output OLD_CODE
//CHARACTER = OLD_CODE
//WHILE there are still input characters DO
// Read NEW_CODE
// IF NEW_CODE is not in the translation table THEN
// STRING = get translation of OLD_CODE
// STRING = STRING+CHARACTER
// ELSE
// STRING = get translation of NEW_CODE
// END of IF
// output STRING
// CHARACTER = first character in STRING
// add OLD_CODE + CHARACTER to the translation table
// OLD_CODE = NEW_CODE
//END of WHILE
fixopen 2003-08-21
  • 打赏
  • 举报
回复
自己顶一下
fixopen 2003-08-21
  • 打赏
  • 举报
回复
没人回答么?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧