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

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

?? lzh.pas

?? themeengine6源碼
?? PAS
?? 第 1 頁 / 共 2 頁
字號:
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is: cDIB.PAS, released August 28, 2000.

The Initial Developer of the Original Code is Peter Morris (pete@stuckindoors.com),
Portions created by Peter Morris are Copyright (C) 2000 Peter Morris.
All Rights Reserved.

Purpose of file:
This is the main drawing engine.

Contributor(s):
None as yet


Last Modified: March 18, 2001
Current Version: 1.8

-----------------------------------------------------------------------------}

unit Lzh;

{$R-}

interface

uses Sysutils, Classes;

const
  //LZss parameters
  cStringBufferSize = 4096; //Size of string buffer
  cLookAheadSize = 60; //Size of look-ahead buffer
  cThreshHold = 2;
  cNull = cStringBufferSize; //End of the tree's node


  //Huffman parameters
  cNumChars = 256 - cThreshHold + cLookAheadSize;
  cTableSize  = (cNumChars * 2) - 1;  //Size of table
  cRootPos =	cTableSize - 1; //Root position
  cMaximumFreq = $8000; //Update when cummulative Freq hits this value

  //Tables FOR encoding/decoding upper 6 bits of sliding dictionary pointer
  //Encoder table
  cEncTableLen: array[0..63] of byte = ($03, $04, $04, $04, $05, $05, $05, $05,
    $05, $05, $05, $05, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06,
    $06, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07,
    $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $08, $08, $08, $08, $08,
    $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08);

  cEncTableCode: array [0..63] of byte = ($00, $20, $30, $40, $50, $58, $60,
    $68, $70, $78, $80, $88, $90, $94, $98, $9C, $A0, $A4, $A8, $AC, $B0, $B4,
    $B8, $BC, $C0, $C2, $C4, $C6, $C8, $CA, $CC, $CE, $D0, $D2, $D4, $D6, $D8,
    $DA, $DC, $DE, $E0, $E2, $E4, $E6, $E8, $EA, $EC, $EE, $F0, $F1, $F2, $F3,
    $F4, $F5, $F6, $F7, $F8, $F9, $FA, $FB, $FC, $FD, $FE, $FF);

  //Decoder table
  cDecTableLen: array[0..255] of byte = ($03, $03, $03, $03, $03, $03, $03, $03,
    $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03,
    $03, $03, $03, $03, $03, $03, $03, $03, $03, $04, $04, $04, $04, $04, $04,
    $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04,
    $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04,
    $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $05, $05, $05,
    $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05,
    $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05,
    $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05,
    $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05,
    $05, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06,
    $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06,
    $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06, $06,
    $06, $06, $06, $06, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07,
    $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07,
    $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07, $07,
    $07, $07, $07, $07, $07, $07, $07, $08, $08, $08, $08, $08, $08, $08, $08,
	  $08, $08, $08, $08, $08, $08, $08, $08);

  cDecTableCode: array [0..255] of byte = ($00, $00, $00, $00, $00, $00, $00,
    $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
    $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $01, $01, $01,
    $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $02, $02, $02, $02,
    $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $03, $03, $03,
    $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $04, $04,
    $04, $04, $04, $04, $04, $04, $05, $05, $05, $05, $05, $05, $05, $05, $06,
    $06, $06, $06, $06, $06, $06, $06, $07, $07, $07, $07, $07, $07, $07, $07,
    $08, $08, $08, $08, $08, $08, $08, $08, $09, $09, $09, $09, $09, $09, $09,
    $09, $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0A, $0B, $0B, $0B, $0B, $0B, $0B,
    $0B, $0B, $0C, $0C, $0C, $0C, $0D, $0D, $0D, $0D, $0E, $0E, $0E, $0E, $0F,
    $0F, $0F, $0F, $10, $10, $10, $10, $11, $11, $11, $11, $12, $12, $12, $12,
    $13, $13, $13, $13, $14, $14, $14, $14, $15, $15, $15, $15, $16, $16, $16,
    $16, $17, $17, $17, $17, $18, $18, $19, $19, $1A, $1A, $1B, $1B, $1C, $1C,
    $1D, $1D, $1E, $1E, $1F, $1F, $20, $20, $21, $21, $22, $22, $23, $23, $24,
    $24, $25, $25, $26, $26, $27, $27, $28, $28, $29, $29, $2A, $2A, $2B, $2B,
    $2C, $2C, $2D, $2D, $2E, $2E, $2F, $2F, $30, $31, $32, $33, $34, $35, $36,
    $37, $38, $39, $3A, $3B, $3C, $3D, $3E, $3F);


