Git Product home page Git Product logo

huffmanzip's Introduction

HuffmanZip

基于QT5的哈夫曼编码压缩软件

项目简介

使用哈夫曼编码进行文件压缩和解压缩,并通过QT提供用户gui界面,实现进度条显示。 可解压缩2G文件,但是速度较为缓慢。虽然理论可压缩更大的文件,但建议不要测试过大的文件。 ps:软件效果图在example文件夹中

使用说明

  • clone项目,用QT打开pro文件。
  • 使用example文件夹中的exe文件。

文件说明

  1. 'huffmantree' 定义了哈夫曼树及其节点
  2. 'zip' 压缩解压核心类
  3. 'mainwindow' QT主界面

基本思路

  • 压缩操作:首先要求用户输入源文件与目标文件名,然后统计源文件中各字符出现的频度,以字符出现频度为权建立哈夫曼权,再将源文件名和各字符出现的频度写入目标文件中,最后对源文件中各字节进行哈夫曼编码,将编码按比特为单位写入到目标文件。
  • 解压缩操作:首先要求用户输入压缩文件、目标文件名以及储存路径,然后从压缩文件中读入源文件的文件名与各字符出现的频度,以压缩操作中相同的方法构造哈夫曼树,再对压缩文件读入字节,逐个解码,并将解码后的字符写入目标文件中。

压缩情况

  1. txt文件压缩效率较好,解压后文件与原文件相同,没有出现损坏,符合预期效果。
  2. JPG格式图片压缩与原文件大小相差不大,解压后与原文件相同,图片没有损坏,由于格式问题,以及哈夫曼编码方式自身的限制,测试结果符合预期。
  3. Doc格式Word文档压缩率较高,解压后与原文件相同,解压无误。符合预期效果。
  4. Docx格式Word文档压缩后比原文件大了1KB,解压后大小与原文件相同且内容没有改变。软件对于docx格式文档的压缩效率还有待提高。

huffmanzip's People

Contributors

weixiao1998 avatar machinec avatar

Stargazers

JZLshen avatar  avatar Molo avatar  avatar  avatar  avatar zhanlutuzi avatar Verloren avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

shinji411 lm0710

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.