JP2001196937A - Data coding method, data decoding method, and computer- readable recording medium recording program to allow computer to execute the method - Google Patents

Data coding method, data decoding method, and computer- readable recording medium recording program to allow computer to execute the method

Info

Publication number
JP2001196937A
JP2001196937A JP2000007194A JP2000007194A JP2001196937A JP 2001196937 A JP2001196937 A JP 2001196937A JP 2000007194 A JP2000007194 A JP 2000007194A JP 2000007194 A JP2000007194 A JP 2000007194A JP 2001196937 A JP2001196937 A JP 2001196937A
Authority
JP
Japan
Prior art keywords
value
code
state
event
numerical
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
JP2000007194A
Other languages
Japanese (ja)
Other versions
JP3753580B2 (en
Inventor
Yoshitsugu Inoue
喜嗣 井上
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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co Ltd
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 Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP2000007194A priority Critical patent/JP3753580B2/en
Publication of JP2001196937A publication Critical patent/JP2001196937A/en
Application granted granted Critical
Publication of JP3753580B2 publication Critical patent/JP3753580B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

PROBLEM TO BE SOLVED: To efficiently compress pseudo medium tone image data generated by error spread processing in soft ware processing by a microprocessor. SOLUTION: Any of states S0-S3 is selected as a state value S on the basis of a consecutive 0-bit number X, a consecutive 1-bit number Y, a value A just before the X, and a value B just before the Y, a value just before the S is selected as a T, and on the incidence of a dissident event, a state code Q denoting the state value S is generated. On the incidence of a coincident event in the case of X≠A, a numeral code P denoting the value X is generated, and in the case of Y≠B, a numeral code P denoting the value Y is generated, and on the incidence of a regression event, a numeral code P denoting a value of a reparative number N is generated prior to the production of the state code.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】この発明は、データを走査し
て得られるランレングス数値列を0のビット連続数と1
のビット連続数との組を入力単位として順次入力し、所
定の符号列に変換して出力するデータ符号化方法、符号
列データを走査して得られる符号列を入力し、0のビッ
ト連続数Xと1のビット連続数Yとの組を単位とするラ
ンレングス数値列に復元して出力するデータ復号化方
法、およびその方法をコンピュータに実行させるプログ
ラムを記録したコンピュータ読み取り可能な記録媒体に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention
A data encoding method of sequentially inputting a set with the number of bit continuations as an input unit, converting the data into a predetermined code string and outputting the code string, inputting a code string obtained by scanning code string data, and inputting a bit continuation number of 0 The present invention relates to a data decoding method for restoring and outputting a run-length numerical sequence in units of a set of X and a bit continuous number Y of 1 and a computer-readable recording medium storing a program for causing a computer to execute the method.

【0002】[0002]

【従来の技術】従来、レーザープリンタなどの印刷装置
では、印刷対象となる画像データを圧縮(符号化)して
一時的にメモリに蓄積し、このメモリに蓄積した圧縮デ
ータを伸張(復号)しながら実際の印刷をおこなうこと
により、画像データを記憶するためのメモリのメモリ容
量を低減する省メモリ技術が知られている。
2. Description of the Related Art Conventionally, in a printing apparatus such as a laser printer, image data to be printed is compressed (encoded) and temporarily stored in a memory, and the compressed data stored in the memory is decompressed (decoded). Meanwhile, a memory saving technique for reducing the memory capacity of a memory for storing image data by performing actual printing is known.

【0003】かかる省メモリ技術の本来の目的は、画像
データを記憶するメモリのメモリ容量を低減してコスト
ダウンを図ることにあるので、画像データを圧縮又は伸
張するための複雑な専用ハードウエアを設けるのは妥当
ではなく、印刷装置のマイクロプロセッサにこれらの処
理をソフトウエア的におこなわせる必要がある。
The original purpose of such a memory-saving technique is to reduce the memory capacity of a memory for storing image data to reduce costs. Therefore, complicated dedicated hardware for compressing or expanding image data is used. It is not appropriate to provide them, and it is necessary to cause the microprocessor of the printing apparatus to perform these processes by software.

【0004】ここで、二次元静止画像の符号化技術とし
ては、副走査方向のデータ相関を考慮してデータ圧縮を
おこなう二次元圧縮技術や算術符号を用いて予測符号化
をおこなう予想符号化技術が高い圧縮率を得ることがで
きる技術として知られている。
Here, as a coding technique for a two-dimensional still image, a two-dimensional compression technique for performing data compression in consideration of data correlation in the sub-scanning direction or a predictive coding technique for performing predictive coding using an arithmetic code is used. Is known as a technique capable of obtaining a high compression ratio.

【0005】しかし、印刷装置のマイクロプロセッサを
用いてこれらの符号化技術をソフトウエア的に実現しよ
うとすると、処理遅延が生じてしまうので、印刷解像度
や印刷速度が日々向上する昨今では、これらの符号化技
術を用いることは効率的ではない。このため、マイクロ
プロセッサに圧縮伸張をおこなわせる場合には、一次元
圧縮と呼ばれる比較的単純な圧縮技術が広く用いられて
いる。
However, if these encoding techniques are implemented in software using a microprocessor of a printing apparatus, processing delays occur, and in recent years, the printing resolution and the printing speed are improved day by day. Using coding techniques is not efficient. Therefore, when a microprocessor performs compression and decompression, a relatively simple compression technique called one-dimensional compression is widely used.

【0006】従来の一次元圧縮技術としては、ランレン
グス処理やファクシミリ装置などで採用されているMH
(Modified Haffman)符号が広く知られているが、疑似
中間調画像のような色(白黒)が短い周期で頻繁に変化
する画像データの場合には、効率良く圧縮することがで
きない。特に、パーソナルコンピュータやネットワーク
の進展によってイメージデータを印刷する機会が増加し
てきたため、このMH符号を省メモリ機構として採用す
るのは効率的ではない。
Conventional one-dimensional compression techniques include MH used in run-length processing and facsimile machines.
(Modified Haffman) codes are widely known, but in the case of image data in which the color (black and white) frequently changes in a short cycle, such as a pseudo halftone image, it cannot be efficiently compressed. In particular, since the opportunity to print image data has increased due to the development of personal computers and networks, it is not efficient to adopt this MH code as a memory saving mechanism.

【0007】このため、色が短い周期で頻繁に変化する
画像データの圧縮率を改善するために、画像データやラ
ンレングスの繰り返し性を検出する符号化技術が知られ
ている。たとえば、特許第2683506号公報(従来
技術1)には、白ワードの長さと黒ワードの長さを両方
記述可能な制御ワードを使用することにより、白ワード
と黒ワードが比較的短い周期で規則的に現れるイメージ
データを効率的に圧縮するデータ圧縮(伸張)方法及び
装置が開示されている。
For this reason, in order to improve the compression ratio of image data in which colors frequently change in a short cycle, an encoding technique for detecting the repeatability of image data and run length is known. For example, Japanese Patent No. 2683506 (Prior Art 1) discloses that a control word capable of describing both the length of a white word and the length of a black word is used so that the white word and the black word are regulated at a relatively short cycle. A data compression (expansion) method and apparatus for efficiently compressing image data that appears in a random manner is disclosed.

【0008】具体的には、この従来技術1では、あるワ
ード長(バイト)を規定し、すべてが白であるデータ単
位を白ワードとし、すべてが白でないものを黒ワードと
して取り扱い、それらの繰り返し出現数、黒ワードの内
容、制御語などをワード長単位で符号化しているので、
符号化および復号化に際して特別な符号テーブルを必要
とせず、また、ワード長単位で処理できるのでマイクロ
プロセッサで処理しても十分な処理性能を期待すること
ができる。
Specifically, in the prior art 1, a certain word length (byte) is defined, data units that are all white are treated as white words, and those that are not all white are treated as black words. Since the number of occurrences, the contents of black words, control words, etc. are encoded in word length units,
Since a special code table is not required for encoding and decoding, and processing can be performed in word length units, sufficient processing performance can be expected even if processing is performed by a microprocessor.

【0009】また、特開平9−65147号公報(従来
技術2)には、白および黒の各々のランレングスを記憶
し、ある色のランレングス値が同色の直前のランレング
ス値と一致する場合に、所定の反復符号を生成すること
により、圧縮率および処理速度を改善する画像信号圧縮
(復元)方法および装置が開示されている。
Japanese Unexamined Patent Publication No. Hei 9-65147 (Prior Art 2) stores run lengths of white and black, and a case where a run length value of a certain color matches a run length value immediately before the same color. Discloses an image signal compression (decompression) method and apparatus for improving a compression ratio and a processing speed by generating a predetermined repetition code.

【0010】[0010]

【発明が解決しようとする課題】しかしながら、上記従
来技術1では、ワード列単位で繰り返し性を検出してい
るので、対象となる画像データに含まれる繰り返しの周
期とワード長とが一致するかまたは倍数となる場合にの
み高い圧縮率が得られるにすぎず、一般的な画像データ
について十分な圧縮が得られないという問題がある。
However, in the above-mentioned prior art 1, since the repeatability is detected in word string units, the repetition period included in the target image data and the word length are equal to each other. There is a problem that only a high compression ratio can be obtained only when it is a multiple, and sufficient compression cannot be obtained for general image data.

【0011】また、上記従来技術2では、ラン長の一致
が発生したときに生成される反復符号が一致しなかった
場合に符号化される符号語に比べて十分に少ないデータ
量である場合にのみ圧縮率が向上するものにすぎないと
いう問題がある。すなわち、より短い符号語を反復符号
に割り当てることは、相対的に一致しないラン長の符号
語を長くするので、色が短い周期で頻繁に変化するよう
な画像データに対しては十分な圧縮率を持つ符号セット
を得ることが困難になる。
[0011] Further, in the above-mentioned prior art 2, when the repetition code generated when the run lengths match does not match, the data amount is sufficiently smaller than the code word to be coded when the repetition code does not match. There is a problem that only the compression ratio is improved. In other words, assigning shorter codewords to repetition codes lengthens codewords with run lengths that do not match relatively, so that a sufficient compression ratio is applied to image data in which colors frequently change in a short cycle. It is difficult to obtain a code set having

【0012】具体的には、この従来技術2の実施の形態
では、符号セットはMH符号に類似するものであり、マ
イクロプロセッサによる処理ではランレングス符号技術
のような高速性を期待することができない。また、ラン
レングス値を記憶するための記憶部が色に対応して設け
られているので、ランレングス値の比較や格納に際し
て、色に応じて参照・格納先を選択する処理が必要とな
り、マイクロプロセッサによる高速処理の妨げになると
いう問題もある。
Specifically, in the embodiment of the prior art 2, the code set is similar to the MH code, and the processing by the microprocessor cannot be expected to be as fast as the run-length code technique. . In addition, since a storage unit for storing run-length values is provided for each color, it is necessary to perform a process of selecting a reference / storage destination according to a color when comparing and storing run-length values. There is also a problem that it hinders high-speed processing by the processor.

【0013】なお、上記二次元圧縮技術、予測符号化技
術およびMH符号化などにおいては、ラインバッファ、
確率テーブル、符号テーブルといった比較的大きな容量
のメモリが必要になるという問題がある。たとえば、1
200dpi(ドット/インチ)の解像度、25ppm
(ページ/分)の印刷速度であれば、画素周波数は10
0MHzを超えるのが一般的である。このような周波数
で上記メモリを含む符号化/復号化のハードウエア回路
を動作させることは極めて困難であり、また、たとえ回
路を並列化して低周波数で動作させるとしても、テーブ
ルをも含めて並列化する必要があるので大規模な回路と
なり、コストアップにつながる結果となる。
In the two-dimensional compression technique, the predictive coding technique and the MH coding, a line buffer,
There is a problem that a relatively large capacity memory such as a probability table and a code table is required. For example, 1
200 dpi (dot / inch) resolution, 25 ppm
If the printing speed is (pages / minute), the pixel frequency is 10
Generally, it exceeds 0 MHz. It is extremely difficult to operate an encoding / decoding hardware circuit including the above-mentioned memory at such a frequency, and even if the circuit is operated in parallel and operated at a low frequency, the parallel operation including the table is performed. Therefore, a large-scale circuit is required, which results in an increase in cost.

【0014】また、特願平11−12479号には、ラ
ンレングス値が同色の直前のランレングス値と一致する
事象が連続する場合に、その連続数を符号化することに
より、符号数を削減するよう構成することにより、疑似
中間調画像データに対しても高い圧縮率と高い処理速度
とを両立できるようにしたデータ符号化および復号化方
法が記載されているが、誤差拡散処理を施した疑似中間
調画像を含むような画像データの場合には、十分な圧縮
率が得られない。
Japanese Patent Application No. Hei 11-12479 discloses that, when events in which the run length value coincides with the immediately preceding run length value of the same color continue, the number of codes is reduced by encoding the continuous number. A data encoding and decoding method is described in which a high compression rate and a high processing speed can be achieved at the same time even for pseudo halftone image data. In the case of image data including a pseudo halftone image, a sufficient compression ratio cannot be obtained.

【0015】この発明は、上述した従来技術による問題
点を解消するため、誤差拡散処理により生成された疑似
中間調画像データについても効率良く圧縮することがで
き、マイクロプロセッサによるソフトウエア処理に適合
するデータ符号化方法、データ復号化方法、およびその
方法をコンピュータに実行させるプログラムを記録した
コンピュータ読み取り可能な記録媒体を提供することを
目的とする。
According to the present invention, pseudo-halftone image data generated by an error diffusion process can be efficiently compressed in order to solve the above-described problems of the prior art, and is compatible with software processing by a microprocessor. An object of the present invention is to provide a data encoding method, a data decoding method, and a computer-readable recording medium recording a program for causing a computer to execute the method.

【0016】[0016]

【課題を解決するための手段】上述した課題を解決し、
目的を達成するため、請求項1の発明に係るデータ符号
化方法は、データを走査して得られるランレングス数値
列を0のビット連続数と1のビット連続数との組を入力
単位として順次入力し、所定の符号列に変換して出力す
るデータ符号化方法であって、前記0のビットの連続
数、前記1のビットの連続数、直前の0のビットの連続
数および直前の1のビットの連続数に基づいて、前記入
力単位のデータに対応する状態値を算定する算定工程
と、前記算定工程により算定された状態値および直前の
状態値に基づいて、前記入力単位のデータに対応する状
態符号および数値符号を生成する生成工程と、を含んだ
ことを特徴とする。
Means for Solving the Problems To solve the above-mentioned problems,
In order to achieve the object, a data encoding method according to the present invention is characterized in that a run-length numerical sequence obtained by scanning data is sequentially set using a set of a 0-bit continuous number and a 1-bit continuous number as an input unit. A data encoding method for inputting, converting into a predetermined code string, and outputting the same, wherein the number of consecutive 0 bits, the number of consecutive 1 bits, the number of consecutive 0 bits immediately before, and the number of consecutive 1 bits A calculating step of calculating a state value corresponding to the data of the input unit based on the number of continuous bits; and a state value corresponding to the data of the input unit based on the state value calculated by the calculating step and the immediately preceding state value. Generating a state code and a numerical code.

【0017】この請求項1の発明によれば、0のビット
の連続数、1のビットの連続数、直前の0のビットの連
続数および直前の1のビットの連続数に基づいて、入力
単位のデータに対応する状態値を算定し、算定した状態
値および直前の状態値に基づいて、入力単位のデータに
対応する状態符号および数値符号を生成することとした
ので、誤差拡散処理により生成された疑似中間調画像デ
ータについても効率良く圧縮することができる。
According to the first aspect of the present invention, the input unit is determined based on the number of consecutive 0 bits, the number of consecutive 1 bits, the number of consecutive 0 bits immediately before, and the number of consecutive 1 bits immediately before. The state value corresponding to the data is calculated, and the state code and the numerical code corresponding to the data of the input unit are generated based on the calculated state value and the immediately preceding state value. The pseudo halftone image data can also be efficiently compressed.

【0018】また、請求項2の発明に係るデータ符号化
方法は、請求項1の発明において、前記算定工程は、前
記0のビットの連続数X、前記1のビットの連続数Y、
直前の0のビットの連続数Aおよび直前の1のビットの
連続数Bが、X≠A且つY≠Bの関係にある場合に状態
S0の値を状態値Sとし、X=A且つY≠Bの関係にあ
る場合に状態S1の値を状態値Sとし、X≠A且つY=
Bの関係にある場合に状態S2の値を状態値Sとし、X
=A且つY=Bの関係にある場合に状態S3の値を状態
値Sとすることを特徴とする。
According to a second aspect of the present invention, in the data encoding method according to the first aspect of the present invention, the calculating step comprises the step of calculating the number of consecutive 0 bits X, the number of consecutive 1 bits Y,
When the number of consecutive bits A of the immediately preceding 0 bits and the number of consecutive bits B of the immediately preceding 1 bit are in a relationship of X ≠ A and Y ≠ B, the value of the state S0 is set to the state value S, and X = A and Y ≠ B, the value of the state S1 is defined as the state value S, and X ≠ A and Y =
B, the value of the state S2 is set to the state value S, and X
= A and Y = B, and the value of the state S3 is set as the state value S.

【0019】この請求項2の発明によれば、0のビット
の連続数X、1のビットの連続数Y、直前の0のビット
の連続数Aおよび直前の1のビットの連続数Bが、X≠
A且つY≠Bの関係にある場合に状態S0の値を状態値
Sとし、X=A且つY≠Bの関係にある場合に状態S1
の値を状態値Sとし、X≠A且つY=Bの関係にある場
合に状態S2の値を状態値Sとし、X=A且つY=Bの
関係にある場合に状態S3の値を状態値Sとすることと
したので、4つの状態値を利用して、効率良くデータを
圧縮することができる。
According to the second aspect of the present invention, the continuous number X of 0 bits, the continuous number Y of 1 bits, the continuous number A of immediately preceding 0 bits, and the continuous number B of immediately preceding 1 bits are: X ≠
When the relationship is A and Y ≠ B, the value of the state S0 is set to the state value S. When the relationship X = A and Y ≠ B, the state S1 is set.
Is the state value S, the value of the state S2 is the state value S when X ≠ A and Y = B, and the value of the state S3 is the state when X = A and Y = B. Since the value S is set, the data can be efficiently compressed using the four state values.

【0020】また、請求項3の発明に係るデータ符号化
方法は、請求項2の発明において、前記生成工程は、直
前の状態値Tが状態S3であり、かつ、前記状態値Sと
直前の状態値Tとが等しい一致事象となった場合にこれ
を反復事象とみなして、該反復事象が連続して発生する
反復数Nを算出する反復数算定工程と、前記反復事象の
発生後に、前記状態値Sと直前の状態値Tとが異なる不
一致事象または入力完了となった場合に回帰事象と判定
する回帰事象判定工程と、前記不一致事象が発生した場
合に前記状態値Sの値を示す状態符号を生成する状態符
号生成工程と、前記状態符号生成工程による状態符号の
生成が終了するかまたは前記一致事象が発生した際に、
前記0のビットの連続数Xまたは前記1のビットの連続
数Yの値を示す数値符号を生成する第1の数値符号生成
工程と、前記回帰事象が発生した場合に、前記状態符号
生成工程による状態符号の生成に先だって、前記反復数
算定工程によって算定された反復数Nの値を示す数値符
号を生成する第2の数値符号生成工程と、を含んだこと
を特徴とする。
According to a third aspect of the present invention, in the data encoding method according to the second aspect of the present invention, in the generating step, the immediately preceding state value T is the state S3, and When a coincidence event equal to the state value T is considered, this is regarded as a repetition event, and a repetition number calculation step of calculating a repetition number N in which the repetition event occurs continuously; and A regression event determining step of determining a regression event when the status value S and the immediately preceding status value T differ from each other or when input is completed; and a status indicating the value of the status value S when the mismatch event occurs. A state code generation step of generating a code, and when the generation of the state code by the state code generation step ends or the coincidence event occurs,
A first numerical code generating step of generating a numerical code indicating a value of the number of consecutive bits X of 0 or the number of consecutive bits Y of 1 bit, and the state code generating step when the regression event occurs. A step of generating a numerical code indicating a value of the number of iterations N calculated in the number of iterations calculating step, prior to generating the state code.

【0021】この請求項3の発明によれば、直前の状態
値Tが状態S3であり、かつ、状態値Sと直前の状態値
Tとが等しい一致事象となった場合にこれを反復事象と
みなして、該反復事象が連続して発生する反復数Nを算
出し、反復事象の発生後に、状態値Sと直前の状態値T
とが異なる不一致事象または入力完了となった場合に回
帰事象と判定し、不一致事象が発生した場合に状態値S
の値を示す状態符号を生成し、この状態符号の生成が終
了するかまたは一致事象が発生した際に、0のビットの
連続数Xまたは1のビットの連続数Yの値を示す数値符
号を生成し、回帰事象が発生した場合に、状態符号の生
成に先だって反復数Nの値を示す数値符号を生成するこ
ととしたので、一致事象、不一致事象、反復事象、回帰
事象の概念を利用して効率良くデータを圧縮することが
できる。
According to the third aspect of the present invention, when the immediately preceding state value T is the state S3 and the state value S is equal to the immediately preceding state value T, a coincidence event is defined as a repeated event. Considering this, the number of repetitions N at which the repetitive event occurs continuously is calculated, and after the repetitive event occurs, the state value S and the immediately preceding state value T
Is determined to be a regression event when a mismatch event or input completion is different from the above, and a state value S is determined when a mismatch event occurs.
Is generated, and when the generation of this status code is completed or a coincidence event occurs, a numerical code indicating the value of the number of consecutive bits X of 0 or the number of consecutive bits Y of 1 is changed to When a regression event occurs, a numerical code indicating the value of the number of repetitions N is to be generated prior to the generation of the status code, so that the concept of a coincidence event, a non-coincidence event, a repetition event, and a regression event is used. Data can be efficiently compressed.

【0022】また、請求項4の発明に係るデータ符号化
方法は、請求項3の発明において、前記算定工程は、符
号化を開始する際に、T、A、Bおよび反復数Nにそれ
ぞれ所定の初期値を格納する初期化工程と、前記Xおよ
びYに所定のランレングス値を入力する入力工程と、前
記入力工程による入力後に、前記状態値Sを生成する状
態値生成工程とを含み、前記生成工程は、前記状態値生
成工程により生成された状態値Sに対応して前記一致事
象または不一致事象の発生を判定する一致事象判定工程
と、前記一致事象の発生に応答して前記反復事象の発生
の有無を判定する反復事象判定工程と、前記反復事象の
発生に応答して前記反復数を加算する反復数加算工程
と、前記不一致事象の発生または符号化対象データの終
了に応答して前記回帰事象の発生の有無を判定する回帰
事象判定工程と、前記回帰事象の発生に応答して前記反
復数Nの値を示す反復数数値符号を生成する反復数数値
符号生成工程と、前記反復数数値符号の生成後に前記反
復数Nを所定の初期値に戻す回帰工程と、前記不一致事
象の発生または前記回帰工程による反復数Nの初期化に
応答して前記状態値Sの値を表現する状態符号を生成す
る状態符号生成工程と、前記状態符号生成工程による状
態符号の生成または前記反復事象判定工程による反復事
象の発生の判定後に、前記XがAと一致しない場合に該
Xに対応する数値符号を生成し、前記YがBと一致しな
い場合に該Yに対応する数値符号を生成する数値符号生
成工程と、前記数値符号生成工程による数値符号の生成
または前記反復数加算工程による反復数Nの加算後に、
前記Aの内容をXに更新し、前記Bの内容をYに更新
し、前記Tの内容をSに更新する直前値更新工程とを含
んだことを特徴とする。
According to a fourth aspect of the present invention, in the data encoding method according to the third aspect of the present invention, when the encoding is started, each of T, A, B and the number of repetitions N is set to a predetermined value. An initializing step of storing an initial value of, an inputting step of inputting a predetermined run-length value to the X and Y, and a state value generating step of generating the state value S after the input by the inputting step. The generation step includes a coincidence event determination step of determining occurrence of the coincidence event or the non-coincidence event in response to the state value S generated by the state value generation step; and the repetition event in response to the occurrence of the coincidence event. A repetition event determining step of determining whether or not the occurrence of a repetition event, a repetition number adding step of adding the repetition number in response to the occurrence of the repetition event, and in response to the occurrence of the mismatch event or the end of the encoding target data Said times A regression event determination step of determining whether an event has occurred; a repetition number code generating step of generating a repetition number code indicating the value of the repetition number N in response to the occurrence of the regression event; A regression step of returning the number of iterations N to a predetermined initial value after code generation, and a state code representing the value of the state value S in response to the occurrence of the mismatch event or the initialization of the number of iterations N by the regression step After the state code generation step of generating the state code and the determination of the occurrence of the repetition event by the repetition event determination step, when the X does not coincide with A, a numerical code corresponding to the X And a numerical code generating step of generating a numerical code corresponding to Y when the Y does not match B, and generating a numerical code by the numerical code generating step or repeating by the repeating number adding step After the addition of N,
A value updating step of updating the content of A to X, updating the content of B to Y, and updating the content of T to S.

【0023】この請求項4の発明によれば、符号化を開
始する際に、T、A、Bおよび反復数Nにそれぞれ所定
の初期値を格納し、XおよびYに所定のランレングス値
を入力し、この入力後に状態値Sを生成し、生成された
状態値Sに対応して一致事象または不一致事象の発生を
判定し、一致事象の発生に応答して反復事象の発生の有
無を判定し、反復事象の発生に応答して反復数を加算す
るし、不一致事象の発生または符号化対象データの終了
に応答して回帰事象の発生の有無を判定し、回帰事象の
発生に応答して反復数Nの値を示す反復数数値符号を生
成し、反復数数値符号の生成後に反復数Nを所定の初期
値に戻し、不一致事象の発生または反復数Nの初期化に
応答して状態値Sの値を表現する状態符号を生成し、状
態符号の生成または反復事象の発生の判定後に、XがA
と一致しない場合に該Xに対応する数値符号を生成し、
YがBと一致しない場合に該Yに対応する数値符号を生
成し、数値符号の生成または反復数Nの加算後に、Aの
内容をXに更新し、Bの内容をYに更新し、Tの内容を
Sに更新することとしたので、マイクロプロセッサによ
るソフトウエア処理に適合したデータの圧縮をおこなう
ことができる。
According to the fourth aspect of the present invention, when encoding is started, a predetermined initial value is stored in each of T, A, B and the number of repetitions N, and a predetermined run length value is stored in X and Y. Input, generate a state value S after this input, determine whether a matching event or a non-matching event has occurred according to the generated state value S, and determine whether or not a repetitive event has occurred in response to the occurrence of the matching event In response to the occurrence of a recurring event, the number of repetitions is added, and in response to the occurrence of a discrepancy event or the end of the data to be encoded, it is determined whether or not a regression event has occurred. A repetition number numerical code indicating the value of the repetition number N is generated, and after the repetition number code is generated, the repetition number N is returned to a predetermined initial value, and a state value is generated in response to occurrence of a mismatch event or initialization of the repetition number N. A state code representing the value of S is generated, and a state code is generated or After the determination of the occurrence of repetitive events, X is A
Generates a numerical code corresponding to the X when not equal to
If Y does not match B, generate a numerical code corresponding to Y, and after generating the numerical code or adding the number of repetitions N, update the contents of A to X, update the contents of B to Y, Is updated to S, so that data compression suitable for software processing by the microprocessor can be performed.

【0024】また、請求項5の発明に係るデータ復号化
方法は、符号列データを走査して得られる符号列を入力
し、0のビット連続数Xと1のビット連続数Yとの組を
単位とするランレングス数値列に復元して出力するデー
タ復号化方法であって、復号化を開始する際に、復元さ
れる状態値を記憶する記憶部S、復元されるランレング
ス値のうち前記Xに相当する値を記憶する記憶部Cおよ
び復元されるランレングス値のうち前記Yに相当する値
を記憶する記憶部Dに所定の初期値を代入して初期化す
る初期化工程と、所定の符号単位を入力して該符号が数
値符号Pであるか状態符号Qであるかを判定する入力符
号種判定工程と、前記入力符号種判定工程により数値符
号と判定された場合に、該符号を数値に復元して記憶部
Lに記憶する数値符号復元工程と、前記入力符号種判定
工程により状態符号と判定された場合に、該符号を前記
状態値に復元して前記Sに記憶する状態符号復元工程
と、前記Lに復元数値が格納された時点での状態値Sの
値が、X≠A且つY≠Bの関係にある状態S0、X=A
且つY≠Bの関係にある状態S1、X≠A且つY=Bの
関係にある状態S2若しくはX=A且つY=Bの関係に
ある状態S3(ただし、Aを直前の0のビットの連続数
とし、Bを直前の1のビットの連続数とする)のいずれ
であるかを識別する識別工程と、前記Sに新たな状態値
が格納された時点で、該Sの値が前記S3と一致するか
否かを判定するS3状態判定工程と、前記識別工程によ
り前記Sの値が前記S0であると識別された場合に、前
記Lの値を前記Cに格納した後に、次の数値符号を入力
および復元して、前記Dに格納する第1のラン値更新工
程と、前記識別工程により前記Sの値が前記S1である
と識別された場合に、前記Lの値を前記Dに格納する第
2のラン値更新工程と、前記識別工程により前記Sの値
が前記S2であると識別された場合に、前記Lの値を前
記Cに格納する第3のラン値更新工程と、前記第1、第
2または第3のラン値更新工程による更新が終了した時
点または前記S3状態判定工程により前記Sの値が状態
値S3と一致すると判定された時点で、前記CおよびD
の値を一組のランレングス値として出力する第1の出力
工程と、前記識別工程により前記S値の値が前記S3で
あると識別された場合に、前記CおよびDの値を一組の
ランレングス値として前記Lの値に対応する回数分出力
する第2の出力工程と、を含んだことを特徴とする。
According to a fifth aspect of the present invention, in the data decoding method, a code string obtained by scanning code string data is input, and a set of a 0-bit continuation number X and a 1-bit continuation number Y is formed. What is claimed is: 1. A data decoding method for restoring and outputting a run-length numerical sequence as a unit, comprising: a storage unit S for storing a restored state value when decoding is started; An initialization step of substituting a predetermined initial value into a storage unit C for storing a value corresponding to X and a storage unit D for storing a value corresponding to Y among the run length values to be restored, and An input code type determining step of inputting the code unit of (i) and determining whether the code is the numerical code P or the status code Q. If the input code type determining step determines that the code is a numerical code, To be restored to a numerical value and stored in the storage unit L A state code restoring step, a state code restoring step of restoring the code to the state value when it is determined by the input code type judging step to be the state value and storing the same in the S, and a restored numerical value stored in the L. The state value S at the time of the state S0, X = A in the relation of X ≠ A and Y ≠ B
And a state S1 in a relation of Y ≠ B, a state S2 in a relation of X ≠ A and Y = B, or a state S3 in a relation of X = A and Y = B (where A is a continuation of the immediately preceding bit of 0). A number, and B is the number of continuations of the immediately preceding 1 bit), and when a new state value is stored in S, the value of S is After the value of L is stored in the C when the value of S is determined to be S0 in the S3 state determination step of determining whether or not they match, and in the identification step, the next numerical code Inputting and restoring, and storing the value of L in the D when the value of S is identified as S1 in the first run value updating step of storing the value in the D and storing the value of S in the identification step The value of S is S2 by the second run value updating step to be performed and the identification step. If identified, a third run value update step of storing the value of L in the C, and a point in time when the update in the first, second or third run value update step is completed or the S3 state determination When it is determined in the step that the value of S matches the state value S3, the values of C and D are determined.
And a first output step of outputting the values of C and D as a set of run-length values. If the value of the S value is identified as S3 by the identification step, the values of C and D are A second output step of outputting a run length value the number of times corresponding to the value of L.

