JP2005269184A - Data compressing process, program, data recovery method, and apparatus - Google Patents

Data compressing process, program, data recovery method, and apparatus Download PDF

Info

Publication number
JP2005269184A
JP2005269184A JP2004078056A JP2004078056A JP2005269184A JP 2005269184 A JP2005269184 A JP 2005269184A JP 2004078056 A JP2004078056 A JP 2004078056A JP 2004078056 A JP2004078056 A JP 2004078056A JP 2005269184 A JP2005269184 A JP 2005269184A
Authority
JP
Japan
Prior art keywords
length
matching
identification information
match
sequence
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.)
Granted
Application number
JP2004078056A
Other languages
Japanese (ja)
Other versions
JP4093193B2 (en
Inventor
Kuniaki Ueki
國明 植木
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 JP2004078056A priority Critical patent/JP4093193B2/en
Publication of JP2005269184A publication Critical patent/JP2005269184A/en
Application granted granted Critical
Publication of JP4093193B2 publication Critical patent/JP4093193B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a data compressing method based on an LZ77 code which can improve a compression rate, and to provide a data compressing method which time duration does not require for processing of data compression and restoration. <P>SOLUTION: The data compression method includes the steps of retrieving the maximum length coincidence sequence coincident longest to sequence to a signature sequence for encoding existing in the coded signature sequence, encoding based on the position coincident to the longest sequence and the length coincident to the length of the longest sequence, and compressing the data. The sign formed by the encoding includes a code representing the sign about the length of the represent sign in length and the coincident length of the represent sign, the sign representing the coincident position, and the sign representing the coincident length. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、符号化済みの記号列との一致に基づいて符号化することにより、データを圧縮する方法等に関し、特に、データ圧縮率を向上させることができ、データ圧縮及び復元の処理に時間のかからないデータ圧縮方法等に関する。   The present invention relates to a method of compressing data by encoding based on a match with an encoded symbol string, and in particular, it can improve a data compression rate and spend time on data compression and decompression processing. The present invention relates to a data compression method that does not cost.

近年、情報処理技術の発達やインターネット等のネットワークの普及により、膨大なデータが処理されると共に通信されるようになってきている。例えば、ホストコンピュータからネットワークを介してプリンタに印刷を実行させるということが一般によく行われ、また、プリンタの処理速度も随時向上してきているが、ホストコンピュータからプリンタに送信する印刷データの容量が大きい場合にはその通信に時間がかかってしまい、プリンタの処理速度を十分に生かすことができないという事態も発生する。従って、データを如何に圧縮して送信し、受信後、如何に復元するかというデータの圧縮及び復元技術が必要となってくる。   In recent years, with the development of information processing technology and the spread of networks such as the Internet, a huge amount of data has been processed and communicated. For example, it is a common practice to cause a printer to execute printing from a host computer via a network, and the processing speed of the printer is improved as needed, but the capacity of print data transmitted from the host computer to the printer is large. In some cases, the communication takes time, and the processing speed of the printer cannot be fully utilized. Therefore, a data compression and decompression technique is required for how data is compressed and transmitted and how it is restored after reception.

かかるデータの圧縮及び復元技術としては、従来から、その目的や対象データにより幾つかのものが提案されている。その一つとして、LZ77(Ziv and Lempel(1977))符号を用いた方法がある。かかる手法では、現在符号化を行なっている記号(データ)の前後の記号列をバッファに保存し、このバッファを辞書として参照して、符号化しようとしている記号列と一致する、最長の記号列を当該辞書内で探索する。そして、探索された記号列の長さと位置の情報により対象の記号列を符号化する。   Conventionally, several data compression and decompression techniques have been proposed depending on the purpose and target data. One of them is a method using an LZ77 (Ziv and Lempel (1977)) code. In this method, a symbol string before and after a symbol (data) that is currently encoded is stored in a buffer, and this buffer is referred to as a dictionary, and the longest symbol string that matches the symbol string to be encoded is stored. In the dictionary. Then, the target symbol string is encoded based on the length and position information of the searched symbol string.

このLZ77方式にも様々なバリエーションが開発されており、例えば、下記非特許文献1に記載されたLZSS符号を用いた方法は現在頻繁に用いられている。かかる方法は、前記一致する最長記号列の長さが所定の値より小さい場合には、元の記号をそのまま符号とし、即ち、上述の一致記号列の長さと位置による符号化は行なわず、一致する最長記号列の長さが所定の値より大きい場合には、上述の一致記号列の長さと位置による符号化を行なう。そして、両者を区別するためのフラグを符号の先頭に付加する。   Various variations have been developed for the LZ77 system. For example, a method using an LZSS code described in Non-Patent Document 1 below is frequently used. In this method, when the length of the matching longest symbol string is smaller than a predetermined value, the original symbol is used as it is, that is, the above matching symbol string is not encoded according to the length and position. When the length of the longest symbol string to be performed is larger than a predetermined value, the above-described encoding based on the length and position of the matching symbol string is performed. Then, a flag for distinguishing both is added to the head of the code.

また、このようなLZ77方式のデータ圧縮方法について、圧縮率の向上などの目的により幾つかの提案がなされている(例えば、下記特許文献1及び2)。
特開平5−11973号公報 特開平7−261977号公報 植松友彦著、「文書データ圧縮アルゴリズム入門」、第2版、CQ出版、1995年6月、p.145−148
Further, several proposals have been made for such an LZ77 data compression method for the purpose of improving the compression ratio (for example, Patent Documents 1 and 2 below).
Japanese Patent Laid-Open No. 5-11973 JP 7-261977 A Tomohiko Uematsu, “Introduction to Document Data Compression Algorithm”, Second Edition, CQ Publishing, June 1995, p. 145-148

しかしながら、上述したLZSS符号では、前記一致する最長記号列の位置(以下、一致位置と呼ぶ)と長さ(以下、一致長さと呼ぶ)を固定長さの符号(ビット列)で表現しているので、データの圧縮率があまりよくないという課題があった。   However, in the above-described LZSS code, the position (hereinafter referred to as the matching position) and the length (hereinafter referred to as the matching length) of the longest matching symbol string are expressed by a fixed-length code (bit string). There was a problem that the data compression rate was not so good.

また、上記特許文献1には、辞書内の一致する記号列に出現番号なるものを付けて、この出現番号を上記一致位置として出力することにより、データ圧縮率の向上を図ろうとする方法が記載されているが、かかる方法では、圧縮されたデータの復号の際にも、一致する記号列の出現位置を検索によって求める必要があり、復元の処理に時間がかかってしまうという問題があった。   Further, Patent Document 1 describes a method for improving the data compression rate by attaching an appearance number to a matching symbol string in the dictionary and outputting the appearance number as the matching position. However, such a method has a problem in that it takes time for the restoration process because it is necessary to obtain the appearance position of the matching symbol string by searching even when the compressed data is decoded.

また、上記特許文献2には、上記一致位置と一致長さを、スプレイ木により動的に変化する符号で表現し、圧縮率の向上を図る技術が示されているが、符号を動的に変更するため、圧縮、復元共に処理が複雑であり、それらの処理に時間がかかるという課題があった。   Further, in Patent Document 2, a technique for expressing the matching position and the matching length with a code that dynamically changes according to a spray tree and improving the compression ratio is shown. Because of the change, both the compression and decompression processes are complicated, and there is a problem that these processes take time.

そこで、本発明の目的は、LZ77符合に基づくデータ圧縮方法であって、圧縮率を改善でき、また、データ圧縮及び復元の処理に時間のかからないデータ圧縮方法等を提供することである。   Therefore, an object of the present invention is to provide a data compression method based on the LZ77 code, which can improve the compression rate, and that does not take time for data compression and decompression processing.

上記の目的を達成するために、本発明の一つの側面は、符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮するデータ圧縮方法であって、前記符号化によって生成される符号が、前記一致位置を表す符号の長さと前記一致長さを表す符号の長さとを表す符号と、前記一致位置を表す符号と、前記一致長さを表す符号と、から構成されることを特徴とする。従って、本発明によれば、一致位置を表す符号と一致長さを表す符号の長さを必要最低限の長さとすることができ、データ圧縮率の向上を図ることができる。   In order to achieve the above object, one aspect of the present invention is to search for a longest match sequence having a maximum length match with a symbol string to be encoded, existing in an encoded symbol string, and to perform the longest match. A data compression method for compressing data by performing encoding based on a match position that is a sequence existing position and a match length that is a length of the longest match sequence, wherein the code generated by the encoding is It is characterized by comprising a code representing the length of the code representing the coincidence position and the length of the code representing the coincidence length, a code representing the coincidence position, and a code representing the coincidence length. Therefore, according to the present invention, the length of the code representing the coincidence position and the code representing the coincidence length can be set to the minimum necessary length, and the data compression rate can be improved.

更に、上記の発明において、その好ましい態様は、前記一致位置を表す符号が、前記一致位置を表す値を2進法で表現した場合の最上位の1を除いたものであり、前記一致長さを表す符号が、前記一致長さを表す値を2進法で表現した場合の最上位の1を除いたものであることを特徴とする。これにより、データ圧縮率を高めることができる。   Further, in the above invention, a preferable aspect thereof is that the code representing the coincidence position is obtained by removing the most significant 1 when the value representing the coincidence position is expressed in a binary system, and the coincidence length. Is a code obtained by removing the most significant 1 when the value representing the matching length is expressed in binary. Thereby, the data compression rate can be increased.

上記の目的を達成するために、本発明の別の側面は、符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮するデータ圧縮方法であって、前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により前記符号化を行い、前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により前記符号化を行なうことを特徴とする。従って、本発明によれば、復元が容易であり、かつ、圧縮率の高いデータ圧縮を可能とする。   In order to achieve the above object, another aspect of the present invention is to search for a longest matching sequence having a maximum length match with a symbol string to be encoded, existing in an encoded symbol string, and to perform the longest match. A data compression method for compressing data by encoding based on a match position that is a sequence existing position and a match length that is a length of the longest match sequence, wherein the length of the longest match sequence is a predetermined length If the value is smaller than the value, the encoding is performed with the first identification information having a predetermined length indicating that the original symbol is smaller than the predetermined value, and the length of the longest matching sequence is the predetermined value. If the value is greater than or equal to the value, the same as the first identification information indicating that the value is greater than or equal to the predetermined value, the length of the match position information indicating the match position, and the length of the match length information indicating the match length Second identification information of length, the matching position information, and the matching length And broadcasting, by and performing the coding. Therefore, according to the present invention, it is possible to perform data compression that is easy to restore and has a high compression rate.

更に、上記の発明において、その好ましい態様は、前記一致位置情報が、前記一致位置を表す値を2進法で表現した場合の最上位の1を除いたものであり、前記一致長さ情報が、前記一致長さを表す値を2進法で表現した場合の最上位の1を除いたものであることを特徴とする。   Furthermore, in the above-described invention, a preferable aspect thereof is that the matching position information is obtained by removing the highest-order 1 when the value representing the matching position is expressed in binary, and the matching length information is The value representing the matching length is obtained by excluding the most significant 1 when expressed in binary.

更に、上記の発明において、好ましい態様は、前記第一識別情報及び又は第二識別情報がハフマン符号化されることを特徴とする。これにより、さらにデータ圧縮率を高めることが可能となる。   Furthermore, in the above invention, a preferred aspect is characterized in that the first identification information and / or the second identification information is Huffman-encoded. As a result, the data compression rate can be further increased.

上記の目的を達成するために、本発明の別の側面は、符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮する処理をコンピュータに実行させるデータ圧縮プログラムが、前記最長一致系列の長さが、所定の値以上であるか否かを判定する第一ステップと、前記第一ステップにおいて、前記最長一致系列の長さが前記所定の値以上でないと判定された場合には、当該所定の値以上でない旨と元の記号を表す、所定長さの第一識別情報により前記符号化を行う第二ステップと、前記第一ステップにおいて、前記最長一致系列の長さが前記所定の値以上であるなと判定された場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により前記符号化を行う第三ステップとを、前記コンピュータに実行させることである。   In order to achieve the above object, another aspect of the present invention is to search for a longest matching sequence having a maximum length match with a symbol string to be encoded, existing in an encoded symbol string, and to perform the longest match. A data compression program that causes a computer to execute a process of encoding and compressing data based on a match position that is the position of a sequence and a match length that is the length of the longest match sequence is the length of the longest match sequence Is determined to be greater than or equal to a predetermined value, and in the first step, when it is determined that the length of the longest match sequence is not equal to or greater than the predetermined value, In the second step of performing the encoding with the first identification information of a predetermined length, which represents that the original symbol is not greater than or equal to the value, and in the first step, the length of the longest match sequence is greater than or equal to the predetermined value It is determined that there is no In this case, the length is equal to or more than the predetermined value, the length of the matching position information indicating the matching position, and the length of the matching length information indicating the matching length, and the same length as the first identification information. And causing the computer to execute a third step of performing the encoding by using second identification information, the matching position information, and the matching length information.

上記の目的を達成するために、本発明の別の側面は、符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化されたデータを復元するデータ復元方法であって、前記復元対象のデータが、前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により符号化され、前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により符号化されている場合に、前記第一識別情報あるいは第二識別情報の長さである前記所定長さ分の符号を解釈し、当該符号が第一識別情報であるかあるいは第二識別情報であるかを判断する第一ステップと、前記第一ステップにおいて、第一識別情報であると判断された場合には、当該第一識別情報に含まれる前記元の記号に復号する第二ステップと、前記第一ステップにおいて、第二識別情報であると判断された場合には、当該第二識別情報に基づいて前記一致位置情報と一致長さ情報の長さを求める第三ステップと、前記第二識別情報に続く、前記第三ステップで求められた前記一致位置情報の長さ分の符号から、前記一致位置を求める第四ステップと、前記一致位置情報に続く、前記第三ステップで求められた前記一致長さ情報の長さ分の符号から、前記一致長さを求める第五ステップと、前記第四及び第五ステップで求められた一致位置と一致長さに基づいて、復号済みの記号列を用いて復号する第六ステップとを有することを特徴とする。従って、本発明によれば、上述のように符号化されたデータを、容易に復元することが可能となる。   In order to achieve the above object, another aspect of the present invention is to search for a longest matching sequence having a maximum length match with a symbol string to be encoded, existing in an encoded symbol string, and to perform the longest match. A data restoration method for restoring data encoded based on a match position that is a position of a sequence and a match length that is a length of the longest match sequence, wherein the data to be restored is the longest match sequence If the length of the longest matching sequence is smaller than the predetermined value, the length of the longest matching sequence is encoded with the first identification information of a predetermined length indicating that the length is smaller than the predetermined value and the original symbol. Is equal to or greater than the predetermined value, indicates that it is equal to or greater than the predetermined value, the length of the matching position information indicating the matching position, and the length of the matching length information indicating the matching length, Second identification information having the same length as one identification information, and the matching position information And the matching length information, the code corresponding to the predetermined length which is the length of the first identification information or the second identification information is interpreted, and the code is the first identification A first step for determining whether the information is information or second identification information; and if the first step determines that the identification information is first identification information, the source included in the first identification information In the second step of decoding into the symbol of the above, and in the first step, if it is determined that the second identification information, the length of the matching position information and the matching length information based on the second identification information A third step for obtaining the matching position, a fourth step for obtaining the matching position from the code for the length of the matching position information obtained in the third step, and the matching position information. Next, in the third step The fifth step for obtaining the match length from the code corresponding to the length of the match length information obtained, and decoding based on the match position and the match length obtained in the fourth and fifth steps And a sixth step of decoding using the symbol string. Therefore, according to the present invention, it is possible to easily restore the data encoded as described above.

上記の目的を達成するために、本発明の別の側面は、符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化されたデータを復元するデータ復元装置が、復号済みの記号列を格納する記号列格納手段と、前記復元対象のデータが、前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により符号化され、前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により符号化されている場合に、前記第一識別情報あるいは第二識別情報の長さである前記所定長さ分の符号により、当該符号が第一識別情報であるかあるいは第二識別情報であるかを判断し、第一識別情報であると判断された場合には、当該第一識別情報に含まれる前記元の記号に復号し、第二識別情報であると判断された場合には、当該第二識別情報に基づいて前記一致位置情報と一致長さ情報の長さを求め、当該第二識別情報に続く、前記求められた一致位置情報の長さ分の符号と前記求められた一致長さ情報の長さ分の符号から、前記一致位置と前記一致長さを求め、前記求められた一致位置と一致長さに基づいて、前記記号列格納手段に格納された記号列を用いて復号する、復号手段とを備えることである。   In order to achieve the above object, another aspect of the present invention is to search for a longest matching sequence having a maximum length match with a symbol string to be encoded, existing in an encoded symbol string, and to perform the longest match. A data restoration device that restores data encoded based on a match position that is a sequence existing position and a match length that is a length of the longest match sequence, and a symbol string storage unit that stores a decoded symbol string When the length of the longest matching sequence is smaller than a predetermined value, the first identification information having a predetermined length represents that the data to be restored is smaller than the predetermined value and the original symbol. When the length of the longest match sequence is equal to or greater than the predetermined value, the length of the match position information indicating the match position and the match length are expressed. Same as the first identification information, indicating the length of the matching length information. The predetermined length that is the length of the first identification information or the second identification information when encoded by the second identification information of the length, the matching position information, and the matching length information The code of minutes determines whether the code is first identification information or second identification information, and if it is determined to be first identification information, the first identification information includes the When the original symbol is decoded and determined to be the second identification information, the length of the matching position information and the matching length information is obtained based on the second identification information, and the second identification information is Subsequently, from the code for the length of the obtained match position information and the code for the length of the obtained match length information, the match position and the match length are obtained, and the obtained match position Based on the matching length, the symbol string stored in the symbol string storage means is used. Decoding Te, it is to include a decoding means.

本発明の更なる目的及び、特徴は、以下に説明する発明の実施の形態から明らかになる。   Further objects and features of the present invention will become apparent from the embodiments of the invention described below.

以下、図面を参照して本発明の実施の形態例を説明する。しかしながら、かかる実施の形態例が、本発明の技術的範囲を限定するものではない。なお、図において、同一又は類似のものには同一の参照番号又は参照記号を付して説明する。 Embodiments of the present invention will be described below with reference to the drawings. However, such an embodiment does not limit the technical scope of the present invention. In the drawings, the same or similar elements are denoted by the same reference numerals or reference symbols.

図1は、本発明を適用したデータ圧縮装置の実施の形態例に係る構成図である。また、図2は、本発明を適用したデータ復元装置の実施の形態例に係る構成図である。図1及び図2に示すデータ圧縮装置1及びデータ復元装置2が、本発明に係るデータ圧縮方法及び復元方法を用いた装置である。本データ圧縮装置1のデータ圧縮方法は、LZ77符号の考え方を基本としているが、符号化に用いる前記一致位置と一致長さを固定長さの符号(ビット列)で表現せず、一致位置と一致長さを表現する符号の長さ(ビット数)の情報を、それらの符号の前に付けて符号化を行うと共に、一致位置と一致長さを表現する符号の長さを極力短くすることにより、データの圧縮率を改善しようとするものである。また、本データ復元装置2のデータ復元方法は、上記圧縮時に付加された、一致位置と一致長さを表現する符号長さの情報に基づいて、一致位置と一致長さの情報を容易に取得し、それらの情報から元の記号列に復号するものであり、処理に時間のかからない復元処理を実現するものである。   FIG. 1 is a configuration diagram according to an embodiment of a data compression apparatus to which the present invention is applied. FIG. 2 is a configuration diagram according to an embodiment of a data restoration apparatus to which the present invention is applied. The data compression apparatus 1 and the data decompression apparatus 2 shown in FIGS. 1 and 2 are apparatuses using the data compression method and the decompression method according to the present invention. The data compression method of the data compression apparatus 1 is based on the concept of the LZ77 code, but does not represent the coincidence position and coincidence length used for encoding with a fixed-length code (bit string) but coincides with the coincidence position. By encoding information with the length (number of bits) of the codes representing the lengths in front of those codes, and shortening the length of the codes representing the matching position and the matching length as much as possible It is intended to improve the data compression rate. In addition, the data restoration method of the data restoration device 2 easily obtains the information on the match position and the match length based on the code length information representing the match position and the match length added at the time of compression. In addition, the information is decoded into the original symbol string, and a restoration process that does not take much time is realized.

図1に示すように、データ圧縮装置1は、入力バッファ11、符号化部12、及び辞書バッファ13から構成され、入力されるデータを符号化してデータ容量を圧縮する装置である。ここで、入力される符号化前のデータのことを記号(列)と呼ぶこととし、本実施の形態例においては、各記号、例えば、図1の入力バッファ11内の“A”、“B”など、は8ビットのデータであるものとする。また、処理後の符号は、2進法による“0”又は“1”のビット列で表現される。   As shown in FIG. 1, the data compression apparatus 1 is composed of an input buffer 11, an encoding unit 12, and a dictionary buffer 13, and encodes input data to compress the data capacity. Here, input data before encoding is referred to as a symbol (column). In this embodiment, each symbol, for example, “A”, “B” in the input buffer 11 of FIG. "Etc." are assumed to be 8-bit data. Further, the processed code is expressed by a bit string of “0” or “1” in binary.

入力バッファ11は、符号化対象の記号列を順次受け入れて格納するデータバッファであり、符号化が終了した記号列を順次辞書バッファ13に引き渡す。また、入力バッファ11の長さ(図1のL2)、即ち、格納可能な記号の数は、本実施の形態例では258であるものとする。この長さL2は、前記一致長さ(例えば、図1のl)の最大値を意味するものである。   The input buffer 11 is a data buffer that sequentially receives and stores symbol strings to be encoded, and sequentially transfers the symbol strings that have been encoded to the dictionary buffer 13. The length of the input buffer 11 (L2 in FIG. 1), that is, the number of symbols that can be stored is 258 in the present embodiment. This length L2 means the maximum value of the matching length (for example, 1 in FIG. 1).

辞書バッファ13は、符号化済みの記号列を上記入力バッファ11から順次受け入れて格納するデータバッファであり、LZ77方式において所謂辞書と呼ばれているものである。ここに格納された記号列は、入力バッファ11内の符号化処理対象の記号列と比較され、この中から入力バッファ11内の記号列と一致する最大長の記号列(以下、最長一致系列と呼ぶ)が探索される。辞書バッファ13では、符号化部12における符号化が終了する度に、符号化が済んだ記号列を受け入れて、先頭にある(図1の左側に位置する)その分の記号列が不要の記号として吐き出される。また、辞書バッファ13の長さ(図1のL1)、即ち、格納可能な記号の数は、本実施の形態例では16384(16K)であるものとする。この長さL1は、前記一致位置を表す距離(例えば、図1のd)の最大値を意味するものである。図1に示す例では、最長一致系列が“ABCD”であり、その長さである一致長さがlであり、その一致位置がpであるということになる。   The dictionary buffer 13 is a data buffer that sequentially receives encoded symbol strings from the input buffer 11 and stores them, and is called a so-called dictionary in the LZ77 system. The symbol string stored here is compared with the symbol string to be encoded in the input buffer 11, and the maximum length symbol string that matches the symbol string in the input buffer 11 (hereinafter referred to as the longest matching sequence). Is called). In the dictionary buffer 13, every time encoding in the encoding unit 12 is completed, the encoded symbol string is accepted, and the symbol string at the head (located on the left side in FIG. 1) is unnecessary. Will be exhaled. Further, the length of the dictionary buffer 13 (L1 in FIG. 1), that is, the number of symbols that can be stored is 16384 (16K) in the present embodiment. This length L1 means the maximum value of the distance (for example, d in FIG. 1) representing the coincidence position. In the example shown in FIG. 1, the longest matching sequence is “ABCD”, the matching length which is the length thereof is l, and the matching position is p.

