JPH08265167A - Data compression device - Google Patents
Data compression deviceInfo
- Publication number
- JPH08265167A JPH08265167A JP6234795A JP6234795A JPH08265167A JP H08265167 A JPH08265167 A JP H08265167A JP 6234795 A JP6234795 A JP 6234795A JP 6234795 A JP6234795 A JP 6234795A JP H08265167 A JPH08265167 A JP H08265167A
- Authority
- JP
- Japan
- Prior art keywords
- character
- input
- stored
- match
- matching
- 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.)
- Withdrawn
Links
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Transmission Systems Not Characterized By The Medium Used For Transmission (AREA)
Abstract
(57)【要約】
【目的】 データ圧縮装置の規模を小型化するととも
に、そのコストを低減することを目的とする。
【構成】 制御部102は、入力レジスタ101にスト
アされた入力文字が部分文字列の先頭文字であるか否か
判別し、この判別結果に応じて各一致位置ポインタ10
9〜112に保持させたアドレスを変更しながら、辞書
メモリ103から読み出した文字と入力文字を比較回路
106を用いて比較していくことで最大一致系列を検出
する。この最大一致系列の一致長は一致長カウンタ11
4によりカウントし、その一致長、及び減算器116か
ら出力されるそれの一致位置を一致フラグとともに符号
出力部115から出力させる。また、制御部102は、
入力ポインタ113の書込アドレスを変更しながら、入
力された文字を随時辞書メモリ103に書き込む。
(57) [Abstract] [Purpose] The objective is to reduce the size and size of the data compression device. Configuration: The control unit 102 determines whether or not the input character stored in the input register 101 is the first character of the partial character string, and according to the determination result, each matching position pointer 10
The maximum match sequence is detected by comparing the characters read from the dictionary memory 103 with the input characters using the comparison circuit 106 while changing the addresses held in 9 to 112. The match length of the maximum match sequence is the match length counter 11
The match length and the match position output from the subtractor 116 are output from the code output unit 115 together with the match flag. In addition, the control unit 102
While changing the write address of the input pointer 113, the input character is written in the dictionary memory 103 as needed.
Description
【0001】[0001]
【産業上の利用分野】本発明は、データを入力しながら
それを圧縮する技術に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a technique for inputting data and compressing it.
【0002】[0002]
【従来の技術】近年、コンピュータや通信等の各分野に
おいては扱うデータ量が急速に増大している。このデー
タ量の増大に伴い、データの記憶に要するコスト、電話
料金といった通信に要するコストが増大していることか
ら、このようなコストを抑えるために、データ列の中に
含まれる冗長性を取り除くことでそれを圧縮するデータ
圧縮技術が広く利用されてきている。データ圧縮技術
は、ファイル・アーカイバや分散ファイル・システム、
データ通信、音声・画像通信、コンピュータ・ネットワ
ークなどの分野では既に非常に重要な役割を果たしてお
り、これからさらにその重要度が増していくと考えられ
ている技術である。2. Description of the Related Art In recent years, the amount of data to be handled has rapidly increased in various fields such as computers and communications. Since the cost of storing data and the cost of communication such as telephone charges are increasing with the increase in the amount of data, the redundancy included in the data string is removed in order to suppress such costs. Therefore, data compression technology for compressing it has been widely used. Data compression technology is used for file archiver, distributed file system,
It is a technology that has already played a very important role in the fields of data communication, voice / image communication, computer networks, etc., and its importance is expected to increase in the future.
【0003】データ圧縮方式は、圧縮後のデータ列(圧
縮データ列)を元のデータ列(入力データ列)に復元す
る復号化を行った際の歪みの有無により、歪みを有する
有雑音圧縮(非可逆符号化)と、歪みがない無雑音圧縮
(可逆符号化)とに大別される。通常、有雑音圧縮は、
画像、音声といったある程度の歪みを許容できるデータ
に対して利用され、他方の無雑音圧縮は、ファイル(例
えばプログラム)や文書といった歪みが許されないデー
タに対して利用される。In the data compression method, noise-containing compression having distortion (depending on the presence or absence of distortion when decoding is performed to restore the compressed data string (compressed data string) to the original data string (input data string)) Lossy coding) and noiseless compression without distortion (reversible coding). Normally, noisy compression is
It is used for data that can tolerate some distortion such as images and sounds, while noiseless compression is used for data that does not allow distortion, such as files (eg programs) and documents.
【0004】無雑音圧縮として今日広く利用されている
ものに、Lempel−Ziv方式(以降、LZ方式と
記す)がある。このLZ方式は、文字列を読み込みなが
らその統計的な性質を抽出して符号化を行う、所謂適応
符号化方式の一種である。ここでの文字の定義は、符号
化対象である入力データ列の最小の処理単位のことであ
る。The Lempel-Ziv method (hereinafter referred to as the LZ method) is widely used today as noiseless compression. The LZ method is a kind of so-called adaptive coding method in which a character string is read and its statistical properties are extracted for coding. The definition of the character here is the minimum processing unit of the input data string to be encoded.
【0005】図5は、上記LZ方式を採用した従来のデ
ータ圧縮装置500の構成を示すブロック図である。こ
の図5を参照して、従来のデータ圧縮装置500につい
て説明する。FIG. 5 is a block diagram showing the configuration of a conventional data compression apparatus 500 which adopts the LZ method. A conventional data compression apparatus 500 will be described with reference to FIG.
【0006】このデータ圧縮装置500は、図5に示す
ように、外部から入力した入力データ列(文字列)IW
を記憶する入力メモリ501と、該入力メモリ501内
の符号化が終了した部分文字列が順次記憶される辞書メ
モリ502と、入力メモリ501から読み出された文字
を辞書メモリ502から読み出された文字と比較する比
較回路503と、装置500全体の制御を実行する制御
部504と、制御部504が生成した符号語が格納され
る符号メモリ505、及びフラグレジスタ506と、符
号メモリ505、及びフラグレジスタ506に格納され
た符号語を出力するために用いられる出力メモリ507
とから構成される。As shown in FIG. 5, this data compression device 500 has an input data string (character string) IW input from the outside.
Input memory 501, a dictionary memory 502 in which encoded partial character strings in the input memory 501 are sequentially stored, and a character read from the input memory 501 is read from the dictionary memory 502. A comparison circuit 503 for comparing with a character, a control unit 504 for controlling the entire apparatus 500, a code memory 505 in which a code word generated by the control unit 504 is stored, a flag register 506, a code memory 505, and a flag. Output memory 507 used to output the codeword stored in register 506
Composed of and.
【0007】上記の構成において、辞書メモリ502に
記憶された文字列は辞書として利用される。制御部50
4は、入力メモリ501、辞書メモリ502の文字を読
み出すアドレスを変更させながら、比較回路503を用
いて各メモリ501、502から読み出された文字が一
致するか否かを比較していくことにより、入力メモリ5
01の符号化の対象となっている部分文字列と一致する
辞書メモリ502の部分文字列(一致系列)を検索す
る。In the above structure, the character string stored in the dictionary memory 502 is used as a dictionary. Control unit 50
4 changes the addresses for reading characters in the input memory 501 and the dictionary memory 502, and compares the characters read from the memories 501 and 502 by using the comparison circuit 503 to compare whether or not the characters match. , Input memory 5
A partial character string (match sequence) in the dictionary memory 502 that matches the partial character string that is the target of encoding 01 is searched.
【0008】この制御部504による一致系列(部分文
字列)の検索は、例えば次のようにして行われる。先
ず、現時点の符号化を行う対象となっている部分文字列
の先頭文字と一致する文字を、辞書メモリ502の最も
過去に記憶された文字から順次探していき、この先頭文
字と一致する文字を見つける。先頭文字と一致する文字
を見つけると、その文字が記憶されているアドレス(以
降、一致位置と記す)を記憶した後、辞書メモリ502
のこの見つけた文字に続く文字と入力メモリ501の部
分文字列の先頭文字に続く文字とを順次比較していき、
一致すると比較した文字数(一致長)をカウントする。
このカウントは2つの文字が一致しないと比較するまで
継続して行い、カウントした値(一致長)は既に記憶し
た先頭アドレスと対応させて記憶する。これにより1つ
の一致系列の抽出が終了し、このような一致系列の抽出
を繰り返し行い、抽出した一致系列のなかからその一致
長が最大のものを最大一致系列として抽出する。The search for the matching sequence (partial character string) by the control unit 504 is performed as follows, for example. First, the character matching the first character of the partial character string to be encoded at the present time is sequentially searched from the character stored in the dictionary memory 502 in the earliest, and the character matching the first character is searched. locate. When a character that matches the first character is found, the address where that character is stored (hereinafter referred to as the matching position) is stored, and then the dictionary memory 502
The character following the found character of No. and the character following the first character of the partial character string of the input memory 501 are sequentially compared,
When they match, the number of characters compared (match length) is counted.
This counting is continuously performed until it is compared that the two characters do not match, and the counted value (match length) is stored in association with the already stored start address. As a result, the extraction of one matching series is completed, such matching series extraction is repeated, and the one with the largest matching length is extracted as the maximum matching series from the extracted matching series.
【0009】制御部504は、この検索を行った結果に
基づいて符号化を行う。具体的には、上記のようにして
見つけた最大一致系列の長さが所定数以上であった場
合、一致フラグに“1”をセットしてこれをフラグレジ
スタ506に格納し、該最大一致系列の一致位置、及び
その一致長を符号メモリ505に格納する。反対に符号
化対象である部分文字列の先頭文字と一致する文字が辞
書メモリ502に見つけられなかった場合を含め、最大
一致系列の長さが所定数未満であった場合、一致フラグ
に“0”をセットしてこれをフラグレジスタ506に格
納し、該先頭文字を表すデータ(例えば、ASCIIコ
ード)を符号メモリ505にそのまま格納する。The control unit 504 performs encoding based on the result of this search. Specifically, when the length of the maximum matching sequence found as described above is equal to or greater than a predetermined number, the matching flag is set to "1" and stored in the flag register 506, and the maximum matching sequence is stored. The matching position and the matching length are stored in the code memory 505. On the contrary, when the length of the maximum matching sequence is less than the predetermined number, including the case where the character matching the first character of the partial character string to be encoded is not found in the dictionary memory 502, the matching flag is set to "0". "" Is set and stored in the flag register 506, and the data (for example, ASCII code) representing the first character is stored in the code memory 505 as it is.
【0010】制御部504は、上記のようにして入力メ
モリ501の文字列に対する符号化を部分文字列に分け
て順次行うとともに、入力メモリ501、辞書メモリ5
02に記憶させる内容(文字列)を更新する。具体的に
は、例えば入力メモリ501のある部分文字列に対する
符号化が終了すると、この符号化が終了した部分文字列
を辞書メモリ502に新たに登録し、入力メモリ501
にはこの部分文字列の文字数分、入力データ列IWを新
たに書き込む。As described above, the control unit 504 divides the character string of the input memory 501 into partial character strings and sequentially performs the encoding, and also the input memory 501 and the dictionary memory 5
The contents (character string) stored in 02 are updated. Specifically, for example, when encoding of a partial character string in the input memory 501 is completed, the partial character string of which the encoding is completed is newly registered in the dictionary memory 502, and the input memory 501
In this case, the input data string IW is newly written for the number of characters of this partial character string.
【0011】また、制御部504は、フラグレジスタ5
06にそのビット数の一致フラグを格納すると、このフ
ラグレジスタ506、符号メモリ505に格納されてい
る内容を出力メモリ507に格納する。その後、この出
力メモリ507に格納された符号語を圧縮符号出力OW
として外部に出力する。The control unit 504 also includes a flag register 5
When the match flag of the number of bits is stored in 06, the contents stored in the flag register 506 and the code memory 505 are stored in the output memory 507. After that, the code word stored in the output memory 507 is compressed and outputted as a compressed code.
To the outside.
【0012】上記の動作を繰り返すことで入力データ列
(文字列)IWに対する圧縮が行われる。出力メモリ5
07から随時出力される圧縮符号出力OWは、例えば磁
気記憶装置に出力され、ここで磁気ディスク上に格納さ
れる。By repeating the above operation, the input data string (character string) IW is compressed. Output memory 5
The compressed code output OW that is output from 07 at any time is output to, for example, a magnetic storage device, and is stored on the magnetic disk here.
【0013】なお、圧縮符号出力(符号語)OWの復号
は、過去に復号化した文字列を辞書として利用し、一致
フラグの値が“0”のときは符号語が表す文字、その値
が“1”のときは辞書として記憶している復号した文字
列から符号語に応じて部分文字列を抽出して複写してい
くことで行われる。For decoding the compressed code output (code word) OW, the character string decoded in the past is used as a dictionary. When the value of the match flag is "0", the character represented by the code word and its value are When the value is "1", the partial character string is extracted from the decoded character string stored as a dictionary according to the code word and copied.
【0014】[0014]
【発明が解決しようとする課題】しかしながら、上述し
た従来のデータ圧縮装置500は、一致系列の抽出を繰
り返すことで最大一致系列を検索していることから、符
号化を行う文字列を記憶させておかなければならなかっ
た。符号化を行う文字列は入力メモリ501に記憶させ
ているが、このようなメモリを備えたことによって装置
500が大型化していたという問題点があった。However, since the above-described conventional data compression apparatus 500 searches for the maximum matching sequence by repeating the extraction of the matching sequence, the character string to be encoded is stored. I had to go. The character string to be encoded is stored in the input memory 501, but there is a problem that the apparatus 500 is upsized due to the provision of such a memory.
【0015】データ圧縮装置は、例えばコンピュータの
バスに接続して、その主記憶装置や外部記憶装置に記憶
させるデータの圧縮に利用される。このため、バス等に
接続して用いられるように、LSI(Large Scale Inte
grated Circuit)化が望まれている。このLSI化を容
易とし、また、そのコストを抑えられるように、その規
模が小さいデータ圧縮装置が望まれていた。The data compression device is connected to, for example, a bus of a computer and is used to compress data to be stored in the main storage device or an external storage device. For this reason, LSI (Large Scale Inte
grated circuit) is desired. A data compression device having a small scale has been desired so that the LSI can be easily made and the cost can be suppressed.
【0016】本発明の課題は、データ圧縮装置の規模を
小型化するとともに、そのコストを低減することにあ
る。An object of the present invention is to reduce the size of a data compression device and reduce its cost.
【0017】[0017]
【課題を解決するための手段】本発明のデータ圧縮装置
は、過去に入力された文字列を記憶する記憶手段を備
え、該記憶手段に記憶された文字列を参照し、繰り返し
入力された部分文字列を検出することで文字列を表すデ
ータ量の圧縮を行うことを前提とし、以下の手段を備え
る。A data compression apparatus according to the present invention comprises a storage means for storing a character string input in the past, and refers to the character string stored in the storage means to repeatedly input a part. The following means are provided on the premise that the amount of data representing a character string is compressed by detecting the character string.
【0018】先ず、文字判別手段は、入力された文字が
部分文字列の先頭文字であるか否かを判別する。一致位
置記憶手段は、文字判別手段が入力された文字を先頭文
字と判別したとき、該入力された文字と一致する文字が
記憶されている記憶手段のアドレスを一致位置として記
憶する。First, the character discriminating means discriminates whether or not the input character is the first character of the partial character string. When the character discriminating means discriminates the inputted character as the leading character, the coincident position storing means stores the address of the storing means in which the character coincident with the inputted character is stored as the coincident position.
【0019】読出手段は、先頭文字であると文字判別手
段が判別した文字に続く文字が入力される度に、該文字
の入力に応じて一致位置から順次アドレスを変更しなが
ら記憶手段に記憶されている文字を読み出す。The reading means stores each time a character following the character judged by the character judging means as the first character is inputted, the address is stored in the memory means while sequentially changing the address from the matching position in accordance with the input of the character. Read the character.
【0020】比較手段は、入力された文字と読出手段が
記憶手段から読み出した文字が一致するか否かを比較
し、書込手段は、文字が入力される度に、該入力された
文字を記憶手段に随時書き込む。The comparing means compares whether or not the input character and the character read from the storing means by the reading means match, and the writing means, each time a character is input, compares the input character with the input character. Write in the storage means at any time.
【0021】計数手段は、文字判別手段が入力された文
字を先頭文字と判別してから比較手段が一致すると比較
した回数を計数することで、記憶手段に記憶されている
部分文字列の長さを計数する。The counting means counts the number of times the character judging means judges the inputted character as the first character and then compares the characters when the comparing means agree with each other, thereby calculating the length of the partial character string stored in the storing means. Is counted.
【0022】符号生成手段は、文字判別手段が入力され
た文字を先頭文字と判別した後に比較手段の比較結果が
不一致となったとき、記憶手段に記憶されている部分文
字列を表す符号語を一致位置、計数手段が計数した文字
数から生成する。The code generation means, when the comparison result of the comparison means becomes inconsistent after the character discriminating means discriminates the inputted character as the leading character, the code generating means stores the code word representing the partial character string stored in the storing means. It is generated from the matching position and the number of characters counted by the counting means.
【0023】なお、上記の構成において、一致位置記憶
手段を複数備え、読出手段は、文字が入力される度に、
複数の一致位置記憶手段に記憶されているそれぞれの一
致位置から順次変更させたアドレスに記憶されている文
字を記憶手段から各々読み出し、比較手段は、読出手段
が記憶手段から文字を読み出す毎に、該記憶手段から読
みだされた文字と入力された文字を順次比較し、計数手
段は、読出手段が記憶手段から読み出した文字のなかで
比較手段が入力された文字と一致すると比較した文字が
あった場合に計数を1度行い、符号生成手段は、読出手
段が記憶手段から読み出した文字のなかで比較手段が入
力された文字と一致すると比較した文字がなかった場合
に、記憶手段に記憶されている部分文字列を表す符号語
を生成する、ことが望ましい。In the above construction, a plurality of coincidence position storing means are provided, and the reading means is provided with each time a character is input.
The characters stored at the addresses sequentially changed from the respective coincidence positions stored in the plurality of coincidence position storage means are read out from the storage means, respectively, and the comparison means, each time the reading means reads out the characters from the storage means, The characters read out from the storage means are sequentially compared with the input characters, and the counting means finds among the characters read out from the storage means by the reading means that the comparison means matches the input characters. In the case where there is no character compared with the character input by the comparison means among the characters read by the read means from the storage means, the code generation means stores it in the storage means. It is desirable to generate a codeword that represents a substring that has
【0024】[0024]
【作用】本発明のデータ圧縮装置は、文字が入力される
度に、該入力された文字が部分文字列の先頭文字に該当
するか否か判別し、該判別結果に応じてこの入力された
文字が辞書(記憶手段)に記憶されているか否か検索す
るとともに、この入力された文字を辞書に新たに登録し
ながら繰り返し入力された部分文字列を検出することで
符号化を行う。Each time a character is input, the data compression apparatus of the present invention determines whether or not the input character corresponds to the first character of the partial character string, and the input character is input according to the result of the determination. Encoding is performed by searching whether or not the character is stored in the dictionary (storage means), and by detecting the partial character string repeatedly input while newly registering the input character in the dictionary.
【0025】例えば、入力された文字が部分文字列の先
頭文字に該当すると判別した場合、この入力された文字
に一致する文字が記憶されている辞書のアドレス(一致
位置)を複数検索する。この入力された文字に続けて入
力される文字は、文字が入力される度に各一致位置から
連続させて変更させたアドレスから読み出したそれぞれ
の文字と一致するか否か比較し、これらの文字のなかで
一致すると比較された文字が入力された数をカウントし
ていくことで、最大一致系列、及びその一致長を確定す
る。最大一致系列が確定すると、その一致位置、一致長
から符号語を生成することで、この最大一致系列に対応
する入力された部分文字列の符号化を行う。この符号化
を行う一方、入力された文字は随時辞書に新たに登録す
る。For example, when it is determined that the input character corresponds to the first character of the partial character string, a plurality of addresses (matching positions) in the dictionary in which the character matching the input character is stored are searched. Each time a character is input, the characters that are input after this input character are compared to see if they match the respective characters read from the addresses that were changed consecutively from each matching position. Among them, the maximum matching sequence and its matching length are determined by counting the number of input characters that are compared and are compared. When the maximum matching sequence is determined, a codeword is generated from the matching position and the matching length to encode the input partial character string corresponding to this maximum matching sequence. While this encoding is performed, the input character is newly registered in the dictionary as needed.
【0026】上記のように、一致位置を検索しておくこ
とで文字の入力に合わせて随時符号化を行うことが可能
となり、また、入力された文字を辞書に随時登録するこ
とが可能となる。これにより、符号化対象の文字列を記
憶しておく必要性が回避され、メモリ数、及びその容量
の低減が可能となる。従って、装置の規模の小型化、及
びそのコストの低減が実現される。As described above, by searching for the matching position, it is possible to perform encoding at any time according to the input of the character, and it is possible to register the input character at any time in the dictionary. . This avoids the need to store the character string to be encoded and reduces the number of memories and the capacity thereof. Therefore, it is possible to reduce the size of the device and reduce its cost.
【0027】[0027]
【実施例】以下、本発明の実施例を、図面を参照しなが
ら詳細に説明する。図1は、本実施例によるデータ圧縮
装置100の構成を示すブロック図である。Embodiments of the present invention will now be described in detail with reference to the drawings. FIG. 1 is a block diagram showing the configuration of a data compression apparatus 100 according to this embodiment.
【0028】このデータ圧縮装置100における入力デ
ータ列IDは、特には図示しない外部装置(例えばCP
U)から、例えば1文字を8ビットで表現するASCI
Iコードで入力される。外部装置からは、入力データ列
IDは1ビットの書込信号とともに入力され、その書込
信号がアクティブになると、1文字の入力データ列ID
は入力レジスタ101にストアされる。The input data string ID in this data compression device 100 is an external device (not shown) such as CP.
U), for example, ASCII that represents one character in 8 bits
Input with I code. The input data string ID is input from the external device together with the 1-bit write signal, and when the write signal becomes active, the 1-character input data string ID is input.
Are stored in the input register 101.
【0029】書込信号は、入力レジスタ101の他に、
制御部102に入力される。制御部102は、装置10
0全体の制御を行うものであり、この書込信号がアクテ
ィブになる度に符号化処理(その動作は以下に説明す
る)を起動する。In addition to the input register 101, the write signal is
It is input to the control unit 102. The controller 102 controls the device 10
The control of 0 as a whole is performed, and the encoding process (the operation thereof will be described below) is activated each time the write signal becomes active.
【0030】入力レジスタ101にストアされている文
字(以降、入力文字と記す)は、データセレクタ10
4、及び前データレジスタ105に出力される。この前
データレジスタ105は、特には図示していないが、制
御部102から入力する書込信号がアクティブになるこ
とで入力文字(入力レジスタ101にストアされている
文字)をストアする。Characters stored in the input register 101 (hereinafter referred to as input characters) are the data selector 10
4 and the previous data register 105. Although not particularly shown, the previous data register 105 stores the input character (the character stored in the input register 101) when the write signal input from the control unit 102 becomes active.
【0031】データセレクタ104は、前データレジス
タ105、入力レジスタ101がストアしている文字を
各々入力し、制御部102からのセレクト信号に従って
選択した一方を比較回路106に出力する。比較回路1
06は、データセレクタ104から出力された文字と、
辞書メモリ103から読み出された文字とが一致するか
否かを比較し、この比較結果を制御部102に出力す
る。The data selector 104 inputs the characters stored in the previous data register 105 and the input register 101, respectively, and outputs one selected according to the select signal from the control unit 102 to the comparison circuit 106. Comparison circuit 1
06 is a character output from the data selector 104,
It compares whether or not the characters read from the dictionary memory 103 match, and outputs the comparison result to the control unit 102.
【0032】本実施例における辞書メモリ103は、4
Kbyteの記憶容量(辞書サイズ)を有し、過去に入
力された4Kbyte分の文字(符号化済入力)が記憶
される。辞書メモリ103の読出アドレス、書込アドレ
スは、アドレスセレクタ107に接続された各ポインタ
により指定される。The dictionary memory 103 in this embodiment has four
It has a storage capacity (dictionary size) of Kbytes and stores characters (coded input) for 4Kbytes input in the past. The read address and the write address of the dictionary memory 103 are designated by each pointer connected to the address selector 107.
【0033】このアドレスセレクタ107には、辞書先
頭ポインタ108、一致位置ポインタ109〜112、
及び入力ポインタ113の各ポインタが接続されてい
る。アドレスセレクタ107は制御部102からのセレ
クト信号に従ってこれらのなかから1つを選択する。The address selector 107 has a dictionary head pointer 108, matching position pointers 109 to 112,
And each pointer of the input pointer 113 is connected. The address selector 107 selects one of these according to a select signal from the control unit 102.
【0034】ここで、上記各ポインタについて、図2を
参照して説明する。図2は、各ポインタが示す辞書メモ
リ103上のアドレス例を示す図である。図2(a)
は、符号化済入力が辞書サイズ(本実施例では4Kby
te)よりも小さい場合、図2(b)は、符号化済入力
が辞書サイズよりも大きい場合を各々示し、斜線で示す
部分は文字が記憶されている領域を表している。また、
P1〜P4は、各々一致位置ポインタ109〜112が
指示(保持)しているアドレスの位置を示す。Here, each of the above pointers will be described with reference to FIG. FIG. 2 is a diagram showing an example of an address on the dictionary memory 103 indicated by each pointer. Figure 2 (a)
Indicates that the coded input is a dictionary size (4 Kby in this embodiment).
2 (b), the coded input is larger than the dictionary size, and the hatched portion represents the area in which characters are stored. Also,
P1 to P4 indicate the positions of the addresses designated (held) by the matching position pointers 109 to 112, respectively.
【0035】上記したように辞書メモリ103は、過去
に入力された4Kbyte分の文字が記憶されることか
ら、各ポインタ108〜113は12ビット(212=4
096)である。As described above, since the dictionary memory 103 stores the characters of 4 Kbytes input in the past, each of the pointers 108 to 113 has 12 bits (2 12 = 4).
096).
【0036】辞書先頭ポインタ108は、制御部102
から出力された、辞書メモリ103に記憶されている文
字列において最も過去に記憶された文字のアドレスを保
持する。このため、符号化済入力が辞書サイズよりも小
さい場合(図2(a)参照)、辞書先頭ポインタ108
は辞書メモリ103の先頭アドレスを示す値を保持し、
符号化済入力が辞書サイズよりも大きい場合、図2
(b)に示すように、辞書先頭ポインタ108が指示す
るアドレスは先頭アドレスとは限らず、辞書メモリ10
3上をそれに文字が書き込まれる度に移動(スライド)
する。The dictionary head pointer 108 is used by the control unit 102.
The character string stored in the dictionary memory 103, which is output from, holds the address of the oldest stored character. Therefore, when the encoded input is smaller than the dictionary size (see FIG. 2A), the dictionary head pointer 108
Holds a value indicating the start address of the dictionary memory 103,
If the encoded input is larger than the dictionary size, then FIG.
As shown in (b), the address designated by the dictionary head pointer 108 is not limited to the head address, and the dictionary memory 10
Move over 3 every time a letter is written to it (slide)
To do.
【0037】入力ポインタ113は、制御部102から
出力された、辞書メモリ103に新たに文字を書き込む
アドレスを保持する。このため、符号化済入力が辞書サ
イズよりも小さい場合(図2(a)参照)、入力ポイン
タ113には辞書メモリ103のまだ文字が書き込まれ
ていない領域の先頭を示すアドレスが保持され、符号化
済入力が辞書サイズよりも大きい場合、図2(b)に示
すように、最も過去に記憶された文字のアドレス、即ち
辞書先頭ポインタ108が保持しているアドレスと同じ
値が入力ポインタ113に保持される。The input pointer 113 holds an address output from the control unit 102 for writing a new character in the dictionary memory 103. Therefore, when the coded input is smaller than the dictionary size (see FIG. 2A), the input pointer 113 holds the address indicating the beginning of the area of the dictionary memory 103 in which no character is written, and the code is When the digitized input is larger than the dictionary size, as shown in FIG. 2B, the address of the character stored in the earliest, that is, the same value as the address held by the dictionary head pointer 108 is stored in the input pointer 113. Retained.
【0038】入力ポインタ113(辞書先頭ポインタ1
08)に保持されるアドレスは、辞書メモリ103を循
環させるように変更される。このため、辞書メモリ10
3には過去に入力された4Kbyte分の文字が常に記
憶される。Input pointer 113 (dictionary top pointer 1
The address held in 08) is changed so as to circulate the dictionary memory 103. Therefore, the dictionary memory 10
The character of 4 Kbytes input in the past is always stored in 3.
【0039】一致位置ポインタ109〜112は、辞書
メモリ103から文字を読み出すアドレスを保持するも
のであり、入力レジスタ101にストアされた入力文字
が部分文字列の先頭文字であると制御部102が判別し
たとき(この判別については後述する)、その入力文字
と一致する文字が記憶されているアドレス(一致位置)
を各々保持する。ここでは、以降の説明を簡単にするた
め、現在入力レジスタ101にストアされている入力文
字は先頭文字であるとし、この先頭文字と判別した入力
文字、この入力文字に続く文字が入力された際の制御部
102の動作を順次説明していくなかで、入力された文
字の種類の判別について説明することにする。The matching position pointers 109 to 112 hold addresses for reading characters from the dictionary memory 103, and the control unit 102 determines that the input character stored in the input register 101 is the first character of the partial character string. Address (matching position) where the character that matches the input character is stored
Hold each. Here, in order to simplify the following description, it is assumed that the input character currently stored in the input register 101 is the first character, and when the input character determined to be the first character and the character following the input character are input. As the operation of the control unit 102 is sequentially described, the determination of the type of the input character will be described.
【0040】本実施例では、上記一致位置の検索は辞書
先頭ポインタ108が示すアドレスから順次アドレスを
変更させながら行われる。一致位置ポインタ109に一
致位置を保持、即ち比較回路106の比較結果が一致を
示すと、制御部102はこのときの一致位置ポインタ1
09の値を一致位置ポインタ110にストアさせる。そ
の後、アドレスセレクタ107に一致位置ポインタ11
0を選択させ、一致位置ポインタ110をインクリメン
トしながら辞書メモリ103から読み出された文字を入
力文字と順次比較していくことにより、一致位置ポイン
タ110に一致位置を保持させる。以降、他の一致位置
ポインタ111、一致位置ポインタ112に対しても同
様に、一致位置を各々保持させる。In this embodiment, the search for the matching position is performed while sequentially changing the address from the address indicated by the dictionary head pointer 108. When the coincidence position is held in the coincidence position pointer 109, that is, when the comparison result of the comparison circuit 106 indicates coincidence, the control unit 102 causes the coincidence position pointer 1 at this time.
The value of 09 is stored in the coincidence position pointer 110. After that, the address selector 107
0 is selected, the character read from the dictionary memory 103 is sequentially compared with the input character while the matching position pointer 110 is incremented, and the matching position pointer 110 holds the matching position. After that, the matching positions are held similarly for the other matching position pointers 111 and 112.
【0041】上記した入力文字と一致する文字の検索
は、一致位置ポインタ109〜112の全てに一致位置
を保持させるか、或いは辞書メモリ103に記憶されて
いる文字を全て参照、即ち辞書先頭ポインタ108のア
ドレスから循環させて入力ポインタ113の直前のアド
レスまでの文字を参照することで終了する。一致位置を
保持する順序により、各一致位置ポインタ109〜11
2が保持する一致位置は図2(a)、及び(b)に示す
ようになる。To search for a character that matches the input character, all of the matching position pointers 109 to 112 hold the matching position, or all the characters stored in the dictionary memory 103 are referenced, that is, the dictionary head pointer 108. The process ends by referring to the characters up to the address immediately before the input pointer 113 by circulating from the address of. Each of the matching position pointers 109 to 11 depends on the order of holding the matching positions.
The matching positions held by 2 are as shown in FIGS. 2 (a) and 2 (b).
【0042】制御部102は、この検索の結果、入力レ
ジスタ101の入力文字と一致する文字を見つけた場
合、入力文字を前データレジスタ105にストアさせる
とともに、アドレスセレクタ107に入力ポインタ11
3を選択させ、入力ポインタ113が指示するアドレス
にこの入力文字を記憶させる。入力文字を辞書メモリ1
03に記憶させると、制御部102は一致位置を保持さ
せた一致位置ポインタ、辞書先頭ポインタ108、入力
ポインタ113をインクリメントし、その後、制御部1
02は外部装置に対して文字の出力を要求する。この外
部装置に対する文字の出力の要求は、例えばその旨を示
す割り込み信号を外部装置に送出することで行われる。When the control unit 102 finds a character that matches the input character of the input register 101 as a result of this search, it stores the input character in the previous data register 105 and causes the address selector 107 to input the input pointer 11.
3 is selected, and this input character is stored in the address designated by the input pointer 113. Input character dictionary memory 1
When it is stored in 03, the control unit 102 increments the match position pointer holding the match position, the dictionary head pointer 108, and the input pointer 113, and then the control unit 1
02 requests the external device to output characters. The request to output the character to the external device is made by, for example, sending an interrupt signal to that effect to the external device.
【0043】一方、上記の検索により入力文字と一致す
る文字が見つからなかった場合、制御部102は、
“0”をセットした一致フラグを符号出力部115に出
力するととともに、データセレクタ104を介してこの
入力文字を符号出力部115に出力させる。また、これ
に続いて入力文字を辞書メモリ103に書き込み、辞書
先頭ポインタ108、入力ポインタ113をインクリメ
ントした後、外部装置に次の文字の出力を要求する。こ
の場合、現時点の入力文字は符号化が終了しているの
で、制御部102は外部装置から次に入力する文字を先
頭文字と判別する。On the other hand, when the character matching the input character is not found by the above search, the control unit 102
The match flag in which “0” is set is output to the code output unit 115, and at the same time, the input character is output to the code output unit 115 via the data selector 104. Further, subsequently, the input character is written in the dictionary memory 103, the dictionary head pointer 108 and the input pointer 113 are incremented, and then the output of the next character is requested to the external device. In this case, since the input character at the present time has been encoded, the control unit 102 determines that the character input next from the external device is the first character.
【0044】外部装置から新たに次の文字が入力される
と、即ち入力レジスタ101に新たに文字がストアされ
ると、制御部102は、符号化処理を再開する。このと
き、1つ前の入力文字と一致する文字を辞書メモリ10
3内に見つけられなかった場合、上記したように、この
新たに入力された文字は先頭文字に該当することになる
ので、各一致位置ポインタ109〜112に一致位置を
保持させるための検索を再度行う。When the next character is newly input from the external device, that is, when a new character is stored in the input register 101, the control unit 102 restarts the encoding process. At this time, the character that matches the immediately preceding input character is set to the dictionary memory 10
If it is not found in 3, the newly input character corresponds to the first character, as described above, and the search for holding the matching position in each of the matching position pointers 109 to 112 is performed again. To do.
【0045】一方、例えば各一致位置ポインタ109〜
112に一致位置を保持させていた場合(実際は、これ
らのなかで一致位置を保持するポインタが1つでもあれ
ばよい)、各々インクリメントしておいた各一致位置ポ
インタ109〜112が指示するアドレスに記憶された
文字がこの新たに入力された文字と一致するか否かの比
較を、一致位置ポインタ109が指示するアドレスに記
憶された文字から順次行う。これは、アドレスセレクタ
107が選択するポインタを順次切り換えていくことで
行われる。On the other hand, for example, each matching position pointer 109-
When the matching position is held in 112 (actually, even if there is only one pointer holding the matching position among these), the incremented matching position pointers 109 to 112 indicate the addresses. The comparison of whether the stored character matches the newly input character is sequentially performed from the character stored at the address designated by the matching position pointer 109. This is performed by sequentially switching the pointers selected by the address selector 107.
【0046】上記比較を行った結果、各一致位置ポイン
タ109〜112が指示するアドレスから読み出された
文字のなかで入力文字と一致する文字がなかった場合、
制御部102は符号出力部115に“0”の一致フラグ
を出力するとともに、データセレクタ104を介して前
データレジスタ105の文字を符号出力部115に入力
させる。これにより、入力文字までの符号化が終了した
ことになるので、制御部102はこの入力文字を先頭文
字と判別し、上述した一致位置の検索を再び行う。As a result of the above comparison, when there is no character that matches the input character among the characters read from the addresses designated by the matching position pointers 109 to 112,
The control unit 102 outputs the coincidence flag of “0” to the code output unit 115 and causes the character of the previous data register 105 to be input to the code output unit 115 via the data selector 104. As a result, the encoding up to the input character has been completed, so the control unit 102 determines this input character as the first character, and performs the above-described matching position search again.
【0047】反対に、各一致位置ポインタ109〜11
2が指示するアドレスから読み出された文字のなかで入
力文字と一致する文字があった場合、制御部102は辞
書メモリ103に記憶されている一致系列の長さ(文字
数)をカウントさせる一致長カウンタ114をリセット
(“0”をセット)する。この一致長カウンタ114の
リセットを行うと、続いて入力文字を入力ポインタ11
3が指示するアドレスに書き込み、その後、入力文字と
一致する文字を指示した一致位置ポインタ、入力ポイン
タ113、辞書先頭ポインタ108を各々インクリメン
トし、現在の入力文字に続く文字が入力されるのを待
つ。On the contrary, the matching position pointers 109 to 11
If there is a character that matches the input character among the characters read from the address designated by 2, the control unit 102 counts the length (the number of characters) of the matching sequence stored in the dictionary memory 103. The counter 114 is reset (“0” is set). When the match length counter 114 is reset, the input character is subsequently input to the input pointer 11
3 is written to the address indicated by 3, and then the matching position pointer indicating the character that matches the input character, the input pointer 113, and the dictionary head pointer 108 are each incremented, and the character following the current input character is waited for input. .
【0048】一致長カウンタ114をリセットした以降
は、入力文字と一致する文字を読み出した一致位置ポイ
ンタだけをインクリメントしながら、辞書メモリ103
から読み出された文字が全て入力文字と一致しないと比
較回路106が比較するまで一致長カウンタ114のカ
ウントアップを継続して行う。このカウントアップを継
続している間、比較回路106による文字の比較が終了
した後に、入力文字の辞書メモリ103への書き込みが
行われる。After the match length counter 114 is reset, the dictionary memory 103 is incremented while incrementing only the match position pointer from which the character matching the input character is read out.
If not all the characters read from the input character match the input character, the match length counter 114 continues to count up until the comparison circuit 106 makes a comparison. While continuing this count-up, after the character comparison by the comparison circuit 106 is completed, the input character is written in the dictionary memory 103.
【0049】辞書メモリ103から読み出された文字が
全て入力文字と一致しなくなると、或いは予め設定され
ている最大一致長(後述する)まで一致長カウンタ11
4をカウントアップさせた後、次の文字が入力される
と、制御部102は、現時点で符号化を行っている部分
文字列の最大一致系列が確定したと判断し、符号出力部
115に“1”の一致フラグを出力する。また、符号出
力部115に対し、一致長カウンタ114からそのカウ
ント値(一致長)、減算器116からアドレスセレクタ
107の出力値から一致長カウンタ114のカウント値
に2を加算した値を減算した結果を順次入力させる。こ
のとき、各一致位置ポインタ109〜112のなかの最
後までインクリメントされていたものをアドレスセレク
タ107に選択させている。このため、減算器116の
減算結果は、各一致位置ポインタ109〜112に保持
されていた一致位置から始まる一致系列のなかの、最大
一致系列の一致位置となる。When all the characters read from the dictionary memory 103 do not match the input characters, or until the preset maximum matching length (described later) is reached, the matching length counter 11
When the next character is input after counting up 4, the control unit 102 determines that the maximum matching sequence of the partial character strings currently being encoded has been determined, and the code output unit 115 displays “ The match flag of "1" is output. Further, the result obtained by subtracting a value obtained by adding 2 to the count value of the match length counter 114 from the output value of the address selector 107 from the subtracter 116 to the code output unit 115 from the match length counter 114 and the count value (match length). Input sequentially. At this time, the address selector 107 is caused to select one of the matching position pointers 109 to 112 that has been incremented to the end. Therefore, the subtraction result of the subtracter 116 becomes the matching position of the maximum matching sequence among the matching sequences starting from the matching positions held in the respective matching position pointers 109 to 112.
【0050】このように最大一致系列が確定すると、入
力レジスタ101にストアされている入力文字よりも過
去に入力された文字までの符号化が終了したことになる
ので、制御部102はこの入力文字を先頭文字と判別す
る。このため、制御部102は、符号出力部115が一
致長カウンタ114のカウント値、減算器116の減算
結果を入力した後、上述したように、各一致位置ポイン
タ109〜112に一致位置を保持させるための検索を
行う。When the maximum matching sequence is determined in this way, the characters up to the character input earlier than the input character stored in the input register 101 have been encoded, so the control unit 102 determines Is determined to be the first character. Therefore, after the code output unit 115 inputs the count value of the match length counter 114 and the subtraction result of the subtractor 116, the control unit 102 causes each of the match position pointers 109 to 112 to hold the match position, as described above. Do a search for.
【0051】符号出力部115は、特には図示しない
が、例えばセレクタ、シフトレジスタ等から構成されて
おり、制御部102によって制御される。符号出力部1
15は、制御部102の制御に従ってセレクタの切り換
え、シフトレジスタのビットシフト等を行うことで、こ
のシフトレジスタに符号語として一致フラグ、及びその
一致フラグの値に応じて文字(ASCIIコード)、或
いは一致長(一致長カウンタ114のカウント値)及び
一致位置(減算器116出力)が順次格納される。シフ
トレジスタに格納された符号語は随時8ビット単位に切
り出されて外部に出力される。このシフトレジスタから
切り出されて出力されたものが圧縮符号出力ODであ
る。Although not particularly shown, the code output section 115 is composed of, for example, a selector, a shift register, etc., and is controlled by the control section 102. Code output unit 1
Reference numeral 15 performs selector switching, bit shift of the shift register, and the like according to the control of the control unit 102, so that the shift register has a match flag as a code word, and a character (ASCII code), or a character according to the value of the match flag. The match length (count value of the match length counter 114) and the match position (output of the subtractor 116) are sequentially stored. The code word stored in the shift register is cut out in 8-bit units at any time and output to the outside. The compressed code output OD is output by being cut out from this shift register.
【0052】ここで、この符号出力部115から出力さ
れる圧縮符号出力ODについて、図3を参照して説明す
る。図3は、圧縮符号出力ODのデータ形式を説明する
図である。The compressed code output OD output from the code output section 115 will be described with reference to FIG. FIG. 3 is a diagram for explaining the data format of the compression code output OD.
【0053】上記したように、本実施例では、入力され
た部分文字列と一致する部分文字列が辞書メモリ103
に記憶されているか否かにより、“1”、或いは“0”
が一致フラグにセットされ、図3に示すように、1ビッ
トで表される一致フラグの値により符号語のデータ形式
は互いに異なる。As described above, in this embodiment, the partial character string that matches the input partial character string is the dictionary memory 103.
"1" or "0" depending on whether it is stored in
Is set in the match flag, and as shown in FIG. 3, the data formats of the code words differ from each other depending on the value of the match flag represented by 1 bit.
【0054】一致フラグに“1”がセットされた場合、
その符号語は該一致フラグ、4ビットの一致長、及び1
2ビットの一致位置からなり、その語長は17ビットで
ある。一方、一致フラグに“0”がセットされた場合、
その符号語は該一致フラグ、及び8ビットで入力された
文字(不一致文字)からなり、その語長は9ビットであ
る。When "1" is set in the match flag,
The code word is the match flag, a match length of 4 bits, and 1
It consists of a 2-bit match position, and its word length is 17 bits. On the other hand, if "0" is set in the match flag,
The code word is composed of the match flag and a character (non-match character) input with 8 bits, and the word length is 9 bits.
【0055】本実施例では、上記したようなデータ形式
としていることから、元のデータ量よりも符号化を行っ
た後のデータ量が大きくならないように、入力された符
号化の対象となる部分文字列と2文字以上一致する部分
文字列が辞書メモリ103に記憶されていない場合、そ
の部分文字列の先頭文字は不一致文字と判断するように
している。このため、一致フラグに“1”がセットされ
た際の一致長は4ビットで2文字から17文字(最大一
致長)を表現させている。In the present embodiment, since the data format is as described above, the input portion to be encoded is prevented from becoming larger than the original data amount after encoding. When a partial character string that matches two or more characters with the character string is not stored in the dictionary memory 103, the first character of the partial character string is determined as a non-matching character. Therefore, when the match flag is set to "1", the match length is expressed by 4 bits from 2 to 17 characters (maximum match length).
【0056】以上が本実施例によるデータ圧縮装置10
0の概略圧縮動作である。次に、上述した圧縮動作につ
いて、具体例を挙げて説明する。図4は、データ圧縮装
置100の圧縮動作例を具体的に説明するための図であ
る。図中、同図(a)は入力データ列IDとして入力さ
れた入力文字列401、同図(b)は該入力文字列40
1における7番目の文字“B”が入力された際の各ポイ
ンタ108〜113が示す辞書メモリ103上のアドレ
ス、同図(c)は該入力文字列401が入力されたこと
で出力される圧縮符号出力ODを各々示す。The above is the data compression apparatus 10 according to the present embodiment.
This is a rough compression operation of 0. Next, the above-described compression operation will be described with a specific example. FIG. 4 is a diagram for specifically explaining a compression operation example of the data compression device 100. In the figure, (a) is the input character string 401 input as the input data string ID, and (b) is the input character string 40.
The address on the dictionary memory 103 indicated by each of the pointers 108 to 113 when the seventh character "B" in 1 is input, and FIG. 6C shows the compression output when the input character string 401 is input. The code output OD is shown respectively.
【0057】図4(a)に示す入力文字列401は、入
力データ列IDとして左から右に向かって1文字ずつ順
次入力レジスタ101にストアされる。この入力文字列
401において、現在7番目の文字“B”が現在入力値
としてこの入力レジスタ101にストアされていること
を表している。The input character string 401 shown in FIG. 4A is sequentially stored in the input register 101 as the input data string ID, one character at a time from left to right. In the input character string 401, the seventh character “B” is currently stored in the input register 101 as the current input value.
【0058】図4(b)に示すように、この7番目の文
字“B”が入力レジスタ101にストアされていると
き、入力された文字は随時辞書メモリ103に書き込む
ことから、辞書メモリ103には辞書先頭ポインタ10
8が指示するアドレスからそれ以前に入力された6文字
が順次記憶されている。As shown in FIG. 4B, when the seventh character "B" is stored in the input register 101, the input character is written in the dictionary memory 103 at any time. Is the dictionary top pointer 10
Six characters previously input from the address designated by 8 are sequentially stored.
【0059】1〜5番目の文字“AB=0;”は、各々
それが始めて入力された種類であることから、制御部1
02はこれらの文字を辞書メモリ103から検索するこ
とができない。このため、これら1〜5番目の各文字は
全て不一致文字と判断され、入力レジスタ101からデ
ータセレクタ104を介して符号出力部115に出力さ
れることで、“0”がセットされた一致フラグとその文
字とからなる符号語(圧縮符号出力OD)として符号出
力部115から出力される(図4(c)参照)。Since the first to fifth characters "AB = 0;" are the types that were input for the first time, the control unit 1
02 cannot retrieve these characters from the dictionary memory 103. Therefore, each of the first to fifth characters is determined to be a non-matching character, and is output from the input register 101 to the code output unit 115 via the data selector 104, whereby a match flag in which “0” is set is set. It is output from the code output unit 115 as a code word (compressed code output OD) including the characters (see FIG. 4C).
【0060】一方、6番目の文字“B”は2番目に入力
された文字と一致するので、辞書メモリ103を検索し
た結果、図4(b)においてP1で示す2番目の文字が
書き込まれているアドレス(一致位置)が一致位置ポイ
ンタ109に保持される。7番目の文字“B”が入力す
ると、インクリメントされた一致位置ポインタ109が
指示するアドレスから読み出された3番目の文字とこの
7番目の文字は比較回路106によって比較されるが、
これらの文字は一致しないので、6番目の文字は不一致
文字と判断される。このとき、6番目の文字は前データ
レジスタ105にストアされており、この6番目の文字
はデータセレクタ104を介して符号出力部115に出
力され、“0”がセットされた一致フラグが付加されて
出力される。On the other hand, the sixth character "B" matches the second input character, and as a result of searching the dictionary memory 103, the second character indicated by P1 in FIG. 4B is written. The present address (match position) is held in the match position pointer 109. When the seventh character “B” is input, the third character read from the address indicated by the incremented coincidence position pointer 109 and this seventh character are compared by the comparison circuit 106.
Since these characters do not match, the sixth character is determined to be a non-matching character. At this time, the sixth character is stored in the previous data register 105, and the sixth character is output to the code output unit 115 via the data selector 104, and the match flag with "0" set is added. Is output.
【0061】上記したように、7番目の文字は3番目の
文字と一致しないので、制御部102はこの7番目の文
字を先頭文字と判別し、これと一致する文字を辞書メモ
リ103から検索する。7番目の文字は、2番目、及び
6番目の文字と一致しているので、この検索の結果、図
4(b)においてP1で示す2番目の文字が書き込まれ
ているアドレス(一致位置)が一致位置ポインタ109
に保持され、また、図4(b)においてP2で示す6番
目の文字が書き込まれているアドレス(一致位置)が一
致位置ポインタ119に保持される。この検索が終了す
ると、制御部102はこの7番目の文字を辞書メモリ1
03の入力ポインタ113が指示するアドレスに書き込
み、一致位置ポインタ109、110、辞書先頭ポイン
タ108、入力ポインタ113の各ポインタをインクリ
メントした後、次の文字(8番目の文字“=”)の入力
を待つ。As described above, since the 7th character does not match the 3rd character, the control unit 102 determines that this 7th character is the first character, and searches the dictionary memory 103 for the matching character. . Since the 7th character matches the 2nd and 6th characters, as a result of this search, the address (matching position) where the 2nd character indicated by P1 in FIG. Match position pointer 109
Further, the address (match position) where the sixth character P2 in FIG. 4B is written is held in the match position pointer 119. Upon completion of this search, the control unit 102 sets the seventh character to the dictionary memory 1
03 at the address indicated by the input pointer 113, incrementing each of the matching position pointers 109 and 110, the dictionary head pointer 108, and the input pointer 113, and then inputting the next character (eighth character “=”). wait.
【0062】8番目の文字が入力すると、この8番目の
文字は各々インクリメントされた一致位置ポインタ10
9、110が指示するアドレスから読み出された文字、
即ち3番目、7番目の文字と順次比較される。8番目の
文字は7番目の文字と一致しないが、3番目の文字とは
一致するので、制御部102は一致長カウンタ114を
ここでリセットし、また、この入力された8番目の文字
を入力ポインタ113が指示するアドレスに書き込む。
その後、一致位置ポインタ109、辞書先頭ポインタ1
08、入力ポインタ113を各々インクリメントした
後、次の文字(9番目の文字“0”)の入力を待つ。When the eighth character is input, this eighth character is incremented by the matching position pointer 10
Characters read from the address specified by 9, 110,
That is, the third and seventh characters are sequentially compared. The 8th character does not match the 7th character but does match the 3rd character, so the control unit 102 resets the match length counter 114 here, and also inputs this input 8th character. Write to the address designated by the pointer 113.
After that, the matching position pointer 109 and the dictionary head pointer 1
After incrementing 08 and the input pointer 113 respectively, the input of the next character (the ninth character "0") is awaited.
【0063】図4(a)に示すように、9〜10番目の
文字“0;”は、4〜5番目の文字と一致している。こ
のため、以降、11番目の文字“C”が入力されるま
で、制御部102は一致位置ポインタ109をインクリ
メントしながら、この一致位置ポインタ109が指示す
るアドレスから読み出した文字と入力された文字とを順
次比較することになる。この結果、11番目の文字が入
力されるまで一致長カウンタ114のカウントアップは
行われ、この11番目の文字が入力された時点の一致長
カウンタ114のカウント値は“2”となる。また、辞
書メモリ103の先頭アドレス値を“0”と想定する
と、この時の一致位置ポインタ109の値は“5”であ
る。As shown in FIG. 4A, the 9th to 10th characters "0;" match the 4th to 5th characters. Therefore, thereafter, until the eleventh character “C” is input, the control unit 102 increments the coincidence position pointer 109 and detects the character read from the address designated by the coincidence position pointer 109 and the input character. Will be compared sequentially. As a result, the match length counter 114 is counted up until the eleventh character is input, and the count value of the match length counter 114 at the time when the eleventh character is input is "2". Further, assuming that the head address value of the dictionary memory 103 is "0", the value of the coincidence position pointer 109 at this time is "5".
【0064】11番目の文字が入力すると、この文字は
一致位置ポインタ109が指示するアドレスの文字、即
ち6番目の文字と比較される。図4(a)に示すよう
に、この両者は一致しないので、比較回路106は不一
致と比較した結果を制御部102に出力する。制御部1
02は、比較回路106からこの比較結果を入力する
と、最大一致系列が確定したと判断し、続けて、この最
大一致系列の一致長が2文字以上であるか否か、即ち一
致フラグを“1”とした符号語を生成させるか否か判断
する。この場合、最大一致系列は図4(b)にP1で示
す一致位置を先頭としたその文字数が4つの部分文字列
なので、制御部102は“1”をセットした一致フラグ
を符号出力部115に出力する。また、符号出力部11
5に一致長カウンタ114のカウント値、及び減算器1
16の減算結果を順次入力させる。When the eleventh character is input, this character is compared with the character at the address indicated by the matching position pointer 109, that is, the sixth character. As shown in FIG. 4A, since the two do not match, the comparison circuit 106 outputs the result of comparison with the mismatch to the control unit 102. Control unit 1
When the comparison result is input from the comparison circuit 106, 02 determines that the maximum matching sequence has been determined, and subsequently determines whether the matching length of this maximum matching sequence is 2 characters or more, that is, the matching flag is set to "1". It is determined whether or not to generate a code word with "." In this case, the maximum matching sequence is a partial character string having four characters starting from the matching position indicated by P1 in FIG. 4B, and therefore the control unit 102 sends the matching flag set to “1” to the code output unit 115. Output. Further, the code output unit 11
5, the match length counter 114 count value, and the subtracter 1
The 16 subtraction results are sequentially input.
【0065】このとき、制御部102は、アドレスセレ
クタ107に一致位置ポインタ109を選択させてい
る。従って、減算器116から符号出力部115に出力
される減算結果は図4(b)のP1を示す値である。At this time, the control unit 102 causes the address selector 107 to select the coincidence position pointer 109. Therefore, the subtraction result output from the subtractor 116 to the code output unit 115 is a value indicating P1 in FIG.
【0066】図4(c)は、入力文字列401の10番
目の文字までを符号化した際の圧縮符号出力ODを示し
ている。入力文字列401を符号化対象とした場合、上
述したように圧縮動作(符号化処理)が行われるので、
図4(c)に示すように、一致フラグに“0”がセット
されている符号語が6つ続き、7番目で符号語の一致フ
ラグに“1”がセットされる。FIG. 4C shows the compression code output OD when the tenth character up to the input character string 401 is encoded. When the input character string 401 is to be encoded, the compression operation (encoding process) is performed as described above.
As shown in FIG. 4C, six codewords in which the match flag is set to "0" continue, and at the seventh position, the matchword of the codeword is set to "1".
【0067】この7番目の符号語は、7〜10番目の4
文字からなる部分文字列を表したものである。上述した
ように、一致長は2文字を“0”として順次カウントア
ップさせた値なので、このときの一致長は“2”であ
る。符号語として出力する一致位置は実際の一致位置と
しているので、このときの一致位置は“1”である(こ
れは辞書メモリ103の先頭アドレスを“0”としたと
きの値である)。この図4(c)に示す圧縮符号出力O
Dは、符号出力部115のシフトレジスタに格納された
符号語を8ビット単位で切り出すことで符号出力部11
5から随時出力される。This 7th code word is the 7th-10th 4th
It represents a substring of characters. As described above, the match length is a value obtained by sequentially counting up two characters as "0", and thus the match length at this time is "2". Since the matching position output as the code word is the actual matching position, the matching position at this time is "1" (this is the value when the start address of the dictionary memory 103 is "0"). The compression code output O shown in FIG.
D outputs the code word stored in the shift register of the code output unit 115 by cutting out the code word in units of 8 bits.
It is output from 5 at any time.
【0068】このように、本実施例は、符号化の対象と
なる部分文字列の先頭文字が記憶されている辞書メモリ
103の一致位置を確定し、その先頭文字に続く文字が
入力される度に、この文字の入力に対応させてその一致
位置から変更させたアドレスに記憶されている文字と新
たに入力された文字とを随時比較していくことで符号化
を行うため、符号化が済んでいない文字を記憶させるた
めのメモリが不要となり、装置においてメモリが占める
割合を小さくすることができる。これにより、装置の規
模、及びそのコストを抑えることができ、LSI化も容
易となるので、本発明はコンピュータのバス等に直結し
て利用するデータ圧縮装置等に対して広く適用すること
ができる。As described above, in this embodiment, the matching position of the dictionary memory 103 in which the first character of the partial character string to be encoded is stored is determined, and the character following the first character is input. In addition, since the character stored in the address changed from the matching position corresponding to the input of this character and the newly input character are compared with each other as needed, the encoding is completed. A memory for storing non-printed characters is not needed, and the ratio of the memory in the device can be reduced. As a result, the size and cost of the device can be suppressed, and the LSI can be easily implemented. Therefore, the present invention can be widely applied to a data compression device or the like that is directly connected to a bus of a computer and used. .
【0069】また、本実施例では、符号出力部115を
用いて随時圧縮符号出力ODを外部に出力させている。
このため、図5に示す従来のデータ圧縮装置500と比
較すると、備えたメモリ数が低減、即ち入力メモリ50
1、符号メモリ505等を備えなくともよいことから、
装置各部の個々の制御を簡易化することができるという
効果もある。Further, in the present embodiment, the code output section 115 is used to output the compressed code output OD as needed.
Therefore, as compared with the conventional data compression device 500 shown in FIG. 5, the number of memories provided is reduced, that is, the input memory 50.
1, since the code memory 505 and the like need not be provided,
There is also an effect that individual control of each part of the device can be simplified.
【0070】一方、符号化に要する処理時間についてこ
の両者を比較すると、一致系列の抽出の打ち切りかた、
用いる一致位置ポインタ数といった両者の最大一致系列
の検索方法の違いにもよるが、データの入力に要する処
理時間が全体に占める割合は小さいことから、基本的に
はその処理時間に大きな差は発生しない。On the other hand, comparing the two with respect to the processing time required for encoding, how to terminate the extraction of the coincidence sequence
Although it depends on the difference in the maximum matching sequence search method between the two, such as the number of matching position pointers used, the processing time required for data input occupies a small proportion of the total processing time, so basically a large difference occurs in the processing time. do not do.
【0071】なお、本実施例では、一致位置を保持する
一致位置ポインタの数を4つとしているが、この数はこ
れに限定したものではない。一致位置ポインタ数が少な
い程、データ圧縮を高速に行うことはできるが、この一
方で圧縮比(=圧縮後のデータ量/圧縮前のデータ量)
が大きくなるという不具合が発生し易くなる。データ圧
縮に要求する処理速度、符号化の対象となるファイルの
種類等にもよるが、上記圧縮比が大きくなるのを抑える
ためには、この数を4つ以上とすることが望ましい。In this embodiment, the number of matching position pointers holding the matching position is four, but the number is not limited to this. The smaller the number of matching position pointers, the faster the data compression can be, but the compression ratio (= the amount of data after compression / the amount of data before compression)
Is more likely to occur. Although it depends on the processing speed required for data compression, the type of file to be encoded, and the like, it is desirable to set this number to four or more in order to prevent the compression ratio from increasing.
【0072】また、本実施例では、辞書メモリ103の
各アドレスを保持させる各種ポインタ108〜113を
備えているが、例えばこれらのポインタの役割を制御部
102に行わせてもよく、また、一致長カウンタ11
4、減算器116の役割を制御部102に行わせてもよ
い。このように、本発明は圧縮符号出力ODのデータ形
式を含めて柔軟に適用させることができるものである。Further, in the present embodiment, various pointers 108 to 113 for holding each address of the dictionary memory 103 are provided, but for example, the control unit 102 may be made to play the role of these pointers, and the pointers match. Long counter 11
4. The control unit 102 may be caused to play the role of the subtractor 116. As described above, the present invention can be flexibly applied including the data format of the compression code output OD.
【0073】[0073]
【発明の効果】以上、説明したように本発明によれば、
文字が入力される度に、該入力された文字が部分文字列
の先頭文字に該当するか否か判別し、該判別結果に応じ
てこの入力された文字が辞書(記憶手段)に記憶されて
いるか否か検索することで繰り返し入力された部分文字
列を検出するため、文字の入力に合わせて随時文字列の
符号化を行うことができ、また、入力された文字を随時
辞書に登録することができる。これにより、符号化対象
の文字列を記憶しておく必要性を回避され、装置の規模
を小型化するとともに、そのコストを低減することがで
きる。As described above, according to the present invention,
Each time a character is input, it is determined whether or not the input character corresponds to the first character of the partial character string, and the input character is stored in the dictionary (storage means) according to the determination result. Since the substrings that have been repeatedly input are detected by searching for the presence or absence of the characters, the character strings can be encoded at any time according to the input of characters, and the input characters can be registered in the dictionary at any time. You can As a result, it is possible to avoid the need to store the character string to be encoded, reduce the size of the device, and reduce the cost.
【0074】また、先頭文字に該当すると判別した文字
と一致する文字が記憶されている辞書の一致位置を複数
抽出して上記の検索を行うようにすることで、圧縮比が
大きくなるのを抑えることができる。Further, it is possible to prevent the compression ratio from increasing by extracting a plurality of matching positions in the dictionary in which the character matching the character determined to correspond to the first character is stored and performing the above search. be able to.
【図1】本実施例によるデータ圧縮装置の構成を示すブ
ロック図である。FIG. 1 is a block diagram showing the configuration of a data compression apparatus according to this embodiment.
【図2】各ポインタが示す辞書メモリ上のアドレス例を
示す図である。FIG. 2 is a diagram showing an example of an address on a dictionary memory indicated by each pointer.
【図3】圧縮符号出力のデータ形式を説明する図であ
る。FIG. 3 is a diagram illustrating a data format of compressed code output.
【図4】圧縮動作例を具体的に説明するための図であ
る。FIG. 4 is a diagram for specifically explaining a compression operation example.
【図5】従来のデータ圧縮装置の構成を示すブロック図
である。FIG. 5 is a block diagram showing a configuration of a conventional data compression device.
100 データ圧縮装置 101 入力レジスタ 102 制御部 103 辞書メモリ 106 比較回路 107 アドレスセレクタ 108 辞書先頭ポインタ 109〜112 一致位置ポインタ 113 入力ポインタ 114 一致長カウンタ 115 出力制御部 116 減算器 100 Data Compressor 101 Input Register 102 Control Unit 103 Dictionary Memory 106 Comparison Circuit 107 Address Selector 108 Dictionary Start Pointer 109-112 Match Position Pointer 113 Input Pointer 114 Match Length Counter 115 Output Control Unit 116 Subtractor
Claims (3)
手段を備え、該記憶手段に記憶された文字列を参照し、
繰り返し入力された部分文字列を検出することで文字列
を表すデータ量の圧縮を行うデータ圧縮装置であって、 入力された文字が部分文字列の先頭文字であるか否かを
判別する文字判別手段と、 前記文字判別手段が入力された文字を先頭文字と判別し
たとき、該入力された文字と一致する文字が記憶されて
いる前記記憶手段のアドレスを一致位置として記憶する
一致位置記憶手段と、 前記先頭文字であると前記文字判別手段が判別した文字
に続く文字が入力される度に、該文字の入力に応じて前
記一致位置から順次アドレスを変更しながら前記記憶手
段に記憶されている文字を読み出す読出手段と、 入力された文字と前記記憶手段から読み出された文字が
一致するか否かを比較する比較手段と、 前記文字判別手段が入力された文字を先頭文字と判別し
てから前記比較手段が一致すると比較した回数を計数す
ることで、前記記憶手段に記憶されている部分文字列の
長さを計数する計数手段と、 前記文字判別手段が入力された文字を先頭文字と判別し
た後、前記比較手段の比較結果が不一致となったとき、
前記記憶手段に記憶されている部分文字列を表す符号語
を前記一致位置、前記計数手段が計数した文字数から生
成する符号生成手段と、 を具備したことを特徴とするデータ圧縮装置。1. A storage means for storing a character string input in the past is provided, and the character string stored in the storage means is referred to,
A data compression device that compresses the amount of data that represents a character string by detecting repeatedly input partial character strings, and determines whether the input character is the first character of the partial character string. A matching position storage unit that stores, as a matching position, an address of the storage unit in which a character matching the input character is stored when the character determining unit determines the input character as a leading character. Each time a character following the character discriminated by the character discriminating means is inputted as the first character, it is stored in the storage means while sequentially changing the address from the coincident position according to the input of the character. The reading means for reading out the character, the comparing means for comparing the inputted character with the character read out from the storing means, and the character for judging the input character Counting means for counting the length of the partial character string stored in the storage means by counting the number of times that the comparison means has matched after determining that the character is input, and the character determination means is input. After the character is discriminated as the first character, and when the comparison result of the comparison means does not match,
A data compression apparatus comprising: a code generation unit that generates a code word representing a partial character string stored in the storage unit from the coincidence position and the number of characters counted by the counting unit.
字を前記記憶手段に随時書き込む書込手段を、 さらに具備したことを特徴とする請求項1記載のデータ
圧縮装置。2. The data compression apparatus according to claim 1, further comprising a writing unit that writes the input character into the storage unit whenever the character is input.
致位置記憶手段に記憶されているそれぞれの一致位置か
ら順次変更させたアドレスに記憶されている文字を前記
記憶手段から各々読み出し、 前記計数手段は、前記読出手段が前記記憶手段から読み
出した文字のなかで前記比較手段が入力された文字と一
致すると比較した文字があった場合に計数を1度行い、 前記符号生成手段は、前記読出手段が前記記憶手段から
読み出した文字のなかで前記比較手段が入力された文字
と一致すると比較した文字がなかった場合に、前記記憶
手段に記憶されている部分文字列を表す符号語を生成す
る、 ことを特徴とする請求項1、または2記載のデータ圧縮
装置。3. A plurality of the matching position storage means are provided, and the reading means sets an address sequentially changed from each matching position stored in the plurality of matching position storage means each time a character is input. When each of the stored characters is read out from the storage means, and the counting means finds among the characters read out from the storage means by the reading means a character that is compared with the input character by the comparing means. When the reading means reads out from the storage means and there is no character that the comparing means compares with the input character, the code generating means performs the counting once. The data compression apparatus according to claim 1 or 2, wherein a code word representing a partial character string stored in is generated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP6234795A JPH08265167A (en) | 1995-03-22 | 1995-03-22 | Data compression device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP6234795A JPH08265167A (en) | 1995-03-22 | 1995-03-22 | Data compression device |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH08265167A true JPH08265167A (en) | 1996-10-11 |
Family
ID=13197510
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP6234795A Withdrawn JPH08265167A (en) | 1995-03-22 | 1995-03-22 | Data compression device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH08265167A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010154156A (en) * | 2008-12-25 | 2010-07-08 | Casio Electronics Co Ltd | Data compressing apparatus |
-
1995
- 1995-03-22 JP JP6234795A patent/JPH08265167A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010154156A (en) * | 2008-12-25 | 2010-07-08 | Casio Electronics Co Ltd | Data compressing apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5659737A (en) | Methods and apparatus for data compression that preserves order by using failure greater than and failure less than tokens | |
US5870036A (en) | Adaptive multiple dictionary data compression | |
US5883588A (en) | Data compression system and data compression device for improving data compression rate and coding speed | |
CA2007168C (en) | Variable length string matcher | |
JP2534465B2 (en) | Data compression apparatus and method | |
EP0129439B1 (en) | High speed data compression and decompression apparatus and method | |
US5151697A (en) | Data structure management tagging system | |
US8255398B2 (en) | Compression of sorted value indexes using common prefixes | |
US5049881A (en) | Apparatus and method for very high data rate-compression incorporating lossless data compression and expansion utilizing a hashing technique | |
US5440753A (en) | Variable length string matcher | |
JP3234104B2 (en) | Method and system for searching compressed data | |
US6819271B2 (en) | Parallel compression and decompression system and method having multiple parallel compression and decompression engines | |
US5363098A (en) | Byte aligned data compression | |
US20010026231A1 (en) | Apparatus for repeatedly compressing a data string and a method thereof | |
US20050192994A1 (en) | Data compression method and apparatus | |
US10224957B1 (en) | Hash-based data matching enhanced with backward matching for data compression | |
EP0688104A2 (en) | Data compression method and apparatus | |
US20060106870A1 (en) | Data compression using a nested hierarchy of fixed phrase length dictionaries | |
JPH0855008A (en) | Method and system for compression of data using system generation dictionary | |
JP2001345710A (en) | Data compression apparatus and method | |
US10146817B2 (en) | Inverted index and inverted list process for storing and retrieving information | |
CN111611250A (en) | Data storage device, data query method, data query device, server and storage medium | |
CN111817722A (en) | Data compression method and device and computer equipment | |
US5815096A (en) | Method for compressing sequential data into compression symbols using double-indirect indexing into a dictionary data structure | |
US5394143A (en) | Run-length compression of index keys |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20020604 |