type
  TLZHAction = (acCompress, acDecompress);
  ElzhException = Class(Exception);

  //====================
  PFrequency = ^TFrequency;
  TFrequency = array [0..cTableSize] of word;

  PParent = ^TParent;
  TParent = array [0..pred(cTableSize + cNumChars)] of SmallInt;

  PChild = ^TChild;
  TChild = array [0..PRED(cTableSize)] of SmallInt;

  PTextBuffer = ^TTextBuffer;
  TTextBuffer = array [0..cStringBufferSize + cLookAheadSize - 2] of byte;

  PLinkArray = ^TLinkArray;
  TLinkArray = array [0..cStringBufferSize] of SmallInt;

  PLinkBackArray = ^TLinkBackArray;
  TLinkBackArray = array [0..cStringBufferSize + 256] of SmallInt;

  TLZHStream = class
  private
    { Private declarations }
    FAction: TLZHAction;

    Code,
    Len,
    PutBuf,
    GetBuf: Word;

    GetLen,
    PutLen: Byte;

    FUncompressedSize,
    FBytesWritten,
    FBytesRead,
    OrigSize,
    CodeSize,
    PrintCount: Longint;

    MatchPos,
    MatchLen: SmallInt;


    TextBuff: PTextBuffer;

    LeftLeaf,
    ParentLeaf: PLinkArray;
    RightLeaf: PLinkBackArray;
    
    Freq: PFrequency;

    Parent: PParent;
    Child: PChild;

    FSource,
    FDest                     : TStream;
    //Initialize the tree
    procedure InitTree;

    //Insert a new node
    procedure InsertNode(r : SmallInt);

    //Delete a node from the tree
    procedure DeleteNode(p: SmallInt);

    //Get a bit from the stream
    function GetBit: SmallInt;

    //Get a byte from the stream
    function GetByte: SmallInt;

    //Update a char
    procedure update(c : SmallInt);

    //Start huffman encoding
    procedure StartHuff;

    //Output some results
    procedure Putcode(l : SmallInt; c: WORD);

    //Reconstruct frequency tree
    procedure Reconstruct;

    //Encode a character
    procedure EncodeChar(c: WORD);

    //Encode a string position in the tree
    procedure EncodePosition(c : WORD);

    //Output "endcode end" flag
    procedure EncodeEnd;

    //Decode a character
    function DecodeChar: SmallInt;

    //Decode a string from the tree
    function DecodePosition: Word;

    //Start LZH
    procedure InitLZH;

    //End LZH
    procedure EndLZH;
  protected
    procedure InternalRead(var Data; Size : Word; var BytesRead: Word);
    procedure InternalWrite(const Data; Size : Word; var BytesWritten: Word);
    procedure ReadData(var Data; Size : Word; var BytesRead: Word);
    procedure WriteData(const Data; Size : Word; var BytesWritten: Word);
  public
    constructor Create(Source, Dest : TStream);
    function Pack(OrigSize: Longint): Longint;
    procedure Unpack;
  end;

implementation {===============================================================}

procedure TLZHStream.InitTree;
var
  I: SmallInt;
begin
  for I := cStringBufferSize + 1 to cStringBufferSize + 256 do
    RightLeaf[i] := cNull;  // ROOT !!

  for I := 0 TO cStringBufferSize do
    ParentLeaf[i] := cNull; //NODE