次に、符号化部12は、当該データ圧縮装置1における記号列の入力、符号化、及び符号の出力に係る全般の制御を行なう部分であるが、主に、辞書バッファ13を参照しながら、入力バッファ11内の記号列を符号化する処理を実行する。かかる符号化部12が行なう符号化処理に特徴があり、その具体的な内容については後述する。なお、符号化部12は、処理の手順を示したプログラムとそのプログラムに従って処理を実行するCPU等で構成してもよいし、ハードウェア回路で構成してもよい。   Next, the encoding unit 12 is a part that performs general control related to the input, encoding, and output of the symbol string in the data compression apparatus 1, mainly referring to the dictionary buffer 13, A process of encoding the symbol string in the input buffer 11 is executed. The encoding process performed by the encoding unit 12 is characterized, and the specific contents thereof will be described later. The encoding unit 12 may be configured by a program indicating a processing procedure, a CPU that executes processing according to the program, or may be configured by a hardware circuit.

図2に示すように、データ復元装置2もデータ圧縮装置1と同様の構成をしており、入力バッファ21、復号部22(復号手段)、及び辞書バッファ23(記号列格納手段)を備えている。本データ復元装置2は、前記データ圧縮装置1で圧縮されたデータ(符号)を元の記号列のデータに復元する装置である。入力バッファ21は、処理対象の符号を順次受け入れて格納するデータバッファである。辞書バッファ23は、復号済みの記号列を復号部22から順次受け入れて格納するデータバッファである。ここに格納された記号列は、復号部22による復号処理時に参照され、復号処理に利用される。辞書バッファ23では、復号部22における処理が終了する度に、復号された記号列を受け入れて、先頭にある(図2の右側に位置する)その分の記号列が不要の記号として吐き出される。また、辞書バッファ23の長さ(サイズ)は、データ圧縮装置1の辞書バッファ13の長さL1と同じである。   As shown in FIG. 2, the data decompression device 2 has the same configuration as the data compression device 1, and includes an input buffer 21, a decoding unit 22 (decoding means), and a dictionary buffer 23 (symbol string storage means). Yes. The data restoration device 2 is a device for restoring the data (code) compressed by the data compression device 1 to the original symbol string data. The input buffer 21 is a data buffer that sequentially receives and stores codes to be processed. The dictionary buffer 23 is a data buffer that sequentially receives and stores decoded symbol strings from the decoding unit 22. The symbol string stored here is referred to during the decoding process by the decoding unit 22 and is used for the decoding process. In the dictionary buffer 23, every time the processing in the decoding unit 22 is completed, the decoded symbol string is accepted, and the corresponding symbol string at the head (located on the right side in FIG. 2) is spouted as an unnecessary symbol. Further, the length (size) of the dictionary buffer 23 is the same as the length L1 of the dictionary buffer 13 of the data compression apparatus 1.

