JP3753580B2 - Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method - Google Patents

Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method Download PDF

Info

Publication number
JP3753580B2
JP3753580B2 JP2000007194A JP2000007194A JP3753580B2 JP 3753580 B2 JP3753580 B2 JP 3753580B2 JP 2000007194 A JP2000007194 A JP 2000007194A JP 2000007194 A JP2000007194 A JP 2000007194A JP 3753580 B2 JP3753580 B2 JP 3753580B2
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.)
Expired - Fee Related
Application number
JP2000007194A
Other languages
Japanese (ja)
Other versions
JP2001196937A (en
Inventor
喜嗣 井上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
この発明は、データを走査して得られるランレングス数値列を0のビット連続数と1のビット連続数との組を入力単位として順次入力し、所定の符号列に変換して出力するデータ符号化方法、符号列データを走査して得られる符号列を入力し、0のビット連続数Xと1のビット連続数Yとの組を単位とするランレングス数値列に復元して出力するデータ復号化方法、およびその方法をコンピュータに実行させるプログラムを記録したコンピュータ読み取り可能な記録媒体に関する。
【0002】
【従来の技術】
従来、レーザープリンタなどの印刷装置では、印刷対象となる画像データを圧縮(符号化)して一時的にメモリに蓄積し、このメモリに蓄積した圧縮データを伸張(復号)しながら実際の印刷をおこなうことにより、画像データを記憶するためのメモリのメモリ容量を低減する省メモリ技術が知られている。
【0003】
かかる省メモリ技術の本来の目的は、画像データを記憶するメモリのメモリ容量を低減してコストダウンを図ることにあるので、画像データを圧縮又は伸張するための複雑な専用ハードウエアを設けるのは妥当ではなく、印刷装置のマイクロプロセッサにこれらの処理をソフトウエア的におこなわせる必要がある。
【0004】
ここで、二次元静止画像の符号化技術としては、副走査方向のデータ相関を考慮してデータ圧縮をおこなう二次元圧縮技術や算術符号を用いて予測符号化をおこなう予想符号化技術が高い圧縮率を得ることができる技術として知られている。
【0005】
しかし、印刷装置のマイクロプロセッサを用いてこれらの符号化技術をソフトウエア的に実現しようとすると、処理遅延が生じてしまうので、印刷解像度や印刷速度が日々向上する昨今では、これらの符号化技術を用いることは効率的ではない。このため、マイクロプロセッサに圧縮伸張をおこなわせる場合には、一次元圧縮と呼ばれる比較的単純な圧縮技術が広く用いられている。
【0006】
従来の一次元圧縮技術としては、ランレングス処理やファクシミリ装置などで採用されているMH(Modified Haffman)符号が広く知られているが、疑似中間調画像のような色(白黒)が短い周期で頻繁に変化する画像データの場合には、効率良く圧縮することができない。特に、パーソナルコンピュータやネットワークの進展によってイメージデータを印刷する機会が増加してきたため、このMH符号を省メモリ機構として採用するのは効率的ではない。
【0007】
このため、色が短い周期で頻繁に変化する画像データの圧縮率を改善するために、画像データやランレングスの繰り返し性を検出する符号化技術が知られている。たとえば、特許第2683506号公報(従来技術1)には、白ワードの長さと黒ワードの長さを両方記述可能な制御ワードを使用することにより、白ワードと黒ワードが比較的短い周期で規則的に現れるイメージデータを効率的に圧縮するデータ圧縮(伸張)方法及び装置が開示されている。
【0008】
具体的には、この従来技術1では、あるワード長(バイト)を規定し、すべてが白であるデータ単位を白ワードとし、すべてが白でないものを黒ワードとして取り扱い、それらの繰り返し出現数、黒ワードの内容、制御語などをワード長単位で符号化しているので、符号化および復号化に際して特別な符号テーブルを必要とせず、また、ワード長単位で処理できるのでマイクロプロセッサで処理しても十分な処理性能を期待することができる。
【0009】
また、特開平9−65147号公報(従来技術2)には、白および黒の各々のランレングスを記憶し、ある色のランレングス値が同色の直前のランレングス値と一致する場合に、所定の反復符号を生成することにより、圧縮率および処理速度を改善する画像信号圧縮(復元)方法および装置が開示されている。
【0010】
【発明が解決しようとする課題】
しかしながら、上記従来技術1では、ワード列単位で繰り返し性を検出しているので、対象となる画像データに含まれる繰り返しの周期とワード長とが一致するかまたは倍数となる場合にのみ高い圧縮率が得られるにすぎず、一般的な画像データについて十分な圧縮が得られないという問題がある。
【0011】
また、上記従来技術2では、ラン長の一致が発生したときに生成される反復符号が一致しなかった場合に符号化される符号語に比べて十分に少ないデータ量である場合にのみ圧縮率が向上するものにすぎないという問題がある。すなわち、より短い符号語を反復符号に割り当てることは、相対的に一致しないラン長の符号語を長くするので、色が短い周期で頻繁に変化するような画像データに対しては十分な圧縮率を持つ符号セットを得ることが困難になる。
【0012】
具体的には、この従来技術2の実施の形態では、符号セットはMH符号に類似するものであり、マイクロプロセッサによる処理ではランレングス符号技術のような高速性を期待することができない。また、ランレングス値を記憶するための記憶部が色に対応して設けられているので、ランレングス値の比較や格納に際して、色に応じて参照・格納先を選択する処理が必要となり、マイクロプロセッサによる高速処理の妨げになるという問題もある。
【0013】
なお、上記二次元圧縮技術、予測符号化技術およびMH符号化などにおいては、ラインバッファ、確率テーブル、符号テーブルといった比較的大きな容量のメモリが必要になるという問題がある。たとえば、1200dpi(ドット/インチ)の解像度、25ppm(ページ/分)の印刷速度であれば、画素周波数は100MHzを超えるのが一般的である。このような周波数で上記メモリを含む符号化/復号化のハードウエア回路を動作させることは極めて困難であり、また、たとえ回路を並列化して低周波数で動作させるとしても、テーブルをも含めて並列化する必要があるので大規模な回路となり、コストアップにつながる結果となる。
【0014】
また、特願平11−12479号には、ランレングス値が同色の直前のランレングス値と一致する事象が連続する場合に、その連続数を符号化することにより、符号数を削減するよう構成することにより、疑似中間調画像データに対しても高い圧縮率と高い処理速度とを両立できるようにしたデータ符号化および復号化方法が記載されているが、誤差拡散処理を施した疑似中間調画像を含むような画像データの場合には、十分な圧縮率が得られない。
【0015】
この発明は、上述した従来技術による問題点を解消するため、誤差拡散処理により生成された疑似中間調画像データについても効率良く圧縮することができ、マイクロプロセッサによるソフトウエア処理に適合するデータ符号化方法、データ復号化方法、およびその方法をコンピュータに実行させるプログラムを記録したコンピュータ読み取り可能な記録媒体を提供することを目的とする。
【0016】
【課題を解決するための手段】
上述した課題を解決し、目的を達成するため、請求項1の発明に係るデータ符号化方法は、データを走査して得られるランレングス値列を0のビット連続数と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として算定する算定工程と、直前の状態値Tが状態S3であり、かつ、前記状態値Sと直前の状態値Tとが等しい一致事象となった場合にこれを反復事象とみなして、該反復事象が連続して発生する反復数Nを算出する反復数算定工程と、前記反復事象の発生後に、前記状態値Sと直前の状態値Tとが異なる不一致事象または入力完了となった場合に回帰事象と判定する回帰事象判定工程と、前記不一致事象が発生した場合に前記状態値Sの値を示す状態符号を生成する状態符号生成工程と、前記状態符号生成工程による状態符号の生成が終了するかまたは前記一致事象が発生した際に、前記0のビットの連続数Xまたは前記1のビットの連続数Yの値を示す数値符号を生成する第1の数値符号生成工程と、前記回帰事象が発生した場合に、前記状態符号生成工程による状態符号の生成に先だって、前記反復数算定工程によって算定された反復数Nの値を示す数値符号を生成する第2の数値符号生成工程と、を含んで前記入力単位のデータに対応する状態符号および数値符号の生成する生成工程と、を含んだことを特徴とする。
【0017】
この請求項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として算定して、直前の状態値Tが状態S3であり、かつ、状態値Sと直前の状態値Tとが等しい一致事象となった場合にこれを反復事象とみなして、該反復事象が連続して発生する反復数Nを算出し、反復事象の発生後に、状態値Sと直前の状態値Tとが異なる不一致事象または入力完了となった場合に回帰事象と判定し、不一致事象が発生した場合に状態値Sの値を示す状態符号を生成し、この状態符号の生成が終了するかまたは一致事象が発生した際に、0のビットの連続数Xまたは1のビットの連続数Yの値を示す数値符号を生成し、回帰事象が発生した場合に、状態符号の生成に先だって反復数Nの値を示す数値符号を生成することとしたので、一致事象、不一致事象、反復事象、回帰事象の概念を利用して、誤差拡散処理により生成された疑似中間調画像データについても効率良くデータを圧縮することができる。
【0022】
また、請求項の発明に係るデータ符号化方法は、請求項の発明において、前記算定工程は、符号化を開始する際に、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に更新する直前値更新工程とを含んだことを特徴とする。
【0023】
この請求項の発明によれば、符号化を開始する際に、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に更新することとしたので、マイクロプロセッサによるソフトウエア処理に適合したデータの圧縮をおこなうことができる。
【0024】
また、請求項の発明に係るデータ復号化方法は、符号列データを走査して得られる符号列を入力し、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の出力工程と、を含んだことを特徴とする。
【0025】
この請求項の発明によれば、復号化を開始する際に、復元される状態値を記憶する記憶部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の値に対応する回数分出力することとしたので、誤差拡散処理により生成された疑似中間調画像データを圧縮したものを効率良く復元することができる。
【0026】
また、請求項の発明に係る記録媒体は、請求項1〜のいずれか一つに記載された方法をコンピュータに実行させるプログラムを記録したことで、そのプログラムを機械読み取り可能となり、これによって、請求項1〜のいずれか一つの動作をコンピュータによって実現することができる。
【0027】
【発明の実施の形態】
以下に添付図面を参照して、この発明に係るデータ符号化方法、データ復号化方法、およびその方法をコンピュータに実行させるプログラムを記録したコンピュータ読み取り可能な記録媒体の好適な実施の形態を詳細に説明する。なお、本実施の形態では、誤差拡散処理により生成された疑似中間調画像データをデータ符号化または復号化する場合を示すこととする。
【0028】
まず最初に、本実施の形態に係るデータ符号化方法およびデータ復号化方法の概念について説明する。図1は、本実施の形態に係るデータ符号化方法およびデータ復号化方法の概念を説明するための説明図である。
【0029】
同図においては、データを走査して得られるランレングス数値列について、値が’0’であるビットの連続数(以下「X」と言う)と、値が’1’であるビットの連続数(以下「Y」と言う)との一組を入力単位として順次入力し、所定の符号列に変換して出力するデータ符号化をおこなう。
【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とする。
【0031】
また、この状態に応じてS0〜S3のいずれかの値を持つ状態値を「S」とし、このSの直前の値を「T」とする。そして、S=Tとなる事象を「一般事象」とし、S≠Tとなる事象を「不一致事象」とし、このTがS3であるときに一致事象が発生すれば「反復事象」とし、この反復事象が連続して発生する数を「反復数N」とする。
【0032】
さらに、この反復事象が発生した後に、不一致事象が発生するかまたは入力が完了すれば「回帰事象」とし、不一致事象が発生した場合には状態値Sの値を示す状態符号Qを生成し、符号生成を終了した時点または一致事象が発生した時点において、X≠Aである場合にはXの値を示す数値符号Pを生成し、Y≠Bである場合にはYの値を示す数値符号Pを生成し、回帰事象が発生した場合には状態符号の生成に先立って反復数Nの値を示す数値符号Pを生成する。
【0033】
図1においては、圧縮対象となるデータが3ビットの’0’で始まり、4ビットの’1’、3ビットの’0’へと続く場合を示している。ランレングスの計測を’0’から始める場合には、データを走査して得られるXおよびYの数値列は、それぞれ’0’の連続数および’1’の連続数となるので、この一組の値が符号化部に順次入力されることになる。
【0034】
同図では、各入力値についての各数値、事象および生成される符号を図示しているが、各事象に関しては、事象がある場合には’○’を記載し、事象がない場合には空欄としている。また、各符号に関しては、符号出力がある場合には’○’を記載し、符号が出力されない場合には空欄としている。
【0035】
なおここでは、状態符号と数値符号の2つの属性を持つが、数値符号についてはどの数値に対応するものであるかを把握できるように3種類に分けて図示している。また厳密に言うと、データの最初のX、YおよびSには直前の値(A、BおよびT)が存在しないことになるが、ここではA、BおよびSの初期値はすべて’0’とする。
【0036】
このように、本実施の形態では、ランレングス値が同一計測対象値の直前のランレングス値と一致する事象が連続する場合に、その連続数を符号化することで符号数を削減するという従来技術の特徴を、S3が複数回連続する場合に反復数Nに対応する数値符号Pを生成することで承継することにより効率的に符号数を削減している。加えて、XまたはYのいずれか一方が直前の値と一致する反面他方が一致しない場合すなわちS1またはS2の状態が連続する場合にも効率的に符号数を削減している。
【0037】
特に、誤差拡散された画像データにおいては、S1およびS2の状態が連続する確率が高いので、この実施の形態による符号数削減の効果は大きい。たとえば、同図では、12組すなわち24個のランレングス値が入力されているが、出力される符号数は11個に削減され、符号数が削減されていることが分かる。
【0038】
次に、本実施の形態で用いる符号化手順について説明する。図2は、本実施の形態で用いる符号化手順を示すフローチャートであり、図3は、図2のステップS209およびS219に示す未出力N符号化手順を示すフローチャートである。
【0039】
図2に示すように、まず最初に、A、BおよびTに所定の定数Cを設定し、Nに0を設定する初期化処理をおこなう(ステップS201)。なお、ここでは説明の便宜上、A、BおよびTに同じ定数Cを設定することとするが、異なる値を設定することもできる。ただし、Tの初期値はS0に示す値であることが符号数を削減するうえで望ましい。その理由は、最初のXおよびYの入力に対して状態値SがS0となる場合が最も高い確率で発生するため、無意味な不一致事象の発生による状態符号の生成を抑制できるからである。また、AおよびBの初期値は、ランレングスの測定を開始する際の値と異なる値を設定することが符号数を削減するうえで望ましい。
【0040】
そして、かかる初期化処理を終えたならば、XおよびYに一組のランレングス値を入力して格納する入力処理をおこない(ステップS202)、この入力に対応して所定の状態Sを生成する状態作成処理をおこなう(ステップS203〜S207)。
【0041】
具体的には、まずS値に0を代入してを初期化した後に(ステップS203)、X値とA値を比較して(ステップS204)、両者が一致する場合には(ステップS204肯定)このSに’1’を加算し(ステップS205)、一致しない場合には(ステップS204否定)そのままステップS206に移行する。さらに、Y値をB値と比較して(ステップS206)、両者が一致する場合には(ステップS206肯定)Sに’2’を加算する(ステップS207)。したがって、S0を表す数値は0、S1を表す数値は1、S2を表す数値は2、S3を表す数値は3となる。
【0042】
その後、生成された状態値Sの値がTと一致するか否かを判断する一致事象判定処理をおこない(ステップS208)、一致する場合(ステップS208肯定)には一致事象であると判断し、一致しない場合(ステップS208否定)には不一致事象であると判断する。
【0043】
具体的には、一致事象が発生した場合には(ステップS208肯定)、S値が3であるか否かを判断し(ステップS211)、このS値が3すなわちS3と一致する場合に(ステップS211肯定)反復事象があるものと判定し、反復数Nの値をインクリメントして(ステップS212)、ステップS217に移行する。
【0044】
これに対して、不一致事象が発生した場合には(ステップS208否定)、反復事象が発生しないものと判定して、未出力N符号化をおこなう(ステップS209)。具体的には、図3に示すように、反復数Nの値が0よりも大きいか否かを判断し(ステップS301)、0よりも大きい場合には(ステップS301肯定)、回帰事象が発生したものと判定し、数値符号化(N)をおこなって数値符号を出力した後(ステップS302)、Nに0を代入して初期化する(ステップS303)。一方、反復数Nの値が0のままである場合には(ステップS301否定)、回帰事象が発生していないものと判断する。
【0045】
そして、この未出力N符号化を終えたならば、状態Sの値を表現する状態符号を生成し出力する状態符号化(S)をおこない(ステップS210)、ラン数値符号出力処理をおこなう(ステップS213〜S216)。
【0046】
具体的には、まずX値とA値を比較し(ステップS213)、両者が一致しない場合には(ステップS213否定)、Xの値を表現する状態符号を生成し出力する数値符号化(X)をおこなう(ステップS214)。また、Y値とB値を比較し(ステップS215)、両者が一致しない場合には(ステップS215否定)、Yの値を表現する状態符号を生成し出力する数値符号化(Y)をおこなう(ステップS216)。
【0047】
その後、AをX値で更新し、BをY値で更新し、TをS値で更新する直前値の更新をおこない(ステップS217)、符号化対象データがあるならば(ステップS218否定)ステップS202に移行して上記処理を繰り返す。なお符号化対象データがなくなった場合には(ステップS218肯定)、すでに説明した未出力N符号化をおこなって(ステップS219)処理を終了する。
【0048】
上記一連の処理をおこなうことにより、不一致事象が発生した場合には状態値Sの値を示す状態符号Qを生成し、符号生成を終了した時点または一致事象が発生した時点で、X≠Aである場合にはXの値を示す数値符号Pを生成し、Y≠Bである場合にはYの値を示す数値符号Pを生成し、回帰事象が発生した場合には、状態符号の生成に先立って反復数Nの値を示す数値符号Pを生成して符号化することができる。
【0049】
なお、上記処理手順をソフトウエアで実現する場合には、X,Y,A,B,S,TおよびNには適切なメモリを割り当てれば良いが、マイクロプロセッサの汎用レジスタを用いることが処理性能を向上するうえで望ましい。また、定数Cと各制御については、プログラムすなわち命令コードとして記述することで実現できる。
【0050】
また、上記一連の説明では説明の便宜上、ランレングス測定入力(ステップS202)およびこれに関連するデータ終了判定(ステップS218)および符号生成(ステップS210、S214、S216、S302)についての詳細な説明を省略した。
【0051】
次に、本実施の形態に係るデータ復号手順について説明する。図4は、本実施の形態に係るデータ復号手順を示すフローチャートである。同図に示すように、復号処理を開始する際に、復元される状態値を記憶するSと、復元されるランレングス値のうちXに相当する値を記憶するAと、Yに相当する値を記憶するBとに、それぞれ定数Cを代入して初期化する(ステップS401)。なお、復号が正しくおこなわれるためには、A、BおよびSに代入される初期値は、符号化時の初期化処理(図2のステップS201)時に、A、BおよびSに代入した値と同じ値を代入する必要がある。
【0052】
そして、この初期化処理を終えたならば、符号入力をKに代入し(ステップS402)、このKが数値符号Pであるか状態符号Qであるかを判断する入力符号判定処理(ステップS403)をおこなう。その結果、数値符号であると判断された場合には(ステップS403肯定)、このKに格納された符号を数値に復元してLに記憶する数値復元処理(ステップS404)をおこない、状態識別処理(ステップS405〜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)。
【0054】
また、状態値Sが0でない場合には(ステップS405否定)、状態値Sが1であるか否かを確認し(ステップS406)、状態値Sが1である場合には(ステップS406肯定)、S1に対応する処理すなわちL値をBに格納する処理をおこない(ステップS412)、Aを出力XとしBを出力Yとした一組のランレングス値として出力する(ステップS414)。
【0055】
さらに、状態値Sが1でない場合には(ステップS406否定)、状態値Sが2であるか否かを確認し(ステップS407)、状態値Sが2である場合には(ステップS407肯定)、S2に対応する処理すなわちL値をAに格納する処理をおこない(ステップS413)、Aを出力XとしBを出力Yとした一組のランレングス値として出力する(ステップS414)。
【0056】
また、状態値Sが2でない場合には(ステップS407否定)、S3に対応する処理をおこなう。具体的には、Lの値を初期値としてNに格納した後(ステップS417)、Aを出力XとしBを出力Yとした一組のランレングス値として出力し(ステップS418)、Nをデクリメントした後(ステップS419)、このNの値が0でなければ(ステップS420否定)、ステップS418に移行して処理を繰り返す。そして、Nの値が0になった時点で(ステップS420肯定)、終了判定をおこない(ステップS421)、終了しない場合には(ステップS421否定)、上記ステップS402に移行する。
【0057】
また、上記ステップS403で数値符号であると判断された場合には(ステップS403否定)、Kに格納された符号を状態値に復元してSに格納し(ステップS415)、このSが3であるか否かを確認する(ステップS416)。その結果、このSが3である場合には(ステップS416肯定)、ステップS414に移行し、Sが3でなければ(ステップS416否定)ステップS421に移行する。
【0058】
上記一連の処理をおこなうことにより、状態符号を入力して所定の状態値Sに復元した時点で、このSがS3の状態である場合には一組のランレングス値が省略されているので、数値符号の入力を待つことなくその時点でAおよびBに記憶した一組のランレングス値の出力をおこなうことができる。
【0059】
また、数値符号を入力し所定の数値に復元してLに記憶した時点で、このS値がS0である場合には、一組のランレングス値が一組の数値符号に符号化されているので、このLに記憶した値と次の数値符号を復号して得られる値とを用いて一組のランレングス値の出力をおこなう。
【0060】
また、このS値がS1である場合には、0の連続数に対する数値符号が省略されているので、Aに記憶した値と復元した数値Lとを用いて一組のランレングス値の出力をおこない、このS値がS2である場合には、1の連続数に対する数値符号が省略されているので、Bに記憶した値と復元した数値Lとを用いて一組のランレングス値の出力をおこなう。
【0061】
さらに、このS値がS3である場合には、復元された数値は反復数Nであり、N組のランレングス値が省略されているので、その時点でAおよびBに記憶された値を用いて一組のランレングス値の出力動作を数値の回数分繰り返す。このため、図2に示したデータ符号化手順で生成した符号列データから元のランレングス列を復号することができる。
【0062】
なお、上記処理手順をソフトウエアで実現する場合には、X,Y,A,B,S,T,K,LおよびNには適切なメモリを割り当てれば良いが、マイクロプロセッサの汎用レジスタを用いることが処理性能を向上するうえで望ましい。また、定数Cと各制御については、プログラムすなわち命令コードとして記述することで実現できる。
【0063】
また、上記一連の処理のいくつかは省略することができ、たとえば、反復数を計数記憶するためのNと、復元された数値を記憶するLとを兼用して一方を省略することもできる。出力ランレングス値を記憶するXおよびYの一方で他方を代用することもできる。
【0064】
さらに、上記一連の説明では説明の便宜上、ランレングス数値出力(ステップS414およびS418)およびこれに関連するデータ終了判定(ステップS421)についての詳細な説明を省略した。
【0065】
次に、図2および図4に示したデータ符号化処理およびデータ復号化処理に用いる符号セットについて説明する。図5は、図2および図4に示したデータ符号化処理およびデータ復号化処理に用いる符号セットの一例を示す説明図である。
【0066】
同図に示すように、本実施の形態で用いる符号セットは第1〜第6の6種類の符号単位で構成され、具体的には、第1の符号形式P1〜第3の符号形式P3は数値を示す数値符号Pであり、第4の符号形式Q1〜第6の符号形式Q3は、状態値を示す状態符号Qである。
【0067】
ここで、第1の符号形式P1は、4ビット幅を有し、該4ビットの数値が”10”未満であることを利用して識別されるものであり、該数値に1を加算した値が数値Lに対応する。第2の符号形式P2は、8ビット幅を有し、符号列において先行する上位4ビットの値が”11”または”12”であることにより識別されるものであり、下位ビットの値に”11”を加算した値が数値Lに対応する。
【0068】
第3の符号形式P3は、少なくとも8ビット幅で4の倍数となるビット幅を有し、符号列において先行する上位4ビットの値が”12”であることにより識別される。この4ビットについては、’8’以上の数値が検出されるまで各4ビットの下位3ビットを上位に向かって連接した(つなぎ合わせた)数値に”43”を加算した値が数値Lに対応する。
【0069】
第4の符号形式Q1は、4ビット幅を有し、該4ビットの数値が”13”であることにより識別され、直前の状態値に’1’を加算した値の下位2ビットが新たな状態値に対応する。第5の符号形式Q2は、4ビット幅を有し、該4ビットの数値が”14”であることにより識別され、直前の状態値に’2’を加算した値の下位2ビットが新たな状態値に対応する。第6の符号形式Q3は、4ビット幅を有し、該4ビットの数値が”15”であることにより識別され、直前の状態値に’3’を加算した値の下位2ビットが新たな状態値に対応する。
【0070】
なお、状態値の値としては4つの値を取り得るが、状態符号は状態値に変化が生じた場合にのみ生成される。ある状態値から他の状態値への移行対象は3つしかないので、状態符号の数は3つに削減されている。
【0071】
また、数値符号Pにおいて、値が’0’となる符号を明示していないが、後述する変換手順を用いて’0’を表現することが望ましい。ただし、この符号形式は、表現可能な値域を原理的に制約するものではなく、第3の符号形式P3を用いる場合には任意の整数を表現することができる点に留意する必要がある。なぜなら、数値を復元する処理に用いられる一時記憶は有限のビット幅を持つものであるが、P3符号の長さには制約がないので、連接と加算による処理結果が桁上がりによる’0’や負数となる符号を生成できるからである。
【0072】
次に、図5に示した符号セットを用いた場合の入力符号種判定、状態符号化制御、状態復元処理、数値符号化処理および数値復元処理について説明する。まず、入力符号種の判定(図4のステップS403に対応する)においては、符号の先行する上位4ビットの値が”12”以下の値であれば数値符号であると判断し、それ以外の場合には状態符号であると判断することができる。
【0073】
図6は、図5に示した符号セットを用いた場合の状態符号化制御手順を示すフローチャートであり、図7は、図5に示した符号セットを用いた場合の状態復号化制御手順を示すフローチャートである。なお、図中に示す「K(n)←数値」は、右辺の数値の下位nビットを符号として出力することを意味し、「W」は、演算に使用する作業メモリである。
【0074】
図6に示すように、状態符号化をおこなう場合には、状態値Sから直前の状態値Tを減じた値と’3’とをビットごとに論理和し、これに”12”を加算した値を作業メモリWに格納し(ステップS601)、この作業メモリWの下位4ビットを4ビットの符号Kとして出力する(ステップS602)ことになる。
【0075】
図7に示すように、状態復号化をおこなう場合には、Q1〜Q3のいずれかの符号の発生に対応して、符号の値から”12”を減じた値をそれまでの状態値Sに加算し、その結果の値と定数値’3’とのビットごとの論理積をとってこれを新たな状態値として状態値Sに格納する(ステップS701)ことになる。
【0076】
上記図6および図7に示す制御をおこなうことにより、所定の状態符号の生成および該状態符号を用いた状態値の復元が可能となる。たとえば、符号化の直前の状態値Tが’0’で新たな状態値Sが’3’である場合には、「S−T」は’3’となるため、この値と定数値’3’のビットごとの論理積は’3’となる。そして、この値に”12”を加えた”15”すなわちQ3符号が生成される。一方、状態符号を復元する際には、「K−12」は”3”となり、この値にそれまでの状態値’0’を加えた値’3’と定数値’3’のビットごとの論理積をとると、’3’が新たな状態値Sとなり、正しく復元されていることが分かる。
【0077】
また、符号化の直前の状態値Tが’3’で新たな状態値Sが’0’である場合には、「S−T」は’−3’となり、この値と定数値’3’のビットごとの論理積は’1’となるので、この値に”12”を加えた”13”すなわちQ1符号が生成される。一方、状態符号を復元する際には、「K−12」は”1”となり、この値にそれまでの状態値’3’を加えた値’4’と定数値’3’のビットごとの論理積をとると、’0’が新たな状態値Sとなり、正しく復元されていることが分かる。
【0078】
図8は、図5に示した符号セットを用いた場合の数値符号化制御手順を示すフローチャートであり、図9は、図5に示した符号セットを用いた場合の数値復号化制御手順を示すフローチャートである。なお、図中に示す「K(n)←数値」は、右辺の数値の下位nビットを符号として出力することを意味し、「W」は、演算に使用する作業メモリである。
【0079】
図8に示すように、ここでは符号化対象である数値「V」をP1〜P3のいずれかの符号に変換して出力する。すでに言及したように、この数値符号Pには値が’0’となる符号が定義されていないので、ここでは「V=0」である場合にはこれを「Z」という定数値に変換する0値変換処理をおこなっている。すなわち、V=0となる頻度が非常に低いため、これを比較的に長い符号語に割り当てることにより圧縮率の改善を図っている。具体的には、下記に示すステップS801〜S804がこの0値変換処理に相当し、ステップS805以降が数値から符号語を生成する処理に相当する。
【0080】
同図に示すように、まず最初に、符号化対象値Vが定数値Z以上であるか否かを判断し(ステップS801)、Z以上である場合には(ステップS801肯定)Vの値をインクリメントする(ステップS802)。また、Z以上でない場合には(ステップS801否定)Vが0であるか否かを判断し(ステップS803)、Zが0であれば(ステップS803肯定)Vに定数値Zを格納する(ステップS804)。
【0081】
そして、この0値変換処理を終えたならば、その時点での符号化対象値Vが”10”以下であるか否かを判断し(ステップS805)、”10”以下である場合には(ステップS805肯定)、Vから’1’を減じた値の下位4ビットを符号として出力して(ステップS806)、数値符号化を終了する。
【0082】
一方、Vが”10”以下でない場合には(ステップS805否定)、このVが”42”以下であるか否かを判断し(ステップS807)、”42”以下である場合には(ステップS807肯定)このVに”149”を加えた値の下位8ビットを符号として出力し(ステップS808)、数値符号化を終了する。P2符号の定義から、「K(8)←160+(V−11)」すなわち「K(8)←V+149」となるので、ここで生成される符号がP2符号にほかならない。なお、この”160”を2進数表現すると「10100000」となるので、上位3ビットが符号固有の定数となる。
【0083】
また、上記ステップS807において、Vが”42”以下でないと判断された場合には(ステップS807否定)、まずP3符号の開始識別符号として”12”の値を持つ4ビットの符号を出力する(ステップS809)。その後、このVから”43”を減じた値を作業メモリWに格納し(ステップS810)、このWの値が’8’未満であるか否かを調べる(ステップS811)。
【0084】
その結果、’8’以上である場合には(ステップS811否定)、W値の下位3ビットの値を4ビットの符号として出力するとともに(ステップS812)、このW値を3ビット分右にシフトして符号出力した部分を切り捨てた後に(ステップS813)、上記ステップS811に戻る。
【0085】
これに対して、’8’未満である場合には(ステップS811肯定)、W値に’8’を加えた値を4ビットの符号として出力して(ステップS814)、数値符号化を終了する。なお、定数’7’を2進数表現すると「0111」となるので、ステップS812で生成される符号は常に’8’以上の数値となり、この符号が数値部の最後のものであることを明示でき、この符号がP3符号に他ならないことが分かる。
【0086】
図9に示すように、数値復元をおこなう場合には、P1〜P3のいずれかの符号形式で符号化された符号列を順次4ビット単位で読み出し、作業メモリWに数値を復元することになる。なお、「K←符号入力」なる標記は、Kに4ビットの符号を数値として入力することを意味する。また、ここでは図8に示した0値変換処理の逆変換である「0値逆変換処理」をおこなっている。下記に示すステップS901〜S911が数値復元処理に相当し、ステップS912以降が0値逆変換処理に相当する。
【0087】
同図に示すように、数値復元処理をおこなう場合には、まず符号の最初の4ビットをKに入力し(ステップS901)、このK値が”10”未満であるか否かを判断する(ステップS902)。そして、K値が”10”未満である場合には(ステップS902肯定)、このK値に’1’を加えた値を復元数値としてWに格納し(ステップS903)、後述する0値逆変換処理に移行する。なお、最初の4ビットが”10”未満である符号はP1符号に他ならないので、このK値に’1’を加えることで数値に復元できる。
【0088】
これに対して、K値が”10”未満でない場合には(ステップS902否定)、このK値が”12”であるか否かを判断し(ステップS904)、”12”でない場合には(ステップS904否定)、K値を4ビット左シフトした値をWに記憶し、このKに符号の次の4ビットを入力して、Wと新たなK値とを加えた値から”149”を減じた値を復元数値としてWに格納した後(ステップS905)、後述する0値逆変換処理に移行する。
【0089】
一方、K値が”12”である場合には(ステップS904肯定)、符号が8ビット長を持つP2符号に他ならないので、Wの値を’0’に初期化した後(ステップS906)、符号の次の4ビットをKに入力し(ステップS907)、WにこのK値を加算し(ステップS908)、該K値が’8’未満であるか否かを判断する(ステップS909)。
【0090】
その結果、K値が’8’未満である場合には(ステップS909肯定)、以降に数値部の符号が続くので、Wの値を3ビット左にシフトした後に(ステップS910)、上記ステップS907に移行する。
【0091】
これに対して、K値が’8’未満でない場合には(ステップS909否定)、それまでのWに”35”を加算した値をあらためてWに格納し(ステップS911)、0値逆変換処理に移行する。P3符号では、その4ビットとして’8’以上の値が検出されるまで各4ビットの下位3ビットを上位に向かって連接した(つなぎ合わせた)数値に”43”を加算した値が復元数値に対応する。そして、’8’以上の数値が検出されたときのKの値には、数値部分の終了を示す’8’が余分に加算されているので、ここでは「43−8」である”35”を加算している。
【0092】
その後、0値変換処理を復元する0値逆変換処理をおこなう。具体的には、復元された数値Wが定数Zよりも大きな値であるか否かを確認し(ステップS912)、Zよりも大きな値である場合には(ステップS912肯定)、Wから’1’を減じた値をWに格納して(ステップS913)数値復元処理を終了する。
【0093】
これに対して、数値WがZ以下である場合には(ステップS912否定)、復元された数値Wが定数Zと一致するか否かを確認し(ステップS914)、一致する場合には(ステップS914肯定)、このWに’0’を代入して(ステップS915)数値復元処理を終了する。
【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を生成するよう構成したので、マイクロプロセッサによるソフトウエア処理で、誤差拡散処理により生成された疑似中間調画像データについても効率良く圧縮することができる。
【0095】
【発明の効果】
以上説明したように、請求項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として算定して、直前の状態値Tが状態S3であり、かつ、状態値Sと直前の状態値Tとが等しい一致事象となった場合にこれを反復事象とみなして、該反復事象が連続して発生する反復数Nを算出し、反復事象の発生後に、状態値Sと直前の状態値Tとが異なる不一致事象または入力完了となった場合に回帰事象と判定し、不一致事象が発生した場合に状態値Sの値を示す状態符号を生成し、この状態符号の生成が終了するかまたは一致事象が発生した際に、0のビットの連続数Xまたは1のビットの連続数Yの値を示す数値符号を生成し、回帰事象が発生した場合に、状態符号の生成に先だって反復数Nの値を示す数値符号を生成することとしたので、一致事象、不一致事象、反復事象、回帰事象の概念を利用して、誤差拡散処理により生成された疑似中間調画像データについても効率良くデータを圧縮することが可能なデータ符号化方法が得られるという効果を奏する。
【0098】
また、請求項の発明によれば、符号化を開始する際に、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に更新するよう構成したので、マイクロプロセッサによるソフトウエア処理に適合したデータの圧縮をおこなうことが可能なデータ符号化方法が得られるという効果を奏する。
【0099】
また、請求項の発明によれば、復号化を開始する際に、復元される状態値を記憶する記憶部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の値に対応する回数分出力するよう構成したので、誤差拡散処理により生成された疑似中間調画像データを圧縮したものを効率良く復元することが可能なデータ復号化方法が得られるという効果を奏する。
【0100】
また、請求項の発明によれば、請求項1〜のいずれか一つに記載された方法をコンピュータに実行させるプログラムを記録したことで、そのプログラムを機械読み取り可能となり、これによって、請求項1〜のいずれか一つの動作をコンピュータによって実現することが可能な記録媒体が得られるという効果を奏する。
【図面の簡単な説明】
【図1】この発明の実施の形態に係るデータ符号化方法およびデータ復号化方法の概念を説明するための説明図である。
【図2】本実施の形態で用いる符号化手順を示すフローチャートである。
【図3】図2のステップS209およびS219に示す未出力N符号化手順を示すフローチャートである。
【図4】本実施の形態に係るデータ復号手順を示すフローチャートである。
【図5】図2および図4に示したデータ符号化処理およびデータ復号化処理に用いる符号セットの一例を示す説明図である。
【図6】図5に示した符号セットを用いた場合の状態符号化制御手順を示すフローチャートである。
【図7】図5に示した符号セットを用いた場合の状態復号化制御手順を示すフローチャートである。
【図8】図5に示した符号セットを用いた場合の数値符号化制御手順を示すフローチャートである。
【図9】図5に示した符号セットを用いた場合の数値復号化制御手順を示すフローチャートである。
【符号の説明】
X 0の連続数
Y 1の連続数
A 直前のX値
B 直前のY値
S 状態値
T 直前のS値
N,P,P1,P2,P3 数値符号
Q、Q1,Q2,Q3 状態符号
[0001]
BACKGROUND OF THE INVENTION
The present invention sequentially inputs a run-length numerical sequence obtained by scanning data as a unit of a set of 0 bit continuations and 1 bit continuations as an input unit, converts the data into a predetermined code sequence, and outputs the data code Method, data code obtained by scanning a code string data and inputting a code string obtained by scanning the code string data, and restoring and outputting a run-length numeric string in units of a set of 0 bit continuation number X and 1 bit continuation number Y And a computer-readable recording medium on which a program for causing a computer to execute the method is recorded.
[0002]
[Prior art]
Conventionally, a printing apparatus such as a laser printer compresses (encodes) image data to be printed, temporarily stores it in a memory, and performs actual printing while decompressing (decoding) the compressed data stored in the memory. A memory-saving technique is known that reduces the memory capacity of a memory for storing image data.
[0003]
The original purpose of such a memory-saving technique is to reduce the memory capacity of the memory for storing the image data to reduce the cost. Therefore, it is necessary to provide complicated dedicated hardware for compressing or expanding the image data. It is not appropriate, and it is necessary to cause the microprocessor of the printing apparatus to perform these processes in software.
[0004]
Here, as a two-dimensional still image encoding technique, two-dimensional compression techniques that perform data compression in consideration of data correlation in the sub-scanning direction and predictive encoding techniques that perform predictive encoding using arithmetic codes are highly compressed. It is known as a technology that can obtain rates.
[0005]
However, if these encoding technologies are implemented by software using a microprocessor of a printing apparatus, processing delays occur, and in recent years, the printing resolution and printing speed are improved day by day. It is not efficient to use. For this reason, a relatively simple compression technique called one-dimensional compression is widely used when the microprocessor performs compression / decompression.
[0006]
As a conventional one-dimensional compression technique, an MH (Modified Haffman) code used in a run-length process or a facsimile machine is widely known, but a color (black and white) such as a pseudo halftone image has a short cycle. In the case of image data that changes frequently, it cannot be compressed efficiently. In particular, since the opportunity to print image data has increased with the progress of personal computers and networks, it is not efficient to employ this MH code as a memory saving mechanism.
[0007]
For this reason, in order to improve the compression rate of image data whose color frequently changes in a short cycle, an encoding technique for detecting repeatability of image data and run length is known. For example, in Japanese Patent No. 2683506 (Prior Art 1), by using a control word that can describe both the length of a white word and the length of a black word, the white word and the black word are controlled in a relatively short cycle. A data compression (decompression) method and apparatus for efficiently compressing image data that appears automatically is disclosed.
[0008]
Specifically, in this prior art 1, a certain word length (byte) is defined, a data unit that is all white is treated as a white word, a non-white data unit is treated as a black word, the number of repeated occurrences thereof, Since the contents of black words, control words, etc. are encoded in units of word lengths, no special code table is required for encoding and decoding, and processing can be performed in units of word lengths so that even microprocessors can process them. Sufficient processing performance can be expected.
[0009]
Japanese Laid-Open Patent Publication No. 9-65147 (prior art 2) stores white and black run lengths, and a predetermined value is obtained when the run length value of a certain color matches the run length value immediately before the same color. An image signal compression (decompression) method and apparatus for improving the compression rate and processing speed by generating a repetitive code is disclosed.
[0010]
[Problems to be solved by the invention]
However, in the above prior art 1, since repeatability is detected in units of word strings, a high compression rate is obtained only when the repetition period included in the target image data and the word length match or become a multiple. There is a problem that sufficient compression cannot be obtained for general image data.
[0011]
Further, in the above-described prior art 2, the compression rate is only when the amount of data is sufficiently smaller than the codeword encoded when the repetitive codes generated when the run lengths match do not match. There is a problem that this is only an improvement. That is, assigning shorter codewords to repetitive codes lengthens codewords with relatively unmatched run lengths, so a sufficient compression ratio for image data whose colors change frequently in short cycles It is difficult to obtain a code set having.
[0012]
Specifically, in the embodiment of the prior art 2, the code set is similar to the MH code, and high speed as in the run-length code technique cannot be expected in the processing by the microprocessor. In addition, since a storage unit for storing run-length values is provided corresponding to colors, it is necessary to select a reference / storage destination according to colors when comparing and storing run-length values. There is also a problem that high-speed processing by the processor is hindered.
[0013]
The two-dimensional compression technique, the predictive coding technique, the MH coding, and the like have a problem that a relatively large capacity memory such as a line buffer, a probability table, and a code table is required. For example, if the resolution is 1200 dpi (dots / inch) and the printing speed is 25 ppm (pages / minute), the pixel frequency generally exceeds 100 MHz. It is extremely difficult to operate the encoding / decoding hardware circuit including the memory at such a frequency, and even if the circuit is operated in parallel and operated at a low frequency, it is parallel including the table. As a result, it becomes a large-scale circuit, resulting in an increase in cost.
[0014]
Further, Japanese Patent Application No. 11-12479 is configured to reduce the number of codes by encoding the number of consecutive runs when the run length value matches the run length value immediately preceding the same color. Data encoding and decoding methods that can achieve both a high compression rate and high processing speed for pseudo-halftone image data are described. In the case of image data including an image, a sufficient compression rate cannot be obtained.
[0015]
In order to eliminate the above-mentioned problems caused by the prior art, the present invention can efficiently compress pseudo halftone image data generated by error diffusion processing, and data encoding suitable for software processing by a microprocessor. It is an object of the present invention to provide a method, a data decoding method, and a computer-readable recording medium recording a program for causing a computer to execute the method.
[0016]
[Means for Solving the Problems]
  In order to solve the above-described problems and achieve the object, a data encoding method according to the first aspect of the present invention provides a run length obtained by scanning data.ValueA data encoding method in which a sequence is sequentially input as an input unit of a set of 0 consecutive bits and 1 consecutive bits, converted into a predetermined code sequence, and output.As the calculation of the state value corresponding to the data of the input unit, the number of consecutive 0 bits X, the number of consecutive 1 bits Y, the number of consecutive 0 bits A immediately before, and the number of consecutive 1 bits immediately preceding 1 When B is in the relationship of X ≠ A and Y ≠ B, the value of the state S0 is the state value S, and when X = A and Y ≠ B, the value of the state S1 is the state value S, and X A calculation step of calculating the value of state S2 as state value S when ≠ A and Y = B, and calculating the value of state S3 as state value S when X = A and Y = B; When the immediately preceding state value T is the state S3 and the state value S and the immediately preceding state value T are the same coincidence event, this is regarded as a repetitive event, and the repetitive event occurs continuously. The iteration number calculating step for calculating the iteration number N, and the state value S and the immediately preceding state after the occurrence of the iteration event. A non-coincidence event different from the value T or a regression event determination step for determining a regression event when the input is completed, and a state code generation for generating a state code indicating the value of the state value S when the mismatch event occurs And a numerical code indicating the value of the consecutive number X of 0 bits or the consecutive number Y of 1 bits when the generation of the state code by the state code generating step is completed or the coincidence event occurs A first numerical code generation step for generating the number of iterations N and the number N of iterations calculated by the iteration number calculation step prior to the generation of the state code by the state code generation step when the regression event occurs A second numerical code generation step for generating a numerical code, and a generation step for generating a state code and a numerical code corresponding to the input unit data,It is characterized by including.
[0017]
  According to the invention of claim 1,In the calculation of the state value corresponding to the data of the input unit, the number of consecutive 0 bits X, the number of consecutive 1 bits Y, the number of consecutive 0 bits A immediately before, and the number of consecutive 1 bits B immediately preceding When X ≠ A and Y ≠ B, the value of the state S0 is the state value S. When X = A and Y ≠ B, the value of the state S1 is the state value S, and X ≠ A and The value of the state S2 is set as the state value S when Y = B, and the value of the state S3 is calculated as the state value S when X = A and Y = B. Is the state S3, and the state value S and the previous state value T are equal coincident events, this is regarded as a repetitive event, and the repetitive number N in which the repetitive event occurs continuously is calculated. When a repetitive event occurs, the status value S and the previous status value T are different from each other, or the input is completed. When a mismatch event occurs, a status code indicating the value of the status value S is generated. When the generation of the status code ends or a match event occurs, the number of consecutive 0 bits X Alternatively, a numerical code indicating the value of the consecutive number Y of 1 bits is generated, and when a regression event occurs, the numerical code indicating the value of the iteration number N is generated prior to the generation of the state code. Using the concept of event, mismatch event, repetitive event, and regression event, it is possible to efficiently compress the pseudo halftone image data generated by the error diffusion process.
[0022]
  Claims2The data encoding method according to the present invention is as follows.1In the invention, the calculation step includes an initialization step of storing predetermined initial values in T, A, B, and the number of iterations N, respectively, when encoding is started;SaidAn input step for inputting a run-length value; and a state value generating step for generating the state value S after input by the input step, wherein the generating step uses the state value S generated by the state value generating step. Corresponding event determination step for determining occurrence of the coincidence event or mismatch event, repetitive event determination step for determining whether or not the repetitive event has occurred in response to occurrence of the coincidence event, and occurrence of the repetitive event An iteration number adding step of adding the iteration number in response to the occurrence of the mismatch event or a regression event determining step of determining whether or not the regression event has occurred in response to the end of the encoding target data, and the regression An iterative number numerical code generation step for generating an iterative number numerical code indicating the value of the iterative number N in response to the occurrence of an event, and a regression for returning the iterative number N to a predetermined initial value after generating the iterative number numerical code A state code generation step for generating a state code representing the value of the state value S in response to occurrence of the mismatch event or initialization of the number of iterations N by the regression step, and a state by the state code generation step After generation of a code or determination of occurrence of a repetitive event by the repetitive event determination step, if X does not match A, a numerical code corresponding to X is generated, and if Y does not match B, Y is set to Y After the numerical code generation step for generating the corresponding numerical code, and the generation of the numerical code by the numerical code generation step or the addition of the number of iterations N by the number of iterations addition step, the content of A is updated to X, And updating the contents to Y and updating the contents of T to S immediately before updating.
[0023]
  This claim2According to the invention, when encoding is started, predetermined initial values are stored in T, A, B and the number of repetitions N, respectively, and X and YTo laThe length value is input, and after this input, the state value S is generated, the occurrence of the coincidence event or the disagreement event is determined corresponding to the generated state value S, and the occurrence of the repetitive event is generated in response to the occurrence of the coincidence event Determine the presence or absence, add the number of iterations in response to the occurrence of a repetitive event, determine the presence or absence of a regression event in response to the occurrence of a discrepancy event or the end of data to be encoded, and In response, an iteration number numerical code indicating the value of the iteration number N is generated. After the iteration number numeric code is generated, the iteration number N is returned to a predetermined initial value, and in response to the occurrence of a mismatch event or the initialization of the iteration number N. A state code expressing the value of the state value S is generated, and after generation of the state code or determination of occurrence of a repetitive event, if X does not match A, a numerical code corresponding to X is generated, and Y is B If it does not match, generate a numeric code corresponding to Y After generating the numerical code or adding the number of iterations N, 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. You can compress the data that fits.
[0024]
  Claims3The data decoding method according to the present invention inputs a code string obtained by scanning the code string data, and has a run length in units of a set of 0 bit continuation number X and 1 bit continuation number Y.ValueA data decoding method for restoring and outputting to a column, wherein when decoding is started, a storage unit S that stores a state value to be restored, and a value corresponding to X among the restored run length values An initialization step of initializing a storage unit C to be stored and a storage unit D to store a value corresponding to the Y of the restored run length values by substituting a predetermined initial value, and a predetermined code unit are input. An input code type determining step for determining whether the code is a numerical code P or a state code Q, and when the input code type determining step determines that the code is a numerical code, the code is restored to a numerical value. A numerical code restoration step stored in the storage unit L, and a state code restoration step for restoring the code to the state value and storing it in the S when the input code type determination step determines the state code; State at the time when the restoration value is stored in L State S0 where X ≠ A and Y ≠ B, S1 where X = A and Y ≠ B, S2 where X ≠ A and Y = B, or X = A And an identification step for identifying which state S3 is in a relationship of Y = B (where A is the number of consecutive 0 bits immediately before and B is the number of consecutive 1 bits immediately preceding); When a new state value is stored in S, the S3 state determination step for determining whether or not the value of S matches S3, and the value of S is S0 by the identification step In the case of being identified, after the value of L is stored in the C, the next numerical code is input and restored, and the first run value updating step of storing in the D is performed. A second run value that stores the value of L in D when the value is identified as S1 A new run value, a third run value updating step of storing the value of L in the C when the value of S is identified as the S2 by the identification step, the first, second or When updating by the third run value updating step is completed or when it is determined by the S3 state determination step that the value of S matches the state value S3, the C and D values are set to a set of run length values. And when the S value is identified as S3 by the identification step, the C and D values are set to the L value as a set of run length values. And a second output step for outputting the corresponding number of times.
[0025]
  This claim3According to the invention, when starting decoding, the storage unit S that stores the restored state value, the storage unit C that stores the value corresponding to the X among the restored run-length values, and the restored A predetermined initial value is substituted into a storage unit D for storing a value corresponding to Y among the run length values, and a predetermined code unit is input, so that the code is a numerical code P or a state 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 to S The state value S at the time when the restored numerical value is stored and stored in L is the state S0 where X ≠ A and Y ≠ B, and the states S1 and X where X = A and Y ≠ B Neither state S2 in the relationship of ≠ A and Y = B or state S3 in the relationship of X = A and Y = B When a new state value is stored in S, it is determined whether or not the value of S matches S3, and when the value of S is identified as S0, After the value of L is stored in C, the next numerical code is input and restored and stored in D. When the value of S is identified as S1, the value of L is stored in D and the value of S Is determined to be S2, the value of L is stored in C, and when updating is completed or when it is determined that the value of S matches the state value S3, a set of values of C and D is set. When the S value is identified as S3, the C and D values are output as a set of run length values for the number of times corresponding to the L value. It is possible to efficiently restore the compressed halftone image data generated by the error diffusion process.
[0026]
  Claims4The recording medium according to the present invention is the first aspect.3By recording a program that causes a computer to execute the method described in any one of the above, the program can be machine-readable, and thereby3Any one of the operations can be realized by a computer.
[0027]
DETAILED DESCRIPTION OF THE INVENTION
Exemplary embodiments of a data encoding method, a data decoding method, and a computer-readable recording medium storing a program for causing a computer to execute the method according to the present invention are described in detail below with reference to the accompanying drawings. explain. In the present embodiment, the case where the pseudo halftone image data generated by the error diffusion process is encoded or decoded is shown.
[0028]
First, the concept of the data encoding method and the data decoding method according to the present embodiment will be described. FIG. 1 is an explanatory diagram for explaining the concept of the data encoding method and the data decoding method according to the present embodiment.
[0029]
In the figure, for a run-length numerical sequence obtained by scanning data, the number of consecutive bits having a value of “0” (hereinafter referred to as “X”) and the number of consecutive bits having a value of “1”. Data encoding is performed in which a set (hereinafter referred to as “Y”) is sequentially input as an input unit, converted into a predetermined code string, and output.
[0030]
Specifically, the value immediately before X is “A”, the value immediately before Y is “B”,
X ≠ A and Y ≠ B
Let S0 be the state of
X = A and Y ≠ B
Let S1 be the state of
X ≠ A and Y = B
Let S2 be the state of
X = A and Y = B
Let S3 be the state.
[0031]
Further, a state value having any value of S0 to S3 according to this state is “S”, and a value immediately before this S is “T”. Then, an event where S = T is set as a “general event”, an event where S ≠ T is set as a “mismatch event”, and if a match event occurs when T is S3, it is set as a “repeated event”. The number of consecutive occurrences of events is defined as “repetition number N”.
[0032]
Furthermore, after this repetitive event occurs, if a mismatch event occurs or input is completed, it is set as a “regression event”. If 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 coincidence event occurs, a numerical code P indicating the value of X is generated when X ≠ A, and a numerical code indicating the value of Y when Y ≠ B P is generated, and when a regression event occurs, a numerical code P indicating the value of the iteration number N is generated prior to the generation of the state code.
[0033]
FIG. 1 shows a case where the data to be compressed starts with “0” of 3 bits and continues to “1” of 4 bits and “0” of 3 bits. When the run length measurement is started from “0”, the X and Y numeric sequences obtained by scanning the data have 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, but for each event, “○” is described when there is an event, and blank when there is no event. It is said. For each code, “◯” is described when there is a code output, and blank when no code is output.
[0035]
Here, although there are two attributes of a status code and a numerical code, the numerical code is divided into three types so that it can be understood which numerical value corresponds. Strictly speaking, the previous values (A, B and T) do not exist 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]
As described above, in the present embodiment, when events whose run length values match the run length value immediately before the same measurement target value continue, the number of codes is reduced by encoding the continuous number. The number of codes is efficiently reduced by inheriting the feature of the technology by generating a numerical code P corresponding to the number of repetitions N when S3 continues multiple times. In addition, the number of codes is efficiently reduced when either X or Y matches the previous value but the other does not match, that is, when the state of S1 or S2 continues.
[0037]
In particular, in error-diffused image data, the probability that the states of S1 and S2 are continuous is high, so the effect of reducing the number of codes according to this embodiment is great. For example, in the same figure, 12 sets, that is, 24 run length values are input, but it is understood that the number of codes to be output is reduced to 11, and the number of codes is reduced.
[0038]
Next, an encoding procedure used in this embodiment will be described. FIG. 2 is a flowchart showing the encoding procedure used in this embodiment, and FIG. 3 is a flowchart showing the non-output N encoding procedure shown in steps S209 and S219 of FIG.
[0039]
As shown in FIG. 2, first, initialization processing is performed in which predetermined constants C are set in A, B, and T, and N is set to 0 (step S201). Here, for convenience of explanation, the same constant C is set for A, B, and T, but different values may be set. However, it is desirable that the initial value of T is the value shown in S0 in order to reduce the number of codes. The reason is that the generation of the state code due to the occurrence of a meaningless mismatch event can be suppressed because the case where the state value S is S0 occurs with the highest probability for the first input of X and Y. In addition, it is desirable that the initial values of A and B are set to values different from the values at the start of run length measurement in order to reduce the number of codes.
[0040]
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 is generated corresponding to this input. State creation processing is performed (steps S203 to S207).
[0041]
Specifically, after initializing by substituting 0 for the S value (step S203), the X value and the A value are compared (step S204), and if they match (Yes in step S204). “1” is added to this S (step S205), and if they do not match (No at step S204), the process proceeds to step S206 as it is. Further, the Y value is compared with the B value (step S206), and if they match (Yes at step S206), '2' is added to S (step S207). Therefore, the numerical value representing S0 is 0, the numerical value representing S1 is 1, the numerical value representing S2 is 2, and the numerical value representing S3 is 3.
[0042]
Thereafter, a matching event determination process is performed to determine whether or not the value of the generated state value S matches T (step S208). If they match (Yes in step S208), it is determined as a matching event. If they do not match (No at Step S208), it is determined that the event is a mismatch event.
[0043]
Specifically, when a coincidence event occurs (Yes at Step S208), it is determined whether or not the S value is 3 (Step S211), and when this S value coincides with 3, that is, S3 (Step S211). S211 Yes) It is determined that there is a repetitive event, the value of the number of repetitions N is incremented (step S212), and the process proceeds to step S217.
[0044]
On the other hand, if a mismatch event has occurred (No at step S208), it is determined that no repetitive event has occurred, and non-output N encoding is performed (step S209). Specifically, as shown in FIG. 3, it is determined whether or not the value of the iteration number N is greater than 0 (step S301). If it is greater than 0 (step S301 affirmative), a regression event occurs. After determining that it has been performed and performing numerical encoding (N) and outputting a numerical code (step S302), initialization is performed by substituting 0 for N (step S303). On the other hand, when the value of the iteration number N remains 0 (No at step S301), it is determined that no regression event has occurred.
[0045]
When this non-output N encoding is completed, state encoding (S) for generating and outputting a state code representing the value of state S is performed (step S210), and run numerical code output processing is performed (step S210). S213 to S216).
[0046]
Specifically, first, the X value and the A value are compared (step S213), and if they do not match (No in step S213), a numerical code (X that generates and outputs a state code representing the value of X) (X ) Is performed (step S214). Also, the Y value and the B value are compared (step S215), and if they do not match (No at step S215), the state code expressing the Y value is generated and output (Y) (step S215). Step S216).
[0047]
Thereafter, A is updated with the X value, B is updated with the Y value, and T is updated with the S value (Step S217). If there is data to be encoded (No at Step S218), Step The process proceeds to S202 and the above process is repeated. If there is no more data to be encoded (Yes at step S218), the previously described non-output N encoding is performed (step S219), and the process is terminated.
[0048]
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 code generation is completed or when a match event occurs, X ≠ A In some cases, a numerical code P indicating the value of X is generated. In a case where Y ≠ B, a numerical code P indicating the value of Y is generated. When a regression event occurs, a state code is generated. A numerical code P indicating the value of the iteration number N can be generated and encoded in advance.
[0049]
When the above processing procedure is realized by software, an appropriate memory may be allocated to X, Y, A, B, S, T, and N, but it is possible to use a general-purpose register of a microprocessor. Desirable for improving performance. The constant C and each control can be realized by describing them as a program, that is, an instruction code.
[0050]
Further, in the above series of explanations, for the convenience of explanation, the run length measurement input (step S202) and related data end determination (step S218) and code generation (steps S210, S214, S216, S302) are described in detail. Omitted.
[0051]
Next, a data decoding procedure according to this 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 starting the decoding process, S for storing the restored state value, A for storing the value corresponding to X among the restored run length values, and the value corresponding to Y Is initialized by substituting a constant C for each B stored (step S401). In order to perform decoding correctly, the initial values assigned to A, B, and S are the values assigned to A, B, and S during the initialization process during encoding (step S201 in FIG. 2). It is necessary to assign the same value.
[0052]
When this initialization process is completed, the code input is substituted for K (step S402), and an input code determination process for determining whether this K is the numerical code P or the state code Q (step S403). To do. As a result, if it is determined that the code is a numerical code (Yes at Step S403), a numerical value restoring process (Step S404) is performed to restore the code stored in K to a numerical value and store it in L, and the state identifying process The process proceeds to (Steps S405 to 407).
[0053]
Specifically, it is confirmed whether or not the state value S is 0 (step S405), and when the state value S is 0 (step S405 affirmative), the process corresponding to S0, that is, restored to A The run length value L is stored (step S408), the next code unit is input and stored in K (step S409), the code stored in K is restored to a numerical value, and stored in L ( In step S410), the process stores the value of L in B (step S411), and outputs a set of run length values in which A is output X and B is output Y (step S414).
[0054]
When the state value S is not 0 (No at Step S405), it is confirmed whether or not the state value S is 1 (Step S406). When the state value S is 1 (Yes at Step S406). , The process corresponding to S1, that is, the process of storing the L value in B (step S412), is output as a set of run length values in which A is output X and B is output Y (step S414).
[0055]
Further, when the state value S is not 1 (No at Step S406), it is confirmed whether or not the state value S is 2 (Step S407). When the state value S is 2 (Yes at Step S407). , The process corresponding to S2, that is, the process of storing the L value in A (step S413), is output as a set of run length values in which A is output X and B is output Y (step S414).
[0056]
If the status value S is not 2 (No at step S407), the process corresponding to S3 is performed. Specifically, the L value is stored in N as an initial value (step S417), and then output as a set of run length values in which A is output X and B is output Y (step S418), and N is decremented. After this (step S419), if the value of N is not 0 (No at step S420), the process proceeds to step S418 and the process is repeated. Then, when the value of N becomes 0 (Yes at Step S420), an end determination is made (Step S421), and when it does not end (No at Step S421), the process proceeds to Step S402.
[0057]
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 the state value and stored in S (step S415). It is confirmed whether or not there is (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]
By performing the above series of processing, when the state code is input and restored to the predetermined state value S, when this S is in the state of S3, a set of run length values is omitted. A set of run length values stored in A and B can be output without waiting for the input of a numerical code.
[0059]
In addition, when this S value is S0 when a numerical code is inputted and restored to a predetermined numerical value and stored in L, 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]
When the S value is S1, the numerical code for the continuous number of 0 is omitted, so that 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, the numerical code for the continuous number of 1 is omitted, so that a set of run length values is output using the value stored in B and the restored numerical value L. Do it.
[0061]
Further, when this S value is S3, the restored numerical value is the number of iterations N, and N sets of run length values are omitted, so the values stored in A and B at that time are used. Repeat the output operation of a set of run length values 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]
When the above processing procedure is realized by software, an appropriate memory may be allocated to X, Y, A, B, S, T, K, L, and N. It is desirable to use it for improving the processing performance. The constant C and each control can be realized by describing them as a program, that is, an instruction code.
[0063]
Further, some of the series of processes described above can be omitted. For example, N for counting and storing the number of iterations and L for storing the restored numerical value can also be omitted. It is also possible to substitute one of X and Y for storing the output run length value.
[0064]
Further, in the above series of explanations, for the convenience of explanation, detailed explanations about the run-length numerical value output (steps S414 and S418) and the data end determination (step S421) related thereto are omitted.
[0065]
Next, the code set used for 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]
As shown in the figure, the code set used in the present embodiment is composed of six types of code units of 1st to 6th. Specifically, the first code format P1 to the third code format P3 are: A numerical code P indicating a numerical value, and a fourth code format Q1 to a sixth code format Q3 are state codes Q indicating state values.
[0067]
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 is a value obtained by adding 1 to the numerical value. Corresponds to the numerical value L. The second code format P2 has an 8-bit width and is identified by the value of the upper 4 bits preceding in the code string being “11” or “12”. A value obtained by adding 11 ″ corresponds to the numerical value L.
[0068]
The third code format P3 is at least 8 bits wide and has a bit width that is a multiple of 4 and is identified by the value of the preceding 4 bits in the code string being “12”. For these 4 bits, the value obtained by adding “43” to the numerical value obtained by concatenating the lower 3 bits of 4 bits upward (connected) until a numerical value of “8” or more is detected corresponds to the numerical value L. To do.
[0069]
The fourth code format Q1 has a 4-bit width, is identified by the 4-bit numerical value being “13”, and the lower two bits of the value obtained by adding “1” to the previous state value are new. Corresponds to the state value. The fifth code format Q2 has a 4-bit width, is identified by the 4-bit value being “14”, and the lower 2 bits of the value obtained by adding “2” to the previous state value are new. Corresponds to the state value. The sixth code format Q3 has a 4-bit width, is identified by the 4-bit value being “15”, and the lower 2 bits of the value obtained by adding “3” to the previous state value are new. Corresponds to the state value.
[0070]
Although the state value can take four values, the state code is generated only when the state value changes. Since there are only three transition objects from one state value to another state value, the number of state codes is reduced to three.
[0071]
In addition, in the numerical code P, the code whose value is “0” is not clearly shown, but it is desirable to express “0” using a conversion procedure described later. However, this code format does not limit the range that can be expressed in principle, and it should be noted that 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 the numerical value has a finite bit width, but since there is no restriction on the length of the P3 code, the result of processing by concatenation and addition becomes '0' or This is because a negative sign can be generated.
[0072]
Next, input code type determination, state coding control, state restoration processing, numerical value coding processing, and numerical value restoration processing when the code set shown in FIG. 5 is used will be described. First, in the determination of the input code type (corresponding to step S403 in FIG. 4), if the value of the upper 4 bits preceding the code is a value equal to or less than “12”, it is determined that the code is a numerical code. In this case, it can be determined that it is a status code.
[0073]
6 is a flowchart showing a state encoding control procedure when the code set shown in FIG. 5 is used. FIG. 7 shows a state decoding control procedure when the code set shown in FIG. 5 is used. It is a flowchart. In the figure, “K (n) ← numerical value” means that the lower n bits of the numerical value on the right side are output as a code, and “W” is a working memory used for the calculation.
[0074]
As shown in FIG. 6, when state encoding is performed, a value obtained by subtracting the previous state value T from the state value S and “3” are logically ORed for each bit, and “12” is added to this. The value is stored in the working memory W (step S601), and the lower 4 bits of the working memory W are output as a 4-bit code K (step S602).
[0075]
As shown in FIG. 7, when state decoding is performed, a value obtained by subtracting “12” from the code value is changed to the state value S so far in response to the generation of any of the codes Q1 to Q3. Addition is performed, and a logical product for each bit of the resultant value and the constant value '3' is obtained and stored in the state value S as a new state value (step S701).
[0076]
By performing the control shown in FIGS. 6 and 7, it is possible to generate a predetermined state code and restore the state value using the state code. For example, when the state value T immediately before encoding is “0” and the new state value S is “3”, “ST” is “3”, so this value and the constant value “3”. The logical product for each bit of “3” is “3”. Then, “15” obtained by adding “12” to this value, that is, a Q3 code is generated. On the other hand, when restoring the state code, “K-12” becomes “3”, and the value “3” obtained by adding the previous state value “0” to this value and the constant value “3” for each bit. When the logical product is taken, “3” becomes a new state value S, and it can be seen that it is correctly restored.
[0077]
When the state value T immediately before encoding is “3” and the new state value S is “0”, “ST” becomes “−3”, and this value and the constant value “3”. Since the logical product for each bit of “1” is “1”, “13” obtained by adding “12” to this value, that is, the Q1 code is generated. On the other hand, when restoring the state code, “K-12” becomes “1”, and the value “4” obtained by adding the previous state value “3” to this value and the constant value “3” for each bit. When the logical product is taken, “0” becomes a new state value S, and it is understood that the state is correctly restored.
[0078]
FIG. 8 is a flowchart showing a numerical encoding control procedure when the code set shown in FIG. 5 is used, and FIG. 9 shows a numerical decoding control procedure when the code set shown in FIG. 5 is used. It is a flowchart. In the figure, “K (n) ← numerical value” means that the lower n bits of the numerical value on the right side are output as a code, and “W” is a working memory used for the calculation.
[0079]
As shown in FIG. 8, here, the numerical value “V” to be encoded is converted into one of codes P1 to P3 and output. As already mentioned, since the sign of the value “0” is not defined in this numerical code P, here, when “V = 0”, it is converted into a constant value “Z”. Zero value conversion processing is performed. That is, since the frequency of V = 0 is very low, the compression rate is improved by assigning it to a relatively long codeword. Specifically, steps S801 to S804 described below correspond to the zero value conversion process, and steps after step S805 correspond to a process of generating a code word from a numerical value.
[0080]
As shown in the figure, first, it is determined whether or not the encoding target value V is equal to or greater than a constant value Z (step S801). If it is equal to or greater than Z (Yes in step S801), the value of V is set. Increment (step S802). If it is not equal to or greater than Z (No at Step S801), it is determined whether V is 0 (Step S803). If Z is 0 (Yes at Step S803), the constant value Z is stored in V (Step S803). S804).
[0081]
When the zero-value conversion process is finished, it is determined whether or not the current encoding target value V is “10” or less (step S805). (Yes in step S805), the lower 4 bits of the value obtained by subtracting “1” from V are output as a code (step S806), and the numerical encoding ends.
[0082]
On the other hand, if V is not "10" or less (No in step S805), it is determined whether or not this V is "42" or less (step S807). If V is "42" or less (step S807). (Yes) The lower 8 bits of the value obtained by adding “149” to V are output as a code (step S808), and the numerical encoding is terminated. Since the definition of the P2 code is “K (8) ← 160 + (V−11)”, that is, “K (8) ← V + 149”, the code generated here is nothing but the P2 code. Since “160” is expressed as a binary number “10100000”, the upper 3 bits are a code-specific constant.
[0083]
If it is determined in step S807 that V is not equal to or lower than “42” (No in step S807), a 4-bit code having a value of “12” is first output as the start identification code of the P3 code ( Step S809). Thereafter, a value obtained by subtracting “43” from V is stored in the work memory W (step S810), and it is checked whether or not the value of W is less than “8” (step S811).
[0084]
If the result is “8” or more (No at step S811), the lower 3 bits of the W value are output as a 4-bit code (step S812), and the W value is shifted to the right by 3 bits. After the code output portion is cut off (step S813), the process returns to step S811.
[0085]
On the other hand, if it is less 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), and numerical encoding is terminated. . Since the constant “7” is expressed as a binary number “0111”, the code generated in step S812 is always a numerical value of “8” or more, and it can be clearly shown that this code is the last one in the numerical part. It can be seen that this code is nothing but the P3 code.
[0086]
As shown in FIG. 9, when performing numerical value restoration, a code string encoded in any one of the code formats P1 to P3 is sequentially read in units of 4 bits, and the numerical value is restored to the working memory W. . Note that the notation “K ← sign input” means that a 4-bit code is input to K as a numerical value. In addition, here, “0 value reverse conversion processing” which is reverse conversion of the 0 value conversion processing shown in FIG. 8 is performed. Steps S901 to S911 shown below correspond to a numerical value restoration process, and steps after step S912 correspond to a zero value reverse conversion process.
[0087]
As shown in the figure, when performing 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 the K value is less than “10” (step S901). 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 stored in W as a restored numerical value (Step S903), and 0 value reverse conversion described later is performed. Transition to processing. Since the code in which the first 4 bits are less than “10” is nothing but the P1 code, it can be restored to a numerical value by adding “1” to this K value.
[0088]
On the other hand, when the K value is not less than “10” (No at Step S902), it is determined whether or not the K value is “12” (Step S904). In step S904, the value obtained by shifting the K value to the left by 4 bits is stored in W, the next 4 bits of the sign are input to K, and "149" is calculated from the value obtained by adding W and the new K value. After the subtracted value is stored in W as a restored numerical value (step S905), the process proceeds to 0 value reverse conversion processing described later.
[0089]
On the other hand, when 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 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 the K value is less than '8' (step S909).
[0090]
As a result, if the K value is less than '8' (Yes at Step S909), the sign of the numerical value part continues thereafter, so after shifting the value of W to the left by 3 bits (Step S910), the above Step S907 Migrate to
[0091]
On the other hand, if the K value is not less than “8” (No at Step S909), the value obtained by adding “35” to the previous W is newly stored in W (Step S911), and the zero-value inverse conversion process is performed. Migrate to In the P3 code, a value obtained by adding “43” to a numerical value obtained by concatenating the lower 3 bits of 4 bits upward (connected) until a value of “8” or more is detected as the 4 bits. Corresponding to Then, since “8” indicating the end of the numerical value part is added to the value of K when a numerical value of “8” or more is detected, “35” which is “43-8” here. Is added.
[0092]
Thereafter, a zero value reverse conversion process for restoring the zero value conversion process is performed. Specifically, it is confirmed whether or not the restored numerical value W is larger than the constant Z (step S912). If the restored numerical value W is larger than Z (step S912 affirmative), from W to “1”. The value obtained by subtracting 'is stored in W (step S913), and the numerical value restoring process is terminated.
[0093]
On the other hand, when the numerical value W is equal to or smaller than Z (No at Step S912), it is confirmed whether or not the restored numerical value W matches the constant Z (Step S914). (Yes in S914), “0” is substituted for W (step S915), and the numerical value restoring process is terminated.
[0094]
As described above, in this embodiment, one of the states S0 to S3 is based on the 0-bit continuous number X, the 1-bit continuous number Y, the value A immediately before X, and the value B immediately before Y. The state value is S, the value immediately before S is T, and when a mismatch event occurs, a state code Q indicating the value of the state value S is generated. When X ≠ A, a numerical code P indicating the value of X is generated, and when Y ≠ B, a numerical code P indicating the value of Y is generated and a regression event occurs. In this case, since the numerical code P indicating the value of the repetition number N is generated prior to the generation of the state code, the pseudo halftone image data generated by the error diffusion process by software processing by the microprocessor. Can also be compressed efficiently.
[0095]
【The invention's effect】
  As described above, according to the invention of claim 1,In the calculation of the state value corresponding to the data of the input unit, the number of consecutive 0 bits X, the number of consecutive 1 bits Y, the number of consecutive 0 bits A immediately before, and the number of consecutive 1 bits B immediately preceding When X ≠ A and Y ≠ B, the value of the state S0 is the state value S. When X = A and Y ≠ B, the value of the state S1 is the state value S, and X ≠ A and The value of the state S2 is set as the state value S when Y = B, and the value of the state S3 is calculated as the state value S when X = A and Y = B. Is the state S3, and the state value S and the previous state value T are equal coincident events, this is regarded as a repetitive event, and the repetitive number N in which the repetitive event occurs continuously is calculated. When a repetitive event occurs, the status value S and the previous status value T are different from each other, or the input is completed. When a mismatch event occurs, a status code indicating the value of the status value S is generated. When the generation of the status code ends or a match event occurs, the number of consecutive 0 bits X Alternatively, a numerical code indicating the value of the consecutive number Y of 1 bits is generated, and when a regression event occurs, the numerical code indicating the value of the iteration number N is generated prior to the generation of the state code. Using the concept of event, discrepancy event, repetitive event, and regression event, data can be efficiently compressed even for pseudo halftone image data generated by error diffusion processing.There is an effect that a possible data encoding method can be obtained.