【0025】この請求項5の発明によれば、復号化を開
始する際に、復元される状態値を記憶する記憶部S、復
元されるランレングス値のうち前記Xに相当する値を記
憶する記憶部Cおよび復元されるランレングス値のうち
前記Yに相当する値を記憶する記憶部Dに所定の初期値
を代入して初期化し、所定の符号単位を入力して該符号
が数値符号Pであるか状態符号Qであるかを判定し、数
値符号と判定された場合に、該符号を数値に復元して記
憶部Lに記憶し、状態符号と判定された場合に、該符号
を状態値に復元してSに記憶し、Lに復元数値が格納さ
れた時点での状態値Sの値が、X≠A且つY≠Bの関係
にある状態S0、X=A且つY≠Bの関係にある状態S
1、X≠A且つY=Bの関係にある状態S2若しくはX
=A且つY=Bの関係にある状態S3のいずれであるか
を識別し、Sに新たな状態値が格納された時点で、該S
の値がS3と一致するか否かを判定し、Sの値がS0で
あると識別された場合に、Lの値をCに格納した後に次
の数値符号を入力および復元してDに格納し、Sの値が
S1であると識別された場合に、Lの値をDに格納し、
Sの値がS2であると識別された場合に、Lの値をCに
格納し、更新が終了した時点またはSの値が状態値S3
と一致すると判定された時点で、CおよびDの値を一組
のランレングス値として出力し、S値の値がS3である
と識別された場合に、CおよびDの値を一組のランレン
グス値としてLの値に対応する回数分出力することとし
たので、誤差拡散処理により生成された疑似中間調画像
データを圧縮したものを効率良く復元することができ
る。
According to the fifth aspect of the present invention, when decoding is started, the storage unit S for storing the restored state value and the value corresponding to the X among the restored run length values are stored. A predetermined initial value is substituted into a storage unit C and a storage unit D that stores a value corresponding to the Y among the run length values to be restored and initialized, a predetermined code unit is input, and the code is a numerical code P Or the status code Q, and if it is determined that the code is a numerical code, the code is restored to a numerical value and stored in the storage unit L. The state value S at the time when the restored numerical value is stored in L is stored in S, and the state value S at the time when the restored numerical value is stored in L is the state S0 in the relation of X 関係 A and Y ≠ B, State S in relation
1, a state S2 or X in which X ≠ A and Y = B
= A and Y = B are identified, and when a new state value is stored in S,
Is determined whether the value of S is equal to S3. If the value of S is identified as S0, the value of L is stored in C, the next numerical code is input and restored, and stored in D Then, when the value of S is identified as S1, the value of L is stored in D,
When it is determined that the value of S is S2, the value of L is stored in C, and when the update is completed or the value of S is the state value S3
When it is determined that the values match, the values of C and D are output as a set of run-length values. If the value of S is identified as S3, the values of C and D are Since the number of times corresponding to the value of L is output as the length value, the compressed halftone image data generated by the error diffusion process can be efficiently restored.