また、辞書バッファ23内の状態は、その時に復号部22において処理対象となっている符号が、データ圧縮装置1において符号化された時の辞書バッファ13の状態と一緒の状態となっている。図1に示す例で“ABCD”という記号列が、一致位置p(又はd)と一致長さlに基づいて符号化された場合に、当該符号がデータ復元装置2によって復号処理される際には、辞書バッファ23内の状態は図2に示すような状態になっている。即ち、辞書バッファ23の左端から距離dの位置pより“ABCD”の順番に(図2では逆方向に表現されている)記号列が納められる。従って、復号部22は、符号から取得される一致位置p(又はd)と一致長さlの情報に基づいて“ABCD”と復号することができる。   Further, the state in the dictionary buffer 23 is the same as the state of the dictionary buffer 13 when the code to be processed in the decoding unit 22 at that time is encoded in the data compression apparatus 1. In the example shown in FIG. 1, when the symbol string “ABCD” is encoded based on the matching position p (or d) and the matching length l, when the code is decoded by the data restoration device 2. The state in the dictionary buffer 23 is as shown in FIG. That is, the symbol strings (expressed in the reverse direction in FIG. 2) are stored in the order of “ABCD” from the position p at a distance d from the left end of the dictionary buffer 23. Therefore, the decoding unit 22 can decode “ABCD” based on the matching position p (or d) acquired from the code and the matching length l.

復号部22は、当該データ復元装置2における符号の入力、復号、及び記号の出力に係る全般の制御を行なう部分であるが、主に、辞書バッファ23を参照しながら、入力バッファ21内の符号を復号する処理を実行する。かかる復号部22が行なう復号処理の具体的な内容については後述する。なお、復号部22は、処理の手順を示したプログラムとそのプログラムに従って処理を実行するCPU等で構成してもよいし、ハードウェア回路で構成してもよい。   The decoding unit 22 is a part that performs general control related to code input, decoding, and symbol output in the data restoration device 2, and mainly refers to the code in the input buffer 21 while referring to the dictionary buffer 23. The process which decodes is performed. Specific contents of the decoding process performed by the decoding unit 22 will be described later. The decoding unit 22 may be configured by a program showing a processing procedure, a CPU that executes processing according to the program, or may be configured by a hardware circuit.

図3は、データ圧縮装置1の符号化部12が行なう処理の内容を例示したフローチャートである。以下、図3に基づいて、本データ圧縮装置1で行なわれる圧縮処理の具体的な内容について説明する。まず、処理対象の記号列が順番に入力バッファ11に読み込まれる(ステップS10)。次に、符号化部12は、入力バッファ11に格納された先頭位置(図1では、左端位置)からの記号列について、辞書バッファ13内に格納された記号列との一致を探索する(ステップS11)。即ち、前述した最長一致系列を検索する。   FIG. 3 is a flowchart illustrating the contents of the process performed by the encoding unit 12 of the data compression apparatus 1. Hereinafter, based on FIG. 3, the specific content of the compression process performed by this data compression apparatus 1 is demonstrated. First, the symbol strings to be processed are sequentially read into the input buffer 11 (step S10). Next, the encoding unit 12 searches the symbol string from the head position (left end position in FIG. 1) stored in the input buffer 11 for a match with the symbol string stored in the dictionary buffer 13 (step S11). That is, the longest matching sequence described above is searched.

そして、検索された最長一致系列の長さ(一致長さ)が予め定められた値以上であるか否かがチェックされる(ステップS12)。例えば、かかる所定数は“4”とされる。その結果、一致長さが3以下であれば(ステップS12のNo)、符号化部12は、入力バッファ11の先頭位置にある記号を、最長一致系列の一致位置と一致長さで表現せずに、当該記号をそのまま2進法で表現する手法で符号化する。そして、その符号を出力する(ステップS13)。具体的には、本実施の形態例では、記号は8ビットのデータであるので、元の記号のままの8ビットのデータを9ビットで表現し、それを当該記号の符号とする。   Then, it is checked whether or not the length of the searched longest matching sequence (matching length) is not less than a predetermined value (step S12). For example, the predetermined number is “4”. As a result, if the match length is 3 or less (No in step S12), the encoding unit 12 does not represent the symbol at the head position of the input buffer 11 with the match position of the longest match sequence and the match length. In addition, the symbol is encoded by a method of expressing the symbol as it is in the binary system. And the code | symbol is output (step S13). Specifically, in the present embodiment, since the symbol is 8-bit data, the 8-bit data as the original symbol is represented by 9 bits, which is used as the code of the symbol.