end;

Procedure TLZHStream.InsertNode(r : SmallInt);
var
  tmp,i, p, cmp : SmallInt;
  key : PTextBuffer;
  c : WORD;
begin
  cmp := 1;
  key := @TextBuff[r];
  p := SUCC(cStringBufferSize) + key[0];
  RightLeaf[r] := cNull;
  LeftLeaf[r] := cNull;
  MatchLen := 0;
  while MatchLen < cLookAheadSize do begin
    if (cmp >= 0) then begin
	    if (RightLeaf[p] <> cNull) then
        p := RightLeaf[p]
      else begin
	      RightLeaf[p] := r;
		    ParentLeaf[r] := p;
		    exit;
      end;
    end else begin
      if (LeftLeaf[p] <> cNull) then
	       p := LeftLeaf[p]
      else begin
        LeftLeaf[p] := r;
		    ParentLeaf[r] := p;
		    exit;
      end;
    end;

    i := 0;
    cmp := 0;
	  while (i < cLookAheadSize) and (cmp = 0) do begin
      inc(i);
      cmp := key[i] - TextBuff[p + i];
    end;

    if (i > cThreshHold) then begin
      tmp := PRED((r - p) and PRED(cStringBufferSize));
	    if (i > MatchLen) then begin
        MatchPos := tmp;
        MatchLen := i;
      end;

	    if (MatchLen < cLookAheadSize) and (i = MatchLen) then begin
        c := tmp;
		    if (c < MatchPos) then begin
          MatchPos := c;
        end;
      end;
    end; { if i > threshold }
  end; { WHILE match_length < F }

  ParentLeaf[r] := ParentLeaf[p];
  LeftLeaf[r] := LeftLeaf[p];
  RightLeaf[r] := RightLeaf[p];
  ParentLeaf[LeftLeaf[p]] := r;
  ParentLeaf[RightLeaf[p]] := r;
  if (RightLeaf[ParentLeaf[p]] = p) then
    RightLeaf[ParentLeaf[p]] := r
  else
    LeftLeaf[ParentLeaf[p]] := r;

  ParentLeaf[p] := cNull;  { remove p }
end;

procedure TLZHStream.DeleteNode(p: SmallInt);
var
  q : SmallInt;
begin
  if (ParentLeaf[p] = cNull) then exit; //Unregistered node

  if RightLeaf[p] = cNull then
   q := LeftLeaf[p]
  else begin
    if (LeftLeaf[p] = cNull) then
      q := RightLeaf[p]
    else begin
      q := LeftLeaf[p];
      if (RightLeaf[q] <> cNull) then begin
        repeat
          q := RightLeaf[q];
        until (RightLeaf[q] = cNull);

        RightLeaf[ParentLeaf[q]] := LeftLeaf[q];
        ParentLeaf[LeftLeaf[q]] := ParentLeaf[q];
        LeftLeaf[q] := LeftLeaf[p];
        ParentLeaf[LeftLeaf[p]] := q;
      end;

      RightLeaf[q] := RightLeaf[p];
      ParentLeaf[RightLeaf[p]] := q;
    end;
  end;
  ParentLeaf[q] := ParentLeaf[p];

  if (RightLeaf[ParentLeaf[p]] = p) then
    RightLeaf[ParentLeaf[p]] := q
  else
    LeftLeaf[ParentLeaf[p]] := q;

  ParentLeaf[p] := cNull;
end;


{ Huffman coding parameters }
function TLZHStream.GetBit: SmallInt;
var
  i: BYTE;
  i2: SmallInt;
  Wresult: Word;
begin
  while (getlen <= 8) do begin
    InternalRead(i,1,Wresult);
    if Wresult = 1 then
      i2 := i
    else
      i2 := 0;

    getbuf := getbuf OR (i2 SHL (8 - getlen));
    inc(getlen,8);
  end;

  i2 := getbuf;
  getbuf := getbuf SHL 1;
  dec(getlen);
  getbit := SmallInt((i2 < 0));