【0026】また、請求項6の発明に係る記録媒体は、
請求項1〜5のいずれか一つに記載された方法をコンピ
ュータに実行させるプログラムを記録したことで、その
プログラムを機械読み取り可能となり、これによって、
請求項1〜5のいずれか一つの動作をコンピュータによ
って実現することができる。
Further, the recording medium according to the invention of claim 6 is:
By recording a program for causing a computer to execute the method according to any one of claims 1 to 5, the program becomes machine-readable, thereby
The operation of any one of claims 1 to 5 can be realized by a computer.

【0027】[0027]

【発明の実施の形態】以下に添付図面を参照して、この
発明に係るデータ符号化方法、データ復号化方法、およ
びその方法をコンピュータに実行させるプログラムを記
録したコンピュータ読み取り可能な記録媒体の好適な実
施の形態を詳細に説明する。なお、本実施の形態では、
誤差拡散処理により生成された疑似中間調画像データを
データ符号化または復号化する場合を示すこととする。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS With reference to the accompanying drawings, a data encoding method and a data decoding method according to the present invention and a computer-readable recording medium storing a program for causing a computer to execute the method will be described below. Embodiments will be described in detail. In the present embodiment,
It is assumed that pseudo halftone image data generated by the error diffusion process is encoded or decoded.

【0028】まず最初に、本実施の形態に係るデータ符
号化方法およびデータ復号化方法の概念について説明す
る。図1は、本実施の形態に係るデータ符号化方法およ
びデータ復号化方法の概念を説明するための説明図であ
る。
First, the concept of a data encoding method and a data decoding method according to the present embodiment will be described. FIG. 1 is an explanatory diagram for explaining the concept of a data encoding method and a data decoding method according to the present embodiment.

【0029】同図においては、データを走査して得られ
るランレングス数値列について、値が’0’であるビッ
トの連続数(以下「X」と言う)と、値が’1’である
ビットの連続数(以下「Y」と言う)との一組を入力単
位として順次入力し、所定の符号列に変換して出力する
データ符号化をおこなう。
In the figure, in a run-length numerical sequence obtained by scanning data, the number of consecutive bits (hereinafter referred to as “X”) having a value of “0” and the number of bits having a value of “1” are shown. Is sequentially input as an input unit, and is converted into a predetermined code string and output.

【0030】具体的には、このXの直前の値を「A」、
Yの直前の値を「B」とし、X≠A 且つ Y≠Bの状
態をS0とし、X=A 且つ Y≠Bの状態をS1と
し、X≠A 且つ Y=Bの状態をS2とし、X=A
且つ Y=Bの状態をS3とする。
Specifically, the value immediately before X is "A",
The value immediately before Y is “B”, the state of X ≠ A and Y ≠ B is S0, the state of X = A and Y ≠ B is S1, the state of X ≠ A and Y = B is S2, X = A
The state of Y = B is S3.

【0031】また、この状態に応じてS0〜S3のいず
れかの値を持つ状態値を「S」とし、このSの直前の値
を「T」とする。そして、S=Tとなる事象を「一般事
象」とし、S≠Tとなる事象を「不一致事象」とし、こ
のTがS3であるときに一致事象が発生すれば「反復事
象」とし、この反復事象が連続して発生する数を「反復
数N」とする。
In addition, a state value having one of S0 to S3 according to this state is defined as “S”, and a value immediately before S is defined as “T”. An event where S = T is defined as a “general event”, an event where S な る T is defined as a “mismatch event”, and if a coincidence event occurs when T is S3, it is defined as a “repeated event”. The number of consecutive occurrences of an event is referred to as “the number of repetitions N”.

【0032】さらに、この反復事象が発生した後に、不
一致事象が発生するかまたは入力が完了すれば「回帰事
象」とし、不一致事象が発生した場合には状態値Sの値
を示す状態符号Qを生成し、符号生成を終了した時点ま
たは一致事象が発生した時点において、X≠Aである場
合にはXの値を示す数値符号Pを生成し、Y≠Bである
場合にはYの値を示す数値符号Pを生成し、回帰事象が
発生した場合には状態符号の生成に先立って反復数Nの
値を示す数値符号Pを生成する。
Further, after the occurrence of the repetitive event, if a mismatch event occurs or the input is completed, the state is defined as a "regression event". If a mismatch event occurs, a status code Q indicating the value of the status value S is displayed. At the time when the code generation is completed or when a coincidence event occurs, a numerical code P indicating the value of X is generated when X ≠ A, and the value of Y is generated when Y ≠ B. When a regression event occurs, a numerical code P indicating the value of the number of repetitions N is generated prior to generation of the state code.

【0033】図1においては、圧縮対象となるデータが
3ビットの’0’で始まり、4ビットの’1’、3ビッ
トの’0’へと続く場合を示している。ランレングスの
計測を’0’から始める場合には、データを走査して得
られるXおよびYの数値列は、それぞれ’0’の連続数
および’1’の連続数となるので、この一組の値が符号
化部に順次入力されることになる。
FIG. 1 shows a case where the data to be compressed starts with 3-bit “0” and continues with 4-bit “1” and 3-bit “0”. When the run length measurement is started from “0”, the numerical sequence of X and Y obtained by scanning the data is a continuous number of “0” and a continuous number of “1”, respectively. Are sequentially input to the encoding unit.

【0034】同図では、各入力値についての各数値、事
象および生成される符号を図示しているが、各事象に関
しては、事象がある場合には’○’を記載し、事象がな
い場合には空欄としている。また、各符号に関しては、
符号出力がある場合には’○’を記載し、符号が出力さ
れない場合には空欄としている。
In the figure, each numerical value, event, and generated code for each input value are shown. For each event, “○” is described when there is an event, and when there is no event, Is blank. Also, for each code,
If there is a code output, “○” is described, and if no code is output, it is blank.

【0035】なおここでは、状態符号と数値符号の2つ
の属性を持つが、数値符号についてはどの数値に対応す
るものであるかを把握できるように3種類に分けて図示
している。また厳密に言うと、データの最初のX、Yお
よびSには直前の値(A、BおよびT)が存在しないこ
とになるが、ここではA、BおよびSの初期値はすべ
て’0’とする。
Here, although there are two attributes, a state code and a numerical code, the numerical codes are shown in three types so that it is possible to grasp which numerical value corresponds to which numerical code. Strictly speaking, there is no immediately preceding value (A, B and T) in the first X, Y and S of the data, but here the initial values of A, B and S are all “0”. And

【0036】このように、本実施の形態では、ランレン
グス値が同一計測対象値の直前のランレングス値と一致
する事象が連続する場合に、その連続数を符号化するこ
とで符号数を削減するという従来技術の特徴を、S3が
複数回連続する場合に反復数Nに対応する数値符号Pを
生成することで承継することにより効率的に符号数を削
減している。加えて、XまたはYのいずれか一方が直前
の値と一致する反面他方が一致しない場合すなわちS1
またはS2の状態が連続する場合にも効率的に符号数を
削減している。
As described above, in the present embodiment, when events in which the run length value coincides with the run length value immediately before the same measurement target value continue, the number of codes is reduced by encoding the continuous number. In this case, the number of codes is efficiently reduced by inheriting the feature of the related art of performing the above by generating a numerical code P corresponding to the number of repetitions N when S3 is repeated a plurality of times. In addition, when one of X or Y matches the previous value, the other does not match, that is, S1
Alternatively, even when the state of S2 is continuous, the number of codes is efficiently reduced.

【0037】特に、誤差拡散された画像データにおいて
は、S1およびS2の状態が連続する確率が高いので、
この実施の形態による符号数削減の効果は大きい。たと
えば、同図では、12組すなわち24個のランレングス
値が入力されているが、出力される符号数は11個に削
減され、符号数が削減されていることが分かる。
In particular, in the error-diffused image data, there is a high probability that the states of S1 and S2 are continuous.
The effect of reducing the number of codes according to this embodiment is great. For example, in the figure, although 12 sets, that is, 24 run-length values are input, the number of output codes is reduced to 11, and it can be seen that the number of codes is reduced.

