亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lzwtut.htm

?? LZW compression example with java
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
</p>
<b>3c.Example</b>
<p>Let抯 do a brief explanation of what happens when we run Cat256tInTheHatAnd263eR257 through our little decompressor:
<ol>
<li>1. C is read and outputted, First_code = 'C'</li>
<li>2. Next_Code = 'a', 'a' is in table so it is outputted, and "Ca", 256 is added to the table. First_code = 'a'</li>
<li>3. Next_Code = 't', 't' is in table so it is outputted, and "at", 257 is added to the table. First_Code = 't'</li>
<li>4. Next_Code = 256, '256' is in table, so "Ca" is outputted, "tC" , 258 is added to string table, and First_code = 256.</li>
</ol>
The rest should come really easy. And the check if it the code is not in the table is not used in this example, try entering Data like:<br>

AndAndAndAndAndAndAndAndAndAndAndAndAndAndAndAndAndAndAndAnd<br>

"And" see what happens, to keep this tutorial simple we won抰 focus on it to much, if you need to learn more about it have a look at the source and other tutorials in the references section.

And that concluded the decompression stage, whoa; you now know how to use LZW compression!
</p>
<a name = "gif"><b>The GIF</b></a>
<hr><br>
<b>4a.What is it?</b>
<p>
Okay now well go a cover the GIF format. Briefly to summarize what GIF is, GIF stands for the Graphics Interchange Format and is one of the widely accepted methods of transferring images over the net. However it has begun to show its age (supporting only a maximum of 8 bit or 256 colour images) and is gradually being replaced. So we might as well discuss it while it's not extinct like the dinosaurs.

Okay, now obviously we can't just run our decompressor over the image and hope for it to work, the GIF format makes some subtle differences to the code were used too. First there is a header, which looks like so:
</p>
<b>4b. The GIF Format</b>
<p>
<pre>
GIF HEADER
6 Bytes		Signature
2 Bytes		ScreenWidth
2 Bytes		ScreenHeight
1 Byte		Depth
1 Byte		Background
1 Byte		Reserved(87a) or Pixel Aspect Ratio
</pre>
<b>Descriptions:<br><br></b>
<b>Signature</b> - Is either GIF87a or GIF89a, each version has a few changes but most are not to important, the most noticeable being the fact GIF89a supports animated images<br>
<b>ScreenWidth</b> - The maximum size of an image in a GIF, if this is an animated GIF, images can be smaller or equal to this size<br>
<b>ScreenHeight</b> - See above<br>
<b>Depth</b> - This is divided into several bits, as follows:<br>
<b>-----------------Packed Fields-----------<br></b>
<b>Bit 0-2</b>: In 87a these hold the value of pixel, which is the number of bits -1 per pixel in the image. In 89a it抯 the size of the palette ((pixel+1)^2).<br>
<b>Bit 3</b> - Reserved in 87a, in 89a its a sort flag telling you that colours in the colour table are listed in decreasing order of important, but its not big deal now(unless your running a 256 colours desktop).<br>
<b>Bit 4-6</b>: These are cs, cs+1 is the colour resolution of the image. <br>
<b>Bit 7</b> - If set we have a global palette, meaning only one palette in total, if not we have a local palette which means you'll find a palette before each image. (If there are multiple images)<br>
<b>-----------------Packed Fields--------------------<br></b>
<b>Background</b> - The background colour, only important if you have an animated GIF, and some of the "ScreenWidth or Height" is not full.<br>
<b>Reserved/Aspect Ratio</b>: This really isn't important, but uh, if you really need to know more read the GIF89a from wotsit (see references).<br>

Now the <b>Palette</b>, If there is a global palette (Meaning Bit 7 in depth is set) you read this RIGHT after the header, if not after the image identifier, the palette looks like so:<br>
<pre>
1 Byte - red intensity, 0-255-----| Repeat for every color<br>
1 Byte - green intensity, 0-255   | in colour table, usually<br>
1 Byte - blue intensity, 0-255----| (cs+1)^2<br>
</pre>
Remember that the colour map starts with colour 0 and works up!
Now these values are right shifted twice (many 8 bit palette handlers use 6 bit channels, or 0-63 colours per channel) so you may need to left shift twice or divide by 4(unless you抮e dealing with win32api, which wants 0-255 palette entries). However, it really depends on your palette routines so check your documentation on it. Allegro uses 6 bits, and that's why I brought it up.