図4は、本データ圧縮装置1によって生成される符号等を説明するための図である。図4の(a)が、本データ圧縮装置1によって生成される符号を模式的に示したものであり、上段に示される図([不一致]と記載)が、上記ステップS13で出力される符号である。言い換えれば、入力バッファ11の先頭位置から所定数の記号列について、辞書バッファ13内に一致するものが無かった場合の符号を示している。前述のように、かかる符号は、元々8ビットのデータを9ビットで表現したものであるので、必ず最上位のビットは“0”となる。後述するが、前記ステップS12で一致長さが所定数以上である場合には、この最上位のビットが必ず“1”となるので、当該最上位のビットは、所定数の記号列について“不一致”であったことを示すことになる。また、それ以降に続く8ビットのデータは、元の記号そのものである。   FIG. 4 is a diagram for explaining codes and the like generated by the data compression apparatus 1. FIG. 4A schematically shows the code generated by the data compression apparatus 1, and the diagram shown in the upper part (denoted [mismatch]) is the code output in step S13. It is. In other words, the code in the case where there is no match in the dictionary buffer 13 for a predetermined number of symbol strings from the head position of the input buffer 11 is shown. As described above, since this code originally represents 8 bits of data in 9 bits, the most significant bit is always “0”. As will be described later, when the matching length is greater than or equal to a predetermined number in step S12, the most significant bit is always “1”, so that the most significant bit is “mismatched” for a predetermined number of symbol strings. ". The subsequent 8-bit data is the original symbol itself.

従って、当該符号は、その最上位のビットにより上記“不一致”であること、即ち、その後のビット列で記号そのものを表していることを識別させている。言い換えれば、0〜511の値を取れる表現で、0〜255の値を表現することにより、元の記号をそのまま表現したものであることを識別させている。なお、この“不一致”であることと元の記号を含んだ、“不一致”の場合の符号全体を、ここでは“不一致”の場合の識別情報(第一識別情報)と称することとする。   Therefore, the code is identified by the most significant bit as being “mismatched”, that is, indicating the symbol itself in the subsequent bit string. In other words, an expression that can take a value of 0 to 511 is used to express a value of 0 to 255, thereby identifying the original symbol as it is. The entire code in the case of “mismatch” including the “mismatch” and the original symbol is referred to as identification information (first identification information) in the case of “mismatch”.

図3に戻って、前記ステップS12において、一致長さが所定数以上である場合には(ステップS12のYes)、符号化部12は、検索された最長一致系列の一致位置及び一致長さを表すために必要なビット数(ビット列の長さ)を求める(ステップS15)。 本実施の形態例では、前述した辞書バッファ13のサイズから、一致位置は、1〜16384の値を取るので、一致位置を表すのに必要なビット数は、1〜14の値となる。また、前述した入力バッファ11のサイズ及びステップS12における条件から、一致長さは、4〜258の値を取るので、一致長さを表すのに必要なビット数は、1〜8の値となる。   Returning to FIG. 3, when the matching length is equal to or larger than the predetermined number in Step S12 (Yes in Step S12), the encoding unit 12 sets the matching position and the matching length of the searched longest matching sequence. The number of bits (bit string length) necessary to represent is obtained (step S15). In the present embodiment, the matching position takes a value of 1 to 16384 based on the size of the dictionary buffer 13 described above. Therefore, the number of bits necessary to represent the matching position is a value of 1 to 14. Further, the matching length takes a value of 4 to 258 from the size of the input buffer 11 and the condition in step S12 described above, so the number of bits necessary to represent the matching length is a value of 1 to 8. .

次に、符号化部12は、上記求められた一致位置及び一致長さのビット数と、入力バッファ11の先頭位置から所定数の記号列について辞書バッファ13内に“一致”するものがあった旨を示す符号を生成して出力する(ステップS16)。かかる符号を、ここでは“一致”の場合の識別情報(第二識別情報)と称することとする。具体的には、一例として、下記(1)式のような値を識別情報として生成する。
識別情報(“一致”の場合)=256+(BL−1)×最大BP+(BP−1) (1)
但し、 BL:一致長さを表すのに必要なビット数
BP:一致位置を表すのに必要なビット数
最大BP:一致位置を表すのに必要な最大のビット数
なお、本実施の形態例では、上述の通り、最大BPは14の値となり、BP及びBLは上記値を取るので、(1)式により、上記識別情報(“一致”の場合)は256〜367の値となる。従って、当該識別情報(“一致”の場合)も2進法の符号として9ビットで表現される。図4の(a)の下段に示される図([一致]と記載)が、上記所定数の記号列の“一致”があった場合に生成され出力される符号を示しているが、その左側部分の9ビットが当該識別情報に相当する。
Next, the encoding unit 12 “matches” in the dictionary buffer 13 with respect to the number of bits of the obtained matching position and matching length and a predetermined number of symbol strings from the head position of the input buffer 11. The code | symbol which shows that is produced | generated and output (step S16). Such a code is referred to herein as identification information (second identification information) in the case of “match”. Specifically, as an example, a value such as the following formula (1) is generated as identification information.
Identification information (in case of “match”) = 256+ (BL−1) × maximum BP + (BP−1) (1)
Where BL is the number of bits required to represent the matching length
BP: Number of bits required to represent the matching position
Maximum BP: Maximum number of bits required to represent the matching position In the present embodiment, as described above, the maximum BP has a value of 14, and BP and BL have the above values. Thus, the identification information (in the case of “match”) has a value of 256 to 367. Therefore, the identification information (in the case of “match”) is also expressed by 9 bits as a binary code. The figure shown in the lower part of FIG. 4A (described as [match]) shows a code generated and output when there is a “match” of the predetermined number of symbol strings. The 9 bits of the portion correspond to the identification information.

上述のように、当該識別情報は256以上の値を取るので、そのことによって上記“一致”があったことを識別させ、また、当該識別情報の値から256を引いた値によって一致位置及び一致長さを表すのに必要なビット数を示している。言い換えれば、9ビットで表現される当該符号の最上位のビットは常に“1”の値となり、そのことで上記“一致”があったことを示し、下位の8ビットで一致位置及び一致長さを表すのに必要なビット数を示している。   As described above, since the identification information takes a value of 256 or more, it is possible to identify that there is a “match”, and to match the position and match by the value obtained by subtracting 256 from the value of the identification information. The number of bits required to represent the length is shown. In other words, the most significant bit of the code represented by 9 bits always has a value of “1”, which indicates that there is a “match”, and the lower 8 bits indicate the match position and match length. The number of bits necessary to represent

このように、本実施の形態例による符号では、上記“一致”の場合にも“不一致”の場合にも、識別情報が共に9ビットで表現され、その値が256以上であるか否かにより、言い換えれば、最上位のビットにより、一致位置と一致長さに基づく符号化がなされているか否かが識別できる。また、その識別の後、下位8ビットにより、“不一致”の場合には、元の記号そのものを知ることができ、“一致”の場合には、識別情報の後に続く一致位置と一致長さを表す符号の長さを知ることができる。   As described above, in the code according to the present embodiment, the identification information is expressed by 9 bits both in the case of “match” and “mismatch”, depending on whether the value is 256 or more. In other words, it is possible to identify whether or not encoding is performed based on the matching position and the matching length by the most significant bit. In addition, after the identification, the lower 8 bits can be used to know the original symbol itself in the case of “mismatch”, and in the case of “match”, the matching position and the matching length that follow the identification information can be obtained. The length of the code to represent can be known.

かかる識別情報の出力が終了すると、符号化部12は、前記検索された最長一致系列の一致位置を表す一致位置情報を符号として出力する(ステップS17)。具体的には、一致位置を表す値を2進法表現した際の最上位の“1”のビットを除いた下位のビット列を一致位置情報として出力する。これは、最上位のビットが“1”であることが自明であり、極力データ量を少なくしようとする目的によるものである。例えば、一致位置の値が9である場合には、2進法では“1001”となるが、“001”を一致位置情報として出力する。   When the output of the identification information is completed, the encoding unit 12 outputs the matching position information indicating the matching position of the searched longest matching sequence as a code (step S17). Specifically, a lower-order bit string excluding the most significant “1” bit when the value representing the matching position is expressed in binary notation is output as matching position information. This is self-evident that the most significant bit is “1”, and is for the purpose of reducing the amount of data as much as possible. For example, when the value of the coincidence position is 9, although “1001” is obtained in the binary system, “001” is output as the coincidence position information.

また、前述した、一致位置と一致長さを固定長のビット列で表現するLZSS符号の場合と比較して表現すれば、一致位置を最大長の14ビットで表現し、そのビット列のMSB(Most Significant Bit)側から連続して存在している“0”のビットとその次の“1”のビットを取り除いたものを一致位置情報とする。   Further, if the matching position and the matching length are expressed in comparison with the case of the LZSS code expressing the fixed-length bit string, the matching position is expressed by the maximum length of 14 bits, and the MSB (Most Significant) of the bit string is expressed. Bits) obtained by removing the “0” bit continuously present from the “Bit” side and the next “1” bit are used as matching position information.

次に、符号化部12は、前記最長一致系列の一致長さを表す一致長さ情報を符号として出力する(ステップS18)。この一致長さ情報も前記一致位置情報と同様に、一致長さを表す値を2進法表現した際の最上位の“1”のビットを除いた下位のビット列を一致長さ情報として出力する。   Next, the encoding unit 12 outputs match length information indicating the match length of the longest match sequence as a code (step S18). Similarly to the match position information, the match length information is output as a match length information by subordinate bit strings excluding the most significant “1” when the value representing the match length is expressed in binary. .

図4の(a)の下段に例示した符号において、右側に示される“一致位置情報”及び“一致長さ情報”が前記ステップS17及びS18において出力される各情報に相当する。   In the code illustrated in the lower part of FIG. 4A, “coincidence position information” and “coincidence length information” shown on the right side correspond to each information output in steps S17 and S18.