【0038】次に、本実施の形態で用いる符号化手順に
ついて説明する。図2は、本実施の形態で用いる符号化
手順を示すフローチャートであり、図3は、図2のステ
ップS209およびS219に示す未出力N符号化手順
を示すフローチャートである。
Next, an encoding procedure used in the present embodiment will be described. FIG. 2 is a flowchart showing the encoding procedure used in the present embodiment, and FIG. 3 is a flowchart showing the non-output N encoding procedure shown in steps S209 and S219 in FIG.

【0039】図2に示すように、まず最初に、A、Bお
よびTに所定の定数Cを設定し、Nに0を設定する初期
化処理をおこなう(ステップS201)。なお、ここで
は説明の便宜上、A、BおよびTに同じ定数Cを設定す
ることとするが、異なる値を設定することもできる。た
だし、Tの初期値はS0に示す値であることが符号数を
削減するうえで望ましい。その理由は、最初のXおよび
Yの入力に対して状態値SがS0となる場合が最も高い
確率で発生するため、無意味な不一致事象の発生による
状態符号の生成を抑制できるからである。また、Aおよ
びBの初期値は、ランレングスの測定を開始する際の値
と異なる値を設定することが符号数を削減するうえで望
ましい。
As shown in FIG. 2, first, an initialization process for setting a predetermined constant C to A, B and T and setting 0 to N is performed (step S201). Here, for convenience of explanation, the same constant C is set for A, B and T, but different values can be set. However, it is desirable that the initial value of T be the value shown in S0 in order to reduce the number of codes. The reason is that the state value S becomes S0 with respect to the first input of X and Y at the highest probability, so that the generation of a state code due to the occurrence of a meaningless mismatch event can be suppressed. Further, it is desirable to set the initial values of A and B to values different from the values at the start of the run length measurement in order to reduce the number of codes.

【0040】そして、かかる初期化処理を終えたなら
ば、XおよびYに一組のランレングス値を入力して格納
する入力処理をおこない(ステップS202)、この入
力に対応して所定の状態Sを生成する状態作成処理をお
こなう(ステップS203〜S207)。
When the initialization process is completed, an input process for inputting and storing a set of run-length values in X and Y is performed (step S202), and a predetermined state S corresponding to the input is executed. Is performed (steps S203 to S207).

【0041】具体的には、まずS値に0を代入してを初
期化した後に(ステップS203)、X値とA値を比較
して(ステップS204)、両者が一致する場合には
(ステップS204肯定)このSに’1’を加算し(ス
テップS205)、一致しない場合には(ステップS2
04否定)そのままステップS206に移行する。さら
に、Y値をB値と比較して(ステップS206)、両者
が一致する場合には(ステップS206肯定)Sに’
2’を加算する(ステップS207)。したがって、S
0を表す数値は0、S1を表す数値は1、S2を表す数
値は2、S3を表す数値は3となる。
More specifically, after initializing by substituting 0 for the S value (step S203), the X value and the A value are compared (step S204). (S204 affirmative) '1' is added to this S (step S205), and if they do not match (step S2)
04 No) The process directly proceeds to step S206. Further, the Y value is compared with the B value (step S206), and if they match (Yes at step S206), the process proceeds to step S206.
2 'is added (step S207). Therefore, S
The value representing 0 is 0, the value representing S1 is 1, the value representing S2 is 2, and the value representing S3 is 3.

【0042】その後、生成された状態値Sの値がTと一
致するか否かを判断する一致事象判定処理をおこない
(ステップS208)、一致する場合(ステップS20
8肯定)には一致事象であると判断し、一致しない場合
(ステップS208否定)には不一致事象であると判断
する。
Thereafter, a matching event determination process is performed to determine whether or not the generated state value S matches T (step S208).
(8 affirmative), it is determined that the event is a coincidence event, and if they do not match (No at Step S208), it is determined that the event is a non-coincidence event.

【0043】具体的には、一致事象が発生した場合には
(ステップS208肯定)、S値が3であるか否かを判
断し(ステップS211)、このS値が3すなわちS3
と一致する場合に(ステップS211肯定)反復事象が
あるものと判定し、反復数Nの値をインクリメントして
(ステップS212)、ステップS217に移行する。
More specifically, if a coincidence event has occurred (Yes at step S208), it is determined whether or not the S value is 3 (step S211).
If (step S211 is affirmative), it is determined that there is a repetition event, the value of the number of repetitions N is incremented (step S212), and the routine goes to step S217.

【0044】これに対して、不一致事象が発生した場合
には(ステップS208否定)、反復事象が発生しない
ものと判定して、未出力N符号化をおこなう(ステップ
S209)。具体的には、図3に示すように、反復数N
の値が0よりも大きいか否かを判断し(ステップS30
1)、0よりも大きい場合には(ステップS301肯
定)、回帰事象が発生したものと判定し、数値符号化
(N)をおこなって数値符号を出力した後(ステップS
302)、Nに0を代入して初期化する(ステップS3
03)。一方、反復数Nの値が0のままである場合には
(ステップS301否定)、回帰事象が発生していない
ものと判断する。
On the other hand, if a mismatch event has occurred (No at step S208), it is determined that no repetition event has occurred, and non-output N encoding is performed (step S209). Specifically, as shown in FIG.
Is determined whether or not the value of is larger than 0 (step S30).
1) If it is larger than 0 (Yes at step S301), it is determined that a regression event has occurred, and numerical encoding (N) is performed to output a numerical code (step S301).
302), and initialize by substituting 0 for N (step S3)
03). On the other hand, if the value of the number of iterations N remains 0 (No at Step S301), it is determined that no regression event has occurred.

【0045】そして、この未出力N符号化を終えたなら
ば、状態Sの値を表現する状態符号を生成し出力する状
態符号化(S)をおこない(ステップS210)、ラン
数値符号出力処理をおこなう(ステップS213〜S2
16)。
Then, when the non-output N encoding is completed, state encoding (S) for generating and outputting a state code representing the value of the state S is performed (step S210), and a run numerical code output process is performed. (Steps S213 to S2)
16).

【0046】具体的には、まずX値とA値を比較し(ス
テップS213)、両者が一致しない場合には(ステッ
プS213否定)、Xの値を表現する状態符号を生成し
出力する数値符号化(X)をおこなう(ステップS21
4)。また、Y値とB値を比較し(ステップS21
5)、両者が一致しない場合には(ステップS215否
定)、Yの値を表現する状態符号を生成し出力する数値
符号化(Y)をおこなう(ステップS216)。
More specifically, first, the X value and the A value are compared (step S213), and if they do not match (No at step S213), a state code representing the value of X is generated and output. (X) (Step S21)
4). Further, the Y value and the B value are compared (step S21).
5) If they do not match (No at Step S215), a numerical code (Y) for generating and outputting a state code representing the value of Y is performed (Step S216).

【0047】その後、AをX値で更新し、BをY値で更
新し、TをS値で更新する直前値の更新をおこない(ス
テップS217)、符号化対象データがあるならば(ス
テップS218否定)ステップS202に移行して上記
処理を繰り返す。なお符号化対象データがなくなった場
合には(ステップS218肯定)、すでに説明した未出
力N符号化をおこなって(ステップS219)処理を終
了する。
Thereafter, A is updated with the X value, B is updated with the Y value, and the value immediately before T is updated with the S value is updated (step S217). If there is data to be encoded (step S218) No) The process proceeds to step S202 and the above process is repeated. If there is no more data to be encoded (Yes at Step S218), the already-outputted N-code is performed (Step S219), and the process ends.

【0048】上記一連の処理をおこなうことにより、不
一致事象が発生した場合には状態値Sの値を示す状態符
号Qを生成し、符号生成を終了した時点または一致事象
が発生した時点で、X≠Aである場合にはXの値を示す
数値符号Pを生成し、Y≠Bである場合にはYの値を示
す数値符号Pを生成し、回帰事象が発生した場合には、
状態符号の生成に先立って反復数Nの値を示す数値符号
Pを生成して符号化することができる。
By performing the above-described series of processing, when a mismatch event occurs, a state code Q indicating the value of the state value S is generated. When the code generation is completed or when a match event occurs, X is generated. If ≠ A, a numerical sign P indicating the value of X is generated, if Y ≠ B, a numerical sign P indicating the value of Y is generated, and if a regression event occurs,
Prior to generation of the state code, a numerical code P indicating the value of the number of repetitions N can be generated and encoded.

【0049】なお、上記処理手順をソフトウエアで実現
する場合には、X,Y,A,B,S,TおよびNには適
切なメモリを割り当てれば良いが、マイクロプロセッサ
の汎用レジスタを用いることが処理性能を向上するうえ
で望ましい。また、定数Cと各制御については、プログ
ラムすなわち命令コードとして記述することで実現でき
る。
When the above procedure is realized by software, appropriate memories may be allocated to X, Y, A, B, S, T and N, but general-purpose registers of a microprocessor are used. It is desirable to improve processing performance. The constant C and each control can be realized by describing them as a program, that is, an instruction code.

【0050】また、上記一連の説明では説明の便宜上、
ランレングス測定入力(ステップS202)およびこれ
に関連するデータ終了判定(ステップS218)および
符号生成(ステップS210、S214、S216、S
302)についての詳細な説明を省略した。
In the above series of description, for convenience of explanation,
Run-length measurement input (step S202) and data end determination related thereto (step S218) and code generation (steps S210, S214, S216, S)
The detailed description of 302) has been omitted.

【0051】次に、本実施の形態に係るデータ復号手順
について説明する。図4は、本実施の形態に係るデータ
復号手順を示すフローチャートである。同図に示すよう
に、復号処理を開始する際に、復元される状態値を記憶
するSと、復元されるランレングス値のうちXに相当す
る値を記憶するAと、Yに相当する値を記憶するBと
に、それぞれ定数Cを代入して初期化する(ステップS
401)。なお、復号が正しくおこなわれるためには、
A、BおよびSに代入される初期値は、符号化時の初期
化処理(図2のステップS201)時に、A、Bおよび
Sに代入した値と同じ値を代入する必要がある。
Next, a data decoding procedure according to the present embodiment will be described. FIG. 4 is a flowchart showing a data decoding procedure according to the present embodiment. As shown in the figure, when the decoding process is started, S which stores a restored state value, A which stores a value corresponding to X among the restored run-length values, and a value which corresponds to Y Is initialized by substituting a constant C into B and storing B, respectively (step S
401). In order for decryption to be performed correctly,
The initial values to be assigned to A, B, and S need to be the same as the values assigned to A, B, and S during the initialization process at the time of encoding (step S201 in FIG. 2).

【0052】そして、この初期化処理を終えたならば、
符号入力をKに代入し(ステップS402)、このKが
数値符号Pであるか状態符号Qであるかを判断する入力
符号判定処理(ステップS403)をおこなう。その結
果、数値符号であると判断された場合には(ステップS
403肯定)、このKに格納された符号を数値に復元し
てLに記憶する数値復元処理(ステップS404)をお
こない、状態識別処理(ステップS405〜407)に
移行する。
Then, after completing this initialization processing,
The code input is substituted for K (step S402), and an input code determination process (step S403) for determining whether this K is the numerical code P or the status code Q is performed. As a result, if it is determined that the code is a numerical code (step S
(403 affirmative), a numerical value restoring process (step S404) of restoring the code stored in K to a numerical value and storing it in L is performed, and the process proceeds to a state identification process (steps S405 to 407).

【0053】具体的には、状態値Sが0であるか否かを
確認し(ステップS405)、状態値Sが0である場合
には(ステップS405肯定)、S0に対応する処理す
なわちAに復元されたランレングス値であるLの値を格
納し(ステップS408)、次の符号単位を入力してK
に格納し(ステップS409)、Kに格納された符号を
数値に復元してLに格納し(ステップS410)、Lの
値をBに格納する(ステップS411)処理をおこな
い、Aを出力XとしBを出力Yとした一組のランレング
ス値として出力する(ステップS414)。
Specifically, it is confirmed whether or not the state value S is 0 (step S405). If the state value S is 0 (Yes at step S405), the process corresponding to S0, ie, A The value of L, which is the restored run-length value, is stored (step S408), and the next code unit is input and K
(Step S409), the code stored in K is restored to a numerical value and stored in L (Step S410), the value of L is stored in B (Step S411), and A is set as the output X. B is output as a set of run-length values with output Y (step S414).

【0054】また、状態値Sが0でない場合には(ステ
ップS405否定)、状態値Sが1であるか否かを確認
し(ステップS406)、状態値Sが1である場合には
(ステップS406肯定)、S1に対応する処理すなわ
ちL値をBに格納する処理をおこない(ステップS41
2)、Aを出力XとしBを出力Yとした一組のランレン
グス値として出力する(ステップS414)。
If the status value S is not 0 (No at Step S405), it is checked whether the status value S is 1 (Step S406), and if the status value S is 1 (Step S406). (S406 affirmative), a process corresponding to S1, that is, a process of storing the L value in B is performed (step S41).
2) Output a set of run-length values where A is the output X and B is the output Y (step S414).

【0055】さらに、状態値Sが1でない場合には(ス
テップS406否定)、状態値Sが2であるか否かを確
認し(ステップS407)、状態値Sが2である場合に
は(ステップS407肯定)、S2に対応する処理すな
わちL値をAに格納する処理をおこない(ステップS4
13)、Aを出力XとしBを出力Yとした一組のランレ
ングス値として出力する(ステップS414)。
Further, if the state value S is not 1 (No at Step S406), it is checked whether or not the state value S is 2 (Step S407). If the state value S is 2 (Step S407). (Affirmative in S407), a process corresponding to S2, that is, a process of storing the L value in A is performed (step S4).
13) Output a set of run-length values where A is the output X and B is the output Y (step S414).

【0056】また、状態値Sが2でない場合には(ステ
ップS407否定)、S3に対応する処理をおこなう。
具体的には、Lの値を初期値としてNに格納した後(ス
テップS417)、Aを出力XとしBを出力Yとした一
組のランレングス値として出力し(ステップS41
8)、Nをデクリメントした後(ステップS419)、
このNの値が0でなければ(ステップS420否定)、
ステップS418に移行して処理を繰り返す。そして、
Nの値が0になった時点で(ステップS420肯定)、
終了判定をおこない(ステップS421)、終了しない
場合には(ステップS421否定)、上記ステップS4
02に移行する。
If the status value S is not 2 (No at Step S407), a process corresponding to S3 is performed.
Specifically, after the value of L is stored in N as an initial value (step S417), it is output as a set of run-length values in which A is output X and B is output Y (step S41).
8) After decrementing N (step S419),
If the value of N is not 0 (No at Step S420),
The process moves to step S418 and the process is repeated. And
When the value of N becomes 0 (Yes at step S420),
An end determination is made (step S421), and if not (step S421 negative), the above-described step S4
Move to 02.