Now after that, you want to look for the Image Descriptor, which looks like so:
<pre>
IMAGE DESCRIPTER
1 Byte - 	ID
2 Bytes - 	ImageLeft
2 Bytes - 	ImageTop
2 Bytes - 	Width
2 Bytes -	Height
1 Byte - 	Depth
</pre>
<b>ID</b> - This is the ',' char or 0x2C in hex.<br>
<b>ImageLeft</b> - How many pixels from the left of the Screenwidth the image starts<br>
<b>ImageTop</b> - Same as above except below top<br>
<b>Width</b> - Width of image in pixels<br>
<b>Height</b> - Height of image in pixels<br>
<b>Depth</b> - Okay this is another packed bit, and is rather different in 89a and 87a. Remember if Bit 7 is not set, you only need to worry about Bit 6 as the others are relevant to Bit 7<br>
<b>-----------------Packed Fields--------------------<br></b>
<b>Bit 0-2</b>: Pixel, in 87a this is bits per pixel-1, in 89a this is the size of the colour table (pixel+1)^2.<br>
<b>Bit 3-4</b>: Reserved both in 87a and 89a<br>
<b>Bit 5</b>: 87a unused, 89a tells that palette is in order of decreasing importance<br>
<b>Bit 6</b>: Image is interlaced, more on interlaced later<br>
<b>Bit 7</b>: if set means has a local palette (animated GIF) meaning the palette starts, then the image otherwise is false meaning image starts right after.<br>
<b>-----------------Packed Fields--------------------<br></b>
It is very important to realize that the image descriptor does NOT HAVE TO START AFTER THE HEADER, keep reading through the GIF until you find the ',' character, then you read the image, otherwise your loader may experience problems with certain GIFs.<br>

After that there is the image which looks like so
<pre>
1 Byte	 		CodeSize
1 Byte 			BufferSize -------|Repeat until
BufferSize Bytes	Buffer     -------|EOI is found
</pre>
Okay, now <b>CodeSize</b> is equal to the bpp +1. This is because the LZW compression of GIF works intelligently. GIF can compress with a maximum of 12 bits per code, however it starts of using only bpp+1 bits per code, and then when the last code used is equal to codeSize^2 then it increases CodeSize by one. This goes on to a maximum of 12 bits, this allows the GIF to compress small images as well as large images.<br>

Now <b>Buffersize</b> is essentially a number from 0-255 that tells how many bytes you're to read and then you repeat it, pretty pointless if you ask me but remember if you read 0 remember to stop reading the image!<br>

Now onto the GIF <b>buffer</b>, this is the same as the lzw compression we just cover with a few differences. They are:<br>
<ul>
<li>a) Variable compression, we already covered this, basically if only 9 bits (any code less then 511) is needed then 9 is used, when code 511 is read, then the compression switches to 10 bits. This goes up until 12, were the maximum is then reached<</li>

<li>b) Now the other variation is the clear code, this bpp ^2 (so if the image has 256 colors, or 8 bit, it would be 256). This can be found anywhere in the buffer, and when it is found, you must clear the tables and codes, and start decompressing with clear tables</li>

<li>c) The final reserved code is bpp^2+1, which is EOI, when this is found the image is finished and you can stop reading.</li>

Okay now that you've loaded an image, you can keep reading until you find the ';', or 0x3B found after you've loaded an image, if you find a ',' before it(89a), that means it is an animated GIF, and you'll have to load more images!
</ul>
Now that's it, you can load a GIF, Hopefully I've explained it really clearly, if not, here is a little present, more pseudo code!