以上説明したように、“不一致”の場合あるいは“一致”の場合における符号の生成及び出力の処理が終了すると、入力バッファ11及び辞書バッファ13に格納されている記号列がスライドされる(ステップS14)。具体的には、上記処理により符号が生成され出力された記号(列)が、入力バッファ11の先頭部分から辞書バッファ13の後尾部分に移動する。そして、その移動分の新たな記号(列)が入力バッファ11に入力され、また、その移動分の記号(列)が辞書バッファ13から吐き出される。なお、前記“不一致”の場合には、1記号のみが符号化されるので、上記移動する記号は一つであり、前記“一致”の場合には、4以上の記号が符号化されるので、上記移動する記号は4以上となる。   As described above, when the code generation and output processing in the case of “mismatch” or “match” is completed, the symbol strings stored in the input buffer 11 and the dictionary buffer 13 are slid (step S14). ). Specifically, the symbol (sequence) generated by the code generated by the above processing and output is moved from the head portion of the input buffer 11 to the tail portion of the dictionary buffer 13. Then, a new symbol (sequence) for the movement is input to the input buffer 11, and a symbol (sequence) for the movement is discharged from the dictionary buffer 13. Note that in the case of “mismatch”, only one symbol is encoded, so there is only one symbol that moves. In the case of “match”, four or more symbols are encoded. The moving symbol is 4 or more.

その後、今回行おうとしている圧縮処理が終了したか否かが判断され(ステップS19)、終了していない場合には(ステップS19のNo)、前述したステップS11からの処理が繰り返される。そして、圧縮処理が終了したと判断された場合には(ステップS19のYes)、一連のデータ圧縮処理を終了する。   Thereafter, it is determined whether or not the compression process to be performed this time has ended (step S19). If the compression process has not ended (No in step S19), the process from step S11 described above is repeated. If it is determined that the compression process has been completed (Yes in step S19), the series of data compression processes is terminated.

図5は、データ復元装置2の復号部22が行なう処理の内容を例示したフローチャートである。以下、図5に基づいて、本データ復元装置2で行なわれる復元処理の具体的な内容について説明する。まず、処理対象の符号が順番に入力バッファ21に読み込まれる(ステップS20)。次に、復号部22は、符号の先頭の9ビット、即ち、識別情報を入力バッファ21より読み込んでその情報を解釈する(ステップS21)。   FIG. 5 is a flowchart illustrating the contents of the process performed by the decryption unit 22 of the data restoration device 2. Hereinafter, based on FIG. 5, the specific content of the restoration process performed by the data restoration apparatus 2 will be described. First, the codes to be processed are sequentially read into the input buffer 21 (step S20). Next, the decoding unit 22 reads the first 9 bits of the code, that is, identification information from the input buffer 21 and interprets the information (step S21).

そして、現在処理対象の符号が、符号化時に前述した“不一致”の場合であったのか“一致”の場合であったのかを判断する(ステップS22)。かかる判断は、前述の通り、識別情報の最上位のビットによって行うことができ、最上位のビットが“0”であれば、“不一致”の場合であったと判断し、最上位のビットが“1”であれば、“一致”の場合であったと判断する。言い換えれば、読み込んだ識別情報の値が0〜255であれば、その値が元の記号そのものを表していると判断し、識別情報の値が256以上であれば、この識別情報でこの後に続く一致位置と一致長さの情報のビット数を知ることができると判断する。   Then, it is determined whether the current processing target code is the case of “mismatch” or “match” at the time of encoding (step S22). As described above, this determination can be made based on the most significant bit of the identification information. If the most significant bit is “0”, it is determined that the case is “mismatch”, and the most significant bit is “ If it is “1”, it is determined that the case is “match”. In other words, if the value of the read identification information is 0 to 255, it is determined that the value represents the original symbol itself, and if the value of the identification information is 256 or more, this identification information follows. It is determined that the number of bits of information on the matching position and the matching length can be known.

かかる判断で、“不一致”の場合であったと判断された場合には(ステップS22のNo)、上記読み込んだ識別情報が元の記号そのものを表しているので、元の記号を復元して出力する(ステップS23)。より具体的には、9ビットの識別情報を8ビットとして出力する。   If it is determined that the result is “mismatch” (No in step S22), since the read identification information represents the original symbol itself, the original symbol is restored and output. (Step S23). More specifically, 9-bit identification information is output as 8 bits.

一方、“一致”の場合であったと判断された場合には(ステップS22のYes)、読み込んだ識別情報から、当該識別情報に続く一致位置情報のビット数と一致長さ情報のビット数を求める(ステップS25)。具体的には、識別情報が前述した(1)式によって生成されているので、読み込んだ識別情報の値から256を引き、その後の値を前記最大BP(14)で割り、その時の余りを一致位置情報のビット数とし、また、その時の商を一致長さ情報のビット数とする。   On the other hand, if it is determined that it is a case of “match” (Yes in step S22), the number of bits of match position information and the number of bits of match length information following the identification information are obtained from the read identification information. (Step S25). Specifically, since the identification information is generated by the above-described equation (1), 256 is subtracted from the value of the read identification information, the subsequent value is divided by the maximum BP (14), and the remainder at that time matches. The number of bits of the position information is used, and the quotient at that time is the number of bits of the matching length information.

次に、復号部22は、前記読み込んだ識別情報に続く、上記求めた一致位置情報のビット数分の符号を、入力バッファ21から読み込む(ステップS26)。その後、復号部22は、当該読み込んだ一致位置情報から一致位置の値を求める(ステップS27)。具体的には、読み込んだ一致位置情報のビット列の最上位に“1”のビットを付加した値を、一致位置の値とする。換言すれば、2の(前記一致位置情報のビット数)乗に一致位置情報の値を加えたものを一致位置の値とする。   Next, the decoding unit 22 reads, from the input buffer 21, codes corresponding to the number of bits of the obtained matching position information following the read identification information (step S26). Thereafter, the decoding unit 22 obtains the value of the coincidence position from the read coincidence position information (step S27). Specifically, a value obtained by adding a bit of “1” to the most significant bit string of the read matching position information is set as the matching position value. In other words, a value obtained by adding the value of the matching position information to the power of 2 (the number of bits of the matching position information) is set as the value of the matching position.

引き続き、復号部22は、前記読み込んだ一致位置情報に続く、前記求めた一致長さ情報のビット数分の符号を、入力バッファ21から読み込む(ステップS28)。その後、復号部22は、当該読み込んだ一致長さ情報から一致長さの値を求める(ステップS29)。具体的には、読み込んだ一致長さ情報のビット列の最上位に“1”のビットを付加した値に、3を加えた値を、一致長さの値とする。換言すれば、2の(前記一致長さ情報のビット数)乗に一致位置情報の値と3を加えたものを一致長さの値とする。ここで3を加えるのは、前述のように、一致長さの値が4〜258の値を取り、符号化時にそれを8ビットで表現するために、一致長さの値から3を引いた値(1〜255)を符号化していることによるものである。   Subsequently, the decoding unit 22 reads, from the input buffer 21, codes corresponding to the number of bits of the obtained match length information following the read match position information (step S28). Thereafter, the decoding unit 22 obtains a value of the matching length from the read matching length information (step S29). Specifically, a value obtained by adding 3 to the value obtained by adding the bit of “1” to the most significant bit string of the read match length information is set as the match length value. In other words, a value obtained by adding the value of the matching position information and 3 to the power of 2 (the number of bits of the matching length information) is set as the matching length value. Here, 3 is added, as described above, the value of the match length takes a value of 4 to 258, and 3 is subtracted from the value of the match length in order to express it with 8 bits at the time of encoding. This is because the values (1 to 255) are encoded.

次に、復号部22は、上記求めた一致位置と一致長さの値から元の記号列を復元して復元した記号列を出力する(ステップS30)。具体的には、辞書バッファ23に格納されている記号列の上記求めた値の一致位置から上記求めた値の一致長さ分の記号列を読み出し、その読み出した記号列を元の記号列として出力する。   Next, the decoding unit 22 restores the original symbol string from the value of the obtained matching position and matching length, and outputs the restored symbol string (step S30). Specifically, a symbol string corresponding to the coincidence length of the obtained value is read from the coincidence position of the obtained value of the symbol string stored in the dictionary buffer 23, and the read symbol string is used as the original symbol string. Output.

以上説明したように、“不一致”の場合あるいは“一致”の場合における復号処理が終了すると、入力バッファ21及び辞書バッファ23に格納されている符号及び記号列がスライドされる(ステップS24)。具体的には、上記処理により復元された符号が入力バッファ21から削除され、その分の新たな符号が入力バッファ21に入力される。また、上記処理により復元された記号列が辞書バッファ23の後尾部分に追加され、先頭部分のその分の記号列が不要な記号として辞書バッファ13から吐き出される。   As described above, when the decoding process in the case of “mismatch” or “match” is completed, the codes and symbol strings stored in the input buffer 21 and the dictionary buffer 23 are slid (step S24). Specifically, the code restored by the above processing is deleted from the input buffer 21, and a new code corresponding to the code is input to the input buffer 21. Further, the symbol string restored by the above processing is added to the tail portion of the dictionary buffer 23, and the corresponding symbol string at the head portion is discharged from the dictionary buffer 13 as an unnecessary symbol.

その後、今回行おうとしている復元処理が終了したか否かが判断され(ステップS31)、終了していない場合には(ステップS31のNo)、前述したステップS21からの処理が繰り返される。そして、復元処理が終了したと判断された場合には(ステップS31のYes)、一連のデータ復元処理を終了する。   Thereafter, it is determined whether or not the restoration process to be performed this time has been completed (step S31). If the restoration process has not been completed (No in step S31), the process from step S21 described above is repeated. If it is determined that the restoration process has been completed (Yes in step S31), the series of data restoration processes is terminated.

図6は、本データ圧縮装置1及びデータ復元装置2が行う処理の具体例を示した図である。図に示す例は、データ圧縮時に前記所定数以上の記号の“一致”があった場合であり、その時の一致位置が300で、一致長さが22であった場合である。図6の(a)は、前記一致位置(300)及び一致長さ(22)を、最大限のビット数の長さで模式的に示した図である。図6の(b)は、当該一致位置(300)及び一致長さ(22)を最大限のビット数で2進法表記したものである。   FIG. 6 is a diagram showing a specific example of processing performed by the data compression apparatus 1 and the data restoration apparatus 2. The example shown in the figure is a case where there is a “match” of the predetermined number or more of symbols at the time of data compression, the match position at that time is 300, and the match length is 22. FIG. 6A is a diagram schematically showing the matching position (300) and the matching length (22) with the maximum number of bits. FIG. 6B shows the matching position (300) and matching length (22) in binary notation with the maximum number of bits.