【0057】また、上記ステップS403で数値符号で
あると判断された場合には(ステップS403否定)、
Kに格納された符号を状態値に復元してSに格納し(ス
テップS415)、このSが3であるか否かを確認する
(ステップS416)。その結果、このSが3である場
合には(ステップS416肯定)、ステップS414に
移行し、Sが3でなければ(ステップS416否定)ス
テップS421に移行する。
If it is determined in step S403 that the code is a numerical code (No in step S403),
The code stored in K is restored to a state value and stored in S (step S415), and it is confirmed whether or not S is 3 (step S416). As a result, when S is 3 (Yes at Step S416), the process proceeds to Step S414, and when S is not 3 (No at Step S416), the process proceeds to Step S421.

【0058】上記一連の処理をおこなうことにより、状
態符号を入力して所定の状態値Sに復元した時点で、こ
のSがS3の状態である場合には一組のランレングス値
が省略されているので、数値符号の入力を待つことなく
その時点でAおよびBに記憶した一組のランレングス値
の出力をおこなうことができる。
By performing the above series of processing, when a state code is input and restored to a predetermined state value S, if this S is in the state of S3, a set of run-length values is omitted. Therefore, a set of run-length values stored in A and B at that time can be output without waiting for the input of a numerical code.

【0059】また、数値符号を入力し所定の数値に復元
してLに記憶した時点で、このS値がS0である場合に
は、一組のランレングス値が一組の数値符号に符号化さ
れているので、このLに記憶した値と次の数値符号を復
号して得られる値とを用いて一組のランレングス値の出
力をおこなう。
When a numerical code is input, restored to a predetermined numerical value and stored in L, if this S value is S0, a set of run-length values is encoded into a set of numerical codes. Therefore, a set of run-length values is output using the value stored in L and the value obtained by decoding the next numerical code.

【0060】また、このS値がS1である場合には、0
の連続数に対する数値符号が省略されているので、Aに
記憶した値と復元した数値Lとを用いて一組のランレン
グス値の出力をおこない、このS値がS2である場合に
は、1の連続数に対する数値符号が省略されているの
で、Bに記憶した値と復元した数値Lとを用いて一組の
ランレングス値の出力をおこなう。
When the S value is S1, 0
Is omitted, a set of run-length values is output using the value stored in A and the restored numerical value L. If the S value is S2, 1 Is omitted, the output of a set of run-length values is performed using the value stored in B and the restored numerical value L.

【0061】さらに、このS値がS3である場合には、
復元された数値は反復数Nであり、N組のランレングス
値が省略されているので、その時点でAおよびBに記憶
された値を用いて一組のランレングス値の出力動作を数
値の回数分繰り返す。このため、図2に示したデータ符
号化手順で生成した符号列データから元のランレングス
列を復号することができる。
Further, when the S value is S3,
Since the restored number is the number of iterations N and the N sets of run-length values are omitted, the output operation of one set of run-length values is performed using the values stored in A and B at that time. Repeat for the number of times. For this reason, the original run-length sequence can be decoded from the code sequence data generated by the data encoding procedure shown in FIG.

【0062】なお、上記処理手順をソフトウエアで実現
する場合には、X,Y,A,B,S,T,K,Lおよび
Nには適切なメモリを割り当てれば良いが、マイクロプ
ロセッサの汎用レジスタを用いることが処理性能を向上
するうえで望ましい。また、定数Cと各制御について
は、プログラムすなわち命令コードとして記述すること
で実現できる。
When the above procedure is implemented by software, appropriate memories may be allocated to X, Y, A, B, S, T, K, L and N. It is desirable to use a general-purpose register in order to improve processing performance. The constant C and each control can be realized by describing them as a program, that is, an instruction code.

【0063】また、上記一連の処理のいくつかは省略す
ることができ、たとえば、反復数を計数記憶するための
Nと、復元された数値を記憶するLとを兼用して一方を
省略することもできる。出力ランレングス値を記憶する
XおよびYの一方で他方を代用することもできる。
Some of the above series of processing can be omitted. For example, N for counting and storing the number of repetitions and L for storing the restored numerical value can be omitted. Can also. One of the X and Y for storing the output run length value can be substituted for the other.

【0064】さらに、上記一連の説明では説明の便宜
上、ランレングス数値出力(ステップS414およびS
418)およびこれに関連するデータ終了判定(ステッ
プS421)についての詳細な説明を省略した。
Further, in the above series of descriptions, run-length numerical output (steps S414 and S414) is provided for convenience of explanation.
418) and the related data end determination (step S421) have been omitted.

【0065】次に、図2および図4に示したデータ符号
化処理およびデータ復号化処理に用いる符号セットにつ
いて説明する。図5は、図2および図4に示したデータ
符号化処理およびデータ復号化処理に用いる符号セット
の一例を示す説明図である。
Next, a code set used in the data encoding process and the data decoding process shown in FIGS. 2 and 4 will be described. FIG. 5 is an explanatory diagram illustrating an example of a code set used for the data encoding process and the data decoding process illustrated in FIGS. 2 and 4.

【0066】同図に示すように、本実施の形態で用いる
符号セットは第1〜第6の6種類の符号単位で構成さ
れ、具体的には、第1の符号形式P1〜第3の符号形式
P3は数値を示す数値符号Pであり、第4の符号形式Q
1〜第6の符号形式Q3は、状態値を示す状態符号Qで
ある。
As shown in the figure, the code set used in the present embodiment is composed of first to sixth types of code units. Specifically, the first code format P1 to the third code The format P3 is a numerical code P indicating a numerical value, and a fourth code format Q
The first to sixth code formats Q3 are status codes Q indicating status values.

【0067】ここで、第1の符号形式P1は、4ビット
幅を有し、該4ビットの数値が”10”未満であること
を利用して識別されるものであり、該数値に1を加算し
た値が数値Lに対応する。第2の符号形式P2は、8ビ
ット幅を有し、符号列において先行する上位4ビットの
値が”11”または”12”であることにより識別され
るものであり、下位ビットの値に”11”を加算した値
が数値Lに対応する。
Here, the first code format P1 has a 4-bit width and is identified using the fact that the 4-bit numerical value is less than “10”, and 1 is assigned to the numerical value. The added value corresponds to the numerical value L. The second code format P2 has an 8-bit width, is identified by the value of the preceding upper 4 bits in the code string being “11” or “12”, and the value of the lower bit is “2”. The value obtained by adding 11 ″ corresponds to the numerical value L.

【0068】第3の符号形式P3は、少なくとも8ビッ
ト幅で4の倍数となるビット幅を有し、符号列において
先行する上位4ビットの値が”12”であることにより
識別される。この4ビットについては、’8’以上の数
値が検出されるまで各4ビットの下位3ビットを上位に
向かって連接した(つなぎ合わせた)数値に”43”を
加算した値が数値Lに対応する。
The third code format P3 has a bit width of at least an 8-bit width and a multiple of 4, and is identified by the value of the preceding upper 4 bits in the code string being "12". As for these 4 bits, the value obtained by adding "43" to the numerical value obtained by concatenating (joining) the lower 3 bits of each 4 bits upward until a numerical value of "8" or more is detected corresponds to the numerical value L. I do.

【0069】第4の符号形式Q1は、4ビット幅を有
し、該4ビットの数値が”13”であることにより識別
され、直前の状態値に’1’を加算した値の下位2ビッ
トが新たな状態値に対応する。第5の符号形式Q2は、
4ビット幅を有し、該4ビットの数値が”14”である
ことにより識別され、直前の状態値に’2’を加算した
値の下位2ビットが新たな状態値に対応する。第6の符
号形式Q3は、4ビット幅を有し、該4ビットの数値
が”15”であることにより識別され、直前の状態値
に’3’を加算した値の下位2ビットが新たな状態値に
対応する。
The fourth code format Q1 has a 4-bit width and is identified by the fact that the 4-bit value is "13", and the lower 2 bits of the value obtained by adding "1" to the immediately preceding status value. Corresponds to the new state value. The fifth code format Q2 is
It has a 4-bit width, and is identified by the fact that the numerical value of the 4-bit is “14”, and the lower 2 bits of the value obtained by adding “2” to the immediately preceding status value correspond to the new status value. The sixth code format Q3 has a 4-bit width, and is identified by the fact that the numerical value of the 4-bit is “15”, and the lower 2 bits of the value obtained by adding “3” to the immediately preceding status value are new. Corresponds to the state value.

【0070】なお、状態値の値としては4つの値を取り
得るが、状態符号は状態値に変化が生じた場合にのみ生
成される。ある状態値から他の状態値への移行対象は3
つしかないので、状態符号の数は3つに削減されてい
る。
Although the state value can take four values, the state code is generated only when a change occurs in the state value. The transition target from one state value to another state value is 3
Since there are only three, the number of state codes is reduced to three.

【0071】また、数値符号Pにおいて、値が’0’と
なる符号を明示していないが、後述する変換手順を用い
て’0’を表現することが望ましい。ただし、この符号
形式は、表現可能な値域を原理的に制約するものではな
く、第3の符号形式P3を用いる場合には任意の整数を
表現することができる点に留意する必要がある。なぜな
ら、数値を復元する処理に用いられる一時記憶は有限の
ビット幅を持つものであるが、P3符号の長さには制約
がないので、連接と加算による処理結果が桁上がりによ
る’0’や負数となる符号を生成できるからである。
In the numerical code P, a code whose value is “0” is not explicitly shown, but it is desirable to represent “0” by using a conversion procedure described later. However, it should be noted that this code format does not restrict the expressible value range in principle, and an arbitrary integer can be expressed when the third code format P3 is used. This is because the temporary storage used for the process of restoring a numerical value has a finite bit width, but since the length of the P3 code is not restricted, the processing result by the concatenation and addition may be “0” due to a carry, or “0”. This is because a sign that is a negative number can be generated.

【0072】次に、図5に示した符号セットを用いた場
合の入力符号種判定、状態符号化制御、状態復元処理、
数値符号化処理および数値復元処理について説明する。
まず、入力符号種の判定(図4のステップS403に対
応する)においては、符号の先行する上位4ビットの値
が”12”以下の値であれば数値符号であると判断し、
それ以外の場合には状態符号であると判断することがで
きる。
Next, when the code set shown in FIG. 5 is used, input code type determination, state coding control, state restoration processing,
The numerical value encoding process and the numerical value restoration process will be described.
First, in the determination of the input code type (corresponding to step S403 in FIG. 4), if the value of the preceding upper 4 bits of the code is a value equal to or less than "12", it is determined that the code is a numerical code.
Otherwise, it can be determined that it is a status code.

【0073】図6は、図5に示した符号セットを用いた
場合の状態符号化制御手順を示すフローチャートであ
り、図7は、図5に示した符号セットを用いた場合の状
態復号化制御手順を示すフローチャートである。なお、
図中に示す「K(n)←数値」は、右辺の数値の下位n
ビットを符号として出力することを意味し、「W」は、
演算に使用する作業メモリである。
FIG. 6 is a flowchart showing a state encoding control procedure when the code set shown in FIG. 5 is used. FIG. 7 is a state decoding control procedure when the code set shown in FIG. 5 is used. It is a flowchart which shows a procedure. In addition,
“K (n) ← numerical value” shown in the figure is the lower n of the numerical value on the right side.
Bits are output as codes, and "W" is
This is a working memory used for calculation.

【0074】図6に示すように、状態符号化をおこなう
場合には、状態値Sから直前の状態値Tを減じた値と’
3’とをビットごとに論理和し、これに”12”を加算
した値を作業メモリWに格納し(ステップS601)、
この作業メモリWの下位4ビットを4ビットの符号Kと
して出力する(ステップS602)ことになる。
As shown in FIG. 6, when state encoding is performed, a value obtained by subtracting the immediately preceding state value T from the state value S is obtained by adding
3 'is ORed bit by bit, and a value obtained by adding "12" to this is stored in the working memory W (step S601).
The lower 4 bits of the working memory W are output as a 4-bit code K (step S602).

【0075】図7に示すように、状態復号化をおこなう
場合には、Q1〜Q3のいずれかの符号の発生に対応し
て、符号の値から”12”を減じた値をそれまでの状態
値Sに加算し、その結果の値と定数値’3’とのビット
ごとの論理積をとってこれを新たな状態値として状態値
Sに格納する(ステップS701)ことになる。
As shown in FIG. 7, when state decoding is performed, a value obtained by subtracting "12" from the code value in response to the occurrence of one of the codes Q1 to Q3 is set to the state up to that time. The value is added to the value S, the logical product of the result value and the constant value '3' is calculated for each bit, and this is stored as a new state value in the state value S (step S701).

【0076】上記図6および図7に示す制御をおこなう
ことにより、所定の状態符号の生成および該状態符号を
用いた状態値の復元が可能となる。たとえば、符号化の
直前の状態値Tが’0’で新たな状態値Sが’3’であ
る場合には、「S−T」は’3’となるため、この値と
定数値’3’のビットごとの論理積は’3’となる。そ
して、この値に”12”を加えた”15”すなわちQ3
符号が生成される。一方、状態符号を復元する際には、
「K−12」は”3”となり、この値にそれまでの状態
値’0’を加えた値’3’と定数値’3’のビットごと
の論理積をとると、’3’が新たな状態値Sとなり、正
しく復元されていることが分かる。
By performing the control shown in FIGS. 6 and 7, it is possible to generate a predetermined state code and restore a state value using the state code. For example, if the state value T immediately before encoding is “0” and the new state value S is “3”, “ST” becomes “3”, so this value and the constant value “3” The logical product of 'for each bit is'3'. Then, "15" obtained by adding "12" to this value, that is, Q3
A code is generated. On the other hand, when restoring the state code,
"K-12" becomes "3", and when a logical AND for each bit of a value "3" obtained by adding the previous state value "0" to this value and a constant value "3" is obtained, "3" is newly obtained. It can be seen that the state value S is properly restored.