</p>
<b>4c. GIF Pseudo Code</b>
<p>
<pre>
Load Header
Load Image Descriptor after ID has been found
Clear LZW tables
get First_Code
get Code_Size
DO
 get Next_Code
 If Codeword = Clear Code (CC)
  Clear LZW Table
	get FirstCode
Elseif CodeWord = EOI
   BREAK LOOP 
Else
     if Next_Code is NOT in the string table
		String_Buffer = translated First_code + 
    first byte of First_Code
	else
		String_Buffer = Translation of Next_Code
	add translated First_code + first byte of 
First_Code to the table
	First_Code = Next_Code
	display String_Buffer

  If Code_Used = COdesize ^2 -1  AND CodeSize > 12    
     CodeSize = Codesize +1
LOOP  
</pre>
Make sure to check for the CC(clear code) and EOI(end of image), and the MINUTE your last code used is the CodeSize ^2-1 (So if it was a CodeSize of 9, 511), then increase your CodeSize. The rest is the same as your standard LZW loading, so ill leave actually writing the whole thing an exercise to you, however, you may look at the sources that come with the tutorial, ported to a couple of languages so take a look at which ever one you prefer!
</p>

<b>4d.Advanced GIF topics</b>
<p>
Okay there are a few things of the GIF I have not covered yet:
First:
Interlaced GIFs, as promised, here is the info I was holding out: 

Interlaced GIFs are similar to normal GIFs, except they are designed to be able to display parts of the image before the image has been downloaded. They do that by encoding not top to bottom, but every 8th line, starting with line 0, then every 8th row, starting with row 4, then every 4th row starting with 2 and then finally, you draw every 2nd line, starting with line 1. Confused well, here is a quick drawing:
</p>
<pre>
Row Number          Drawn on pass
0			1
1			   4
2			  3
3			   4
4			 2
5			   4
6			  3
7			   4
8			1
9			   4
10			  3
11			   4
12			 2
13			   4
14			  3
15			   4
16			1
</pre>
This way, an image is gradually formed, rather then being drawn top to bottom, it made sense when 56k modems were common, but now it doesn't really have many benefits. Nothing else is different, the only difference is the way the pixels are drawn and compressed.

<br><b>GIF 89a Extensions</b><br>
GIF 89a adds many new features to the GIF format, some of which have already been discussed, and Ill briefly mention the names of the additions and how to read them
<ul>
<li>The GIF 89a additions begin with the symbol 0x21; this is found before an image descriptor. After the identifier, another identifier is used to determine which extension is used. The extensions are, with a brief summary:</li>

<li>Graphics Control Extension - used mainly for transparency, as well as having a few other flags. Extension identifier is 0xF9.</li>

<li>Comment Extension - adds user comments to an image, extension identifier is 0xFE.</li>

<li>Plain text extension - Used to draw the image in text. Really it抯 not terribly important, identifier is 0x01.</li>

<li>Application Extension - I'm not sure what use this has, identifier is 0xFF. (It doesn't help load the image so don't worry about it).</li>
</ul>
For more information on these extensions please consult the official GIF 89a documentation, it can be found in the references section.
</p>
<a name = "code"><b>Source Code</b></a>
<hr>

<b>5a. The Source Code contains 2 ports</b>
<p>
The C code is 100% C, and works in both MSVC and Mingw, and I'm positive will work in any ANSII c compatible compiler (if not tell me which one and ill see what I can do). The GIF Loading section requires Allegro, I used version 4 but older and newer versions (within reason) should be compatible (I didn't exactly push it to the limits). They were not tested under LINUX, however
GifAllegS is uses the same code base and it works under Linux, so this code should too, hopefully.<br><br>

The Java code was written for the JVM 1.4.2, but likewise I didn't do anything special, older/newer versions within reason should be compatible. Because Java has built in support for
Gifs, I did not port the GIF code over, but you are welcome to do so.<br><br>

Both ports were written for clarity, and I tried my best to write legible, clear code. The code is not optimized for speed and I wouldn't be surprised if the speed can be easily increased (You should have no trouble speeding things up). Global variables in C were avoided, in fact, none are used. Neither are static variables. Code is meant to be modified, feel free to do so, be sure to give credit, the code is freeware, but on the understanding that credit will be given where it is due. Be sure to thank some people from the reference section if you have room as well, I would never have been able to write this without them.<br>
<br>
I didn't do a C++ port, although I admit it would be really cool to use constructors and other stuff, but the Java code is close enough, and easily ported. And besides, the C code works well enough in C++. Though I won't hide the fact that I think the C++ version would come out really nice and be totally awesome to use, especially with the ability for vector tables and other stuff... the Java code is a port, and I didn抰 use any of its really neat features unfortunately.<br>
</p>
<b>5b. Notes on Source Code</b>
<p>
Okay, first off if you find a bug 
please report it to me, and better yet, if you know how to fix it send that too, it'll help greatly. Also you can drop by the http://starsdev.cjb.net/developer/ website and see if any new tutorials ever come up. There
you can also find my Allegro GIF library.<br><br>

GIF interlaced is not supported; neither are local colourmaps or animated GIFs. These are easy to write however, and check the references for any more information you may need. Consider it an exercise. If you look at the source code you'll notice that it loads the entire buffer chunk at once, which is faster then reading each byte, but does waste memory. You can read a byte at a time instead if you wanted to, try doing so as an exercise, you'll find it very simple to do!
(Although, most computers do have 256 MB of ram)<br><br>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产a视频精品免费观看| 色综合天天综合给合国产| 99久久久久久| 精品91自产拍在线观看一区| 一区二区国产盗摄色噜噜| 国产乱人伦偷精品视频不卡| 欧美丰满嫩嫩电影| 玉米视频成人免费看| 福利一区二区在线观看| 日韩精品一区在线| 国产盗摄一区二区| 日韩一区二区三区观看| 国产日韩欧美电影| 日韩不卡手机在线v区| 在线观看区一区二| 亚洲天堂中文字幕| 成人午夜又粗又硬又大| 欧美成人三级在线| 美女任你摸久久| 欧美一级电影网站| 奇米精品一区二区三区四区| 欧美日韩午夜在线| 偷偷要91色婷婷| 在线亚洲欧美专区二区| 亚洲伦理在线免费看| 成人sese在线| 3d动漫精品啪啪1区2区免费| 国产二区国产一区在线观看| 3atv一区二区三区| 五月婷婷另类国产| 欧美精品自拍偷拍动漫精品| 亚洲资源在线观看| 欧美性一级生活| 天天色综合成人网| 欧美一区二区在线观看| 免费的成人av| 精品国产在天天线2019| 99精品久久只有精品| 亚洲免费av网站| 91福利资源站| 偷窥国产亚洲免费视频| 欧美一级淫片007| 久草这里只有精品视频| 国产日韩欧美在线一区| 波多野结衣精品在线| 亚洲精品精品亚洲| 欧美乱妇15p| 日韩中文字幕不卡| 一本久久a久久精品亚洲| 国产精品乱人伦| 色av成人天堂桃色av| 亚洲精品精品亚洲| 欧美一卡二卡在线| 成人污视频在线观看| 《视频一区视频二区| 精品视频一区二区三区免费| 另类人妖一区二区av| 欧美国产欧美综合| 欧美亚洲一区三区| 国产一区二区三区在线观看免费| 欧美国产亚洲另类动漫| 欧美日本一区二区在线观看| 精品一区二区三区视频在线观看| 日本一区二区三区视频视频| 欧美伊人久久久久久久久影院| 精品一区二区三区影院在线午夜| 一区在线中文字幕| 欧美一区二区三区人| 欧美videos中文字幕| 国产麻豆成人精品| 亚洲美女屁股眼交3| 日韩欧美一级在线播放| 91在线播放网址| 久久66热re国产| 一卡二卡三卡日韩欧美| 久久久91精品国产一区二区精品| 91精彩视频在线| 国产福利视频一区二区三区| 亚洲电影中文字幕在线观看| 国产目拍亚洲精品99久久精品| 欧美日韩在线观看一区二区| 福利电影一区二区| 秋霞午夜av一区二区三区| 国产精品无遮挡| 久久亚洲综合色| 欧美精品在欧美一区二区少妇| 成人免费毛片片v| 久久国内精品自在自线400部| 亚洲制服丝袜av| 国产精品国产三级国产普通话三级 | 久久精品水蜜桃av综合天堂| 91美女片黄在线| 国产一区视频导航| 蜜桃精品视频在线观看| 亚洲成av人片一区二区三区| 亚洲欧美日韩在线不卡| 欧美国产一区二区| 久久久精品影视| 精品剧情在线观看| 欧美一区二区三区影视| 精品视频一区二区不卡| 91激情五月电影| 91麻豆高清视频| 91性感美女视频| 不卡一区二区三区四区| 国产不卡在线一区| 懂色av噜噜一区二区三区av| 国产乱码精品一区二区三区忘忧草 | 国产拍欧美日韩视频二区| 欧美日韩国产片| 在线看日韩精品电影| a亚洲天堂av| 97精品久久久久中文字幕| 99免费精品在线观看| 91在线观看地址| 色婷婷综合久久久中文字幕| 成人国产电影网| 99国产精品久| 91在线播放网址| 欧美性大战久久久久久久蜜臀 | 午夜精品福利一区二区三区蜜桃| 樱花影视一区二区| 亚洲成人动漫精品| 蜜桃久久久久久| 国产精品亚洲综合一区在线观看| 国产成人久久精品77777最新版本| 国产精品综合视频| 成人激情午夜影院| 国产精品成人一区二区三区夜夜夜| 99re这里都是精品| 色狠狠色噜噜噜综合网| 欧美私模裸体表演在线观看| 777色狠狠一区二区三区| 欧美成人r级一区二区三区| 久久久久久久精| 中日韩av电影| 亚洲福利国产精品| 国产综合久久久久影院| 99视频精品免费视频| 欧美疯狂性受xxxxx喷水图片| 精品日韩成人av| 国产精品国产自产拍高清av| 亚洲成人精品一区二区| 国产麻豆视频一区二区| 91在线码无精品| 日韩一区二区免费在线电影| 久久久久久久久蜜桃| 亚洲精品视频观看| 麻豆精品视频在线观看免费| 丁香婷婷综合网| 欧美精品久久天天躁| 日本一区二区视频在线| 婷婷一区二区三区| 波多野结衣一区二区三区| 91精品国产入口在线| 久久亚洲精品小早川怜子| 亚洲欧美综合色| 日韩成人av影视| 91麻豆123| 久久久久国产精品麻豆| 亚洲国产乱码最新视频| 成人理论电影网| 国产精品热久久久久夜色精品三区| 亚洲丝袜自拍清纯另类| 国产一区二区三区免费| 欧美美女直播网站| 中文字幕精品一区| 精品影视av免费| 欧美日精品一区视频| 国产精品美女久久久久aⅴ国产馆| 午夜av区久久| 色先锋久久av资源部| 久久精品视频免费| 久久99久久久欧美国产| 欧美三级一区二区| 亚洲视频在线观看一区| 丰满少妇在线播放bd日韩电影| 日韩免费一区二区| 天堂成人国产精品一区| 色综合久久久久综合99| 国产日韩欧美在线一区| 久久精品国产网站| 欧美一级日韩一级| 婷婷久久综合九色综合伊人色| 色综合久久久久综合99| 综合激情网...| 99免费精品视频| 亚洲欧洲99久久| av电影天堂一区二区在线观看| 久久人人97超碰com| 国产一区在线不卡| 欧美精品一区二区蜜臀亚洲| 麻豆国产一区二区| 日韩欧美在线123| 麻豆国产欧美日韩综合精品二区| 在线综合视频播放| 日本欧美肥老太交大片| 欧美一级免费大片| 蜜桃精品视频在线| 久久亚洲欧美国产精品乐播|