かかる状態に対して前述した符号化部12による符号化が行われると図6の(c)に示すような符号が生成されて出力される。図に示す符号の左部分が前述した識別情報(“一致”の場合)であり、前記(1)式に従って図に示すような計算がなされて、識別情報の値は320となる。即ち、一致長さの値である22から3を引いた19を2進法表現するのに必要なビット数5(BL)から1を差し引いた4という値に、14(最大BP)を掛け、その値に、一致位置の値である300を2進法表現するのに必要なビット数9(BP)から1を差し引いた値8と、256が加えられて320という識別情報が得られる。   When the encoding by the encoding unit 12 described above is performed on this state, a code as shown in FIG. 6C is generated and output. The left part of the code shown in the figure is the above-described identification information (in the case of “match”), and the calculation shown in the figure is performed according to the above equation (1), and the value of the identification information is 320. That is, the value of 4 obtained by subtracting 1 from the number of bits 5 (BL) necessary for binary representation of 19 obtained by subtracting 3 from 22 which is the value of the matching length is multiplied by 14 (maximum BP), The value 8 obtained by subtracting 1 from the number of bits 9 (BP) necessary for binary representation of 300, which is the value of the matching position, and 256 are added to the value, and identification information of 320 is obtained.

また、図6の(c)に示す符号の中央部分の8ビットが一致位置情報であり、300を2進法表現したビット列の最上位の“1”が除かれたものとなっている。従って、図6の(b)に示した14ビットの表現から、MSB側の全ての“0”と上記最上位の“1”が除かれた8ビットが符号として出力されることになる。また、図6の(c)に示す符号の右部分が一致長さ情報であり、22から3を引いた19を2進法表現したビット列の最上位の“1”が除かれたものとなっている。従って、図6の(b)に示した8ビットの表現から、MSB側の全ての“0”と上記最上位の“1”が除かれた4ビットが符号として出力されることになる。   Further, 8 bits in the central portion of the code shown in FIG. 6C is the coincidence position information, and the most significant “1” of the bit string expressing 300 in binary is removed. Accordingly, 8 bits obtained by removing all “0” s on the MSB side and the most significant “1” from the 14-bit representation shown in FIG. 6B are output as codes. Further, the right part of the code shown in FIG. 6C is the matching length information, and is obtained by excluding the most significant “1” of the bit string in which 19 obtained by subtracting 3 from 22 is represented in binary. ing. Therefore, 4 bits obtained by removing all “0” s on the MSB side and the most significant “1” from the 8-bit expression shown in FIG. 6B are output as codes.

このような符号が、データ復元装置2で受け取られ復号部22で復号されると、前記識別情報が解釈されて、一致位置情報と一致長さ情報のビット数がそれぞれ8と4であると判断される。そして、前述した処理内容に従って、図6の(d)に示されるように、まず、識別情報の後の8ビットが読み出されて、その最上位に“1”のビットが付加される。これにより、一致位置の値が300であると判断される。また、一致位置情報の後の4ビットが読み出されて、その最上位に“1”のビットが付加され、更に、3が加えられて、一致長さの値が22であると判断される。これにより、復号部22は、辞書バッファ23から所定の記号列を取り出して出力し、当該符号に対する復号処理を終了する。   When such a code is received by the data restoration device 2 and decoded by the decoding unit 22, the identification information is interpreted and it is determined that the number of bits of the matching position information and the matching length information is 8 and 4, respectively. Is done. Then, according to the processing contents described above, as shown in FIG. 6D, first, the 8 bits after the identification information are read, and the bit “1” is added to the most significant bit. Thereby, it is determined that the value of the coincidence position is 300. Also, the 4 bits after the coincidence position information are read out, a bit of “1” is added to the most significant bit, and 3 is added, and it is determined that the coincidence length value is 22. . Thus, the decoding unit 22 extracts and outputs a predetermined symbol string from the dictionary buffer 23, and ends the decoding process for the code.

以上説明したように、本実施の形態例によるデータ圧縮方法及び復元方法では、辞書(バッファ13)内に所定長以上の最長一致系列が存在しない場合には、その旨と元の記号を含む一定長の識別情報を符号として出力し、一方、辞書内に所定長以上の最長一致系列が存在する場合には、その旨と、一致位置を表す情報の長さ及び一致長さを表す情報の長さとを含む上記識別情報と同長さの識別情報をまず出力し、その後に、一致位置情報と一致長さ情報を出力する。そして、これら一致位置情報及び一致長さ情報は、一致位置及び一致長さを示す値を2進法表示した際の最上位のビットを除いたビット列で表現される。   As described above, in the data compression method and the decompression method according to the present embodiment, when there is no longest matching sequence of a predetermined length or more in the dictionary (buffer 13), a constant including the fact and the original symbol. If the longest identification sequence longer than a predetermined length exists in the dictionary, the length identification information is output as a code, and to that effect, the length of the information indicating the matching position and the length of the information indicating the matching length First, identification information having the same length as that of the above-described identification information is output, and thereafter, matching position information and matching length information are output. The coincidence position information and the coincidence length information are expressed by a bit string excluding the most significant bit when the value indicating the coincidence position and the coincidence length is displayed in binary.

従って、一致位置と一致長さに基づく符号化をした際に、それらを表す情報を常に最大の固定長(本実施の形態例では、14と8)のビット列で表現する必要がなく、上記識別情報が付加されても、符号全体として平均的に符号の長さを短くでき、従来よりもデータ圧縮率を向上させることができる。図4の(b)は、一致位置と一致長さの最大値が本実施の形態例と同じ場合に、LZSS符号を用いた時の符号例を模式的に示している。上段の辞書内に所定長以上の最長一致系列が存在しない場合(「不一致」)には、その旨を示す“0”と元の記号8ビットが出力される。また、下段の辞書内に所定長以上の最長一致系列が存在する場合(「一致」)には、その旨を示す“1”と固定長の一致位置情報及(14ビット)及び一致長さ情報(8ビット)が出力される。図4の(a)に示した本実施の形態例の場合と比較して[不一致]の場合には、データ長さは同じであるが、[一致]の場合には、本実施の形態例の場合の方が平均してデータ長さが短くなるという評価が得られている。   Therefore, when encoding is performed based on the matching position and the matching length, it is not necessary to always represent the information representing them with a bit string of the maximum fixed length (14 and 8 in the present embodiment), and the above identification Even if information is added, the length of the code as a whole can be shortened on average, and the data compression rate can be improved as compared with the conventional case. FIG. 4B schematically shows a code example when the LZSS code is used when the maximum value of the matching position and the matching length is the same as in the present embodiment. If there is no longest matching sequence of a predetermined length or longer in the upper dictionary (“mismatch”), “0” indicating that fact and 8 bits of the original symbol are output. If the longest matching sequence having a predetermined length or longer exists in the lower dictionary (“match”), “1” indicating that, a fixed-length match position information (14 bits), and match length information (8 bits) is output. Compared to the case of the present embodiment shown in FIG. 4A, the data length is the same in the case of “mismatch”, but in the case of “match”, the present embodiment example In the case of, the evaluation that the data length becomes shorter on average is obtained.

また、当該符号を復元する場合には、まず、同じ長さの識別情報を解釈して、一致位置と一致長さに基づく符号化がなされているかが判断され、当該符号化がなされている場合にも、識別情報から一致位置情報と一致長さ情報を容易に読み取ることができる。従って、復号処理時に検索などの複雑な処理を必要とせず、処理に時間を要することはない。   Also, when restoring the code, first, the identification information of the same length is interpreted, it is determined whether the encoding based on the matching position and the matching length has been made, and the coding has been made In addition, the matching position information and the matching length information can be easily read from the identification information. Therefore, complicated processing such as search is not required at the time of decoding processing, and processing does not take time.

なお、前記(1)式における乗数、即ち、一致長さ情報のビット数に掛ける乗数、を14としたが、この乗数を16にしてもよい。これにより、符号化時の乗算及び復号時の除算はビットシフトで済むことになり、さらに、圧縮及び復元の処理を高速化することができる。また、この場合にも識別情報のビット数は増やす必要がなく、データ量が増えることもない。   Although the multiplier in the equation (1), that is, the multiplier to be applied to the number of bits of the matching length information is 14, the multiplier may be 16. As a result, the multiplication at the time of encoding and the division at the time of decoding need only be a bit shift, and the compression and decompression processes can be further accelerated. Also in this case, it is not necessary to increase the number of bits of identification information, and the amount of data does not increase.

また、本実施の形態例における固定長の識別情報をハフマン符号化してもよい。これにより、更にデータ圧縮率を高めることができる。   Further, the fixed-length identification information in this embodiment may be Huffman encoded. Thereby, the data compression rate can be further increased.

次に、本実施の形態例に係るデータ圧縮方法及び復元方法の適用例について説明する。図7は、本実施の形態例に係るデータ圧縮方法及び復元方法を用いた印刷システムの概略構成図である。図7に示すように、本印刷システムは、ホストコンピュータ3とプリンタ4から構成される。ホストコンピュータ3のアプリケーション31から印刷要求が出され、それを受けるプリンタドライバ32が印刷データを生成して、プリンタ4へ送信する。プリンタ4では、その印刷データをコントローラ41が受信し、所定の処理を施した後にデータをエンジン42に送る。エンジン42は、そのデータに基づいて、印刷媒体への印刷を実行する。   Next, application examples of the data compression method and the decompression method according to this embodiment will be described. FIG. 7 is a schematic configuration diagram of a printing system using the data compression method and the decompression method according to the present embodiment. As shown in FIG. 7, the printing system includes a host computer 3 and a printer 4. A print request is issued from the application 31 of the host computer 3, and the printer driver 32 that receives the print request generates print data and transmits it to the printer 4. In the printer 4, the controller 41 receives the print data, performs predetermined processing, and sends the data to the engine 42. The engine 42 executes printing on a print medium based on the data.

当該印刷システムは、所謂ホストベースのシステムであり、ホストコンピュータ3側でハーフトーン処理(スクリーン処理)までを行ってしまう。従って、プリンタドライバ32には、図7に示すように、画像データを生成する画像生成部33、色の変換処理を行う色変換部34、ハーフトーン処理を行うハーフトーン処理部35、及びハーフトーン処理後の印刷データを圧縮する圧縮部36が備えられている。なお、これらの部分は、それぞれの処理内容が示されたドライバプログラムとそれに従って処理を実行するCPU(制御装置)等によって構成され得る。   The printing system is a so-called host-based system and performs up to halftone processing (screen processing) on the host computer 3 side. Accordingly, as shown in FIG. 7, the printer driver 32 includes an image generation unit 33 that generates image data, a color conversion unit 34 that performs color conversion processing, a halftone processing unit 35 that performs halftone processing, and a halftone. A compression unit 36 is provided for compressing the processed print data. Note that these portions can be configured by a driver program showing the contents of each process and a CPU (control device) that executes the process according to the driver program.