【0077】また、符号化の直前の状態値Tが’3’で
新たな状態値Sが’0’である場合には、「S−T」
は’−3’となり、この値と定数値’3’のビットごと
の論理積は’1’となるので、この値に”12”を加え
た”13”すなわちQ1符号が生成される。一方、状態
符号を復元する際には、「K−12」は”1”となり、
この値にそれまでの状態値’3’を加えた値’4’と定
数値’3’のビットごとの論理積をとると、’0’が新
たな状態値Sとなり、正しく復元されていることが分か
る。
If the state value T immediately before encoding is “3” and the new state value S is “0”, “ST”
Is "-3", and the logical product of this value and the constant value "3" for each bit is "1", so "13", which is obtained by adding "12" to this value, that is, a Q1 code is generated. On the other hand, when restoring the state code, “K-12” becomes “1”,
When a logical AND for each bit of a value '4' obtained by adding the previous state value '3' to this value and a constant value '3' is taken, '0' becomes a new state value S and is correctly restored. You can see that.

【0078】図8は、図5に示した符号セットを用いた
場合の数値符号化制御手順を示すフローチャートであ
り、図9は、図5に示した符号セットを用いた場合の数
値復号化制御手順を示すフローチャートである。なお、
図中に示す「K(n)←数値」は、右辺の数値の下位n
ビットを符号として出力することを意味し、「W」は、
演算に使用する作業メモリである。
FIG. 8 is a flowchart showing a numerical value encoding control procedure when the code set shown in FIG. 5 is used, and FIG. 9 is a numerical decoding control procedure when the code set shown in FIG. 5 is used. It is a flowchart which shows a procedure. In addition,
“K (n) ← numerical value” shown in the figure is the lower n of the numerical value on the right side.
Bits are output as codes, and "W" is
This is a working memory used for calculation.

【0079】図8に示すように、ここでは符号化対象で
ある数値「V」をP1〜P3のいずれかの符号に変換し
て出力する。すでに言及したように、この数値符号Pに
は値が’0’となる符号が定義されていないので、ここ
では「V=0」である場合にはこれを「Z」という定数
値に変換する0値変換処理をおこなっている。すなわ
ち、V=0となる頻度が非常に低いため、これを比較的
に長い符号語に割り当てることにより圧縮率の改善を図
っている。具体的には、下記に示すステップS801〜
S804がこの0値変換処理に相当し、ステップS80
5以降が数値から符号語を生成する処理に相当する。
As shown in FIG. 8, here, the numerical value "V" to be encoded is converted into one of the codes P1 to P3 and output. As already mentioned, since the sign whose value is “0” is not defined in this numerical code P, here, when “V = 0”, this is converted into a constant value “Z”. 0 value conversion processing is performed. That is, since the frequency of V = 0 is very low, the compression rate is improved by assigning this to a relatively long codeword. Specifically, steps S801 to S801 shown below
Step S804 corresponds to this 0-value conversion processing, and step S80
Steps 5 and after correspond to a process of generating a codeword from a numerical value.

【0080】同図に示すように、まず最初に、符号化対
象値Vが定数値Z以上であるか否かを判断し(ステップ
S801)、Z以上である場合には(ステップS801
肯定)Vの値をインクリメントする(ステップS80
2)。また、Z以上でない場合には(ステップS801
否定)Vが0であるか否かを判断し(ステップS80
3)、Zが0であれば(ステップS803肯定)Vに定
数値Zを格納する(ステップS804)。
As shown in the figure, first, it is determined whether or not the encoding target value V is equal to or larger than a constant value Z (step S801).
Affirmative) Increment the value of V (step S80)
2). If it is not equal to or greater than Z (step S801)
(No) It is determined whether V is 0 (step S80).
3) If Z is 0 (Yes at Step S803), the constant value Z is stored in V (Step S804).

【0081】そして、この0値変換処理を終えたなら
ば、その時点での符号化対象値Vが”10”以下である
か否かを判断し(ステップS805)、”10”以下で
ある場合には(ステップS805肯定)、Vから’1’
を減じた値の下位4ビットを符号として出力して(ステ
ップS806)、数値符号化を終了する。
When the zero-value conversion processing is completed, it is determined whether or not the current encoding target value V is equal to or less than "10" (step S805). (Yes at step S805), V is set to “1”.
Is output as a code (step S806), and the numerical value encoding ends.

【0082】一方、Vが”10”以下でない場合には
(ステップS805否定)、このVが”42”以下であ
るか否かを判断し(ステップS807)、”42”以下
である場合には(ステップS807肯定)このVに”1
49”を加えた値の下位8ビットを符号として出力し
(ステップS808)、数値符号化を終了する。P2符
号の定義から、「K(8)←160+(V−11)」す
なわち「K(8)←V+149」となるので、ここで生
成される符号がP2符号にほかならない。なお、この”
160”を2進数表現すると「10100000」とな
るので、上位3ビットが符号固有の定数となる。
On the other hand, if V is not equal to or less than "10" (No at step S805), it is determined whether or not this V is equal to or less than "42" (step S807). (Yes at Step S807) This V is set to “1”.
The lower 8 bits of the value obtained by adding "49" are output as a code (step S808), and the numerical encoding is terminated. From the definition of the P2 code, "K (8) ← 160 + (V-11)", that is, "K ( 8) ← V + 149 ”, so that the code generated here is nothing but the P2 code. This "
When 160 ″ is expressed in a binary number, it becomes “10100000”, so that the upper 3 bits are a code-specific constant.

【0083】また、上記ステップS807において、V
が”42”以下でないと判断された場合には(ステップ
S807否定)、まずP3符号の開始識別符号として”
12”の値を持つ4ビットの符号を出力する(ステップ
S809)。その後、このVから”43”を減じた値を
作業メモリWに格納し(ステップS810)、このWの
値が’8’未満であるか否かを調べる(ステップS81
1)。
In step S807, V
Is not less than or equal to "42" (No at Step S807), first, as the start identification code of the P3 code, "
A 4-bit code having a value of "12" is output (step S809), and a value obtained by subtracting "43" from V is stored in the working memory W (step S810), and the value of this W becomes "8". It is checked whether it is less than (Step S81)
1).

【0084】その結果、’8’以上である場合には(ス
テップS811否定)、W値の下位3ビットの値を4ビ
ットの符号として出力するとともに(ステップS81
2)、このW値を3ビット分右にシフトして符号出力し
た部分を切り捨てた後に(ステップS813)、上記ス
テップS811に戻る。
As a result, if the value is equal to or more than '8' (No at Step S811), the value of the lower 3 bits of the W value is output as a 4-bit code (Step S81).
2) After shifting the W value to the right by 3 bits and discarding the portion output as a code (step S813), the process returns to step S811.

【0085】これに対して、’8’未満である場合には
(ステップS811肯定)、W値に’8’を加えた値を
4ビットの符号として出力して(ステップS814)、
数値符号化を終了する。なお、定数’7’を2進数表現
すると「0111」となるので、ステップS812で生
成される符号は常に’8’以上の数値となり、この符号
が数値部の最後のものであることを明示でき、この符号
がP3符号に他ならないことが分かる。
On the other hand, if it is smaller than '8' (Yes at step S811), a value obtained by adding '8' to the W value is output as a 4-bit code (step S814).
End the numerical encoding. In addition, since the constant '7' is expressed as “0111” in binary notation, the code generated in step S812 is always a numerical value equal to or more than '8', and it can be clearly indicated that this code is the last of the numerical part. It can be seen that this code is nothing but the P3 code.

【0086】図9に示すように、数値復元をおこなう場
合には、P1〜P3のいずれかの符号形式で符号化され
た符号列を順次4ビット単位で読み出し、作業メモリW
に数値を復元することになる。なお、「K←符号入力」
なる標記は、Kに4ビットの符号を数値として入力する
ことを意味する。また、ここでは図8に示した0値変換
処理の逆変換である「0値逆変換処理」をおこなってい
る。下記に示すステップS901〜S911が数値復元
処理に相当し、ステップS912以降が0値逆変換処理
に相当する。
As shown in FIG. 9, when performing a numerical restoration, a code string coded in any of the code formats P1 to P3 is sequentially read in 4-bit units, and
Will be restored. “K ← Sign input”
The notation "" means that a 4-bit code is input to K as a numerical value. Also, here, “0-value inverse conversion processing”, which is the inverse conversion of the 0-value conversion processing shown in FIG. 8, is performed. Steps S901 to S911 described below correspond to a numerical value restoration process, and steps S912 and subsequent steps correspond to a 0-value inverse conversion process.

【0087】同図に示すように、数値復元処理をおこな
う場合には、まず符号の最初の4ビットをKに入力し
(ステップS901)、このK値が”10”未満である
か否かを判断する(ステップS902)。そして、K値
が”10”未満である場合には(ステップS902肯
定)、このK値に’1’を加えた値を復元数値としてW
に格納し(ステップS903)、後述する0値逆変換処
理に移行する。なお、最初の4ビットが”10”未満で
ある符号はP1符号に他ならないので、このK値に’
1’を加えることで数値に復元できる。
As shown in the figure, when performing the numerical value restoration processing, first, the first 4 bits of the code are input to K (step S901), and it is determined whether or not this K value is less than “10”. A determination is made (step S902). If the K value is less than “10” (Yes at Step S902), a value obtained by adding “1” to the K value is set as a restored numerical value.
(Step S903), and the process proceeds to a 0-value inverse conversion process described later. Note that a code whose first 4 bits are less than “10” is nothing but a P1 code.
Numerical values can be restored by adding 1 '.

【0088】これに対して、K値が”10”未満でない
場合には(ステップS902否定)、このK値が”1
2”であるか否かを判断し(ステップS904)、”1
2”でない場合には(ステップS904否定)、K値を
4ビット左シフトした値をWに記憶し、このKに符号の
次の4ビットを入力して、Wと新たなK値とを加えた値
から”149”を減じた値を復元数値としてWに格納し
た後(ステップS905)、後述する0値逆変換処理に
移行する。
On the other hand, if the K value is not less than “10” (No at Step S 902), the K value becomes “1”.
It is determined whether or not “1” is “2” (step S904).
If it is not 2 "(No at Step S904), the value obtained by shifting the K value left by 4 bits is stored in W, the next 4 bits of the code are input to K, and W and the new K value are added. After the value obtained by subtracting “149” from the calculated value is stored in W as a restored numerical value (step S905), the process proceeds to a 0-value inverse conversion process described later.

【0089】一方、K値が”12”である場合には(ス
テップS904肯定)、符号が8ビット長を持つP2符
号に他ならないので、Wの値を’0’に初期化した後
(ステップS906)、符号の次の4ビットをKに入力
し(ステップS907)、WにこのK値を加算し(ステ
ップS908)、該K値が’8’未満であるか否かを判
断する(ステップS909)。
On the other hand, if the K value is "12" (Yes at step S904), since the code is nothing but a P2 code having an 8-bit length, the value of W is initialized to "0" (step S904). S906), the next 4 bits of the code are input to K (step S907), the K value is added to W (step S908), and it is determined whether or not the K value is less than '8' (step S906). S909).

【0090】その結果、K値が’8’未満である場合に
は(ステップS909肯定)、以降に数値部の符号が続
くので、Wの値を3ビット左にシフトした後に(ステッ
プS910)、上記ステップS907に移行する。
As a result, when the K value is less than '8' (Yes at step S909), since the sign of the numerical part follows thereafter, after shifting the value of W to the left by 3 bits (step S910), The process moves to step S907.

【0091】これに対して、K値が’8’未満でない場
合には(ステップS909否定)、それまでのWに”3
5”を加算した値をあらためてWに格納し(ステップS
911)、0値逆変換処理に移行する。P3符号では、
その4ビットとして’8’以上の値が検出されるまで各
4ビットの下位3ビットを上位に向かって連接した(つ
なぎ合わせた)数値に”43”を加算した値が復元数値
に対応する。そして、’8’以上の数値が検出されたと
きのKの値には、数値部分の終了を示す’8’が余分に
加算されているので、ここでは「43−8」である”3
5”を加算している。
On the other hand, if the K value is not less than “8” (No at step S909), “3” is added to W up to that time.
The value obtained by adding 5 "is stored in W again (step S
911), and shifts to the 0-value inverse conversion process. In the P3 code,
A value obtained by adding "43" to a numerical value obtained by connecting (joining) the lower 3 bits of each of the 4 bits upwards until a value of "8" or more is detected as the 4 bits corresponds to the restored numerical value. In addition, since “8” indicating the end of the numerical part is added to the value of K when a numerical value equal to or more than “8” is detected, “43-8” is “3-8” here.
5 "is added.

【0092】その後、0値変換処理を復元する0値逆変
換処理をおこなう。具体的には、復元された数値Wが定
数Zよりも大きな値であるか否かを確認し(ステップS
912)、Zよりも大きな値である場合には(ステップ
S912肯定)、Wから’1’を減じた値をWに格納し
て(ステップS913)数値復元処理を終了する。
Thereafter, a 0-value inverse conversion process for restoring the 0-value conversion process is performed. Specifically, it is determined whether or not the restored numerical value W is a value larger than the constant Z (Step S).
912) If the value is larger than Z (Yes at step S912), a value obtained by subtracting '1' from W is stored in W (step S913), and the numerical value restoration process ends.

【0093】これに対して、数値WがZ以下である場合
には(ステップS912否定)、復元された数値Wが定
数Zと一致するか否かを確認し(ステップS914)、
一致する場合には(ステップS914肯定)、このW
に’0’を代入して(ステップS915)数値復元処理
を終了する。
On the other hand, if the numerical value W is equal to or smaller than Z (No at Step S912), it is checked whether the restored numerical value W matches the constant Z (Step S914).
If they match (Yes at step S914), this W
Is substituted for '0' (step S915), and the numerical value restoration processing ends.