end;

function TLZHStream.GetByte: SmallInt;
var
  j: BYTE;
  i,Wresult: WORD;
begin
  while (getlen <= 8) do begin
    InternalRead(j,1,Wresult);
    if Wresult = 1 then
      i := j
    else
      i := 0;

    getbuf := getbuf OR (i SHL (8 - getlen));
    inc(getlen,8);
  end;

  i := getbuf;
  getbuf := getbuf SHL 8;
  dec(getlen,8);
  getbyte := SmallInt(i SHR 8);
end;

procedure TLZHStream.Putcode(l : SmallInt; c: WORD);
var
  Temp: byte;
  Got: Word;
begin
  putbuf := putbuf OR (c SHR putlen);
  inc(putlen,l);

  if (putlen >= 8) then begin
    Temp := putbuf SHR 8;
    InternalWrite(Temp,1,Got);
    dec(putlen,8);
    if (putlen  >= 8) then begin
      Temp := Lo(PutBuf);
      InternalWrite(Temp,1,Got);
      inc(codesize,2);
      dec(putlen,8);
      putbuf := c SHL (l - putlen);
    end else begin
	    putbuf := putbuf SHL 8;
	    inc(codesize);
    end;
  end;
end;

procedure TLZHStream.StartHuff;
var

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美久久久久中文字幕| 亚洲精品国产一区二区精华液| 91成人免费在线视频| 欧美无人高清视频在线观看| 91麻豆国产香蕉久久精品| 色一区在线观看| 欧美电影影音先锋| 久久九九全国免费| 亚洲人成电影网站色mp4| 亚洲电影激情视频网站| 丝袜国产日韩另类美女| 国内精品不卡在线| 色综合久久66| 精品国产欧美一区二区| 一区二区三区在线观看网站| 偷窥少妇高潮呻吟av久久免费| 久草中文综合在线| 色嗨嗨av一区二区三区| 精品日韩欧美在线| 亚洲综合色区另类av| 从欧美一区二区三区| 欧美老女人第四色| 亚洲乱码国产乱码精品精可以看| 免费成人av在线| 日本福利一区二区| 中文成人av在线| 国产一区二区三区在线观看免费视频 | 欧美国产欧美综合| 六月丁香婷婷久久| 欧美亚洲动漫精品| 中文在线一区二区| 精东粉嫩av免费一区二区三区| 色婷婷国产精品久久包臀| 国产亚洲一本大道中文在线| 日韩高清欧美激情| 91麻豆精品国产91久久久资源速度| 国产精品久久久久影院色老大| 韩国欧美国产1区| 日韩欧美中文字幕公布| 日本午夜精品视频在线观看| 欧美午夜不卡视频| 日韩成人免费在线| 欧美另类久久久品| 精品一区二区综合| 久久久99免费| 91网站视频在线观看| 亚洲精品亚洲人成人网| 欧洲中文字幕精品| 五月天亚洲婷婷| 久久久精品综合| av亚洲精华国产精华| 亚洲国产精品久久久久秋霞影院| 在线观看亚洲精品| 秋霞成人午夜伦在线观看| wwwwww.欧美系列| va亚洲va日韩不卡在线观看| 亚洲午夜电影在线观看| 日韩亚洲欧美一区| 99国产麻豆精品| 美国三级日本三级久久99| 中文欧美字幕免费| 欧美精品一级二级| av电影一区二区| 日本va欧美va瓶| 亚洲另类在线视频| 久久久精品国产99久久精品芒果| 99久久国产综合色|国产精品| 中文字幕人成不卡一区| 欧美高清视频在线高清观看mv色露露十八 | 色欧美日韩亚洲| 午夜精品久久久久久久久久久| 日韩免费高清av| 久久99九九99精品| 日韩毛片视频在线看| 日韩亚洲欧美成人一区| 91小视频在线| 国产一区二区三区香蕉 | 综合久久一区二区三区| 欧美一级欧美一级在线播放| 粉嫩嫩av羞羞动漫久久久| 国产精品三级久久久久三级| 91精品国产综合久久小美女| 成人免费视频免费观看| 三级久久三级久久| 亚洲黄网站在线观看| 久久久久久久久岛国免费| 91精品国产美女浴室洗澡无遮挡| 久久99国产精品免费| 亚洲国产成人tv| 亚洲成人精品一区| 亚洲精品国产无天堂网2021| 国产色产综合产在线视频 | 中文字幕欧美日本乱码一线二线 | 成人免费毛片aaaaa**| 精品在线观看视频| 久久99精品久久久久久| 久久精品噜噜噜成人88aⅴ| 日韩avvvv在线播放| 一区二区三区中文字幕电影| 亚洲美女免费在线| 一级日本不卡的影视| 午夜成人在线视频| 日韩av不卡一区二区| 黄色日韩网站视频| 99精品偷自拍| 在线国产电影不卡| 91精品国产入口| 国产精品久久久久影视| 亚洲免费在线观看视频| 午夜视频在线观看一区二区三区| 日韩精彩视频在线观看| 国产麻豆日韩欧美久久| 国产在线观看一区二区| 色噜噜狠狠色综合中国| 精品免费99久久| 亚洲美女一区二区三区| 伦理电影国产精品| 精品一区二区三区香蕉蜜桃| a亚洲天堂av| 精品免费视频一区二区| 亚洲情趣在线观看| 黄色日韩网站视频| 欧美日韩国产bt| 一区二区三区欧美久久| 国产裸体歌舞团一区二区| 欧美日韩在线观看一区二区| 精品女同一区二区| 青青草国产精品亚洲专区无| 久久超级碰视频| 欧美一区二区三区免费视频| 最新不卡av在线| 粉嫩av一区二区三区在线播放| 欧美丝袜自拍制服另类| 一区二区在线免费| 国产中文一区二区三区| 日韩精品一区二区三区在线播放| 亚洲在线视频网站| 一本到不卡免费一区二区| 国产精品久久99| 久久精品国产一区二区三| 精品999久久久| 视频一区在线视频| 成人午夜视频在线| 粉嫩蜜臀av国产精品网站| 成人动漫中文字幕| 高清成人在线观看| 欧美系列亚洲系列| 99国产精品久久| 精品国产百合女同互慰| 美国三级日本三级久久99| 精品国产一区二区三区忘忧草| 全国精品久久少妇| 久久久久久久av麻豆果冻| 丰满放荡岳乱妇91ww| 国产精品狼人久久影院观看方式| 久久99国内精品| 亚洲欧洲色图综合| 国产剧情一区二区| 欧美国产日韩亚洲一区| 色综合一区二区三区| 日韩电影在线观看网站| 欧美一级日韩免费不卡| 最新高清无码专区| 99国产精品久久久久久久久久久| 亚洲免费高清视频在线| 精品久久国产字幕高潮| 99久久国产免费看| 日韩专区中文字幕一区二区| 国产性色一区二区| 色先锋资源久久综合| 日本中文一区二区三区| 国产精品久久久久久久浪潮网站| 91丨国产丨九色丨pron| 国产在线精品不卡| 日韩电影一区二区三区四区| 久久精品欧美日韩| 91麻豆精品国产91| 色88888久久久久久影院按摩 | 欧美在线观看18| 懂色av一区二区三区蜜臀| 亚洲成人福利片| 亚洲一区二区精品3399| 欧美色精品在线视频| 91色|porny| 色婷婷一区二区三区四区| 福利一区福利二区| 成人毛片老司机大片| 丝袜美腿亚洲色图| 日韩黄色小视频| 国产精品看片你懂得| 日韩视频在线一区二区| 日韩一区二区三区观看| 色综合 综合色| 99久久久国产精品免费蜜臀| 99久久婷婷国产| 日韩精品乱码免费| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 精品国产污网站| 最新久久zyz资源站| 亚洲人成7777|