一方、プリンタ4のコントローラ41には、ホストコンピュータ3から圧縮処理された印刷データが送信されるので、それを復元処理する解凍部43が備えられる。   On the other hand, the print data compressed by the host computer 3 is transmitted to the controller 41 of the printer 4 and is provided with a decompression unit 43 for restoring the print data.

このように構成される本印刷システムの上記圧縮部36と解凍部43に、それぞれ、前述した本実施の形態例に係るデータ圧縮装置1とデータ復元装置2が用いられている。従って、圧縮部36ではハーフトーン処理後のドットイメージを表す印刷データが、前述した手法で符号化される。そして、その符号化された印刷データがプリンタ4に送信され、解凍部43において述した手法で復号される。   The data compression apparatus 1 and the data restoration apparatus 2 according to the above-described embodiment are used for the compression unit 36 and the decompression unit 43 of the printing system configured as described above, respectively. Accordingly, the compression unit 36 encodes the print data representing the dot image after the halftone process by the method described above. The encoded print data is transmitted to the printer 4 and decoded by the method described in the decompression unit 43.

本印刷システムでは、このように本実施の形態例に係るデータ圧縮方法及び復元方法が用いられるので、印刷データの圧縮率を高めることができ、ホストコンピュータ3からプリンタ4への送信時間を短縮できる。従って、高速化するホストコンピュータ3、プリンタ4での処理にデータ送信を追随させることができ、印刷システムとしてのスループットを向上させることができる。特に、本適用例のようにハーフトーン処理後の印刷データは、同じパターンのデータが繰り返し現れる傾向にあることから、圧縮率を向上させるために本データ圧縮方法が適しているといえる。なお、ハーフトーン処理後のデータについて、最長一致系列が同じであった場合に一致位置の値が小さい方を選択するようにして本圧縮方法を使用した場合に、一致位置情報は平均7〜8ビットで、一致長さ情報は平均2〜3ビットで表せるという評価が得られており、符号全体では平均19ビット程度であるといえる。従って、LZSS方式による23ビットの符号と比較してデータを短くすることができる(図4参照)。   In this printing system, the data compression method and restoration method according to this embodiment are used in this way, so that the compression rate of print data can be increased and the transmission time from the host computer 3 to the printer 4 can be shortened. . Accordingly, it is possible to follow the data transmission in the processing by the host computer 3 and the printer 4 which are increased in speed, and the throughput as the printing system can be improved. In particular, since the print data after halftone processing tends to appear repeatedly in the same way as in this application example, it can be said that the present data compression method is suitable for improving the compression rate. For the data after halftone processing, when this compression method is used so that the smaller matching value is selected when the longest matching sequence is the same, the matching position information is an average of 7-8. It has been evaluated that the coincidence length information can be expressed by 2 to 3 bits on the average, and it can be said that the average is about 19 bits for the entire code. Therefore, the data can be shortened as compared with the 23-bit code by the LZSS system (see FIG. 4).

また、プリンタ4の制御装置(CPU)は、パーソナルコンピュータなどで構成されるホストコンピュータ3と比べて、それほど高速のものを採用しなくてもすむようにしたいという要望があるが、本圧縮方法及び復元方法を用いれば、前述の通り、プリンタ4で行われる復元処理が容易となり、当該要望にもかなっている。また、ハーフトーン処理後の印刷データの場合には、前記識別情報のハフマン符号化に適しており、これによって更に圧縮率を向上させることができる。   In addition, there is a demand that the control device (CPU) of the printer 4 does not need to be so fast as compared to the host computer 3 constituted by a personal computer or the like. If the method is used, as described above, the restoration process performed by the printer 4 is facilitated, and the request is met. In addition, in the case of print data after halftone processing, it is suitable for Huffman coding of the identification information, which can further improve the compression rate.

本発明の保護範囲は、上記の実施の形態に限定されず、特許請求の範囲に記載された発明とその均等物に及ぶものである。   The protection scope of the present invention is not limited to the above-described embodiment, but covers the invention described in the claims and equivalents thereof.

本発明を適用したデータ圧縮装置の実施の形態例に係る構成図である。It is a block diagram concerning the example of an embodiment of a data compression device to which the present invention is applied. 本発明を適用したデータ復元装置の実施の形態例に係る構成図である。It is a block diagram concerning the example of an embodiment of a data restoration device to which the present invention is applied. 符号化部12が行なう処理の内容を例示したフローチャートである。It is the flowchart which illustrated the content of the process which the encoding part 12 performs. 本データ圧縮装置1によって生成される符号等を説明するための図である。It is a figure for demonstrating the code | symbol etc. which are produced | generated by this data compression apparatus. 復号部22が行なう処理の内容を例示したフローチャートである。It is the flowchart which illustrated the content of the process which the decoding part 22 performs. データ圧縮装置1及びデータ復元装置2が行う処理の具体例を示した図である。It is the figure which showed the specific example of the process which the data compression apparatus 1 and the data decompression | restoration apparatus 2 perform. 本データ圧縮方法及び復元方法を用いた印刷システムの概略構成図である。It is a schematic block diagram of the printing system using this data compression method and the decompression | restoration method.

符号の説明Explanation of symbols

1 データ圧縮装置、 2 データ復元装置、 3 ホストコンピュータ、 4 プリンタ、 11 入力バッファ、 12 符号化部、 13 辞書バッファ、 21 入力バッファ、 22 復号部(復号手段)、 23 辞書バッファ(記号列格納手段)、 31 アプリケーション、 32 プリンタドライバ、 33 画像生成部、 34 色変換部、 35 ハーフトーン処理部、 36 圧縮部、 41 コントローラ、 42 エンジン、 43 解凍部   DESCRIPTION OF SYMBOLS 1 Data compression apparatus, 2 Data decompression | restoration apparatus, 3 Host computer, 4 Printer, 11 Input buffer, 12 Encoding part, 13 Dictionary buffer, 21 Input buffer, 22 Decoding part (decoding means), 23 Dictionary buffer (Symbol string storage means) ), 31 application, 32 printer driver, 33 image generation unit, 34 color conversion unit, 35 halftone processing unit, 36 compression unit, 41 controller, 42 engine, 43 decompression unit

Claims (8)