【0094】上述してきたように、本実施の形態では、
0ビットの連続数X、1ビットの連続数Y、Xの直前の
値A、Yの直前の値Bに基づいて、状態S0〜S3のい
ずれかの値を状態値をSとし、このSの直前の値をTと
し、不一致事象が発生した場合には状態値Sの値を示す
状態符号Qを生成し、符号生成を終了した時点または一
致事象が発生した時点において、X≠Aである場合には
Xの値を示す数値符号Pを生成し、Y≠Bである場合に
はYの値を示す数値符号Pを生成し、回帰事象が発生し
た場合には状態符号の生成に先立って反復数Nの値を示
す数値符号Pを生成するよう構成したので、マイクロプ
ロセッサによるソフトウエア処理で、誤差拡散処理によ
り生成された疑似中間調画像データについても効率良く
圧縮することができる。
As described above, in the present embodiment,
Based on the continuous number X of 0 bits, the continuous number Y of 1 bit, the value A immediately before X, and the value B immediately before Y, any one of the states S0 to S3 is set as the state value, and When the immediately preceding value is T, a status code Q indicating the value of the status value S is generated when a mismatch event occurs, and X ≠ A at the time when code generation is completed or when a match event occurs. Generates a numerical code P indicating the value of X, generates a numerical code P indicating the value of Y when Y ≠ B, and iterates prior to generation of the state code when a regression event occurs. Since the numerical code P indicating the value of the number N is generated, the pseudo halftone image data generated by the error diffusion process can be efficiently compressed by software processing by the microprocessor.

【0095】[0095]

【発明の効果】以上説明したように、請求項1の発明に
よれば、0のビットの連続数、1のビットの連続数、直
前の0のビットの連続数および直前の1のビットの連続
数に基づいて、入力単位のデータに対応する状態値を算
定し、算定した状態値および直前の状態値に基づいて、
入力単位のデータに対応する状態符号および数値符号を
生成するよう構成したので、誤差拡散処理により生成さ
れた疑似中間調画像データについても効率良く圧縮する
ことが可能なデータ符号化方法が得られるという効果を
奏する。
As described above, according to the first aspect of the present invention, the continuation number of 0 bits, the continuation number of 1 bit, the continuation number of the immediately preceding 0 bit, and the continuation of the immediately preceding 1 bit The state value corresponding to the data of the input unit is calculated based on the number, and based on the calculated state value and the immediately preceding state value,
Since the state code and the numerical code corresponding to the data of the input unit are configured to be generated, a data coding method capable of efficiently compressing the pseudo halftone image data generated by the error diffusion process is obtained. It works.

【0096】また、請求項2の発明によれば、0のビッ
トの連続数X、1のビットの連続数Y、直前の0のビッ
トの連続数Aおよび直前の1のビットの連続数Bが、X
≠A且つY≠Bの関係にある場合に状態S0の値を状態
値Sとし、X=A且つY≠Bの関係にある場合に状態S
1の値を状態値Sとし、X≠A且つY=Bの関係にある
場合に状態S2の値を状態値Sとし、X=A且つY=B
の関係にある場合に状態S3の値を状態値Sとするよう
構成したので、4つの状態値を利用して、効率良くデー
タを圧縮することが可能なデータ符号化方法が得られる
という効果を奏する。
According to the second aspect of the present invention, the continuation number X of 0 bits, the continuation number Y of 1 bit, the continuation number A of the immediately preceding 0 bit, and the continuation number B of the immediately preceding 1 bit are obtained. , X
When the relationship is ≠ A and Y ≠ B, the value of the state S0 is set to the state value S, and when the relationship X = A and Y ≠ B, the state S is set.
1 is the state value S, and when X ≠ A and Y = B, the value of the state S2 is the state value S, and X = A and Y = B
Since the state S3 is set to the state value S in the case of the following relation, the effect of obtaining a data encoding method capable of efficiently compressing data using four state values is obtained. Play.

【0097】また、請求項3の発明によれば、直前の状
態値Tが状態S3であり、かつ、状態値Sと直前の状態
値Tとが等しい一致事象となった場合にこれを反復事象
とみなして、該反復事象が連続して発生する反復数Nを
算出し、反復事象の発生後に、状態値Sと直前の状態値
Tとが異なる不一致事象または入力完了となった場合に
回帰事象と判定し、不一致事象が発生した場合に状態値
Sの値を示す状態符号を生成し、この状態符号の生成が
終了するかまたは一致事象が発生した際に、0のビット
の連続数Xまたは1のビットの連続数Yの値を示す数値
符号を生成し、回帰事象が発生した場合に、状態符号の
生成に先だって反復数Nの値を示す数値符号を生成する
よう構成したので、一致事象、不一致事象、反復事象、
回帰事象の概念を利用して効率良くデータを圧縮するこ
とが可能なデータ符号化方法が得られるという効果を奏
する。
According to the third aspect of the present invention, when the immediately preceding state value T is the state S3, and the state value S is equal to the immediately preceding state value T, this event is repeated. And the number of repetitions N at which the repetitive event occurs continuously is calculated, and after the repetitive event occurs, when the state value S and the immediately preceding state value T are different events or the input is completed, a regression event is performed. When a mismatch event occurs, a status code indicating the value of the status value S is generated. When the generation of this status code ends or when a match event occurs, the number of consecutive bits X of 0 or Since a numerical code indicating the value of the number of consecutive 1 bits Y is generated, and when a regression event occurs, a numerical code indicating the value of the number of repetitions N is generated prior to generation of the state code. , Discrepancy event, repetition event,
There is an effect that a data encoding method capable of efficiently compressing data using the concept of the regression event is obtained.

【0098】また、請求項4の発明によれば、符号化を
開始する際に、T、A、Bおよび反復数Nにそれぞれ所
定の初期値を格納し、XおよびYに所定のランレングス
値を入力し、この入力後に状態値Sを生成し、生成され
た状態値Sに対応して一致事象または不一致事象の発生
を判定し、一致事象の発生に応答して反復事象の発生の
有無を判定し、反復事象の発生に応答して反復数を加算
するし、不一致事象の発生または符号化対象データの終
了に応答して回帰事象の発生の有無を判定し、回帰事象
の発生に応答して反復数Nの値を示す反復数数値符号を
生成し、反復数数値符号の生成後に反復数Nを所定の初
期値に戻し、不一致事象の発生または反復数Nの初期化
に応答して状態値Sの値を表現する状態符号を生成し、
状態符号の生成または反復事象の発生の判定後に、Xが
Aと一致しない場合に該Xに対応する数値符号を生成
し、YがBと一致しない場合に該Yに対応する数値符号
を生成し、数値符号の生成または反復数Nの加算後に、
Aの内容をXに更新し、Bの内容をYに更新し、Tの内
容をSに更新するよう構成したので、マイクロプロセッ
サによるソフトウエア処理に適合したデータの圧縮をお
こなうことが可能なデータ符号化方法が得られるという
効果を奏する。
According to the fourth aspect of the present invention, when encoding is started, a predetermined initial value is stored in each of T, A, B and the number of repetitions N, and a predetermined run length value is stored in X and Y. Is input, and a state value S is generated after the input. The occurrence of a matching event or a mismatching event is determined according to the generated state value S, and the presence or absence of a repetitive event is determined in response to the occurrence of the matching event. Judge, add the number of repetitions in response to the occurrence of the repetition event, determine whether a regression event has occurred in response to the occurrence of a mismatch event or the end of the data to be encoded, and respond to the occurrence of the regression event. To generate a numerical code for the number of repetitions indicating the value of the number of repetitions N. After the numerical code for the number of repetitions is generated, the number of repetitions N is returned to a predetermined initial value. Generate a state code representing the value of the value S;
After the state code is generated or the occurrence of the repetition event is determined, a numerical code corresponding to X is generated when X does not match A, and a numerical code corresponding to Y is generated when X does not match B. , After generating a numerical code or adding the number of iterations N,
Since the contents of A are updated to X, the contents of B are updated to Y, and the contents of T are updated to S, the data can be compressed so as to be suitable for software processing by the microprocessor. There is an effect that an encoding method can be obtained.

【0099】また、請求項5の発明によれば、復号化を
開始する際に、復元される状態値を記憶する記憶部S、
復元されるランレングス値のうち前記Xに相当する値を
記憶する記憶部Cおよび復元されるランレングス値のう
ち前記Yに相当する値を記憶する記憶部Dに所定の初期
値を代入して初期化し、所定の符号単位を入力して該符
号が数値符号Pであるか状態符号Qであるかを判定し、
数値符号と判定された場合に、該符号を数値に復元して
記憶部Lに記憶し、状態符号と判定された場合に、該符
号を状態値に復元してSに記憶し、Lに復元数値が格納
された時点での状態値Sの値が、X≠A且つY≠Bの関
係にある状態S0、X=A且つY≠Bの関係にある状態
S1、X≠A且つY=Bの関係にある状態S2若しくは
X=A且つY=Bの関係にある状態S3のいずれである
かを識別し、Sに新たな状態値が格納された時点で、該
Sの値がS3と一致するか否かを判定し、Sの値がS0
であると識別された場合に、Lの値をCに格納した後に
次の数値符号を入力および復元してDに格納し、Sの値
がS1であると識別された場合に、Lの値をDに格納
し、Sの値がS2であると識別された場合に、Lの値を
Cに格納し、更新が終了した時点またはSの値が状態値
S3と一致すると判定された時点で、CおよびDの値を
一組のランレングス値として出力し、S値の値がS3で
あると識別された場合に、CおよびDの値を一組のラン
レングス値としてLの値に対応する回数分出力するよう
構成したので、誤差拡散処理により生成された疑似中間
調画像データを圧縮したものを効率良く復元することが
可能なデータ復号化方法が得られるという効果を奏す
る。
According to the fifth aspect of the present invention, when the decoding is started, the storage unit S for storing the restored state value,
A predetermined initial value is assigned to a storage unit C for storing a value corresponding to the X among the restored run-length values and a storage unit D for storing a value corresponding to the Y among the restored run-length values. Initialize, input a predetermined code unit and determine whether the code is a numerical code P or a status code Q,
If it is determined to be a numerical code, the code is restored to a numerical value and stored in the storage unit L. If it is determined to be a state code, the code is restored to a state value and stored to S, and restored to L When the value of the state value S at the time when the numerical value is stored is a state S0 in a relation of X ≠ A and Y ≠ B, a state S1 in a relation of X = A and Y ≠ B, X ≠ A and Y = B , Or the state S3 in the relationship of X = A and Y = B, and when a new state value is stored in S, the value of the S matches the value of S3. It is determined whether or not to perform
, When the value of L is stored in C, the next numerical code is input and restored and stored in D, and when the value of S is identified as S1, the value of L Is stored in D, and when the value of S is identified as S2, the value of L is stored in C, and when the update is completed or when it is determined that the value of S matches the state value S3, , C, and D are output as a set of run-length values, and if the value of S is identified as S3, the values of C and D correspond to the value of L as a set of run-length values. Since it is configured to output as many times as possible, an effect is obtained that a data decoding method capable of efficiently restoring the compressed halftone image data generated by the error diffusion process can be obtained efficiently.

【0100】また、請求項6の発明によれば、請求項1
〜5のいずれか一つに記載された方法をコンピュータに
実行させるプログラムを記録したことで、そのプログラ
ムを機械読み取り可能となり、これによって、請求項1
〜5のいずれか一つの動作をコンピュータによって実現
することが可能な記録媒体が得られるという効果を奏す
る。
According to the invention of claim 6, according to claim 1,
Recording a program that causes a computer to execute the method described in any one of (1) to (5), thereby making the program readable by a machine.
This provides an effect that a recording medium capable of realizing any one of the operations (1) to (5) by a computer is obtained.

【図面の簡単な説明】[Brief description of the drawings]

【図1】この発明の実施の形態に係るデータ符号化方法
およびデータ復号化方法の概念を説明するための説明図
である。
FIG. 1 is an explanatory diagram for explaining the concept of a data encoding method and a data decoding method according to an embodiment of the present invention.

【図2】本実施の形態で用いる符号化手順を示すフロー
チャートである。
FIG. 2 is a flowchart showing an encoding procedure used in the present embodiment.

【図3】図2のステップS209およびS219に示す
未出力N符号化手順を示すフローチャートである。
FIG. 3 is a flowchart showing a non-output N encoding procedure shown in steps S209 and S219 of FIG. 2;

【図4】本実施の形態に係るデータ復号手順を示すフロ
ーチャートである。
FIG. 4 is a flowchart showing a data decoding procedure according to the present embodiment.

【図5】図2および図4に示したデータ符号化処理およ
びデータ復号化処理に用いる符号セットの一例を示す説
明図である。
FIG. 5 is an explanatory diagram showing an example of a code set used for the data encoding process and the data decoding process shown in FIGS. 2 and 4;

【図6】図5に示した符号セットを用いた場合の状態符
号化制御手順を示すフローチャートである。
6 is a flowchart showing a state encoding control procedure when the code set shown in FIG. 5 is used.

【図7】図5に示した符号セットを用いた場合の状態復
号化制御手順を示すフローチャートである。
FIG. 7 is a flowchart showing a state decoding control procedure when the code set shown in FIG. 5 is used.

【図8】図5に示した符号セットを用いた場合の数値符
号化制御手順を示すフローチャートである。
8 is a flowchart showing a numerical encoding control procedure when the code set shown in FIG. 5 is used.

【図9】図5に示した符号セットを用いた場合の数値復
号化制御手順を示すフローチャートである。
FIG. 9 is a flowchart showing a numerical value decoding control procedure when the code set shown in FIG. 5 is used.

【符号の説明】[Explanation of symbols]

