JP3603099B2 - Method and apparatus for lossless encoding of data - Google Patents

Method and apparatus for lossless encoding of data Download PDF

Info

Publication number
JP3603099B2
JP3603099B2 JP08395794A JP8395794A JP3603099B2 JP 3603099 B2 JP3603099 B2 JP 3603099B2 JP 08395794 A JP08395794 A JP 08395794A JP 8395794 A JP8395794 A JP 8395794A JP 3603099 B2 JP3603099 B2 JP 3603099B2
Authority
JP
Japan
Prior art keywords
encoding
data
byte
bytes
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP08395794A
Other languages
Japanese (ja)
Other versions
JPH07271552A (en
Inventor
稔明 岡山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP08395794A priority Critical patent/JP3603099B2/en
Publication of JPH07271552A publication Critical patent/JPH07271552A/en
Application granted granted Critical
Publication of JP3603099B2 publication Critical patent/JP3603099B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Description

【0001】
【産業上の利用分野】
この発明は、データを可逆符号化する方法および装置に関する。
【0002】
【従来の技術】
近年では、コンピュータにおいて処理されるデータ量の急激な増大に対応するためにデータ圧縮技術が広く用いられるようになってきている。データ圧縮技術には、圧縮前のデータが元通りに復元される可逆符号化と、元通りに復元されない非可逆符号化とがある。非可逆符号化は、主として画像データの圧縮に用いられている。一方、可逆符号化は、プログラムデータ、テキストデータ、辞書データなどの種々のデータの圧縮に用いられている。
【0003】
可逆符号化の対象となるデータの一種類としてフォントデータがある。フォントデータは、1セットのフォントに含まれる文字の形状を表わすデータである。近年では、パーソナルコンピュータに数種類のフォントデータがロードされ、ユーザが所望のフォントを選択して使用できるようになっている場合が多い。
【0004】
【発明が解決しようとする課題】
ところが、フォントデータに対してテキストデータやプログラムデータと同じ可逆符号化方法で圧縮を行なうと、圧縮率があまり高くならない場合があった。これは、フォントデータがテキストデータやプログラムデータとは異なる特有のデータ配列を有しているためであると考えられる。
【0005】
この発明は、従来技術における上述の課題を解決するためになされたものであり、フォントデータを効率的に圧縮することのできる可逆符号化方法および装置を提供することを目的とする。
【0006】
【課題を解決するための手段および作用】
上述の課題を解決するため、この発明の請求項1に記載されたデータの可逆符号化方法は、(A)入力データの連続した2バイトを調べ、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの符号化条件を満足するか否かを判定する工程と、(B)前記符号化条件を満足する場合には前記2バイトを所定の符号化モードで符号化する工程と、を備えることを特徴とする。
【0007】
フォントデータでは、2バイトの後端バイトとその2バイトの直前の1バイトとが互いに等しく、かつ、その2バイトの先頭バイトが所定の値以下である場合が多い。そこで、このような符号化条件を満足する場合に、フォントデータに適した所定の符号化モードで符号化することによって、フォントデータを効率的に圧縮することができる。
【0008】
請求項2に記載されたデータの可逆符号化方法では、前記工程(B)は、(C)前記2バイトを16ビット未満の符号語で符号化する工程、を含む。
【0009】
こうすれば、圧縮率を1以上にすることができる。
【0010】
請求項3に記載されたデータの可逆符号化方法では、前記工程(C)は、前記所定の符号化モードで符号化されたことを示す8ビット以下の接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する工程、を含む。
【0011】
こうすれば、15ビット以下で2バイトを符号化することができる。
【0012】
請求項4に記載されたデータの可逆符号化方法は、(A)入力データの連続した2バイトが、所定の第1の符号化モードで符号化するための第1の符号化条件を満足するか否かを判定する工程と、(B)前記第1の符号化条件が成立しない場合には、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの第2の符号化条件を満足するか否かを判定する工程と、(C)前記第1の判定条件が成立する場合には少なくとも前記2バイトを圧縮率が最も高い前記第1の符号化モードで符号化し、前記第2の符号化条件が成立する場合には前記2バイトを圧縮率が中程度の第2の符号化モードで符号化し、前記第1と第2の符号化条件がいずれも成立しない場合には少なくとも前記先頭バイトを圧縮率が最も低い第3の符号化モードで符号化する工程とを備えることを特徴とする。
【0013】
符号化条件で符号化モードを選択するようにすれば、2バイトのデータの内容に応じた適切な符号化モードを選択することができる。特にその2バイトがフォントデータに特有の第2の符号化条件を満足する場合には、フォントデータに適した第2の符号化モードで符号化することによって、フォントデータを効率的に圧縮することができる。
【0014】
請求項7に記載したデータの可逆符号化方法では、前記第1の符号化モードによる符号化工程は、少なくとも前記2バイトを含む第1のバイト列と一致する最長の第2のバイト列を前記入力データ内で探索する工程と、前記第1の符号化モードで符号化されたことを示す第1の符号語と、前記第1と第2のバイト列相互の距離を示す第2の符号語と、前記第1のバイト列の長さを示す第3の符号語とを組み合わせることによって符号化データを作成する工程と、を含む。
【0015】
第1の符号化モードでは、一致する最長バイト列を符号化するので、圧縮率を高くすることができる。
【0016】
請求項8に記載のデータの可逆符号化方法では、前記第3の符号化モードは、前記第3の符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程、を含み、前記第3の符号化モードにおける前記接頭語は、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択される。
【0017】
前記第3の符号化モードでは、2バイト中の先頭バイトの16進数表記が7F以下の場合に8ビットで符号化するので、圧縮率が過度に低くならない。
【0018】
請求項9に記載されたデータの可逆符号化方法は、入力データ中において、16進数表記が7F以下である第1のタイプのバイトデータの出現率が所定の条件を満足するか否かを判定し、前記第1のタイプのバイトデータの出現率が所定の条件を満足する場合には、(A)前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する工程と、(B)前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する工程と、を実行することを特徴とする。
【0019】
16進数表記が7F以下のバイトデータの出現率が所定の条件を満たす場合に工程(A),(B)を含む符号化を実行するようにすれば、7F以下のバイトデータを符号化する場合の圧縮率が過度に低くならないように符号語を設定することが可能である。
【0020】
請求項10に記載されたデータの可逆符号化方法では、前記工程(B)は、圧縮率が1以下の前記符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程と、を含み、前記接頭語は、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択される。
【0021】
7F以下のバイトデータは8ビットで符号化できるので、符号化時の圧縮率が過度に低くなることがない。
【0022】
請求項11に記載されたデータの可逆符号化装置は、入力データの連続した2バイトを調べ、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの符号化条件を満足するか否かを判定する判定手段と、前記符号化条件を満足する場合には前記2バイトを所定の符号化モードで符号化する符号化手段と、を備えることを特徴とする。
【0023】
また、請求項14に記載されたデータの可逆符号化装置は、入力データの連続した2バイトが、所定の第1の符号化モードで符号化するための第1の符号化条件を満足するか否かを判定する第1の判定手段と、前記第1の符号化条件が成立しない場合には、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの第2の符号化条件を満足するか否かを判定する第2の手段と、前記第1の判定条件が成立する場合には少なくとも前記2バイトを前記第1の符号化モードで符号化し、前記第2の符号化条件が成立する場合には前記2バイトを第2の符号化モードで符号化し、前記第1と第2の符号化条件がいずれも成立しない場合には少なくとも前記先頭バイトを第3の符号化モードで符号化する符号化手段と、を備えることを特徴とする。
【0024】
請求項19に記載されたデータの可逆符号化装置は、入力データ中において、16進数表記が7F以下である第1のタイプのバイトデータの出現率が所定の条件を満足するか否かを判定する判定手段と、前記第1のタイプのバイトデータの出現率が所定の条件を満足する場合において符号化を行なう符号化手段であって、前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する第1の手段と、前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する第2の手段と、を含む符号化手段と、を備えることを特徴とする。
【0025】
請求項21に記載したデータの可逆符号化方法は、入力データ中において、連続した3バイトの両端のバイトデータが互いに一致する割合が所定の条件を満足するか否かを調べ、前記一致する割合が所定の条件を満足する場合には、(A)前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する工程と、(B)前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する工程と、を実行することを特徴とする。
【0026】
フォントデータでは、3バイトの両端のバイトデータが一致する割合が高いので、この一致割合が所定の条件を満たす場合に工程(A),(B)を含む符号化を実行するようにすれば、フォントデータに適した符号化を行なうことが可能である。
【0027】
請求項22に記載した方法では、前記工程(B)は、圧縮率が1以下の前記符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程と、を含み、前記入力データにおいて16進数表記が7F以下である第1のバイトデータ群の出現率と16進数表記が80以上である第2のバイトデータ群の出現率とを比較し、比較的出現率の高いバイトデータ群の各バイトデータの符号化においては1ビットの第1の接頭語を使用するとともに、比較的出現率の低いバイトデータ群の各バイトデータの符号化においては複数ビットの第2の接頭語を使用する。
【0028】
7F以下のバイトデータ群と80以上のバイトデータ群のうちで、比較的出現率の高いバイトデータ群の各バイトデータが8ビットで符号化できるので、符号化時の圧縮率が過度に低くなることがない。
【0029】
【実施例】
A.装置の構成:
図1は、この発明の一実施例を適用する情報処理装置のハードウェア構成を示すブロック図である。この情報処理装置は、パーソナルコンピュータシステムとして構成されたものであり、図示するように、CPU101を中心にバスにより相互に接続された次の各部を備えている。
【0030】
ROM104:モニタプログラム等を記憶する読み出し専用メモリ
RAM105:主記憶を構成する読み出し・書き込み可能なメモリ
PIC112:各種の割込に優先順位を付けて制御する割込コントローラ
マウスインタフェース115:2ボタンマウス114とのデータ等のやり取りを司るインタフェース
キーボードインタフェース118:キーボード117からのキー入力を司るインタフェース
FDC121:フレキシブルディスクドライブ(FDD)120を制御するフレキシブルディスクコントローラ
HDC125:ハードディスクドライブ(HDD)124を制御するハードディスクコントローラ
CRTC129:必要なデータ等を表示するCRT128への信号出力を制御するCRTコントローラ
プリンタインタフェース131:プリンタ130へのデータの出力を制御するインタフェース。
【0031】
図2は、可逆符号化によるデータの圧縮と伸長とを行なう圧縮伸長用デバイスドライバ200の構成を示す機能ブロック図である。この圧縮伸長用デバイスドライバ200は、RAM105に格納されたプログラムをCPU101が実行することによって実現されている。
【0032】
圧縮伸長用デバイスドライバ200は、圧縮対象となる1クラスタ分のデータを記憶するクラスタバッファ202と、可逆符号化によるデータの圧縮を行なう圧縮部204と、圧縮データを記憶する圧縮データバッファ206と、圧縮データをハードディスク123に書き込む書込制御部208とを備えている。なお、1クラスタは所定のデータサイズであり、例えば8Kバイトである。
【0033】
圧縮部204は、後述する符号化タイプを判定する符号化タイプ判定部210と、LZ(Lempel−Ziv)方式の符号化を行なうLZ符号化部212と、フォントタイプの符号化を行なうフォント符号化部214と、無圧縮タイプの符号化を行なう無圧縮符号化部216とを備えている。以下ではまず、LZ符号化部212とフォント符号化部214と無圧縮符号化部216によって行なわれる3つのタイプの符号化について説明する。なお、この実施例においては、「符号化タイプ」と「符号化モード」は同じ意味である。
【0034】
図3は、LZタイプの符号化方法を示す説明図である。この実施例で使用するLZタイプの符号化はレンペル−ジフ(Lempel−Ziv)方式の符号化であり、特にスライド辞書法と呼ばれる符号化方法を使用している。図3(A)に示す例では、被圧縮データがバイト列「71h 3Ah 3Bh …」を含んでいる。なお、この明細書において、付加記号「 h」は16進数表記であることを示している。
【0035】
LZタイプの符号化は、2バイト以上の連続したバイト列と同じバイト列が以前に出現しているか否かを調べ、以前に同じバイト列があれば、一致する最長のバイト列を調べる。そして、現在のバイト列から以前のバイト列までの距離(オフセット)と、一致した最長のバイト列のバイト数(一致長)とによって、現在のバイト列を符号化する。例えば図3(A)の例では、実線の下線を付した2バイトのバイト列「3Ah 3Bh 」が、破線の下線を付した2バイトのバイト列と同じである。そこで、実線の下線を付した2バイトのバイト列「3Ah 3Bh 」の圧縮データは、LZタイプの符号化データであることを示す接頭語と、一致したバイト列同士の距離を表わす符号語OFFSET(3)と、一致長を表わす符号語LENGTH(2)と、の3つの符号語の組み合わせによって表わされる。なお、OFFSET(3)の括弧内の数値は距離を示すバイト数であり、LENGTH(2)の括弧内の数値は一致長を示すバイト数である。各符号化タイプの圧縮データのフォーマットについては後述する。
【0036】
図3(B)の例では、オフセットが3バイトで一致長が3バイトなので、接頭語と、符号語OFFSET(3)と、符号語LENGTH(3)の組み合わせによって実線の下線を付した3バイトのバイト列が符号化される。
【0037】
図3(C)の例では、第2バイト以降の5バイトが同一である。この場合には、実線の下線を付した第3バイト以降の4バイトが、第2バイト以降の4バイトと一致することになる。従って、オフセットは1バイト、一致長は4バイトとなる。
【0038】
以上のように、LZタイプの符号化方法では、一致するバイト列が以前に存在している場合に、一致する最長のバイト列を符号化することによってデータを圧縮するので、同一のバイト列が繰り返し出現するようなデータを圧縮する場合に適している。
【0039】
図4は、フォントタイプの符号化方法を示す説明図である。フォントデータでは、連続した3バイトの両端が互いに等しく、かつ、中央バイトが80h 未満(すなわち7F以下)である場合が多いという特徴がある。この特徴は、特にトゥルータイプ(TrueType)フォント(TrueTypeはアップルコンピュータ社の商標)において顕著である。
【0040】
図4において、先頭の1バイト「71h 」と下線を付した2バイト「3Ah 71h 」は、上述の特徴を有しているので、下線が付されている2バイトがフォントタイプの符号化によって圧縮される。フォントタイプの符号化の対象となる2バイト「3Ah 71h 」の直前の1バイト「71h 」は、無圧縮タイプの符号化で符号化されていても良く、また、LZタイプの符号化によって符号化されていても良い。
【0041】
フォントタイプの圧縮データは、フォントタイプであることを示す接頭語と、符号化の対象となる2バイト中の先頭バイト「3Ah 」の下位7ビットとで構成される。なお、「3Ah 」の下位7ビットのみを使用すれば良い理由は、フォントタイプの符号化が行なわれる場合に先頭バイトの16進数表記が80h 未満であることが条件とされるので、先頭バイトの最上位ビット(MSB)は常に0だからである。なお、フォントタイプであることを示す接頭語が付されている場合には、その直前に存在する1バイトと、フォントタイプで符号化された2バイト中の後端バイトが同一であることが解るので、後端バイトを示す情報は不要である。
【0042】
この実施例におけるLZタイプの符号化では、2バイト以上の連続したバイト列が以前のバイト列と同一である場合に符号化される。また、フォントタイプの符号化でも、連続した2バイトが上記の所定の特徴を満足する場合に符号化される。従って、どの符号化タイプで符号化するかを判定する場合には、連続した2バイトを調べて3つの符号化タイプの1つを選択すればよい。
【0043】
図5は、この実施例で用いられる各符号化タイプの圧縮データのフォーマットを示す説明図である。無圧縮タイプの符号化による圧縮データには、タイプ1(図5(A))とタイプ2(図5(B))が存在する。無圧縮タイプ1は、圧縮前の最上位ビット(MSB)が0であるバイトデータ(00h 〜7Fh )の圧縮データである。また、無圧縮タイプ2は、圧縮前の最上位ビット(MSB)が1であるバイトデータ(80h 〜FFh )の圧縮データである。図5(A),(B)に示すように、圧縮前のバイトデータの最上位ビットの値によって無圧縮タイプの圧縮データの接頭語を変えているので、接頭語の後ろに付加するデータは、圧縮前のデータの下位7ビットのみでよい。なお、無圧縮タイプ1の圧縮データでは、接頭語を含めた8ビットで圧縮前の1バイトが符号化されている。従って、無圧縮タイプ1の圧縮率は1.0である。無圧縮タイプ2の接頭語は4ビットなので、その圧縮率は約0.7である。
【0044】
通常の符号化方法において、1バイトのデータを無圧縮で符号化した符号化データは、無圧縮を示す1ビット以上の接頭語と、元の8ビットとによって構成されている。従って、その符号化データは9ビット以上のビット数を有しており、圧縮率は1未満である。これに対して上述の無圧縮タイプ1の符号化では、圧縮率が1.0なので、圧縮率は通常の無圧縮の符号化データよりも高い。従って、80h 未満のバイトがある程度以上に含まれているデータに対してこの実施例の符号化方法を適用すれば、通常の符号化方法に比べて圧縮率を高めることが可能である。
【0045】
LZタイプの符号化による圧縮データにもタイプ1(図5(C))とタイプ2(図5(D))が存在する。LZタイプ1はオフセットの値が255(16進表記でFFh )以下の場合に使用される圧縮データであり、LZタイプ2はオフセットの値が256(16進数で100h )以上の場合に使用される圧縮データである。なお、LZタイプ1とLZタイプ2では、接頭語が異なるだけでなく、オフセットを表わす符号語OFFSETも異なっている。例えば、LZタイプ2のオフセットの符号語は8ビットで表わされているのに対して、LZタイプ1のオフセットの符号語は9ビット以上の所定数のビットで表わされている。なお、LZタイプ1,2の一致長の符号語LENGTHは、ハフマン符号化やワイル符号化などの符号化テーブルに従って符号化されている。
【0046】
図5(E)に示すように、フォントタイプの圧縮データは、フォントタイプであることを示す接頭語「1110」と、先頭バイトの下位7ビットで構成されている。
【0047】
図5に示す各符号化タイプは互いに接頭語が異なっており、また、接頭語は一意にかつ瞬時に復号可能な符号語である。従って、圧縮データを復号する際に、接頭語を調べるだけで瞬時に各符号化タイプを判定することができ、各符号化タイプに従って復号することが可能である。
【0048】
図6は、符号化処理の手順を示すフローチャートである。ステップS1では、クラスタバッファ202に格納された被圧縮データの中から連続した2バイトが符号化タイプの判定対象として抽出される。2バイトを符号化タイプの判定対象とするのは、上述したように、LZタイプとフォントタイプの符号化において、2バイト以上の連続したバイト列が符号化されるからである。
【0049】
ステップS2では、LZタイプの符号化条件を満足するか否かが判断される。LZタイプの符号化条件C1は、次の通りである。
符号化条件C1:判定対象の2バイトと同一のバイト列が以前に存在する。
【0050】
上記の条件C1が成立する場合には、ステップS4においてLZタイプの符号化が実行される。フォントタイプの符号化では、図3において説明したように、2バイト以上の連続したバイト列が符号化される。符号化条件C1が成立しない場合には、ステップS3においてフォントタイプの符号化条件を満足するか否かが判断される。フォントタイプの符号化条件C2は、次の通りである。
符号化条件C2:判定対象の2バイトの後端バイトが、対象2バイトの直前の1バイトと等しく、かつ、対象2バイトの先頭バイトが80h 未満である。
【0051】
上記の符号化条件C2が成立する場合には、ステップS5においてフォントタイプの符号化が実行される。フォントタイプの符号化では2バイトが符号化される(図4)。符号化条件C2が成立しない場合には、ステップS6において、判定対象の2バイトの内の先頭バイトが無圧縮タイプで符号化される。無圧縮タイプの符号化では、1バイトが符号化されるだけである。
【0052】
ステップS7では、クラスタバッファ202に格納された被圧縮データの全てが符号化されたか否かが判断され、終了していなければステップS1に戻る。なお、ステップS1〜S3,S7は符号化タイプ判定部210(図2)によって実行され、ステップS4,S5,およびS6はLZ符号化部212、フォント符号化部214、および無圧縮符号化部216によってそれぞれ実行される。
【0053】
図6の手順は次のように言い換えることも可能である。すなわち、LZタイプの符号化は、3つの符号化タイプの中で圧縮率が最も高いので、LZタイプの符号化条件C1が成立する場合にはLZタイプの符号化が行なわれる。また、フォントタイプの符号化は、3つの符号化タイプの中で圧縮率が中程度なので、LZタイプの符号化条件C1が成立しないが、フォントタイプの符号化条件C2が成立する場合にはフォントタイプの符号化が行なわれる。そして、無圧縮タイプの符号化は、圧縮率が最も低いので、LZタイプとフォントタイプで符号化できない場合にのみ無圧縮タイプで符号化される。なお、LZタイプとフォントタイプの符号化は圧縮率が1を超えるのに対して、無圧縮タイプの符号化は圧縮率が1以下である。
【0054】
図7と図8は、実施例を適用して入力データを符号化する一例を示す説明図である。図7(A)は被圧縮データのバイト列を示している。バイト列の最初の1バイトは、LZタイプでもフォントタイプでも圧縮できないので、図7(B)に示すように無圧縮タイプで符号化される。第1バイト「85h 」は、80h 以上なので、無圧縮タイプ2で圧縮される。
【0055】
第2,第3バイト「3Ah 85h 」は上述のフォントタイプの符号化条件C2を満足するので、図7(C)に示すようにフォントタイプで符号化される。
【0056】
第4,第5バイト「3Bh E0h 」はLZタイプの符号化条件C1を満足せず、また、フォントタイプの符号化条件C2も満足しない。従って、図7(D)に示すように、第4バイト「3Bh 」のみが無圧縮タイプ1で符号化される。
【0057】
第5,第6バイト「E0h 3Bh 」も2つの符号化条件C1,C2をいずれも満足しないので、図8(A)に示すように、第5バイト「E0h 」のみが無圧縮タイプ2で符号化される。また、第6,第7バイト「3Bh 3Ah 」も2つの符号化条件C1,C2をいずれも満足しないので、図8(B)に示すように、第6バイト「3Bh 」のみが無圧縮タイプ1で符号化される。
【0058】
第7,第8バイト「3Ah 85h 」は第2,第3バイトと同じなので、LZタイプで符号化される。LZタイプの符号化では、一致する最長のバイト列さが調べられる。図8(C)の例では、一致する最長のバイト列は3バイトなので、第7〜第9バイトの3バイトがLZタイプで符号化される。なお、図8(C)の場合のオフセットは5バイトであり、255バイト以下なのでLZタイプ1の符号化が行なわれている。
【0059】
第10バイト「FFh 」は、2つの符号化条件C1,C2をいずれも満足しないので、図8(D)に示すように、無圧縮タイプ2で符号化される。なお、被圧縮データの符号化が終了した場合には、図示しない所定の終了コードが圧縮データの終端に付加される。
【0060】
上記実施例では、被圧縮データの連続した2バイトが判定条件C1またC2を満足するか否かに応じて符号化タイプを判別していたので、被圧縮データの局所的なデータ構造に応じて適切な符号化タイプを設定することができ、この結果、圧縮率を向上させることができるという利点がある。
【0061】
なお、上記実施例では被圧縮データをフォントデータ用の可逆符号化方法で符号化する場合について説明したが、与えられた被圧縮データをフォントデータ用の可逆符号化方法で圧縮するか、他の可逆符号化方法で圧縮するかを事前に判定するようにすることも可能である。
【0062】
例えば、フォントデータのファイル名の拡張子は、「TTF」などの数種類に限定されていることが多い。そこで、データ圧縮を行なう際に被圧縮データファイルの拡張子を調べ、拡張子が「TTF」などの予め登録された拡張子名と一致した場合には、上述のフォントデータの可逆符号化方法を適用するようしてもよい。
【0063】
なお、上述の無圧縮タイプ1の符号化では符号化データが8ビットですむので、通常の符号化方法による場合よりも無圧縮タイプの符号化データの圧縮率が高いという利点がある。従って、80h 未満のバイトデータの出現率がある程度以上の入力データに対しては、上述の実施例によるフォントデータの符号化方法を適用すれば、通常の符号化方法に比べて符号化データの圧縮率を高めることが可能である。このような考え方に従ってフォントデータの符号化方法を適用すべきか否かを判断する方法としては種々のものが考えられる。例えば、被圧縮データの先頭から一定バイト数(すなわち、入力データの少なくとも一部)を調べ、80h 未満のバイト数が所定の値以上の場合にフォントデータの符号化方法を適用するようにしてもよい。また、被圧縮データを間引きしつつ一定バイト数を調べ、80h 未満のバイト数が所定の値以上の場合にフォントデータの符号化方法を適用するようにしてもよい。
【0064】
なお、80h 以上のバイトデータが比較的多い場合には、80h 以上のデータのための接頭語を1ビット(例えば「0 」)とし、80h 未満のデータには2ビット以上の接頭語(例えば「1111」)を用いるようにしてもよい。換言すれば、入力データの少なくとも一部を調べて、16進数表記が80h 未満のバイトデータと80h 以上のバイトデータの数(または出現率)を調べ、比較的出現率の高い方に1ビットの接頭語を使用し、比較的出現率の低い方2ビット以上の接頭語を使用するようにしてもよい。
【0065】
なお、フォントデータでは連続した3バイトの両端のバイトが同一であるという特徴があるので、この特徴を利用して、1つおきの2バイトが一致する割合が一定以上であればフォントデータの符号化方法を適用するようにすることも可能である。この場合には、入力データの少なくとも一部について1つおきの2バイトが一致する割合を調べ、その結果に応じて、適用すべき符号化方法を選択すればよい。
【0066】
なお、この発明は上記実施例に限られるものではなく、その要旨を逸脱しない範囲において種々の態様において実施することが可能であり、例えば次のような変形も可能である。
【0067】
(1)図9は、図6の処理手順にステップS10とS11を付加したものである。ステップS10において、LZタイプで符号化する際のオフセットが256以上であり、かつ、一致長が2に等しい場合には、ステップS11に移行し、符号化の対象となる2バイトがフォントタイプの判定条件C2を満足するか否かが判断される。フォントタイプの判定条件C2が成立する場合には、符号化対象の2バイトはフォントタイプで符号化され、そうでない場合にはLZタイプで符号化される。このようにするのは、ステップS10,S11の条件をいずれも満足する場合には、LZタイプで符号化するよりもフォントタイプで符号化した方が符号化データの圧縮率が高くなるからである。
【0068】
このように、LZタイプの符号化判定条件C1を満足する2バイトのバイト列に対しても、フォントタイプで符号化した方が符号化データの圧縮率が高くなる場合には、フォントタイプで符号化するようにしてもよい。
【0069】
(2)上記実施例におけるLZ方式の符号化方法の代わりに、ハフマン符号化や算術符号化などの種々の可逆符号化方法を使用することも可能である。
【0070】
【発明の効果】
以上説明したように、請求項1および11に記載された発明によれば、入力データが所定の符号化条件を満足する場合に、フォントデータに適した所定の符号化モードで符号化するので、フォントデータを効率的に圧縮することができるという効果がある。
【0071】
請求項2、5、12および15に記載された発明によれば、圧縮率を1以上にすることができるという効果がある。
【0072】
請求項3、6、13および16に記載された発明によれば、15ビット以下で2バイトを符号化することができるという効果がある。
【0073】
請求項4および14に記載された発明によれば、2バイトのデータの内容に応じた適切な符号化モードを選択することができ、特に、その2バイトがフォントデータに特有の第2の符号化条件を満足する場合において効率的に圧縮することができるという効果がある。
【0074】
請求項7および17に記載された発明によれば、第1の符号化モードにおいて、一致する最長バイト列を符号化するので、圧縮率を高くすることができるという効果がある。
【0075】
請求項8および18に記載された発明によれば、第3の符号化モードにおいて、2バイト中の先頭バイトの16進数表記が7F以下の場合に8ビットで符号化するので、圧縮率が過度に低くならないという効果がある。
【0076】
請求項9および19に記載された発明によれば、16進数表記が7F以下のバイトデータの出現率が所定の条件を満たす場合に工程(A),(B)を含む符号化を実行するので、7F以下のバイトデータを符号化する場合の圧縮率が過度に低くならないように符号語を設定することが可能であるという効果がある。
【0077】
請求項10およびに20に記載された発明によれば、7F以下のバイトデータを8ビットで符号化できるので、符号化時の圧縮率が過度に低くなることがないという効果がある。
【0078】
請求項21に記載された発明によれば、3バイトの両端のバイトデータが一致する割合が所定の条件を満たす場合に工程(A),(B)を含む符号化を実行するので、フォントデータに適した符号化を行なうことが可能であるという効果がある。
【0079】
請求項22に記載された発明によれば、7F以下のバイトデータ群と80以上のバイトデータ群のうちで、比較的出現率の高いバイトデータ群の各バイトデータを8ビットで符号化できるので、符号化時の圧縮率が過度に低くなることがないという効果がある。
【図面の簡単な説明】
【図1】この発明の一実施例を適用する情報処理装置のハードウェア構成を示すブロック図。
【図2】可逆符号化によるデータの圧縮と伸長とを行なう圧縮伸長用デバイスドライバ200の構成を示す機能ブロック図。
【図3】LZタイプの符号化方法を示す説明図。
【図4】フォントタイプの符号化方法を示す説明図。
【図5】各符号化タイプの圧縮データのフォーマットを示す説明図。
【図6】符号化処理の手順を示すフローチャート。
【図7】実施例を適用して入力データを符号化する一例を示す説明図。
【図8】実施例を適用して入力データを符号化する一例を示す説明図。
【図9】符号化処理の手順の変形例を示すフローチャート。
【符号の説明】
101…CPU
104…ROM
105…RAM
112…PIC
115…マウスインタフェース
117…キーボード
118…キーボードインタフェース
121…FDC
123…ハードディスク
124…ハードディスクドライブ
125…HDC
128…CRT
129…CRTC
130…プリンタ
131…プリンタインタフェース
200…圧縮伸長用デバイスドライバ
202…クラスタバッファ
204…圧縮部
206…圧縮データバッファ
208…書込制御部
210…符号化タイプ判定部
212…LZ符号化部
214…フォント符号化部
216…無圧縮符号化部
[0001]
[Industrial applications]
The present invention relates to a method and an apparatus for losslessly encoding data.
[0002]
[Prior art]
In recent years, data compression techniques have been widely used to cope with a rapid increase in the amount of data processed by a computer. Data compression techniques include lossless encoding, in which data before compression is restored as before, and irreversible encoding, in which data is not restored as before. Lossy coding is mainly used for compression of image data. On the other hand, lossless encoding is used for compressing various data such as program data, text data, dictionary data, and the like.
[0003]
Font data is one type of data to be subjected to lossless encoding. Font data is data representing the shape of characters included in one set of fonts. In recent years, in many cases, several types of font data are loaded on a personal computer so that a user can select and use a desired font.
[0004]
[Problems to be solved by the invention]
However, when the font data is compressed by the same reversible encoding method as the text data and the program data, the compression ratio may not be so high. This is considered to be because the font data has a specific data array different from the text data and the program data.
[0005]
SUMMARY OF THE INVENTION The present invention has been made to solve the above-mentioned problems in the related art, and has as its object to provide a lossless encoding method and apparatus capable of efficiently compressing font data.
[0006]
Means and action for solving the problem
In order to solve the above-mentioned problem, a lossless encoding method for data according to claim 1 of the present invention comprises the steps of: (A) examining two consecutive bytes of input data; Determining whether the encoding condition that one byte immediately before is equal to each other and the first byte of the two bytes is equal to or less than a predetermined value is satisfied; and (B) determining whether the encoding condition is satisfied. Encoding the two bytes in a predetermined encoding mode if satisfied.
[0007]
In font data, the trailing byte of two bytes and the one byte immediately before the two bytes are equal to each other, and the leading byte of the two bytes is often equal to or smaller than a predetermined value. Therefore, when such an encoding condition is satisfied, font data can be efficiently compressed by encoding in a predetermined encoding mode suitable for the font data.
[0008]
In the data lossless encoding method according to claim 2, the step (B) includes a step (C) of encoding the two bytes with a code word of less than 16 bits.
[0009]
In this case, the compression ratio can be set to 1 or more.
[0010]
4. The data lossless encoding method according to claim 3, wherein the step (C) includes: a prefix of 8 bits or less indicating that the data is encoded in the predetermined encoding mode; Creating encoded data by combining the bits.
[0011]
In this way, 2 bytes can be encoded with 15 bits or less.
[0012]
According to a fourth aspect of the present invention, (A) two consecutive bytes of input data satisfy a first encoding condition for encoding in a predetermined first encoding mode. And (B) if the first encoding condition is not satisfied, the last byte of the two bytes is equal to the one byte immediately before the two bytes, and Determining whether or not a second encoding condition that the first byte of the two bytes is equal to or smaller than a predetermined value is satisfied; and (C) determining whether the first determination condition is satisfied. Encoding bytes in the first encoding mode having the highest compression ratio, and encoding the two bytes in the second encoding mode having a medium compression ratio when the second encoding condition is satisfied. , When neither the first nor the second encoding condition is satisfied Characterized in that it comprises a step of at least the compression ratio of the first byte is encoded in the lowest third encoding mode.
[0013]
If the encoding mode is selected based on the encoding condition, an appropriate encoding mode can be selected according to the content of the 2-byte data. In particular, when the two bytes satisfy a second encoding condition specific to font data, the font data is efficiently compressed by encoding in a second encoding mode suitable for the font data. Can be.
[0014]
8. The lossless encoding method of data according to claim 7, wherein the encoding step according to the first encoding mode includes the step of encoding a longest second byte sequence that matches a first byte sequence including at least the two bytes. Searching in the input data, a first codeword indicating that the encoding is performed in the first encoding mode, and a second codeword indicating a distance between the first and second byte strings. And generating a coded data by combining the third byte with the third codeword indicating the length of the first byte sequence.
[0015]
In the first encoding mode, since the longest matching byte string is encoded, the compression ratio can be increased.
[0016]
9. The data lossless encoding method according to claim 8, wherein the third encoding mode includes a prefix indicating that encoding is performed in the third encoding mode, and lower 7 bits of the first byte. Obtaining the encoded data by combining the first byte with the first byte. The prefix in the third encoding mode is a 1-bit first byte used when the hexadecimal notation of the first byte is 7F or less. It is selected from one of a prefix and a multi-bit second prefix used when the hexadecimal notation of the first byte is 80 or more.
[0017]
In the third encoding mode, when the hexadecimal notation of the first byte in two bytes is 7F or less, encoding is performed with 8 bits, so that the compression ratio does not become excessively low.
[0018]
The lossless encoding method for data according to claim 9, wherein it is determined whether or not the appearance rate of the first type of byte data whose hexadecimal notation is 7F or less in input data satisfies a predetermined condition. If the appearance rate of the first type of byte data satisfies a predetermined condition, (A) two consecutive bytes in the input data are encoded in an encoding mode in which the compression rate exceeds 1. (B) determining whether the encoding condition is satisfied, and if the encoding condition is not satisfied, sets at least the first byte of the two bytes to an encoding mode having a compression ratio of 1 or less. And encoding.
[0019]
When the encoding including the steps (A) and (B) is executed when the appearance rate of byte data whose hexadecimal notation is 7F or less satisfies a predetermined condition, when byte data of 7F or less is encoded Can be set so that the compression ratio of the code word does not become excessively low.
[0020]
11. The data lossless encoding method according to claim 10, wherein in the step (B), a prefix indicating that encoding has been performed in the encoding mode having a compression ratio of 1 or less, and a lower 7 bytes of the first byte. Obtaining encoded data by combining the first and second bits with each other, wherein the prefix is a 1-bit first prefix used when the hexadecimal notation of the first byte is 7F or less, and It is selected from either one of the multi-bit second prefix used when the hexadecimal notation of the first byte is 80 or more.
[0021]
Since byte data of 7F or less can be encoded with 8 bits, the compression ratio at the time of encoding does not become excessively low.
[0022]
12. The data lossless encoding apparatus according to claim 11, wherein two consecutive bytes of the input data are checked, and a trailing byte of the two bytes and a byte immediately before the two bytes are equal to each other, and Determining means for determining whether or not an encoding condition that the first byte of the byte is equal to or less than a predetermined value is satisfied; and, if the encoding condition is satisfied, encoding the two bytes in a predetermined encoding mode. Encoding means for encoding.
[0023]
According to a fourteenth aspect of the present invention, in the data lossless encoding apparatus, two consecutive bytes of the input data satisfy a first encoding condition for encoding in a predetermined first encoding mode. First determining means for determining whether or not the first encoding condition is not satisfied; and a trailing byte of the two bytes and a byte immediately before the two bytes are equal to each other, and Second means for determining whether or not a second encoding condition that the first byte of the two bytes is equal to or less than a predetermined value is satisfied; and if the first determination condition is satisfied, at least the second condition is satisfied. Encoding a byte in the first encoding mode, and encoding the two bytes in a second encoding mode if the second encoding condition is satisfied; If none of the above holds, at least the first byte Characterized in that it comprises encoding means for encoding the third encoding mode, a.
[0024]
The lossless data encoding apparatus according to claim 19, determines whether or not the appearance rate of the first type of byte data whose hexadecimal notation is 7F or less in input data satisfies a predetermined condition. And encoding means for performing encoding when the appearance rate of the first type of byte data satisfies a predetermined condition, wherein two consecutive bytes in the input data have a compression rate of First means for determining whether or not an encoding condition for encoding in an encoding mode exceeding 1 is satisfied; and, when the encoding condition is not satisfied, at least the first byte of the two bytes is Encoding means including: a second means for encoding in an encoding mode with a compression ratio of 1 or less.
[0025]
22. The lossless encoding method of data according to claim 21, wherein in the input data, it is determined whether or not a rate at which byte data at both ends of three consecutive bytes match each other satisfies a predetermined condition. Satisfies a predetermined condition, it is determined whether (A) two consecutive bytes in the input data satisfy an encoding condition for encoding in an encoding mode in which the compression ratio exceeds 1. And (B) encoding at least the first byte of the two bytes in an encoding mode having a compression ratio of 1 or less when the encoding condition is not satisfied. And
[0026]
In the font data, since the ratio at which the byte data at both ends of the three bytes match is high, if this matching ratio satisfies a predetermined condition, if the encoding including the steps (A) and (B) is executed, It is possible to perform encoding suitable for font data.
[0027]
23. The method according to claim 22, wherein the step (B) is performed by combining a prefix indicating that encoding is performed in the encoding mode with a compression ratio of 1 or less and the lower 7 bits of the first byte. Obtaining encoded data, wherein the input data has a first byte data group whose hexadecimal notation is 7F or less and a second byte data group whose hexadecimal notation is 80 or more. In the encoding of each byte data of the byte data group having a relatively high appearance rate, a 1-bit first prefix is used, and the encoding of each byte data of the byte data group having a relatively low appearance rate is performed. The encoding uses a multi-bit second prefix.
[0028]
Among the byte data group of 7F or less and the byte data group of 80 or more, each byte data of the byte data group having a relatively high appearance rate can be encoded with 8 bits, so that the compression rate at the time of encoding is excessively low. Nothing.
[0029]
【Example】
A. Equipment configuration:
FIG. 1 is a block diagram showing a hardware configuration of an information processing apparatus to which an embodiment of the present invention is applied. This information processing apparatus is configured as a personal computer system, and includes the following units mutually connected by a bus around a CPU 101 as shown in the figure.
[0030]
ROM 104: read-only memory for storing monitor programs and the like
RAM 105: read / write memory constituting main memory
PIC112: Interrupt controller that controls priorities of various interrupts
Mouse interface 115: an interface that controls data exchange with the two-button mouse 114
Keyboard interface 118: an interface for controlling key input from the keyboard 117
FDC 121: Flexible disk controller for controlling flexible disk drive (FDD) 120
HDC 125: a hard disk controller that controls a hard disk drive (HDD) 124
CRTC 129: CRT controller for controlling signal output to CRT 128 for displaying necessary data and the like
Printer interface 131: an interface that controls output of data to the printer 130.
[0031]
FIG. 2 is a functional block diagram showing the configuration of a compression / decompression device driver 200 that performs compression and decompression of data by lossless encoding. The compression / decompression device driver 200 is realized by the CPU 101 executing a program stored in the RAM 105.
[0032]
The device driver 200 for compression and decompression includes a cluster buffer 202 for storing data for one cluster to be compressed, a compression unit 204 for compressing data by lossless encoding, a compressed data buffer 206 for storing compressed data, A write control unit 208 that writes the compressed data to the hard disk 123. One cluster has a predetermined data size, for example, 8 Kbytes.
[0033]
The compression unit 204 includes an encoding type determination unit 210 that determines an encoding type described later, an LZ encoding unit 212 that performs LZ (Lempel-Ziv) encoding, and a font encoding that performs font type encoding. And a non-compression encoding unit 216 for performing non-compression type encoding. First, three types of encoding performed by the LZ encoding unit 212, the font encoding unit 214, and the non-compression encoding unit 216 will be described. In this embodiment, "encoding type" and "encoding mode" have the same meaning.
[0034]
FIG. 3 is an explanatory diagram showing an LZ type encoding method. The LZ type coding used in this embodiment is a Lempel-Ziv coding, and particularly uses a coding method called a slide dictionary method. In the example shown in FIG. 3A, the data to be compressed includes a byte string “71h 3Ah 3Bh...”. In addition, in this specification, the additional symbol "h" indicates that it is a hexadecimal notation.
[0035]
In the LZ type encoding, it is checked whether or not the same byte sequence as a continuous byte sequence of 2 bytes or more has appeared before. If there is the same byte sequence before, the longest matching byte sequence is checked. Then, the current byte sequence is encoded by the distance (offset) from the current byte sequence to the previous byte sequence and the number of bytes of the longest matching byte sequence (match length). For example, in the example of FIG. 3A, the two-byte byte sequence “3Ah 3Bh” underlined with a solid line is the same as the two-byte byte sequence underlined with a broken line. Therefore, the compressed data of the 2-byte byte string “3Ah 3Bh” underlined with a solid line is a prefix indicating that it is LZ type encoded data, and a code word OFFSET (which indicates the distance between the matched byte strings. 3) and a codeword LENGTH (2) representing the match length. The numerical value in parentheses of OFFSET (3) is the number of bytes indicating the distance, and the numerical value in parentheses of LENGTH (2) is the number of bytes indicating the matching length. The format of the compressed data of each encoding type will be described later.
[0036]
In the example of FIG. 3B, since the offset is 3 bytes and the matching length is 3 bytes, the solid, underlined 3 bytes are formed by a combination of the prefix, the code word OFFSET (3), and the code word LENGTH (3). Is encoded.
[0037]
In the example of FIG. 3C, the 5 bytes after the second byte are the same. In this case, the four bytes after the third byte, which are underlined with a solid line, match the four bytes after the second byte. Therefore, the offset is 1 byte and the match length is 4 bytes.
[0038]
As described above, in the LZ type encoding method, when a matching byte sequence has previously existed, data is compressed by encoding the longest matching byte sequence. It is suitable for compressing data that appears repeatedly.
[0039]
FIG. 4 is an explanatory diagram showing a font type encoding method. The font data is characterized in that both ends of three consecutive bytes are equal to each other, and the central byte is often less than 80h (that is, 7F or less). This feature is particularly remarkable in TrueType fonts (TrueType is a trademark of Apple Computer).
[0040]
In FIG. 4, the leading one byte “71h” and the underlined two bytes “3Ah 71h” have the above-described characteristics, so the two underlined bytes are compressed by font type encoding. Is done. One byte “71h” immediately before the two bytes “3Ah 71h” to be encoded by the font type may be encoded by non-compression type encoding, or may be encoded by LZ type encoding. It may be.
[0041]
The font-type compressed data includes a prefix indicating the font type and the lower 7 bits of the first byte "3Ah" in the two bytes to be encoded. The reason why only the lower 7 bits of “3Ah” should be used is that the font type must be encoded in the hexadecimal notation of less than 80h when the font type is encoded. This is because the most significant bit (MSB) is always 0. When a prefix indicating the font type is added, it can be understood that the immediately preceding byte and the last byte of the two bytes encoded by the font type are the same. Therefore, information indicating the trailing byte is unnecessary.
[0042]
In the LZ type encoding in this embodiment, encoding is performed when a continuous byte sequence of two or more bytes is the same as a previous byte sequence. Also, in the case of font-type encoding, encoding is performed when two consecutive bytes satisfy the above-mentioned predetermined characteristics. Therefore, when determining which encoding type is used for encoding, it is only necessary to examine two consecutive bytes and select one of the three encoding types.
[0043]
FIG. 5 is an explanatory diagram showing the format of compressed data of each encoding type used in this embodiment. Type 1 (FIG. 5 (A)) and type 2 (FIG. 5 (B)) exist in the compressed data by the non-compression type encoding. Uncompressed type 1 is compressed data of byte data (00h to 7Fh) whose most significant bit (MSB) before compression is 0. The uncompressed type 2 is compressed data of byte data (80h to FFh) whose most significant bit (MSB) before compression is 1. As shown in FIGS. 5A and 5B, the prefix of the non-compression type compressed data is changed according to the value of the most significant bit of the byte data before compression, so that the data added after the prefix is , Only the lower 7 bits of the data before compression need be used. Note that, in the compressed data of the non-compression type 1, one byte before compression is encoded by 8 bits including the prefix. Therefore, the compression ratio of the non-compression type 1 is 1.0. Since the prefix of uncompressed type 2 is 4 bits, its compression ratio is about 0.7.
[0044]
In a normal encoding method, encoded data obtained by encoding 1-byte data without compression is composed of a prefix of 1 bit or more indicating non-compression and the original 8 bits. Therefore, the encoded data has 9 or more bits, and the compression ratio is less than 1. On the other hand, in the above-mentioned non-compression type 1 encoding, since the compression ratio is 1.0, the compression ratio is higher than that of ordinary uncompressed encoded data. Therefore, if the encoding method of this embodiment is applied to data including bytes less than 80h to some extent or more, it is possible to increase the compression ratio as compared with a normal encoding method.
[0045]
Type 1 (FIG. 5 (C)) and type 2 (FIG. 5 (D)) also exist in compressed data obtained by LZ type encoding. LZ type 1 is compressed data used when the offset value is 255 (FFh in hexadecimal notation), and LZ type 2 is used when the offset value is 256 (100 h 2 in hexadecimal). It is compressed data. Note that the LZ type 1 and the LZ type 2 not only have different prefixes, but also have different codewords OFFSET representing offsets. For example, an LZ type 2 offset codeword is represented by 8 bits, while an LZ type 1 offset codeword is represented by a predetermined number of 9 bits or more. Note that the codeword LENGTH having a matching length of LZ types 1 and 2 is encoded according to an encoding table such as Huffman encoding or Weyl encoding.
[0046]
As shown in FIG. 5E, the font-type compressed data includes a prefix “1110” indicating the font type and the lower 7 bits of the first byte.
[0047]
Each encoding type shown in FIG. 5 has a different prefix, and the prefix is a codeword that can be uniquely and instantaneously decoded. Therefore, when decoding the compressed data, each coding type can be instantaneously determined only by examining the prefix, and decoding can be performed according to each coding type.
[0048]
FIG. 6 is a flowchart showing the procedure of the encoding process. In step S1, two consecutive bytes are extracted from the data to be compressed stored in the cluster buffer 202 as a coding type determination target. The reason why two bytes are to be determined as the encoding type is that, as described above, in the LZ type and font type encoding, a continuous byte string of two or more bytes is encoded.
[0049]
In step S2, it is determined whether or not the LZ type encoding condition is satisfied. The LZ type encoding condition C1 is as follows.
Encoding condition C1: A byte string identical to the two bytes to be determined previously exists.
[0050]
If the above condition C1 is satisfied, LZ type encoding is performed in step S4. In the font type encoding, a continuous byte string of 2 bytes or more is encoded as described with reference to FIG. If the encoding condition C1 is not satisfied, it is determined in step S3 whether the encoding condition of the font type is satisfied. The encoding condition C2 of the font type is as follows.
Coding condition C2: The last byte of the two bytes to be determined is equal to the one byte immediately before the two bytes, and the first byte of the two bytes is less than 80h.
[0051]
If the above-described encoding condition C2 is satisfied, font-type encoding is performed in step S5. In the font type encoding, two bytes are encoded (FIG. 4). If the encoding condition C2 is not satisfied, in step S6, the first byte of the two bytes to be determined is encoded in the non-compression type. In non-compression type coding, only one byte is coded.
[0052]
In step S7, it is determined whether or not all of the data to be compressed stored in the cluster buffer 202 has been encoded. If not, the process returns to step S1. Steps S1 to S3 and S7 are executed by the encoding type determination unit 210 (FIG. 2), and steps S4, S5 and S6 are performed by the LZ encoding unit 212, the font encoding unit 214, and the non-compression encoding unit 216. Respectively.
[0053]
The procedure of FIG. 6 can be reworded as follows. That is, since the LZ type encoding has the highest compression rate among the three encoding types, the LZ type encoding is performed when the LZ type encoding condition C1 is satisfied. In the font type encoding, since the compression ratio is medium among the three encoding types, the LZ type encoding condition C1 is not satisfied. However, when the font type encoding condition C2 is satisfied, the font is not encoded. Type encoding is performed. Since the non-compression type encoding has the lowest compression rate, it is encoded by the non-compression type only when encoding cannot be performed by the LZ type and the font type. Note that the compression ratio of the LZ type and the font type is greater than 1, whereas the compression ratio of the non-compression type is less than 1.
[0054]
7 and 8 are explanatory diagrams showing an example of encoding input data by applying the embodiment. FIG. 7A shows a byte sequence of the data to be compressed. Since the first byte of the byte string cannot be compressed by either the LZ type or the font type, it is encoded by the non-compression type as shown in FIG. Since the first byte "85h" is 80h or more, it is compressed by the non-compression type 2.
[0055]
Since the second and third bytes “3Ah 85h” satisfy the above-described font type encoding condition C2, they are encoded in the font type as shown in FIG. 7C.
[0056]
The fourth and fifth bytes “3Bh E0h” do not satisfy the LZ type encoding condition C1 and do not satisfy the font type encoding condition C2. Therefore, as shown in FIG. 7 (D), only the fourth byte “3Bh” is encoded by the non-compression type 1.
[0057]
Since the fifth and sixth bytes “E0h 3Bh” do not satisfy either of the two encoding conditions C1 and C2, only the fifth byte “E0h” is encoded by the uncompressed type 2 as shown in FIG. Be transformed into Also, since the sixth and seventh bytes “3Bh 3Ah” do not satisfy both of the two encoding conditions C1 and C2, only the sixth byte “3Bh” is the uncompressed type 1 as shown in FIG. .
[0058]
Since the seventh and eighth bytes “3Ah 85h” are the same as the second and third bytes, they are encoded in the LZ type. In LZ type encoding, the longest matching byte sequence is examined. In the example of FIG. 8C, since the longest matching byte string is 3 bytes, the 3rd to 7th to 9th bytes are encoded in the LZ type. Note that the offset in the case of FIG. 8C is 5 bytes, which is 255 bytes or less, so that LZ type 1 encoding is performed.
[0059]
Since the tenth byte “FFh” does not satisfy any of the two encoding conditions C1 and C2, it is encoded by the non-compression type 2 as shown in FIG. When the encoding of the data to be compressed is completed, a predetermined end code (not shown) is added to the end of the compressed data.
[0060]
In the above embodiment, the encoding type is determined according to whether two consecutive bytes of the compressed data satisfy the determination condition C1 or C2. Therefore, the encoding type is determined according to the local data structure of the compressed data. An appropriate coding type can be set, and as a result, there is an advantage that the compression ratio can be improved.
[0061]
In the above embodiment, the case where the data to be compressed is encoded by the lossless encoding method for font data has been described. However, the given data to be compressed is compressed by the lossless encoding method for font data, It is also possible to determine in advance whether to perform compression by the lossless encoding method.
[0062]
For example, the extension of the file name of font data is often limited to several types such as "TTF". Therefore, when data compression is performed, the extension of the compressed data file is checked, and if the extension matches a previously registered extension name such as “TTF”, the above-described lossless encoding method for font data is used. You may make it apply.
[0063]
Note that the above-described uncompressed type 1 encoding requires only 8 bits of encoded data, and thus has an advantage that the compression rate of the uncompressed type encoded data is higher than that obtained by a normal encoding method. Therefore, when the encoding method of the font data according to the above-described embodiment is applied to the input data having the appearance rate of byte data of less than 80h less than a certain level, the compression of the encoded data is smaller than that of the normal encoding method. It is possible to increase the rate. There are various methods for determining whether to apply the font data encoding method according to such a concept. For example, a fixed number of bytes (that is, at least a part of the input data) is checked from the head of the data to be compressed, and the encoding method of the font data is applied when the number of bytes less than 80h is equal to or more than a predetermined value. Good. Further, a fixed number of bytes may be checked while thinning out the data to be compressed, and the font data encoding method may be applied when the number of bytes less than 80h is equal to or more than a predetermined value.
[0064]
When the byte data of 80h or more is relatively large, the prefix for the data of 80h or more is 1 bit (for example, "0"), and the data of less than 80h is 2 bits or more prefix (for example, "0"). 1111 "). In other words, by examining at least a part of the input data, examining the number (or appearance rate) of the byte data in hexadecimal notation less than 80h and the byte data of 80h or more (or appearance rate), A prefix may be used, and a prefix of two or more bits having a relatively low appearance rate may be used.
[0065]
Note that the font data has a feature that the bytes at both ends of three consecutive bytes are the same, and this feature is used to determine the sign of the font data if the ratio of coincidence of every other two bytes is equal to or greater than a certain value. It is also possible to apply the conversion method. In this case, the rate at which every other two bytes match at least a part of the input data may be checked, and an encoding method to be applied may be selected according to the result.
[0066]
The present invention is not limited to the above-described embodiment, and can be implemented in various modes without departing from the gist of the present invention. For example, the following modifications are possible.
[0067]
(1) FIG. 9 is obtained by adding steps S10 and S11 to the processing procedure of FIG. In step S10, if the offset at the time of encoding with the LZ type is 256 or more and the matching length is equal to 2, the process proceeds to step S11, where 2 bytes to be encoded are determined as the font type. It is determined whether condition C2 is satisfied. If the font type determination condition C2 is satisfied, the two bytes to be encoded are encoded with the font type, otherwise, the two bytes are encoded with the LZ type. The reason for this is that when both the conditions of steps S10 and S11 are satisfied, the compression rate of the encoded data is higher when encoding is performed using the font type than when encoding is performed using the LZ type. .
[0068]
As described above, even when a 2-byte byte string that satisfies the LZ type encoding determination condition C1 is encoded with the font type and the compression rate of the encoded data becomes higher, the encoding with the font type is performed. You may make it.
[0069]
(2) Various lossless encoding methods such as Huffman encoding and arithmetic encoding can be used in place of the LZ encoding method in the above embodiment.
[0070]
【The invention's effect】
As described above, according to the first and eleventh aspects of the present invention, when input data satisfies a predetermined encoding condition, encoding is performed in a predetermined encoding mode suitable for font data. There is an effect that font data can be efficiently compressed.
[0071]
According to the second, fifth, twelfth, and fifteenth aspects, the compression ratio can be made 1 or more.
[0072]
According to the third, sixth, thirteenth, and sixteenth aspects, there is an effect that two bytes can be encoded with 15 bits or less.
[0073]
According to the fourth and fourteenth aspects of the present invention, it is possible to select an appropriate encoding mode in accordance with the content of two-byte data. In particular, the two bytes are the second code unique to font data. There is an effect that the compression can be efficiently performed when the conversion condition is satisfied.
[0074]
According to the seventh and 17th aspects of the present invention, in the first encoding mode, the longest matching byte string is encoded, so that the compression rate can be increased.
[0075]
According to the eighth and eighteenth aspects of the present invention, in the third encoding mode, when the hexadecimal notation of the first byte in the two bytes is 7F or less, encoding is performed by 8 bits, so that the compression rate is excessively high. The effect is that it does not decrease.
[0076]
According to the ninth and nineteenth aspects of the present invention, the encoding including the steps (A) and (B) is executed when the appearance rate of byte data whose hexadecimal notation is 7F or less satisfies a predetermined condition. , 7F or less, it is possible to set a code word so that the compression ratio does not become excessively low.
[0077]
According to the tenth and twentieth aspects of the present invention, since byte data of 7F or less can be encoded with 8 bits, the compression rate at the time of encoding does not become excessively low.
[0078]
According to the twenty-first aspect of the present invention, the encoding including the steps (A) and (B) is executed when the ratio of coincidence of the byte data at both ends of the three bytes satisfies a predetermined condition. This makes it possible to perform encoding suitable for.
[0079]
According to the invention described in claim 22, each byte data of a byte data group having a relatively high appearance rate among the byte data group of 7F or less and the byte data group of 80 or more can be encoded with 8 bits. This has the effect that the compression ratio at the time of encoding does not become excessively low.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a hardware configuration of an information processing apparatus to which an embodiment of the present invention is applied.
FIG. 2 is a functional block diagram showing the configuration of a compression / decompression device driver 200 that performs compression and decompression of data by lossless encoding.
FIG. 3 is an explanatory diagram showing an LZ type encoding method.
FIG. 4 is an explanatory diagram showing a font type encoding method.
FIG. 5 is an explanatory diagram showing a format of compressed data of each encoding type.
FIG. 6 is a flowchart showing a procedure of an encoding process.
FIG. 7 is an explanatory diagram showing an example of encoding input data by applying the embodiment.
FIG. 8 is an explanatory diagram showing an example of encoding input data by applying the embodiment.
FIG. 9 is a flowchart illustrating a modification of the procedure of the encoding process.
[Explanation of symbols]
101 ... CPU
104 ... ROM
105 ... RAM
112 ... PIC
115 ... Mouse interface
117 ... Keyboard
118 ... Keyboard interface
121 ... FDC
123 ... Hard disk
124 ... Hard disk drive
125 ... HDC
128 ... CRT
129… CRTC
130 ... Printer
131 ... Printer interface
200: Device driver for compression and decompression
202: Cluster buffer
204: compression unit
206: compressed data buffer
208: Write control unit
210: coding type determination unit
212 ... LZ encoding unit
214: Font encoding unit
216: Non-compression encoding unit

Claims (22)

データを可逆符号化する方法であって、
(A)入力データの連続した2バイトを調べ、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの符号化条件を満足するか否かを判定する工程と、
(B)前記符号化条件を満足する場合には前記2バイトを所定の符号化モードで符号化する工程と、
を備えることを特徴とするデータの可逆符号化方法。
A method of reversibly encoding data,
(A) Checking two consecutive bytes of input data, if the last byte of the two bytes is equal to the one byte immediately before the two bytes and the first byte of the two bytes is equal to or less than a predetermined value Determining whether or not the encoding condition of
(B) encoding the two bytes in a predetermined encoding mode when the encoding condition is satisfied;
A lossless encoding method for data.
請求項1記載のデータの可逆符号化方法であって、
前記工程(B)は、
(C)前記2バイトを16ビット未満の符号語で符号化する工程、を含む
データの可逆符号化方法。
The lossless encoding method of data according to claim 1, wherein
In the step (B),
(C) encoding the two bytes with a code word of less than 16 bits.
請求項2記載のデータの可逆符号化方法であって、
前記工程(C)は、
前記所定の符号化モードで符号化されたことを示す8ビット以下の接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する工程、を含む
データの可逆符号化方法。
3. The data lossless encoding method according to claim 2, wherein
The step (C) includes:
A method of creating encoded data by combining a prefix of 8 bits or less indicating that encoding has been performed in the predetermined encoding mode and the lower 7 bits of the first byte. .
データを可逆符号化する方法であって、
(A)入力データの連続した2バイトが、第1の符号化モードで符号化するための第1の符号化条件を満足するか否かを判定する工程と、
(B)前記第1の符号化条件が成立しない場合には、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの第2の符号化条件を満足するか否かを判定する工程と、
(C)前記第1の判定条件が成立する場合には少なくとも前記2バイトを圧縮率が最も高い前記第1の符号化モードで符号化し、前記第2の符号化条件が成立する場合には前記2バイトを圧縮率が中程度の第2の符号化モードで符号化し、前記第1と第2の符号化条件がいずれも成立しない場合には少なくとも前記先頭バイトを圧縮率が最も低い第3の符号化モードで符号化する工程と、
を備えることを特徴とするデータの可逆符号化方法。
A method of reversibly encoding data,
(A) determining whether two consecutive bytes of input data satisfy a first encoding condition for encoding in a first encoding mode;
(B) when the first encoding condition is not satisfied, the last byte of the two bytes is equal to the one byte immediately before the two bytes, and the first byte of the two bytes is a predetermined value. Determining whether or not a second encoding condition that:
(C) at least the two bytes are encoded in the first encoding mode having the highest compression ratio when the first determination condition is satisfied, and when the second encoding condition is satisfied, Two bytes are encoded in a second encoding mode having a medium compression ratio, and if neither the first nor the second encoding condition is satisfied, at least the first byte is converted to a third encoding having the lowest compression ratio. Encoding in an encoding mode;
A lossless encoding method for data.
請求項4記載のデータの可逆符号化方法であって、
前記第2の符号化モードによる符号化工程は、
前記2バイトを16ビット未満の符号語で符号化する工程、を含む
データの可逆符号化方法。
The data lossless encoding method according to claim 4, wherein
The encoding step according to the second encoding mode includes:
Encoding the two bytes with a codeword of less than 16 bits.
請求項5記載のデータの可逆符号化方法であって、
前記第2の符号化モードによる符号化工程は、前記第2の符号化モードで符号化されたことを示す8ビット以下の接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する工程、を含む
データの可逆符号化方法。
The data lossless encoding method according to claim 5,
In the encoding step in the second encoding mode, the encoding is performed by combining a prefix of 8 bits or less indicating that encoding is performed in the second encoding mode, and the lower 7 bits of the first byte. Creating a data, a method of reversible encoding of data.
請求項4ないし6のいずれかに記載のデータの可逆符号化方法であって、
前記第1の符号化モードによる符号化工程は、
少なくとも前記2バイトを含む第1のバイト列と一致する最長の第2のバイト列を前記入力データ内で探索する工程と、
前記第1の符号化モードで符号化されたことを示す第1の符号語と、前記第1と第2のバイト列相互の距離を示す第2の符号語と、前記第1のバイト列の長さを示す第3の符号語とを組み合わせることによって符号化データを作成する工程と、を含む
データの可逆符号化方法。
A lossless encoding method for data according to any one of claims 4 to 6, wherein:
The encoding step according to the first encoding mode includes:
Searching the input data for a longest second byte sequence that matches a first byte sequence containing at least the two bytes;
A first codeword indicating that encoding has been performed in the first encoding mode, a second codeword indicating a distance between the first and second byte strings, and Creating encoded data by combining with a third codeword indicating the length.
請求項4ないし7のいずれかに記載のデータの可逆符号化方法であって、
前記第3の符号化モードは、前記第3の符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程、を含み、
前記第3の符号化モードにおける前記接頭語は、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択される、データの可逆符号化方法。
A lossless encoding method for data according to any one of claims 4 to 7,
The third encoding mode includes a step of obtaining encoded data by combining a prefix indicating that encoding is performed in the third encoding mode and the lower 7 bits of the first byte,
The prefix in the third encoding mode is a 1-bit first prefix used when the hexadecimal notation of the first byte is 7F or less, and the hexadecimal notation of the first byte is 80 or more. A lossless encoding method for data selected from any one of a plurality of bits and a second prefix used when.
データの可逆符号化方法であって、
入力データ中において、16進数表記が7F以下である第1のタイプのバイトデータの出現率が所定の条件を満足するか否かを判定し、
前記第1のタイプのバイトデータの出現率が所定の条件を満足する場合には、(A)前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する工程と、
(B)前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する工程と、を実行することを特徴とするデータの可逆符号化方法。
A lossless encoding method for data,
In the input data, it is determined whether the appearance rate of the first type of byte data whose hexadecimal notation is 7F or less satisfies a predetermined condition,
When the appearance rate of the byte data of the first type satisfies a predetermined condition, (A) two consecutive bytes in the input data are encoded in an encoding mode in which the compression rate exceeds 1. Determining whether or not the encoding condition of
(B) encoding the at least the first byte of the two bytes in an encoding mode having a compression ratio of 1 or less when the encoding condition is not satisfied. Encoding method.
請求項9記載のデータの可逆符号化方法であって、
前記工程(B)は、圧縮率が1以下の前記符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程と、を含み、
前記接頭語は、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択されるデータの可逆符号化方法。
The data lossless encoding method according to claim 9, wherein
The step (B) includes a step of obtaining encoded data by combining a prefix indicating that encoding has been performed in the encoding mode with a compression ratio of 1 or less and the lower 7 bits of the first byte. Including
The prefix is a 1-bit first prefix used when the hexadecimal notation of the first byte is 7F or less, and a plurality of prefixes used when the hexadecimal notation of the first byte is 80 or more. A lossless encoding method for data selected from one of a bit and a second prefix.
データの可逆符号化装置であって、
入力データの連続した2バイトを調べ、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの符号化条件を満足するか否かを判定する判定手段と、
前記符号化条件を満足する場合には前記2バイトを所定の符号化モードで符号化する符号化手段と、
を備えることを特徴とするデータの可逆符号化装置。
A lossless encoding device for data,
Checking two consecutive bytes of the input data, encoding that the last byte of the two bytes and the one byte immediately before the two bytes are equal to each other and the first byte of the two bytes is equal to or less than a predetermined value Determining means for determining whether a condition is satisfied;
Encoding means for encoding the two bytes in a predetermined encoding mode when the encoding condition is satisfied;
A lossless encoding device for data, comprising:
請求項11記載のデータの可逆符号化装置であって、
前記符号化手段は、
前記2バイトを16ビット未満の符号語で符号化する第1の手段、を含む
データの可逆符号化装置。
The data lossless encoding device according to claim 11, wherein
The encoding means,
A first means for encoding the two bytes with a code word of less than 16 bits, the data lossless encoding apparatus.
請求項12記載のデータの可逆符号化装置であって、
前記第1の手段は、
前記所定の符号化モードで符号化されたことを示す8ビット以下の接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する手段、を含む
データの可逆符号化装置。
The data lossless encoding device according to claim 12,
The first means includes:
A lossless encoding apparatus for encoding the data, comprising: means for creating encoded data by combining a prefix of 8 bits or less indicating that encoding is performed in the predetermined encoding mode and the lower 7 bits of the first byte. .
データの可逆符号化装置であって、
入力データの連続した2バイトが、所定の第1の符号化モードで符号化するための第1の符号化条件を満足するか否かを判定する第1の判定手段と、
前記第1の符号化条件が成立しない場合には、前記2バイトの後端バイトと前記2バイトの直前の1バイトとが互いに等しく、かつ、前記2バイトの先頭バイトが所定の値以下であるとの第2の符号化条件を満足するか否かを判定する第2の手段と、
前記第1の判定条件が成立する場合には少なくとも前記2バイトを圧縮率が最も高い前記第1の符号化モードで符号化し、前記第2の符号化条件が成立する場合には前記2バイトを圧縮率が中程度の第2の符号化モードで符号化し、前記第1と第2の符号化条件がいずれも成立しない場合には少なくとも前記先頭バイトを圧縮率が最も低い第3の符号化モードで符号化する符号化手段と、
を備えることを特徴とするデータの可逆符号化装置。
A lossless encoding device for data,
First determining means for determining whether two consecutive bytes of input data satisfy a first encoding condition for encoding in a predetermined first encoding mode;
If the first encoding condition is not satisfied, the last byte of the two bytes is equal to the one byte immediately before the two bytes, and the first byte of the two bytes is equal to or less than a predetermined value. Second means for determining whether or not a second encoding condition of
When the first determination condition is satisfied, at least the two bytes are encoded in the first encoding mode having the highest compression ratio. When the second encoding condition is satisfied, the two bytes are encoded. Encoding is performed in a second encoding mode having a medium compression rate, and if neither the first nor second encoding condition is satisfied, at least the first byte is encoded in a third encoding mode having the lowest compression rate. Encoding means for encoding with
A lossless encoding device for data, comprising:
請求項14記載のデータの可逆符号化装置であって、
前記符号化手段は、
前記第2の符号化モードによる符号化において、前記2バイトを16ビット未満の符号語で符号化する第1の手段、を含む
データの可逆符号化装置。
The data lossless encoding device according to claim 14,
The encoding means,
A reversible coding apparatus for data, comprising: first means for coding the two bytes with a code word of less than 16 bits in the coding in the second coding mode.
請求項15記載のデータの可逆符号化装置であって、
前記第1の手段は、
前記第2の符号化モードで符号化されたことを示す8ビット以下の接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する手段、を含む
データの可逆符号化装置。
The data lossless encoding device according to claim 15, wherein
The first means includes:
Lossless encoding of data including means for creating encoded data by combining a prefix of 8 bits or less indicating that encoding is performed in the second encoding mode and the lower 7 bits of the first byte. apparatus.
請求項14ないし16のいずれかに記載のデータの可逆符号化装置であって、
前記符号化手段は、
前記第1の符号化モードによる符号化において、少なくとも前記2バイトを含む第1のバイト列と一致する最長の第2のバイト列を前記入力データ内で探索する探索手段と、
前記第1の符号化モードで符号化されたことを示す第1の符号語と、前記第1と第2のバイト列相互の距離を示す第2の符号語と、前記第1のバイト列の長さを示す第3の符号語とを組み合わせることによって符号化データを作成する符号化データ生成手段と、を含む
データの可逆符号化装置。
A data lossless encoding device according to any one of claims 14 to 16,
The encoding means,
Searching means for searching in the input data for a longest second byte string that matches the first byte string including at least the two bytes in the encoding in the first encoding mode;
A first codeword indicating that encoding has been performed in the first encoding mode, a second codeword indicating a distance between the first and second byte strings, and A coded data generating means for generating coded data by combining the third codeword indicating the length with the third codeword.
請求項14ないし17のいずれかに記載のデータの可逆符号化装置であって、
前記符号化手段は、
前記第3の符号化モードによる符号化において、前記第3の符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを作成する手段と、
前記第3の符号化モードにおける前記接頭語として、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択する手段と、を含む
データの可逆符号化装置。
The data lossless encoding device according to any one of claims 14 to 17, wherein
The encoding means,
Means for creating encoded data by combining a prefix indicating that encoding has been performed in the third encoding mode and the lower 7 bits of the first byte in encoding in the third encoding mode. When,
As the prefix in the third encoding mode, the 1-bit first prefix used when the hexadecimal notation of the first byte is 7F or less, and the hexadecimal notation of the first byte is 80 or more. Means for selecting from either one of a plurality of bits and a second prefix used in the case of.
データの可逆符号化装置であって、
入力データ中において、16進数表記が7F以下である第1のタイプのバイトデータの出現率が所定の条件を満足するか否かを判定する判定手段と、
前記第1のタイプのバイトデータの出現率が所定の条件を満足する場合において符号化を行なう符号化手段であって、
前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する第1の手段と、
前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する第2の手段と、を含む符号化手段と、
を備えることを特徴とするデータの可逆符号化装置。
A lossless encoding device for data,
Determining means for determining whether or not the appearance rate of the first type of byte data whose hexadecimal notation is 7F or less in input data satisfies a predetermined condition;
Encoding means for encoding when the appearance rate of the first type of byte data satisfies a predetermined condition,
First means for determining whether or not two consecutive bytes in the input data satisfy an encoding condition for encoding in an encoding mode in which a compression ratio exceeds 1;
An encoding unit including, if the encoding condition is not satisfied, a second unit that encodes at least a first byte of the two bytes in an encoding mode with a compression ratio of 1 or less;
A lossless encoding device for data, comprising:
請求項19記載のデータの可逆符号化装置であって、
前記第2の手段は、
圧縮率が1以下の前記符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを生成する手段と、
前記接頭語として、前記先頭バイトの16進数表記が7F以下である場合に使用される1ビットの第1の接頭語と、前記先頭バイトの16進数表記が80以上である場合に使用される複数ビットの第2の接頭語とのいずれか一方から選択する手段と、を含む
データの可逆符号化装置。
20. The data lossless encoding device according to claim 19,
The second means includes:
Means for generating encoded data by combining a prefix indicating that encoding has been performed in the encoding mode with a compression ratio of 1 or less and the lower 7 bits of the first byte;
As the prefix, a 1-bit first prefix used when the hexadecimal notation of the first byte is 7F or less, and a plurality of prefixes used when the hexadecimal notation of the first byte is 80 or more. Means for selecting from one of a bit and a second prefix.
データの可逆符号化方法であって、
入力データ中において、連続した3バイトの両端のバイトデータが互いに一致する割合が所定の条件を満足するか否かを調べ、
前記一致する割合が所定の条件を満足する場合には、
(A)前記入力データ中の連続した2バイトが、圧縮率が1を超える符号化モードで符号化するための符号化条件を満足するか否かを判定する工程と、
(B)前記符号化条件が成立しない場合には、前記2バイトの少なくとも先頭バイトを、圧縮率が1以下の符号化モードで符号化する工程と、を実行することを特徴とするデータの可逆符号化方法。
A lossless encoding method for data,
In the input data, it is checked whether or not the rate at which the byte data at both ends of three consecutive bytes match each other satisfies a predetermined condition.
When the matching ratio satisfies a predetermined condition,
(A) determining whether two consecutive bytes in the input data satisfy an encoding condition for encoding in an encoding mode in which a compression ratio exceeds 1;
(B) encoding the at least the first byte of the two bytes in an encoding mode having a compression ratio of 1 or less when the encoding condition is not satisfied. Encoding method.
請求項9または21に記載のデータの可逆符号化方法であって、
前記工程(B)は、
圧縮率が1以下の前記符号化モードで符号化されたことを示す接頭語と、前記先頭バイトの下位7ビットとを組み合わせることによって符号化データを得る工程と、を含み、
前記入力データにおいて16進数表記が7F以下である第1のバイトデータ群の出現率と16進数表記が80以上である第2のバイトデータ群の出現率とを比較し、比較的出現率の高いバイトデータ群の各バイトデータの符号化においては1ビットの第1の接頭語を使用するとともに、比較的出現率の低いバイトデータ群の各バイトデータの符号化においては複数ビットの第2の接頭語を使用する、データの可逆符号化方法。
The data lossless encoding method according to claim 9 or 21,
In the step (B),
Obtaining encoded data by combining a prefix indicating that encoding is performed in the encoding mode with a compression ratio of 1 or less and lower 7 bits of the first byte,
The appearance rate of the first byte data group whose hexadecimal notation is 7F or less in the input data is compared with the appearance rate of the second byte data group whose hexadecimal notation is 80 or more, and the appearance rate is relatively high. In encoding each byte data of the byte data group, a 1-bit first prefix is used, and in encoding each byte data of the byte data group having a relatively low appearance rate, a second prefix of a plurality of bits is used. A lossless encoding method for data that uses words.
JP08395794A 1994-03-29 1994-03-29 Method and apparatus for lossless encoding of data Expired - Lifetime JP3603099B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP08395794A JP3603099B2 (en) 1994-03-29 1994-03-29 Method and apparatus for lossless encoding of data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP08395794A JP3603099B2 (en) 1994-03-29 1994-03-29 Method and apparatus for lossless encoding of data

Publications (2)

Publication Number Publication Date
JPH07271552A JPH07271552A (en) 1995-10-20
JP3603099B2 true JP3603099B2 (en) 2004-12-15

Family

ID=13817059

Family Applications (1)

Application Number Title Priority Date Filing Date
JP08395794A Expired - Lifetime JP3603099B2 (en) 1994-03-29 1994-03-29 Method and apparatus for lossless encoding of data

Country Status (1)

Country Link
JP (1) JP3603099B2 (en)

Also Published As

Publication number Publication date
JPH07271552A (en) 1995-10-20

Similar Documents

Publication Publication Date Title
JP3240495B2 (en) Lossless data encoding method and device, and decompression device
JP3009727B2 (en) Improved data compression device
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
TW312771B (en)
US5229768A (en) Adaptive data compression system
US6597812B1 (en) System and method for lossless data compression and decompression
US5874908A (en) Method and apparatus for encoding Lempel-Ziv 1 variants
KR100353171B1 (en) Method and apparatus for performing adaptive data compression
JPH07104971A (en) Compression method using small-sized dictionary applied to network packet
JPH0779262B2 (en) Encoding method of compressed data
JPH08288861A (en) Method for compression of data,method for release of the compression,and device for coding of data
JPH0779263B2 (en) Data compression method
JPH05183443A (en) Code conversion method
JP3603099B2 (en) Method and apparatus for lossless encoding of data
JP4093200B2 (en) Data compression method and program, and data restoration method and apparatus
JPH10341166A (en) Data compression method adaptive to data quantity
JP3105598B2 (en) Data compression method using universal code
JP4093193B2 (en) Data compression method and program, and data restoration method and apparatus
JP3143030B2 (en) Data compression method and device, and data decompression method and device
JP3708318B2 (en) Data compression / decompression apparatus and data compression / decompression method
JP3143029B2 (en) Data compression method and device, and data decompression method and device
JP2003318739A (en) System and method for compressing data sequence, and computer readable medium
JP3442105B2 (en) Data compression and decompression methods
JP2999561B2 (en) Data compression and decompression device
JPH0511973A (en) Data compression system using universal code

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040203

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040727

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A711

Effective date: 20040826

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040826

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20040826

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081008

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091008

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101008

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101008

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111008

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121008

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121008

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131008

Year of fee payment: 9

EXPY Cancellation because of completion of term