[0098]
  Claims2According to the invention, when encoding is started, predetermined initial values are stored in T, A, B and the number of repetitions N, respectively, and X and YTo laThe length value is input, and after this input, the state value S is generated, the occurrence of the coincidence event or the disagreement event is determined corresponding to the generated state value S, and the occurrence of the repetitive event is generated in response to the occurrence of the coincidence event Determine the presence or absence, add the number of iterations in response to the occurrence of a repetitive event, determine the presence or absence of a regression event in response to the occurrence of a discrepancy event or the end of data to be encoded, and In response, an iteration number numerical code indicating the value of the iteration number N is generated. After the iteration number numeric code is generated, the iteration number N is returned to a predetermined initial value, and in response to the occurrence of a mismatch event or the initialization of the iteration number N. A state code expressing the value of the state value S is generated, and after generation of the state code or determination of occurrence of a repetitive event, if X does not match A, a numerical code corresponding to X is generated, and Y is B If it does not match, generate a numeric code corresponding to Y 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 after the generation of the numerical code or the addition of the number of iterations N, the software processing by the microprocessor is performed. There is an effect that a data encoding method capable of compressing suitable data can be obtained.
[0099]
  Claims3According to the invention, when starting decoding, the storage unit S that stores the restored state value, the storage unit C that stores the value corresponding to the X among the restored run-length values, and the restored A predetermined initial value is substituted into a storage unit D for storing a value corresponding to Y among the run length values, and a predetermined code unit is input, so that the code is a numerical code P or a state 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 to S The state value S at the time when the restored numerical value is stored and stored in L is the state S0 where X ≠ A and Y ≠ B, and the states S1 and X where X = A and Y ≠ B Neither state S2 in the relationship of ≠ A and Y = B or state S3 in the relationship of X = A and Y = B When a new state value is stored in S, it is determined whether or not the value of S matches S3, and when the value of S is identified as S0, After the value of L is stored in C, the next numerical code is input and restored and stored in D. When the value of S is identified as S1, the value of L is stored in D and the value of S Is determined to be S2, the value of L is stored in C, and when updating is completed or when it is determined that the value of S matches the state value S3, a set of values of C and D is set. When the S value is identified as S3, the C and D values are output as a set of run length values for the number of times corresponding to the L value. Data that can efficiently restore a compressed halftone image data generated by error diffusion processing. Decoding method an effect that can be obtained.