X 0の連続数 Y 1の連続数 A 直前のX値 B 直前のY値 S 状態値 T 直前のS値 N,P,P1,P2,P3 数値符号 Q、Q1,Q2,Q3 状態符号 X Number of continuations of Y 1 Number of continuations of 1 A X value immediately before B Y value immediately before S State value T S value immediately before N, P, P1, P2, P3 Numeric code Q, Q1, Q2, Q3 Status code

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 データを走査して得られるランレングス
数値列を0のビット連続数と1のビット連続数との組を
入力単位として順次入力し、所定の符号列に変換して出
力するデータ符号化方法であって、 前記0のビットの連続数、前記1のビットの連続数、直
前の0のビットの連続数および直前の1のビットの連続
数に基づいて、前記入力単位のデータに対応する状態値
を算定する算定工程と、 前記算定工程により算定された状態値および直前の状態
値に基づいて、前記入力単位のデータに対応する状態符
号および数値符号を生成する生成工程と、を含んだこと
を特徴とするデータ符号化方法。
1. A data sequence in which a run-length numerical sequence obtained by scanning data is sequentially input as a set of a continuous number of 0 bits and a continuous number of 1 bits as an input unit, converted into a predetermined code sequence, and output. An encoding method, wherein the data of the input unit is based on the number of consecutive 0 bits, the number of consecutive 1 bits, the number of consecutive 0 bits immediately before, and the number of consecutive 1 bits immediately before. A calculating step of calculating a corresponding state value, and a generating step of generating a state code and a numerical code corresponding to the data of the input unit based on the state value calculated by the calculating step and the immediately preceding state value. A data encoding method characterized by including:
【請求項2】 前記算定工程は、前記0のビットの連続
数X、前記1のビットの連続数Y、直前の0のビットの
連続数Aおよび直前の1のビットの連続数Bが、X≠A
且つY≠Bの関係にある場合に状態S0の値を状態値S
とし、X=A且つY≠Bの関係にある場合に状態S1の
値を状態値Sとし、X≠A且つY=Bの関係にある場合
に状態S2の値を状態値Sとし、X=A且つY=Bの関
係にある場合に状態S3の値を状態値Sとすることを特
徴とする請求項1に記載のデータ符号化方法。
2. The method according to claim 1, wherein the consecutive number X of the 0 bits, the consecutive number Y of the one bit, the consecutive number A of the immediately preceding 0 bit, and the consecutive number B of the immediately preceding 1 bit are X, ≠ A
When the relation of Y ≠ B is satisfied, the value of the state S0 is changed to the state value S.
When X = A and Y ≠ B, the value of the state S1 is set as the state value S. When X ≠ A and Y = B, the value of the state S2 is set as the state value S. 2. The data encoding method according to claim 1, wherein the value of the state S3 is set to the state value S when A and Y = B.
【請求項3】 前記生成工程は、 直前の状態値Tが状態S3であり、かつ、前記状態値S
と直前の状態値Tとが等しい一致事象となった場合にこ
れを反復事象とみなして、該反復事象が連続して発生す
る反復数Nを算出する反復数算定工程と、 前記反復事象の発生後に、前記状態値Sと直前の状態値
Tとが異なる不一致事象または入力完了となった場合に
回帰事象と判定する回帰事象判定工程と、 前記不一致事象が発生した場合に前記状態値Sの値を示
す状態符号を生成する状態符号生成工程と、 前記状態符号生成工程による状態符号の生成が終了する
かまたは前記一致事象が発生した際に、前記0のビット
の連続数Xまたは前記1のビットの連続数Yの値を示す
数値符号を生成する第1の数値符号生成工程と、 前記回帰事象が発生した場合に、前記状態符号生成工程
による状態符号の生成に先だって、前記反復数算定工程
によって算定された反復数Nの値を示す数値符号を生成
する第2の数値符号生成工程と、 を含んだことを特徴とする請求項2に記載のデータ符号
化方法。
3. In the generating step, the immediately preceding state value T is the state S3, and the state value S
A repetition number calculating step of calculating the number N of repetitions in which the repetition event occurs successively when the coincidence event becomes equal to the immediately preceding state value T, and the occurrence of the repetition event A regression event determining step of determining a regression event when the status value S and the immediately preceding status value T differ from each other or when input is completed; and a value of the status value S when the mismatch event occurs. A state code generation step of generating a state code indicating: when the generation of the state code by the state code generation step is completed or when the coincidence event occurs, the continuous number X of the 0 bits or the 1 bit A first numerical code generation step of generating a numerical code indicating the value of the continuous number Y, and, when the regression event occurs, prior to generation of the state code by the state code generation step, the repetition number calculation step Yo The data encoding method according to claim 2, further comprising: a second numerical code generation step of generating a numerical code indicating the value of the number of repetitions N calculated in the above.
【請求項4】 前記算定工程は、符号化を開始する際
に、T、A、Bおよび反復数Nにそれぞれ所定の初期値
を格納する初期化工程と、前記XおよびYに所定のラン
レングス値を入力する入力工程と、前記入力工程による
入力後に、前記状態値Sを生成する状態値生成工程とを
含み、 前記生成工程は、前記状態値生成工程により生成された
状態値Sに対応して前記一致事象または不一致事象の発
生を判定する一致事象判定工程と、前記一致事象の発生
に応答して前記反復事象の発生の有無を判定する反復事
象判定工程と、前記反復事象の発生に応答して前記反復
数を加算する反復数加算工程と、前記不一致事象の発生
または符号化対象データの終了に応答して前記回帰事象
の発生の有無を判定する回帰事象判定工程と、前記回帰
事象の発生に応答して前記反復数Nの値を示す反復数数
値符号を生成する反復数数値符号生成工程と、前記反復
数数値符号の生成後に前記反復数Nを所定の初期値に戻
す回帰工程と、前記不一致事象の発生または前記回帰工
程による反復数Nの初期化に応答して前記状態値Sの値
を表現する状態符号を生成する状態符号生成工程と、前
記状態符号生成工程による状態符号の生成または前記反
復事象判定工程による反復事象の発生の判定後に、前記
XがAと一致しない場合に該Xに対応する数値符号を生
成し、前記YがBと一致しない場合に該Yに対応する数
値符号を生成する数値符号生成工程と、前記数値符号生
成工程による数値符号の生成または前記反復数加算工程
による反復数Nの加算後に、前記Aの内容をXに更新
し、前記Bの内容をYに更新し、前記Tの内容をSに更
新する直前値更新工程とを含んだことを特徴とする請求
項3に記載のデータ符号化方法。
4. The calculating step includes, when coding is started, storing a predetermined initial value in each of T, A, B and the number of repetitions N, and a predetermined run length in the X and Y. An input step of inputting a value, and a state value generation step of generating the state value S after the input by the input step, wherein the generation step corresponds to the state value S generated by the state value generation step. A coincidence event determining step of determining whether the repetitive event has occurred; a repetitive event determining step of determining whether the repetitive event has occurred in response to the occurrence of the coincident event; A repetition number adding step of adding the number of repetitions, a regression event determination step of determining whether or not the regression event has occurred in response to the occurrence of the mismatch event or the end of the data to be encoded, To occur A number-of-repetitions number code generating step for generating a number-of-repetitions number code indicating the value of the number-of-repetitions N; a regression step of returning the number-of-repetitions N to a predetermined initial value after the generation of the number-of-repetitions number code; A state code generating step of generating a state code representing the value of the state value S in response to the occurrence of a mismatch event or the initialization of the number of repetitions N by the regression step; After the repetition event is determined by the repetition event determination step, a numerical code corresponding to X is generated when X does not match A, and a numerical code corresponding to Y when Y does not match B. After the numerical code generation step of generating the numerical code, and the generation of the numerical code by the numerical code generation step or the addition of the repetition number N by the repetition number addition step, the content of A is updated to X, and the content of B is changed to Y Update and before 4. The data encoding method according to claim 3, further comprising a step of updating immediately before the content of the description T to S.
【請求項5】 符号列データを走査して得られる符号列
を入力し、0のビット連続数Xと1のビット連続数Yと
の組を単位とするランレングス数値列に復元して出力す
るデータ復号化方法であって、 復号化を開始する際に、復元される状態値を記憶する記
憶部S、復元されるランレングス値のうち前記Xに相当
する値を記憶する記憶部Cおよび復元されるランレング
ス値のうち前記Yに相当する値を記憶する記憶部Dに所
定の初期値を代入して初期化する初期化工程と、 所定の符号単位を入力して該符号が数値符号Pであるか
状態符号Qであるかを判定する入力符号種判定工程と、 前記入力符号種判定工程により数値符号と判定された場
合に、該符号を数値に復元して記憶部Lに記憶する数値
符号復元工程と、 前記入力符号種判定工程により状態符号と判定された場
合に、該符号を前記状態値に復元して前記Sに記憶する
状態符号復元工程と、 前記Lに復元数値が格納された時点での状態値Sの値
が、X≠A且つY≠Bの関係にある状態S0、X=A且
つY≠Bの関係にある状態S1、X≠A且つY=Bの関
係にある状態S2若しくはX=A且つY=Bの関係にあ
る状態S3(ただし、Aを直前の0のビットの連続数と
し、Bを直前の1のビットの連続数とする)のいずれで
あるかを識別する識別工程と、 前記Sに新たな状態値が格納された時点で、該Sの値が
前記S3と一致するか否かを判定するS3状態判定工程
と、 前記識別工程により前記Sの値が前記S0であると識別
された場合に、前記Lの値を前記Cに格納した後に、次
の数値符号を入力および復元して、前記Dに格納する第
1のラン値更新工程と、 前記識別工程により前記Sの値が前記S1であると識別
された場合に、前記Lの値を前記Dに格納する第2のラ
ン値更新工程と、 前記識別工程により前記Sの値が前記S2であると識別
された場合に、前記Lの値を前記Cに格納する第3のラ
ン値更新工程と、 前記第1、第2または第3のラン値更新工程による更新
が終了した時点または前記S3状態判定工程により前記
Sの値が状態値S3と一致すると判定された時点で、前
記CおよびDの値を一組のランレングス値として出力す
る第1の出力工程と、 前記識別工程により前記S値の値が前記S3であると識
別された場合に、前記CおよびDの値を一組のランレン
グス値として前記Lの値に対応する回数分出力する第2
の出力工程と、 を含んだことを特徴とするデータ復号化方法。
5. A code string obtained by scanning code string data is input, restored to a run-length numerical string having a set of a number X of continuous bits of 0 and a number Y of continuous bits of 1 as a unit, and output. A data decoding method, comprising: a storage unit (S) for storing a state value to be restored when decoding is started; a storage unit (C) for storing a value corresponding to the X among the restored run-length values; An initialization step of substituting a predetermined initial value into a storage unit D for storing a value corresponding to the Y among the run-length values to be initialized, and inputting a predetermined code unit and setting the code to a numerical code P Or an input code type determining step of determining whether the code is a state code Q. When the input code type determining step determines that the code is a numerical code, the code is restored to a numerical value and stored in the storage unit L. A code restoring step, and the input code type determining step. A state code restoring step of restoring the code to the state value and storing it in the S when it is determined that the state code is a state code; A state S0 in a relation of SA and Y ≠ B, a state S1 in a relation of X = A and Y ≠ B, a state S2 in a relation of X ≠ A and Y = B, or a relation of X = A and Y = B (A is the number of consecutive bits of the immediately preceding 0, and B is the number of consecutive bits of the immediately preceding 1). At the time when the value is stored, an S3 state determination step of determining whether the value of the S matches the S3, and when the value of the S is identified as the S0 by the identification step, After storing the value of L in the C, the next numerical code is input and restored, and stored in the D. A first run value update step of storing the value of L in the D when the value of S is identified as S1 by the identification step; A third run value updating step of storing the value of L in the C when the value of S is identified as S2 by the identification step; and the first, second or third run. The value of C and D is output as a set of run-length values at the point in time when the update in the value update step is completed or when the value of S is determined to be equal to the state value S3 in the S3 state determination step. 1 and the number of times corresponding to the value of L as a set of run-length values when the value of S is identified to be S3 by the identifying step. The second to output
A data decoding method, comprising the steps of:
【請求項6】 前記請求項1〜5のいずれか一つに記載
された方法をコンピュータに実行させるプログラムを記
録したことを特徴とするコンピュータ読み取り可能な記
録媒体。
6. A computer-readable recording medium on which a program for causing a computer to execute the method according to claim 1 is recorded.
JP2000007194A 2000-01-14 2000-01-14 Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method Expired - Fee Related JP3753580B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000007194A JP3753580B2 (en) 2000-01-14 2000-01-14 Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000007194A JP3753580B2 (en) 2000-01-14 2000-01-14 Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method

Publications (2)

Publication Number Publication Date
JP2001196937A true JP2001196937A (en) 2001-07-19
JP3753580B2 JP3753580B2 (en) 2006-03-08

Family

ID=18535608

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000007194A Expired - Fee Related JP3753580B2 (en) 2000-01-14 2000-01-14 Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method

Country Status (1)

Country Link
JP (1) JP3753580B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111418191A (en) * 2017-12-01 2020-07-14 日本电信电话株式会社 Bit allocation estimation device, bit allocation estimation method, and program
CN117155405A (en) * 2023-08-09 2023-12-01 海飞科(南京)信息技术有限公司 Method for quickly establishing tANS coding and decoding conversion table based on gradient descent

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111418191A (en) * 2017-12-01 2020-07-14 日本电信电话株式会社 Bit allocation estimation device, bit allocation estimation method, and program
CN111418191B (en) * 2017-12-01 2022-12-30 日本电信电话株式会社 Bit allocation estimation device, bit allocation estimation method, and recording medium
CN117155405A (en) * 2023-08-09 2023-12-01 海飞科(南京)信息技术有限公司 Method for quickly establishing tANS coding and decoding conversion table based on gradient descent

Also Published As

Publication number Publication date
JP3753580B2 (en) 2006-03-08

Similar Documents

Publication Publication Date Title
RU2125765C1 (en) Symbol compression method and device, statistical coder (options)
JP2766302B2 (en) Variable length code parallel decoding method and apparatus
JP3009727B2 (en) Improved data compression device
JP3017379B2 (en) Encoding method, encoding device, decoding method, decoder, data compression device, and transition machine generation method
JP2000115783A (en) Decoder and its method
JPH0366227A (en) Method and system for compression coding and decoding method
JPH114170A (en) Method and device for double run length-encoding binary data
JP3684128B2 (en) Arithmetic encoding / decoding method and arithmetic encoding / decoding device
US8934727B2 (en) Image processing apparatus, image processing method, and image forming apparatus
US20020006225A1 (en) Encoding apparatus, decoding apparatus, encoding/decoding apparatus, encoding method and decoding method
JP2954438B2 (en) Encoding device
JP3753580B2 (en) Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method
JP3842914B2 (en) Data encoding method / decoding method, data encoding device / decoding device, and image data recording system using the data encoding method / decoding method
Bird et al. Arithmetic coding with folds and unfolds
JP3266419B2 (en) Data compression / decompression method
US6549665B1 (en) Image signal processing device
JPH11317673A (en) Run length encoding and decoding method therefor
JP2966437B2 (en) Run length code encoder
JP3085118B2 (en) Data compression device
JP2859507B2 (en) Image data compression / decompression method and apparatus
JP3212393B2 (en) Encoding device
JP3083329B2 (en) Data compression / decompression method
Cena et al. A Q-Coder algorithm with carry free addition
JPH09130617A (en) Device and method for processing image
JP3484900B2 (en) Image data encoding device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040513

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050913

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050920

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051117

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20051213

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 3753580

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20081222

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20091222

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20101222

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20101222

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20111222

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111222

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20121222

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20131222

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees