手机开发实战155——GIF介绍3

本文详细介绍了GIF图像格式中的LZW压缩算法和图像数据结构,包括表基图像数据的LZW最小代码长度、图像数据的数据子块结构,以及图形控制扩展块的功能,如图形处理方法、延时时间、透明度控制等关键要素。

6. 表基图像数据

GIF图像采用了LZW算法对实际的图像数据进行压缩。为了提高压缩编码的效率,对LZW编码器输出的代码采用可变长度码VLC(variable-length-code),不是用位数高度的代码来表示输出,而且代表码字的位数是可变的。

表基图像数据(Table Based Image Data)LZW最小代码长度(LZW Minimum Code Size)和图像数据(Image Data)组成,如下图所示。LZW最小代码长度域的值用来确定图像数据中LZW代码使用的初始位数。图像数据(Image Data)由数据子块(Data Sub-blocks)序列组成。

 

7

6

5

4

3

2

1

0

 

域的名称

类型

LZW Minimum Code Size

 

LZW最小代码长度

 

Byte

 

 

Image Data

 

 

图像数据

Data 
Sub-blocks

 

 图像数据的存储格式

数据子块(Data Sub-blocks)的结构如图所示,这是一个可变长度的数据块,其长度由块大小域(Block Size)域中的值确定,字节数在0255之间。

 

7 6 5 4 3 2 1 0

字节号

域的名称

数据类型

Block Size

0

块大小

Byte

 

1

 

Byte

 

 

 

Byte

Data Values

 

数值

Byte

 

 

 

Byte

 

 

 

 

 

 

 

Byte

 

 

Byte

 

 

Byte

 

255

 

Byte

 

数据子块的结构

7. 图形控制扩展块

图形控制扩展块(Graphic Control Extension)包含处理图形描绘块时要使用的参数,它的结构如图所示。现说明如下:

(1) 扩展导入符Extension Introducer)用于识别扩展块的开始,域中的值是一个数值等于0x21的固定值。

(2) 图形控制标签(Graphic Control Label)用于标识当前块是一个图形控制扩展块,域中的值是一个数值等于0xF9的固定值。

(3) 块大小(Block Size)用来说明该扩展块所包含字节数,该字节数是从这个块大小(Block Size)域之后到块结束符之间的字节数。

 

7

6

5

4

3

2

1

0

字节号

域的名称

类型

Extension Introducer

0

扩展导入符

Byte

Graphic Control Label

1

图形扩展标签

Byte

 

 

 

 

Block Size

0

块大小

Byte

<Packed Fields>

1

包装域

See below

Delay Time

2

延时时间

Unsigned

 

 

 

 

Transparent Color Index

3

透明彩色索引

Byte

 

 

 

 

Block Terminator

0

块结束符

Byte

 

图像描述块的结构

(4) 包装域的结构如图所示。处理方法(Disposal Method)规定图形显示之后译码器要用表6-03中所述方法进行处理。

包装域规定的处理方法

 

域值

处理方法

0

没有指定要做任何处理

1

不处理,图形留在原处

2

显示图形的区域必须要恢复成背景颜色

3

恢复成以前显示的图形

4~7

(未定义)

 

用户输入标志(User Input Flag)域表示在继续处理之前是否需要用户输入响应。在延时时间(Delay Time)和用户输入标志(User Input Flag)都设置为1的情况下,继续处理的开始时间取决于用户响应输入在前还是延时时间结束在前。

7

6

5

4

3

2

1

0

Reserved(保留)

Disposal Method(处理方法)

User Input Flag

Transparent Color Flag

图形控制扩展块的包装结构

(5) 透明(Transparency Flag)表示是否给出透明索引(transparency index)

(6) 延时时间(Delay Time)用来指定在图形显示之后继续处理数据流之前的等待时间,一百分之一秒为单位。

(7) 当且仅当透明标志位设置为1时,透明索引(Transparency Index)用来指示处理程序是否要修改显示设备上的相应象点。当且仅当透明标志位设置为1时,就要修改。

(8) 块结束符(Block Terminator)表示该图形控制扩展块(Graphic Control Extension)结束,它是由一个字节组成的数据块,该域的值是一个固定的值:0x00,因此称为零长度数据子块(zero-length Data Sub-block)

8. 无格式文本扩展块

无格式文本扩展块(Plain Text Extension)包含文本数据和描绘文本所须的参数。文本数据用7位的ASCII字符编码并以图形形式显示。扩展块的结构如图所示

 

7 6 5 4 3 2 1 0

字节号

域的名称

数据类型

Extension Introducer (0x21)

0

扩展导入符

Byte

Plain Text Label (0x01)

1

无格式文本标签

Byte

 

 

Block Size

0

块大小

Byte

Text Grid Left Position

1

文本网格左列位置

Unsigned

 

2

 

 

Text Grid Top Position

3

文本网格顶行位置

Unsigned

 

4

 

 

Text Grid Width

5

文本网格宽度

Unsigned

 

6

 

 

Text Grid Height

7

文本网格高度

