- 浏览: 33086 次
- 性别:
- 来自: 北京
最新评论
Fixed-point numbers
The SWF file format supports two types of fixed-point numbers: 32-bit and 16-bit.
The 32-bit fixed-point numbers are 16.16. That is, the high 16 bits represent the number
before the decimal point, and the low 16 bits represent the number after the decimal point.
FIXED values are stored like 32-bit integers in the SWF file (using little-endian byte order)
and must be byte aligned.
For example: The real value 7.5 is equivalent to: 0x0007.8000.
This value is stored in the SWF file as: 00 80 07 00.
SWF 8 and later supports 16-bit 8.8 signed, fixed-point numbers. The high 8 bits represent
the number before the decimal point, and the low 8 bits represent the number after the
decimal point. FIXED8 values are stored like 16-bit integers in the SWF file (using littleendian
byte order) and must be byte aligned.
定点数
swf文件格式支持两种类型的定点数:32位定点数和16位定点数。32位定点数的格式是16.16格式的,小数点前面是高16位,小数点后面低16位。定点值存在SWF文件里,像32位整数形式,采用了little-endian的字节顺序,必须字节对齐。
例如:一个实数:7.5相当于0x0007.8000(10进制转换为16进制可知:7x16^0 . 8*16^-1)。
这个值在SWF文件中是以00 80 07 00的形式存储的。
SWF8或更高版本中,16位的定点数采用8.8格式,小数点前高8位,低8位在小数点后。在SWF文件里FIXED8数据存储时就像16位整数一样使用little-endian字节序,并且必须字节对齐。
Fixed-Point Types
Type Comment
FIXED 32-bit 16.16 fixed-point number 32定点数
FIXED8 16-bit 8.8 fixed-point number 16位定点数
Floating-point numbers
SWF 8 and later supports the use of IEEE Standard 754 compatible floating-point types.
Three types of floating-point numbers are supported.
浮点数
SWF8或更高版本中支持使用IEEE标准754兼容浮点类型。
三种类型的浮点数都支持。
Floating-Point Types
Type Comment
FLOAT16 Half-precision (16-bit) floating-point number (16-bit)半精度
FLOAT Single-precision (32-bit) IEEE Standard 754 compatible (32-bit)单精度
DOUBLE Double-precision (64-bit) IEEE Standard 754 compatible (64-bit)双精度
FLOAT16 is identical to the characteristics of FLOAT except for changes to the number of
bits allocated to the exponent and mantissa:
■ 1 bit for the sign
■ 5 bits for the exponent, with an exponent bias of 16
■ 10 bits for the mantissa
FLOAT16是和IEEE Standard 754类似的,只是改变了标准中分配给尾数和指数的位数。
■1位作为符号位
■5位是分配给指数部分,实际的指数是5位数表示的数和16的差值;
■10位用来表示尾数
Encoded integers
SWF 9 and later supports the use of integers encoded with a variable number of bytes. One
type of encoded integer is supported.
This is a 32-bit unsigned integer value encoded with a variable number of bytes to save space.
All EncodedU32's are encoded as 1-5 bytes depending on the value (larger values need more
space). The encoding method is if the hi bit in the current byte is set, then the next byte is also
part of the value. Each bit in a byte contributes 7 bits to the value, with the hi bit telling us
whether to use the next byte, or if this is the last byte for the value.
This is the algorithm for parsing an EncodedU32:
编码的整数
SWF 9或更高版本支持与一个可变数目字节编码的整数使用。一整数类型的编码支持。
这是一个32位无符号的可变字节编码的整数,以节省空间。
所有EncodedU32的编码为1-5个字节取决于值(较大的值需要更多空间)。该编码方法是,如果在当前字节高位被设置,那么下一个字节也是值的一部分。字节中的每一位都有价值包括高位,告诉我们是否使用下一个字节,或者说明这是最后一个字节的值。
这是分析EncodedU32算法:(此步翻译略)
The SWF file format supports two types of fixed-point numbers: 32-bit and 16-bit.
The 32-bit fixed-point numbers are 16.16. That is, the high 16 bits represent the number
before the decimal point, and the low 16 bits represent the number after the decimal point.
FIXED values are stored like 32-bit integers in the SWF file (using little-endian byte order)
and must be byte aligned.
For example: The real value 7.5 is equivalent to: 0x0007.8000.
This value is stored in the SWF file as: 00 80 07 00.
SWF 8 and later supports 16-bit 8.8 signed, fixed-point numbers. The high 8 bits represent
the number before the decimal point, and the low 8 bits represent the number after the
decimal point. FIXED8 values are stored like 16-bit integers in the SWF file (using littleendian
byte order) and must be byte aligned.
定点数
swf文件格式支持两种类型的定点数:32位定点数和16位定点数。32位定点数的格式是16.16格式的,小数点前面是高16位,小数点后面低16位。定点值存在SWF文件里,像32位整数形式,采用了little-endian的字节顺序,必须字节对齐。
例如:一个实数:7.5相当于0x0007.8000(10进制转换为16进制可知:7x16^0 . 8*16^-1)。
这个值在SWF文件中是以00 80 07 00的形式存储的。
SWF8或更高版本中,16位的定点数采用8.8格式,小数点前高8位,低8位在小数点后。在SWF文件里FIXED8数据存储时就像16位整数一样使用little-endian字节序,并且必须字节对齐。
Fixed-Point Types
Type Comment
FIXED 32-bit 16.16 fixed-point number 32定点数
FIXED8 16-bit 8.8 fixed-point number 16位定点数
Floating-point numbers
SWF 8 and later supports the use of IEEE Standard 754 compatible floating-point types.
Three types of floating-point numbers are supported.
浮点数
SWF8或更高版本中支持使用IEEE标准754兼容浮点类型。
三种类型的浮点数都支持。
Floating-Point Types
Type Comment
FLOAT16 Half-precision (16-bit) floating-point number (16-bit)半精度
FLOAT Single-precision (32-bit) IEEE Standard 754 compatible (32-bit)单精度
DOUBLE Double-precision (64-bit) IEEE Standard 754 compatible (64-bit)双精度
FLOAT16 is identical to the characteristics of FLOAT except for changes to the number of
bits allocated to the exponent and mantissa:
■ 1 bit for the sign
■ 5 bits for the exponent, with an exponent bias of 16
■ 10 bits for the mantissa
FLOAT16是和IEEE Standard 754类似的,只是改变了标准中分配给尾数和指数的位数。
■1位作为符号位
■5位是分配给指数部分,实际的指数是5位数表示的数和16的差值;
■10位用来表示尾数
Encoded integers
SWF 9 and later supports the use of integers encoded with a variable number of bytes. One
type of encoded integer is supported.
This is a 32-bit unsigned integer value encoded with a variable number of bytes to save space.
All EncodedU32's are encoded as 1-5 bytes depending on the value (larger values need more
space). The encoding method is if the hi bit in the current byte is set, then the next byte is also
part of the value. Each bit in a byte contributes 7 bits to the value, with the hi bit telling us
whether to use the next byte, or if this is the last byte for the value.
This is the algorithm for parsing an EncodedU32:
编码的整数
SWF 9或更高版本支持与一个可变数目字节编码的整数使用。一整数类型的编码支持。
这是一个32位无符号的可变字节编码的整数,以节省空间。
所有EncodedU32的编码为1-5个字节取决于值(较大的值需要更多空间)。该编码方法是,如果在当前字节高位被设置,那么下一个字节也是值的一部分。字节中的每一位都有价值包括高位,告诉我们是否使用下一个字节,或者说明这是最后一个字节的值。
这是分析EncodedU32算法:(此步翻译略)
int GetEncodedU32(unsigned char*& pos) { int result = pos[0]; if (!(result & 0x00000080)) { pos++; return result; } result = (result & 0x0000007f) | pos[1]<<7; if (!(result & 0x00004000)) { pos += 2; return result; } result = (result & 0x00003fff) | pos[2]<<14; if (!(result & 0x00200000)) { pos += 3; return result; } result = (result & 0x001fffff) | pos[3]<<21; if (!(result & 0x10000000)) { pos += 4; return result; } result = (result & 0x0fffffff) | pos[4]<<28; pos += 5; return result; }
发表评论
-
手机听书客户端发布了!
2012-06-13 19:41 947沉寂了一段时间,研究了新的产品,迅速做了个人生大转型,改做手机 ... -
(swf file format spec v10)swf文件格式中英文说明书v10,显示列表部分,笔记12
2010-10-24 01:46 959The Display List Displaying a f ... -
(swf file format spec v10)swf文件格式中英文说明书v10,字典部分,笔记10
2010-10-20 23:31 1073The dictionary The dictionary i ... -
(swf file format spec v10)swf文件格式中英文说明书v10,各种标签部分,笔记9
2010-10-20 00:44 1094Definition and control tags The ... -
(swf file format spec v10)swf文件格式中英文说明书v10,SWF文件结构,笔记8
2010-10-18 23:47 1010SWF file structure Following th ... -
(swf file format spec v10)swf文件格式中英文说明书v10,文件结构摘要,笔记7
2010-10-17 23:00 2386SWF Structure Summary This chap ... -
MP4 flash播放器,开放换肤功能,支持iphone/ipad/ipod
2010-10-13 19:16 1771最近视频网站竞争比较激烈,相传youku/tudou都已经开始 ... -
(swf file format spec v10)swf文件格式中英文说明书v10,颜色记录,笔记6
2010-10-13 19:14 1017最枯燥的部分终于要结束了,马上就要迎来很关键的部分,不过这之前 ... -
(swf file format spec v10)swf文件格式中英文说明书v10,字符串部分,笔记5
2010-10-13 19:13 1082STRING(翻译略) Field Type Comment ... -
(swf file format spec v10)swf文件格式中英文说明书v10,位值部分,笔记4
2010-10-13 19:07 1090Bit values Bit values are varia ... -
(swf file format spec v10)swf文件格式中英文说明书v10,基本数据类型部分,笔记2
2010-10-12 10:21 1248What’s new in SWF 10 Flash Play ... -
(swf file format spec v10)swf文件格式中英文说明书v10,简介部分,笔记1
2010-10-12 00:16 1360由于最近研究swf文件格 ... -
用Flash AS3的Clipboard类实现js复制连接功能
2010-10-12 00:11 1059大家都知道JS(clipboardData.setData)实 ... -
新闻列表不同连接色控制方法(AS3)
2010-10-12 00:08 703今天测试TextField通过读取xml文件完成新闻列表,并且 ...
相关推荐
浮点数转定点数 FPGA Verilog
计算机组成原理定点数浮点数等运算方法复习PPT课件.pptx
二进制定点数与浮点数解释,三页,浅显说明。计算机存储的二进制数中一般采用两种存储方式--定点数和浮点数。
浮点数与定点数的相互转换程序,描述了浮点数与定点数的内在联系;浮点数的约点以及定点数与浮点数的相互转化。
MATLAB浮点数转定点数原码代码,适用于数字信号处理中对数据进行预处理。
定点数和浮点数
双字节定点整数(十六进制)转换为3字节浮点数.浮点数到双字节定点整数转换子程序。PIC18F2525单片机。注释详细。
很不错的课件,能够给初学者很大的帮助,内容很详细,值得一看,尤其是刚刚学习计算机组成原理的同学。
如果需要在自己的程序中使用定点数库,可以先引用这些库,然后按照库的文档说明进行使用。需要注意的是,在使用定点数时,需要对倍数和小数位数进行正确的设置,否则可能会导致结果不准确。此外,定点数计算相对于...
计算机组成原理定点数浮点数等运算方法复习PPT学习教案.pptx
浮点数和定点数的加减乘除.pdf
自动Q15定点化
计算机组成原理定点数、浮点数等运算方法复习,包括原码、补码、移码等介绍,以及定点数、浮点数的加减乘等运算。
DSP定点和浮点数格式PPT课件.pptx
d) 利用“实验板”对两种4-bit无符号整数到浮点数转换电路进行综合和实现,设定定点数输入和浮点数输出的人机接口,建议用4个LED灯表示输入值,操作开关或按动按钮后进行转换,用数码管显示有效位和幂指数;...
DSP定点和浮点数格式PPT学习教案.pptx
实用程序 Float2Qpt 允许用户将浮点数转换为 Q(QI.QF) 格式的有符号或无符号定点数,具有自动选择或用户可定义的字长,以及自动选择或用户可定义的容错 (epsilon)。 或者,用户可以传入可选参数以强制转换中使用的舍...
DSP系统实验02New-定点和浮点数格式汇总.pptx
一篇介绍定点浮点的好文章,大家可以看看