[0100]
  Claims4According to the present invention, claims 1 to3By recording a program that causes a computer to execute the method described in any one of the above, the program can be machine-readable, and thereby3There is an effect that a recording medium capable of realizing any one of the above operations by a computer can be obtained.
[Brief description of the drawings]
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;
FIG. 2 is a flowchart showing an encoding procedure used in the present embodiment.
FIG. 3 is a flowchart showing a non-output N encoding procedure shown in steps S209 and S219 of FIG. 2;
FIG. 4 is a flowchart showing a data decoding procedure according to the present embodiment.
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;
6 is a flowchart showing a state encoding control procedure when the code set shown in FIG. 5 is used.
7 is a flowchart showing a state decoding control procedure when the code set shown in FIG. 5 is used.
FIG. 8 is a flowchart showing a numerical encoding control procedure when the code set shown in FIG. 5 is used.
9 is a flowchart showing a numerical decoding control procedure when the code set shown in FIG. 5 is used.
[Explanation of symbols]
Number of consecutive X 0
Number of consecutive Y 1
A Previous X value
B Y value just before
S state value
T S value just before
N, P, P1, P2, P3 Numerical code
Q, Q1, Q2, Q3 Status code

Claims (4)

データを走査して得られるランレングス値列を0のビット連続数と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として算定する算定工程と、
直前の状態値Tが状態S3であり、かつ、前記状態値Sと直前の状態値Tとが等しい一致事象となった場合にこれを反復事象とみなして、該反復事象が連続して発生する反復数Nを算出する反復数算定工程と、前記反復事象の発生後に、前記状態値Sと直前の状態値Tとが異なる不一致事象または入力完了となった場合に回帰事象と判定する回帰事象判定工程と、前記不一致事象が発生した場合に前記状態値Sの値を示す状態符号を生成する状態符号生成工程と、前記状態符号生成工程による状態符号の生成が終了するかまたは前記一致事象が発生した際に、前記0のビットの連続数Xまたは前記1のビットの連続数Yの値を示す数値符号を生成する第1の数値符号生成工程と、前記回帰事象が発生した場合に、前記状態符号生成工程による状態符号の生成に先だって、前記反復数算定工程によって算定された反復数Nの値を示す数値符号を生成する第2の数値符号生成工程と、を含んで前記入力単位のデータに対応する状態符号および数値符号の生成する生成工程と、
を含んだことを特徴とするデータ符号化方法。
The Ranrengu scan value sequence obtained by scanning the data sequentially inputs a set of the number of bit continuations and bit number of consecutive 1 0 as an input unit, there in data encoding method for converting into a predetermined code sequence And
As the calculation of the state value corresponding to the data of the input unit, the number of consecutive 0 bits X, the number of consecutive 1 bits Y, the number of consecutive 0 bits A immediately before, and the number of consecutive 1 bits immediately preceding 1 When B is in the relationship of X ≠ A and Y ≠ B, the value of the state S0 is the state value S, and when X = A and Y ≠ B, the value of the state S1 is the state value S, and X A calculation step of calculating the value of state S2 as state value S when ≠ A and Y = B, and calculating the value of state S3 as state value S when X = A and Y = B;
When the immediately preceding state value T is the state S3 and the state value S and the immediately preceding state value T are the same coincidence event, this is regarded as a repetitive event, and the repetitive event occurs continuously. An iterative number calculating step for calculating an iterative number N, and a regression event determination for determining a regression event when the state value S and the immediately preceding state value T are different from each other after the occurrence of the repetitive event or when the input is completed A state code generation step of generating a state code indicating the value of the state value S when the mismatch event occurs, and generation of the state code by the state code generation step ends or the match event occurs A first numerical code generation step for generating a numerical code indicating a value of the continuous number X of 0 bits or the continuous number Y of 1 bits, and when the regression event occurs, the state Depending on the code generation process A state code corresponding to the data of the input unit, including a second numerical code generation step for generating a numerical code indicating the value of the repetition number N calculated by the repetition number calculation step prior to the generation of the state code And a generation process for generating a numerical code,
Data encoding method characterized by including the.
前記算定工程は、符号化を開始する際に、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に更新する直前値更新工程とを含んだ
ことを特徴とする請求項に記載のデータ符号化方法。
The calculation step, when starting the encoding, T, A, B and the initialization step of storing a respective predetermined initial value to the number of iterations N, the input step of inputting the run-length value in the X and Y And a state value generation step of generating the state value S after input by the input step,
The generation step includes a matching event determination step for determining the occurrence of the coincidence event or the mismatch event corresponding to the state value S generated by the state value generation step, and the repetitive event in response to the occurrence of the coincidence event. A repetitive event determining step for determining whether or not the occurrence of the repetitive event, a repetitive number adding step for adding the repetitive number in response to the occurrence of the repetitive event, and a response to the occurrence of the mismatch event or the end of the encoding target data A regression event determining step for determining whether or not the regression event has occurred, an iteration number numerical code generating step for generating an iteration number numerical code indicating the value of the iteration number N in response to the occurrence of the regression event, and the iteration The value of the state value S is expressed in response to a regression process for returning the iteration number N to a predetermined initial value after generation of a numerical value code, and the occurrence of the mismatch event or the initialization of the iteration number N by the regression process. Status mark And a numerical code corresponding to X when X does not match A after the generation of the state code by the state code generation step or the determination of the occurrence of the repetitive event by the repetitive event determination step A numerical code generation step for generating a numerical code corresponding to Y when Y does not match B, and generation of a numerical code by the numerical code generation step or repetition number N of the repetition number addition step after the addition, it updates the contents of the a to X, updates the contents of the B to Y, wherein the content of the T to claim 1, characterized in that it includes a value just before the update step of updating the S Data encoding method.
符号列データを走査して得られる符号列を入力し、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の出力工程と、
を含んだことを特徴とするデータ復号化方法。
In the code string data type the code string obtained by scanning a number of bit continuations of 0 X and data decoding method for restoring output Ranrengu scan value string to set the unit of one of the number of bit continuations Y There,
When starting decoding, the storage unit S that stores the restored state value, the storage unit C that stores the value corresponding to the X among the restored run-length values, and the run-length value that is restored An initialization step of initializing by substituting a predetermined initial value in the storage unit D for storing a value corresponding to Y;
An input code type determination step of inputting a predetermined code unit and determining whether the code is a numerical code P or a state code Q;
A numerical code restoring step of restoring the code to a numerical value and storing it in the storage unit L when it is determined as a numerical code by the input code type determining step;
A state code restoration step of restoring the code to the state value and storing it in the S when the input code type determination step determines that the state code;
The value of the state value S when the restoration numerical value is stored in the L is the state S0 in the relationship of X ≠ A and Y ≠ B, the state S1 in the relationship of X = A and Y ≠ B, and X ≠ A And state S2 in the relationship of Y = B or state S3 in the relationship of X = A and Y = B (where A is the number of consecutive 0 bits immediately before and B is the number of consecutive 1 bits immediately preceding An identification step for identifying whether the
A S3 state determination step of determining whether or not the value of S matches S3 when a new state value is stored in S;
If the value of S is identified as S0 by the identification step, the value of L is stored in the C, the next numerical code is input and restored, and stored in the D Run value update process,
A second run value updating step of storing the value of L in 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 the S2 by the identifying step;
The values of C and D when the update by the first, second or third run value update process is completed or when it is determined by the S3 state determination process that the value of S matches the state value S3 A first output step for outputting as a set of run length values;
A second output that outputs the C and D values as a set of run length values for the number of times corresponding to the L value when the S value is identified as S3 by the identification step. Process,
A data decoding method comprising:
前記請求項1〜のいずれか一つに記載された方法をコンピュータに実行させるプログラムを記録したことを特徴とするコンピュータ読み取り可能な記録媒体。A computer-readable recording medium having recorded thereon a program for causing a computer to execute the method according to any one of claims 1 to 3 .
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 JP2001196937A (en) 2001-07-19
JP3753580B2 true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6939898B2 (en) * 2017-12-01 2021-09-22 日本電信電話株式会社 Bit assignment estimation device, bit assignment estimation method, program
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
JP2001196937A (en) 2001-07-19

Similar Documents

Publication Publication Date Title
US5363099A (en) Method and apparatus for entropy coding
US5045852A (en) Dynamic model selection during data compression
RU2125765C1 (en) Symbol compression method and device, statistical coder (options)
US7365658B2 (en) Method and apparatus for lossless run-length data encoding
JP2766302B2 (en) Variable length code parallel decoding method and apparatus
US6351569B1 (en) Coding method, decoding method, coding device and decoding device
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
JPH05241777A (en) Data compression system
JP3872217B2 (en) Dither image binary expression processing method, dither image compression binary expression decompression method, and dither image compression and decompression system
JP3753580B2 (en) Data encoding method, data decoding method, and computer-readable recording medium recording a program for causing a computer to execute the method
JP4009808B2 (en) Image processing device
JP3842914B2 (en) Data encoding method / decoding method, data encoding device / decoding device, and image data recording system using the data encoding method / decoding method
JP3676078B2 (en) Run-length encoding method and compression apparatus
JP3124887B2 (en) Data compression / decoding method
JP2612343B2 (en) Data compression method
JPH0723238A (en) Picture data compression and decoding device
JP2966437B2 (en) Run length code encoder
JP3083329B2 (en) Data compression / decompression method
JPH0629861A (en) Data compression method
JP2615215B2 (en) Image data compression method
Cena et al. A Q-Coder algorithm with carry free addition
JP3084187B2 (en) Binary image encoding device and binary image decoding device
JP3132836B2 (en) Image data compression / decompression method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 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