Unsigned

 

8

 

 

Character Cell Width

9

字符单元宽度

Byte

Character Cell Height

10

字符单元高度

Byte

Text Foreground Color Index

11

文本颜色索引

Byte

Text Background Color Index

12

文本背景颜色索引

Byte

 

 

 

 

 

 

Plain Text Data

 

无格式文本数据

Data Sub-blocks

 

 

 

 

 

无格式文本扩展块结构

Most data compression methods that are based on variable-length codes employ the Huffman or Golomb codes. However, there are a large number of less-known codes that have useful properties - such as those containing certain bit patterns, or those that are robust - and these can be useful. This book brings this large set of codes to the attention of workers in the field and to students of computer science. David Salomon’s clear style of writing and presentation, which has been familiar to readers for many years now, allows easy access to this topic. This comprehensive text offers readers a detailed, reader-friendly description of the variable length codes used in the field of data compression. Readers are only required to have a general familiarity with computer methods and essentially an understanding of the representation of data in bits and files. Topics and Features: • Discusses codes in-depth, not the compression algorithms, which are readily available in many books • Includes detailed illustrations, providing readers with a deeper and broader understanding of the topic • Provides a supplementary author-maintained website, with errata and auxiliary material – www.davidsalomon.name/VLCadvertis/VLC.html • Easily understood and used by computer science majors requiring only a minimum of mathematics • Can easily be used as a main or auxiliary textbook for courses on algebraic codes or data compression and protection • An ideal companion volume to David Salomon’s fourth edition of Data Compression: The Complete Reference Computer scientists, electrical engineers and students majoring in computer science or electrical engineering will find this volume a valuable resource, as will those readers in various physical sciences and mathematics. David Salomon is a professor emeritus of Computer Science at California State University, Northridge. He has authored numerous articles and books, including Coding for Data and Computer Communications, Guide to Data Compression Methods, Data Privacy and Security, Computer Graphics and Geometric Modeling, Foundations of Computer Security, and Transformations and Projections in Computer Graphics.
内容概要:本文设计了一种基于PLC的全自动洗衣机控制系统内容概要:本文设计了一种,采用三菱FX基于PLC的全自动洗衣机控制系统,采用3U-32MT型PLC作为三菱FX3U核心控制器,替代传统继-32MT电器控制方式,提升了型PLC作为系统的稳定性与自动化核心控制器,替代水平。系统具备传统继电器控制方式高/低水,实现洗衣机工作位选择、柔和过程的自动化控制/标准洗衣模式切换。系统具备高、暂停加衣、低水位选择、手动脱水及和柔和、标准两种蜂鸣提示等功能洗衣模式,支持,通过GX Works2软件编写梯形图程序,实现进洗衣过程中暂停添加水、洗涤、排水衣物,并增加了手动脱水功能和、脱水等工序蜂鸣器提示的自动循环控制功能,提升了使用的,并引入MCGS组便捷性与灵活性态软件实现人机交互界面监控。控制系统通过GX。硬件设计包括 Works2软件进行主电路、PLC接梯形图编程线与关键元,完成了启动、进水器件选型,软件、正反转洗涤部分完成I/O分配、排水、脱、逻辑流程规划水等工序的逻辑及各功能模块梯设计,并实现了大形图编程。循环与小循环的嵌; 适合人群:自动化套控制流程。此外、电气工程及相关,还利用MCGS组态软件构建专业本科学生,具备PL了人机交互C基础知识和梯界面,实现对洗衣机形图编程能力的运行状态的监控与操作。整体设计涵盖了初级工程技术人员。硬件选型、; 使用场景及目标:I/O分配、电路接线、程序逻辑设计及组①掌握PLC在态监控等多个方面家电自动化控制中的应用方法;②学习,体现了PLC在工业自动化控制中的高效全自动洗衣机控制系统的性与可靠性。;软硬件设计流程 适合人群:电气;③实践工程、自动化及相关MCGS组态软件与PLC的专业的本科生、初级通信与联调工程技术人员以及从事;④完成PLC控制系统开发毕业设计或工业的学习者;具备控制类项目开发参考一定PLC基础知识。; 阅读和梯形图建议:建议结合三菱编程能力的人员GX Works2仿真更为适宜。; 使用场景及目标:①应用于环境与MCGS组态平台进行程序高校毕业设计或调试与运行验证课程项目,帮助学生掌握PLC控制系统的设计,重点关注I/O分配逻辑、梯形图与实现方法;②为工业自动化领域互锁机制及循环控制结构的设计中类似家电控制系统的开发提供参考方案;③思路,深入理解PL通过实际案例理解C在实际工程项目PLC在电机中的应用全过程。控制、时间循环、互锁保护、手动干预等方面的应用逻辑。; 阅读建议:建议结合三菱GX Works2编程软件和MCGS组态软件同步实践,重点理解梯形图程序中各环节的时序逻辑与互锁机制,关注I/O分配与硬件接线的对应关系,并尝试在仿真环境中调试程序以加深对全自动洗衣机控制流程的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值