符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮するデータ圧縮方法であって、
前記符号化によって生成される符号が、
前記一致位置を表す符号の長さと前記一致長さを表す符号の長さとを表す符号と、
前記一致位置を表す符号と、
前記一致長さを表す符号と、から構成される
ことを特徴とするデータ圧縮方法。
The longest matching sequence that matches the maximum length with the encoding target symbol sequence that exists in the encoded symbol sequence is searched, and the matching position that is the location of the longest matching sequence and the length of the longest matching sequence are searched. A data compression method for encoding data based on a certain matching length and compressing data,
The code generated by the encoding is
A code representing the length of the code representing the matching position and the length of the code representing the matching length;
A code representing the matching position;
A data compression method comprising: a code representing the coincidence length.
請求項1において、
前記一致位置を表す符号が、前記一致位置を表す値を2進法で表現した場合の最上位の1を除いたものであり、
前記一致長さを表す符号が、前記一致長さを表す値を2進法で表現した場合の最上位の1を除いたものである
ことを特徴とするデータ圧縮方法。
In claim 1,
The sign representing the matching position is obtained by removing the highest-order 1 when the value representing the matching position is expressed in binary.
The data compression method characterized in that the code representing the matching length is obtained by removing the most significant 1 when the value representing the matching length is expressed in binary.
符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮するデータ圧縮方法であって、
前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により前記符号化を行い、
前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により前記符号化を行なう
ことを特徴とするデータ圧縮方法。
The longest matching sequence that matches the maximum length of the encoding target symbol string that exists in the encoded symbol string is searched, and the matching position that is the position of the longest matching sequence and the length of the longest matching sequence are searched. A data compression method for encoding data based on a certain matching length and compressing data,
When the length of the longest matching sequence is smaller than a predetermined value, the encoding is performed with the first identification information having a predetermined length, representing the fact that it is smaller than the predetermined value and the original symbol,
When the length of the longest match sequence is equal to or greater than the predetermined value, the length of the match position information indicating the match position and the length of the match position information indicating the match position A data compression method, wherein the encoding is performed using second identification information having the same length as the first identification information, the matching position information, and the matching length information.
請求項3において、
前記一致位置情報が、前記一致位置を表す値を2進法で表現した場合の最上位の1を除いたものであり、
前記一致長さ情報が、前記一致長さを表す値を2進法で表現した場合の最上位の1を除いたものである
ことを特徴とするデータ圧縮方法。
In claim 3,
The matching position information is obtained by removing the highest-order 1 when a value representing the matching position is expressed in binary.
The data compression method according to claim 1, wherein the match length information is obtained by excluding the highest 1 when a value representing the match length is expressed in binary.
請求項3あるいは請求項4において、
前記第一識別情報及び又は第二識別情報がハフマン符号化される
ことを特徴とするデータ圧縮方法。
In claim 3 or claim 4,
The data compression method, wherein the first identification information and / or the second identification information is Huffman encoded.
符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化を行いデータを圧縮する処理をコンピュータに実行させるデータ圧縮プログラムであって、
前記最長一致系列の長さが、所定の値以上であるか否かを判定する第一ステップと、
前記第一ステップにおいて、前記最長一致系列の長さが前記所定の値以上でないと判定された場合には、当該所定の値以上でない旨と元の記号を表す、所定長さの第一識別情報により前記符号化を行う第二ステップと、
前記第一ステップにおいて、前記最長一致系列の長さが前記所定の値以上であるなと判定された場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により前記符号化を行う第三ステップとを、前記コンピュータに実行させる
ことを特徴とするデータ圧縮プログラム。
The longest matching sequence that matches the maximum length with the encoding target symbol sequence that exists in the encoded symbol sequence is searched, and the matching position that is the location of the longest matching sequence and the length of the longest matching sequence are searched. A data compression program for causing a computer to execute a process of encoding and compressing data based on a certain matching length,
A first step of determining whether the length of the longest match sequence is equal to or greater than a predetermined value;
In the first step, when it is determined that the length of the longest matching sequence is not greater than or equal to the predetermined value, first identification information having a predetermined length indicating that the length is not equal to or greater than the predetermined value and the original symbol A second step of performing said encoding by:
In the first step, when it is determined that the length of the longest match sequence is not greater than or equal to the predetermined value, the fact that the length is equal to or greater than the predetermined value and the length of the match position information indicating the match position The encoding is performed by second identification information having the same length as the first identification information, the matching position information, and the matching length information, representing the length of the matching length information representing the matching length. A data compression program that causes the computer to execute a third step to be performed.
符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化されたデータを復元するデータ復元方法であって、
前記復元対象のデータが、
前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により符号化され、
前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により符号化されている場合に、
前記第一識別情報あるいは第二識別情報の長さである前記所定長さ分の符号を解釈し、当該符号が第一識別情報であるかあるいは第二識別情報であるかを判断する第一ステップと、
前記第一ステップにおいて、第一識別情報であると判断された場合には、当該第一識別情報に含まれる前記元の記号に復号する第二ステップと、
前記第一ステップにおいて、第二識別情報であると判断された場合には、当該第二識別情報に基づいて前記一致位置情報と一致長さ情報の長さを求める第三ステップと、
前記第二識別情報に続く、前記第三ステップで求められた前記一致位置情報の長さ分の符号から、前記一致位置を求める第四ステップと、
前記一致位置情報に続く、前記第三ステップで求められた前記一致長さ情報の長さ分の符号から、前記一致長さを求める第五ステップと、
前記第四及び第五ステップで求められた一致位置と一致長さに基づいて、復号済みの記号列を用いて復号する第六ステップとを有する
ことを特徴とするデータ復元方法。
The longest matching sequence that matches the maximum length of the encoding target symbol string that exists in the encoded symbol string is searched, and the matching position that is the position of the longest matching sequence and the length of the longest matching sequence are searched. A data restoration method for restoring encoded data based on a certain matching length,
The data to be restored is
When the length of the longest matching sequence is smaller than a predetermined value, it is encoded with first identification information of a predetermined length, representing the fact that it is smaller than the predetermined value and the original symbol,
When the length of the longest match sequence is equal to or greater than the predetermined value, the length of the match position information indicating the match position and the length of the match position information indicating the match position When encoded by second identification information having the same length as the first identification information, the matching position information, and the matching length information,
A first step of interpreting a code for the predetermined length, which is the length of the first identification information or the second identification information, and determining whether the code is the first identification information or the second identification information When,
In the first step, when it is determined as the first identification information, a second step of decoding into the original symbol included in the first identification information;
In the first step, when it is determined as the second identification information, a third step for obtaining the length of the matching position information and the matching length information based on the second identification information;
A fourth step for obtaining the coincidence position from the code for the length of the coincidence position information obtained in the third step following the second identification information;
A fifth step for obtaining the matching length from the code for the length of the matching length information obtained in the third step, following the matching position information;
A data restoration method comprising: a sixth step of decoding using a decoded symbol string based on the matching position and the matching length obtained in the fourth and fifth steps.
符号化済みの記号列の中に存在する、符号化対象の記号列に最大長一致する最長一致系列を検索し、当該最長一致系列の存在位置である一致位置と当該最長一致系列の長さである一致長さとに基づいて符号化されたデータを復元するデータ復元装置であって、
復号済みの記号列を格納する記号列格納手段と、
前記復元対象のデータが、
前記最長一致系列の長さが、所定の値よりも小さい場合には、当該所定の値よりも小さい旨と元の記号を表す、所定長さの第一識別情報により符号化され、
前記最長一致系列の長さが、前記所定の値以上の場合には、当該所定の値以上である旨と前記一致位置を表す一致位置情報の長さと前記一致長さを表す一致長さ情報の長さとを表す、前記第一識別情報と同じ長さの第二識別情報と、前記一致位置情報と、前記一致長さ情報と、により符号化されている場合に、
前記第一識別情報あるいは第二識別情報の長さである前記所定長さ分の符号により、当該符号が第一識別情報であるかあるいは第二識別情報であるかを判断し、
第一識別情報であると判断された場合には、当該第一識別情報に含まれる前記元の記号に復号し、
第二識別情報であると判断された場合には、当該第二識別情報に基づいて前記一致位置情報と一致長さ情報の長さを求め、当該第二識別情報に続く、前記求められた一致位置情報の長さ分の符号と前記求められた一致長さ情報の長さ分の符号から、前記一致位置と前記一致長さを求め、前記求められた一致位置と一致長さに基づいて、前記記号列格納手段に格納された記号列を用いて復号する、復号手段とを備える
ことを特徴とするデータ復元装置。
The longest matching sequence that matches the maximum length of the encoding target symbol string that exists in the encoded symbol string is searched, and the matching position that is the position of the longest matching sequence and the length of the longest matching sequence are searched. A data restoration device for restoring data encoded based on a certain matching length,
Symbol string storage means for storing the decoded symbol string;
The data to be restored is
When the length of the longest matching sequence is smaller than a predetermined value, it is encoded with first identification information of a predetermined length, representing the fact that it is smaller than the predetermined value and the original symbol,
If the length of the longest match sequence is equal to or greater than the predetermined value, the length of the match position information indicating the match position and the length of the match position information indicating the match position When encoded by second identification information having the same length as the first identification information, the matching position information, and the matching length information,
The code for the predetermined length, which is the length of the first identification information or the second identification information, determines whether the code is the first identification information or the second identification information,
If it is determined to be the first identification information, decode to the original symbol included in the first identification information,
If it is determined to be the second identification information, the length of the matching position information and the matching length information is obtained based on the second identification information, and the obtained matching following the second identification information. From the code for the length of the position information and the code for the length of the determined match length information, determine the match position and the match length, and based on the determined match position and the match length, Decoding means for decoding using the symbol string stored in the symbol string storage means.
JP2004078056A 2004-03-18 2004-03-18 Data compression method and program, and data restoration method and apparatus Expired - Fee Related JP4093193B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004078056A JP4093193B2 (en) 2004-03-18 2004-03-18 Data compression method and program, and data restoration method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004078056A JP4093193B2 (en) 2004-03-18 2004-03-18 Data compression method and program, and data restoration method and apparatus

Publications (2)

Publication Number Publication Date
JP2005269184A true JP2005269184A (en) 2005-09-29
JP4093193B2 JP4093193B2 (en) 2008-06-04

Family

ID=35093259

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004078056A Expired - Fee Related JP4093193B2 (en) 2004-03-18 2004-03-18 Data compression method and program, and data restoration method and apparatus

Country Status (1)

Country Link
JP (1) JP4093193B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010068511A (en) * 2008-07-21 2010-03-25 Sony Computer Entertainment Europe Ltd Data compression and decompression
JP2012205058A (en) * 2011-03-25 2012-10-22 Fuji Xerox Co Ltd Image processing apparatus and image processing program
JP2013150041A (en) * 2012-01-17 2013-08-01 Fujitsu Ltd Program, compressed file generation method, compression code expansion method, information processing apparatus and recording medium
WO2014097359A1 (en) * 2012-12-19 2014-06-26 富士通株式会社 Compression program, compression method, compression device and system
WO2015019484A1 (en) * 2013-08-09 2015-02-12 株式会社日立製作所 Data compression device and data expansion device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010068511A (en) * 2008-07-21 2010-03-25 Sony Computer Entertainment Europe Ltd Data compression and decompression
JP2012205058A (en) * 2011-03-25 2012-10-22 Fuji Xerox Co Ltd Image processing apparatus and image processing program
JP2013150041A (en) * 2012-01-17 2013-08-01 Fujitsu Ltd Program, compressed file generation method, compression code expansion method, information processing apparatus and recording medium
WO2014097359A1 (en) * 2012-12-19 2014-06-26 富士通株式会社 Compression program, compression method, compression device and system
US9391636B2 (en) 2012-12-19 2016-07-12 Fujitsu Limited Method and system
JP6032292B2 (en) * 2012-12-19 2016-11-24 富士通株式会社 Compression program, compression device, decompression program, and decompression device
JPWO2014097359A1 (en) * 2012-12-19 2017-01-12 富士通株式会社 Compression program, compression device, decompression program, and decompression device
US9577666B2 (en) 2012-12-19 2017-02-21 Fujitsu Limited Method and system
WO2015019484A1 (en) * 2013-08-09 2015-02-12 株式会社日立製作所 Data compression device and data expansion device
JP6009676B2 (en) * 2013-08-09 2016-10-19 株式会社日立製作所 Data compression device and data decompression device
US9479194B2 (en) 2013-08-09 2016-10-25 Hitachi, Ltd. Data compression apparatus and data decompression apparatus

Also Published As

Publication number Publication date
JP4093193B2 (en) 2008-06-04

Similar Documents

Publication Publication Date Title
CN108768403B (en) LZW-based lossless data compression and decompression method, LZW encoder and decoder
CN108880556B (en) LZ 77-based lossless data compression method, error code recovery method, encoder and decoder
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
JP6195997B2 (en) Data source encoding / decoding method and apparatus with symbol compression
JP4814999B2 (en) Data compression / decompression method and compression / decompression program
JP2017507590A5 (en)
KR101678223B1 (en) Multimedia signature coding and decoding
JP6045123B2 (en) Encoder, decoder and method
CN110021369B (en) Gene sequencing data compression and decompression method, system and computer readable medium
JP2003179501A (en) Data compression method
JP2000315954A (en) Method for compressing inputted data stream and device therefor
JPH08316843A (en) Coder
US7548175B2 (en) Encoding apparatus, decoding apparatus, encoding method, computer readable medium storing program thereof, and computer data signal
Xue et al. An optimized data hiding scheme for deflate codes
WO2007050018A1 (en) Method and system for compressing data
CN113630125A (en) Data compression method, data encoding method, data decompression method, data encoding device, data decompression device, electronic equipment and storage medium
RU2611249C1 (en) Entropy modifier and method to use it
CN110021368B (en) Comparison type gene sequencing data compression method, system and computer readable medium
JP4093193B2 (en) Data compression method and program, and data restoration method and apparatus
JP4093200B2 (en) Data compression method and program, and data restoration method and apparatus
JP4000266B2 (en) Data encoding apparatus, data encoding method, and program thereof
KR100636370B1 (en) Apparatus and method for coding using bit-precision, and apparatus and method for decoding according to the same
KR20050010918A (en) A method and a system for variable-length decoding, and a device for the localization of codewords
JP2010074444A (en) Image compression apparatus and method, image decoding apparatus and method, and computer program
JP3083329B2 (en) Data compression / decompression method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060309

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: 20080212

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080225

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

Free format text: PAYMENT UNTIL: 20110314

Year of fee payment: 3

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: 20120314

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120314

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130314

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20140314

Year of fee payment: 6

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees