JP4109875B2 - Image encoding apparatus, image encoding method, program, and storage medium - Google Patents

Image encoding apparatus, image encoding method, program, and storage medium Download PDF

Info

Publication number
JP4109875B2
JP4109875B2 JP2002046434A JP2002046434A JP4109875B2 JP 4109875 B2 JP4109875 B2 JP 4109875B2 JP 2002046434 A JP2002046434 A JP 2002046434A JP 2002046434 A JP2002046434 A JP 2002046434A JP 4109875 B2 JP4109875 B2 JP 4109875B2
Authority
JP
Japan
Prior art keywords
encoding
pixel
command
data
copy
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
JP2002046434A
Other languages
Japanese (ja)
Other versions
JP2003250053A (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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2002046434A priority Critical patent/JP4109875B2/en
Priority to EP02258367.8A priority patent/EP1318665B1/en
Priority to CNB02155529XA priority patent/CN100397866C/en
Priority to CN 200810097396 priority patent/CN101282406B/en
Priority to CN 200810094578 priority patent/CN101282405B/en
Priority to CN2008100973975A priority patent/CN101282407B/en
Priority to US10/310,812 priority patent/US7245396B2/en
Publication of JP2003250053A publication Critical patent/JP2003250053A/en
Application granted granted Critical
Publication of JP4109875B2 publication Critical patent/JP4109875B2/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)

Description

【0001】
【発明の属する技術分野】
本発明は、画像を符号化する画像符号化装置、符号コマンドからなる符号データに基づいて画像を復号する画像復号装置、画像符号化号方法、画像復号方法、プログラム、記憶媒体に関するものである。
【0002】
【従来の技術】
従来、画像データを圧縮する際に、水平方向および垂直方向に同一の画素値を持つ画素が連続する傾向が高いことを利用して、注目位置との相関が高い、直左または直上の位置を参照して符号化を行うことが一般的であった。
【0003】
また、圧縮しようとする画像データがディザマトリクスによる減色処理を施した画像データである場合には、減色処理を施す際に隣接した画素には異なった演算が適用されるため、近隣の画素よりもむしろ減色処理に使用したディザマトリクスの周期だけ離れた画素との相関が高い。したがってこのような場合、減色処理に使用したディザマトリックスの周期が既知である場合には、注目位置からディザマトリクスの周期だけ離れた、左または上の位置を参照して符号化を行うという方法がある。
【0004】
【発明が解決しようとする課題】
しかしながら、上記方法によれば、画像データの周期とディザマトリクスの周期が異なる場合に、注目位置と参照位置の相関があまり高くないために、効率よく圧縮を行うことができないという欠点を有する。例えば、圧縮しようとする画像データが、解像度が異なる原画像に解像度変換を施した後に減色処理を施した画像データであるような場合に、このような問題が発生することがある。
【0005】
本発明は以上問題に鑑みて成されたものであり、画像を効率よく、特に短い符号で符号化することを目的とする。
【0006】
【課題を解決するための手段】
本発明の目的を達成するために、例えば本発明の画像符号化装置は以下の構成を備える。
【0007】
すなわち、画像に対して、n行m列のマトリクスを用いて擬似中間調処理を施す擬似中間調処理手段と、
前記擬似中間調処理が施された画像における符号化対象画素から行方向に距離n×a(a>0)だけ離れた第1参照画素と、前記符号化対象画素から列方向に距離m×b(b>0)離れた第2参照画素とを、設定された参照順位に従って参照する参照手段と、
前記参照手段が参照している参照画素が、前記符号化対象画素を符号化するのに有効である場合には、当該参照画素を用いて前記符号化対象画素を符号化する符号化手段とを備え、
前記参照順位は、前記第1参照画素と前記第2参照画素のうち前記符号化対象画素との位置関係が、前記符号化対象画素の直前に符号化された前画素と当該前画素の符号化時に前記符号化手段が用いた参照画素との位置関係を満たす参照画素から参照するように設定されることを特徴とする。
【0010】
本発明の目的を達成するために、例えば本発明の画像符号化方法は以下の構成を備える。
【0011】
すなわち、画像に対して、n行m列のマトリクスを用いて擬似中間調処理を施す擬似中間調処理工程と、
前記擬似中間調処理が施された画像における符号化対象画素から行方向に距離n×a(a>0)だけ離れた第1参照画素と、前記符号化対象画素から列方向に距離m×b(b>0)離れた第2参照画素とを、設定された参照順位に従って参照する参照工程と、
前記参照工程で参照している参照画素が、前記符号化対象画素を符号化するのに有効である場合には、当該参照画素を用いて前記符号化対象画素を符号化する符号化工程とを備え、
前記参照順位は、前記第1参照画素と前記第2参照画素のうち前記符号化対象画素との位置関係が、前記符号化対象画素の直前に符号化された前画素と当該前画素の符号化時に前記符号化手段が用いた参照画素との位置関係を満たす参照画素から参照するように設定されることを特徴とする。
【0014】
【発明の実施の形態】
以下添付図面を参照して、本発明を好適な実施形態に従って詳細に説明する。
【0015】
[第1の実施形態]
図1は本実施形態における画像符号化装置として機能するコンピュータ1内の各ソフトウェア群とプリンタ6との関係を示す図である。
【0016】
図中、1はコンピュータであり図10に示す基本構成を備える。図10はコンピュータ1の基本構成を示すブロック図である。図10において1101はCPUで、RAM1102やROM1103内に格納されたプログラムやデータを用いて本装置全体の制御を行うと共に、後述の画像符号化処理やプリンタに対してプリントコマンドを出力する出力制御処理などを行う。1102はRAMで、外部記憶装置1104や記憶媒体ドライブ1109からロードされたプログラムやデータを一時的に記憶するエリアを備えると共に、CPU101が各種の処理を実行する際に用いるワークエリアも備える。1103はROMで、本装置全体の制御を行うプログラムや設定データ等を格納する。
【0017】
1104はハードディスクなどの外部記憶装置で、下記のソフトウェア群や符号化対象のデータをファイルとして保存することができる。1105、1106は夫々キーボード、マウスで、ポインティングデバイスとして各種の指示を本装置に対して入力することができる。1107は表示装置で、CRTや液晶画面などにより構成されており、符号化対象のデータやアプリケーションのGUIなどを表示することができる。1108は画像入力装置で、スキャナやディジタルカメラなど、画像を本装置に対してディジタルデータとして入力することができる装置により構成されており、入力した画像はファイルとして外部記憶装置1104やRAM1102に出力される。
【0018】
1109は記憶媒体ドライブで、CD−ROMやDVD−ROMなどの記憶媒体からプログラムやデータなどを読み込んで外部記憶装置1104に出力する。なお、下記のソフトウェア群や符号化対象のデータを上記記憶媒体に記憶しておき、記憶媒体ドライブ1109からこれらを本装置に供給しても良い。1110はI/F(インターフェース)でLANやインターネットに接続するための、USBやパラレルポートなどにより構成されており、本実施形態では後述のプリンタ6と接続するためにパラレルポートとするが、これに限定されるものではない。1111は上述の各部を繋ぐバスである。
【0019】
図1に戻って、2はオペレーティングシステムであり、コンピュータ1が備えるハードウェア、およびアプリケーション3、プリンタドライバ4、ポートドライバ5などのソフトウェアを管理する。アプリケーション3は、例えばワードプロセッサのようなアプリケーションソフトウェアであり、操作者の指示に従って文書の作成・印刷などを行う。4はプリンタドライバであり、アプリケーション3が発行した印刷指令をオペレーティングシステム2を経て受け取り、該印刷指令をプリンタ6が解釈可能なプリンタコマンドに変換する。5はポートドライバであり、プリンタドライバ4が変換したプリンタコマンドをオペレーティングシステム2を経て受け取り、パラレルポートを経由してプリンタ6に送信する。
【0020】
上記オペレーティングシステム2、アプリケーション3、プリンタドライバ4、ポートドライバ5などのソフトウェア群は上述の通り、外部記憶装置1104に保存されている。6はプリンタであり、ポートドライバ5から受信したプリンタコマンドに従って印刷を行う。
【0021】
図2は本実施形態における画像復号装置として機能するプリンタ6の基本構成を示すブロック図である。図中、11はパラレルポートであり、コンピュータ1からプリンタコマンドを受信する。12はFIFO(ファーストインファーストアウト)メモリであり、パラレルポート11が受信した符号化データを記憶し、記憶したデータを先入れ先出しの順に復号回路13に出力する。復号回路13は、FIFOメモリ12に記憶された符号列データを復号し、プリンタエンジン14に出力する。プリンタエンジン14はレーザビームプリンタエンジンであり、制御回路15の指示により、復号回路13が出力した画像データに従って印刷を行う。画像データはシアン、マゼンタ、黄、黒の各色ごとに面順次で出力される。15は制御回路であり、例えば1チップCPUで構成され、パラレルポート11、FIFOメモリ12、復号回路13、およびプリンタエンジン14の制御を行う。
【0022】
以下、印刷動作について説明する。
【0023】
操作者がコンピュータ1側でキーボード1105やマウス1106を用いてアプリケーション3を操作して印刷データを生成し、これを印刷指示すると、アプリケーション3からオペレーティングシステム2を経由してプリンタドライバ4に印刷指令が渡される。プリンタドライバ4はアプリケーション3から発行された印刷指令に基づき、赤、緑、青の3色からなるRGB画像データを作成し、次いでRGB画像データを、シアン、マゼンタ、黄、黒の4色からなるCMYK画像データに変換する。この際同時に所定のディザマトリクスを使用して減色処理を行う。そして、プリンタドライバ3は、後述する符号化手順に基づき、作成した画像データから符号化データを生成し、用紙サイズ、ビットマップデータのラインの長さとライン数などを指定する印刷制御コマンドとともに出力する。ポートドライバ5は、プリンタドライバ3が作成した、印刷制御コマンドおよび符号化データからなる一連のプリンタコマンドを、プリンタ6に送信する。
【0024】
制御回路15はパラレルポート11を経由してプリンタコマンドを受信する。受信したプリンタコマンドが印刷制御コマンドであれば、印刷制御のために制御回路15の内部に保持する。また、受信したプリンタコマンドが符号化データであった場合は、FIFOメモリ12に格納する。その後、ページ終了コマンドの受信などにより、1ページを構成するプリンタコマンドの受信が完了したことを検出したときに、制御回路15はプリンタエンジン14に印刷の開始を指示する。
【0025】
印刷の開始が指示されると、プリンタエンジン14は給紙カセットから用紙を給紙し、用紙が所定の位置に到達したときに、復号回路13に画像データの出力を要求する。復号回路13は、あらかじめFIFOメモリ12から符号化データを読み出し、復号した画像データを内部のバッファに保持しておき、プリンタエンジン14から画像データの出力を要求されたときに、内部のバッファに保持していた画像データを出力する。復号回路13は、画像データを保持していたバッファに空きができたときに、FIFOメモリ12から引き続く符号化データを読み出し、復号して内部のバッファに保持する。このようにして符号化データは順次復号されて画像データとして出力され、1ページの画像データの出力が全て終了すると、印刷が完了する。
【0026】
次に、図3および図4に示すテーブルを参照し、図1に示したプリンタドライバ3が生成する符号について説明する。
【0027】
図3は、図1に示したプリンタドライバ3が生成する符号化テーブルの一例を示す図である。本実施形態で説明する符号は、ビット単位で可変長であり、例えば2ビットから18ビットまでのビット列で表現される。各符号は、ハフマン符号と同様に、先頭から順に調べることにより符号を識別することができるように構成されている。
【0028】
なお、本実施形態では符号化の際に2箇所の左参照位置、および2箇所の上参照位置を参照するものとし、減色処理の際に使用されたディザマトリクスの特性に合わせ、例えば左参照位置は、注目位置の1バイト左、および4バイト左の位置が、また上参照位置は注目位置の4ライン上、および2ライン上かつ2バイト左の位置に決められている。
【0029】
図3に示すように、符号のビット列が「1」で開始する場合はCOPY UP1コマンドである。このコマンドは後述する長さを示す符号が後続し、あらかじめ決定された高順位の上参照位置から、後続する符号が示す長さのバイト列を複写することを指示する。
【0030】
また、符号のビット列が「011」で開始する場合は、COPY UP2コマンドである。このコマンドは後述する長さを示す符号が後続し、あらかじめ決定された低順位の上参照位置から、後続する符号が示す長さのバイト列を複写し、かつ高順位の上参照位置と低順位の上参照位置とを入れ替えることを指示する。
【0031】
また、符号のビット列が「001」で開始する場合はRAWコマンドである。このコマンドは生データを示す8ビットデータが後続し、後続する8ビットのデータの値を持つ1バイトのデータを指定する。
【0032】
また、符号のビット列が「010」で開始する場合はCOPY LEFT1コマンドである。このコマンドは後述する長さを示す符号が後続し、あらかじめ決定された高順位の左参照位置位置から、後続する符号が示す長さのバイト列を複写することを指示する。
【0033】
また、符号のビット列が「0001」で開始する場合はCOPY LEFT2コマンドである。このコマンドは後述する長さを示す符号が後続し、あらかじめ決定された低順位の左参照位置位置から、後続する符号が示す長さのバイト列を複写し、かつ高順位の左参照位置と低順位の左参照位置とを入れ替えることを指示する。
【0034】
また、符号のビット列が「0000」の場合はEOBコマンドであり、符号ブロックの終了を指示する。
【0035】
低順位の参照位置にてデータが一致した場合には、以後もその参照位置にてデータが一致する可能性が高い。したがって低順位の参照位置を識別するより長い符号を出力した際には、該参照位置の順位を上げて以後より短い符号により識別されるようにすれば、その後該参照位置にてデータが一致した場合に出力する符号の長さは短くなる。よって、COPY UP2コマンド、COPY LEFT2コマンドを実行することで、高順位の参照位置と低順位の参照位置とを入れ替え、今後出力する符号の長さが短くなる。
【0036】
図4は図3に示したCOPY UP1コマンド、COPY UP2コマンド、COPY LEFT1コマンドあるいはCOPY LEFT2コマンドに後続する、長さを示す符号の符号化テーブルの一例である。
【0037】
図4に示すように、符号のビット列が「1」である場合は1バイトの長さを指示する。
【0038】
また、符号のビット列が「01」で開始する場合は1ビットのデータが後続し、後続する1ビットのデータに2を加えた長さ、すなわち2バイトまたは3バイトの長さを指示する。
【0039】
また、符号のビット列が「001」で開始する場合は2ビットのデータが後続し、後続する2ビットのデータに4を加えた長さ、すなわち4バイトから7バイトまでの長さを指示する。
【0040】
また、符号のビット列が「0001」で開始する場合は3ビットのデータが後続し、後続する3ビットのデータに8を加えた長さ、すなわち8バイトから15バイトまでの長さを指示する。
【0041】
また、符号のビット列が「00001」で開始する場合は4ビットのデータが後続し、後続する4ビットのデータに16を加えた長さ、すなわち16バイトから31バイトまでの長さを指示する。
【0042】
また、符号のビット列が「000001」で開始する場合は5ビットのデータが後続し、後続する5ビットのデータに32を加えた長さ、すなわち32バイトから63バイトまでの長さを指示する。
【0043】
また、符号のビット列が「0000001」で開始する場合は6ビットのデータが後続し、後続する6ビットのデータに64を加えた長さ、すなわち64バイトから127バイトまでの長さを指示する。
【0044】
また、符号のビット列が「0000000」で開始する場合は7ビットのデータが後続し、後続する7ビットのデータに128を加えた長さ、すなわち128バイトから255バイトまでの長さを指示する。
【0045】
なお、これらの符号は、あらかじめ多数の画像データで各コマンドの出現頻度を求めておき、ハフマン符号と同様に、出現頻度の高いコマンドに短い符号を、出現頻度の低いコマンドに比較的長い符号を割り当てることにより圧縮率を高くすることができる。
【0046】
次に図5(a)、(b)を参照し、符号化処理について実例を挙げて説明する。図5(a)は符号化対象の画像データを示し、図5(b)は符号化されたデータを示す図である。図5(a)に示すように、最下行には10バイトの画像データ(注目データ)00、00、12、34、56、78、00、BC、DE、00が左から並んでおり、その2行上には画像データ12、34、56、78、9A、BC、DE、00、00、00(参照データ)が左から並んでいる。現在符号化あるいは復号しようとしている画像データは最下行であり、またこの時点で高順位の左参照位置は1バイト左の位置に(つまり低順位の左参照位置は4バイト左の位置に)、低順位の上参照位置は2ライン上かつ2バイト左の位置に(つまり高順位の上参照位置は4ライン上の位置に)なっているものとする。
【0047】
ここで最下行の先頭バイト00は、ビット列001 00000000、すなわち生データ00を示すRAWコマンドに符号化することができる。
【0048】
また、次のバイト00は、ビット列010 1、すなわち1バイトの長さを高順位の左参照位置、すなわち1バイト左の位置から複写するCOPY LEFT1コマンドに符号化することができる。
【0049】
また、その次のバイト列12、34、56、78はビット列011 001 00、すなわち4バイトの長さを低順位の上参照位置、すなわち2ライン上かつ2バイト左の位置から複写するCOPY UP2コマンドに符号化することができる。この結果、上参照位置の順位が入れ替わり、以後のCOPY UP1コマンドは低順位から高順位となった2ライン上かつ2バイト左の位置を、またCOPY UP2コマンドは高順位から低順位となった4ライン上の位置をそれぞれ参照する。
【0050】
その次のバイト00は再び、ビット列001 00000000、すなわち生データ00を示すRAWコマンドに符号化することができる。
【0051】
また、その次のバイト列BC、DE、00はビット列1 01 1、すなわち3バイトの長さを高順位の上参照位置、すなわち2ライン上かつ2バイト左の位置から複写するCOPY UP1コマンドに符号化することができる。
【0052】
以上のようにして、画像データを符号化することができる。次に、図6に示すフローチャートを参照し、プリンタドライバ4の処理の詳細を説明する。図6はプリンタドライバ4が行う処理のフローチャートである。このフローチャートに従ったプログラムはプリンタドライバ4として上述のとおり外部記憶装置1104、もしくは記憶媒体に格納されており、CPU101により(記憶媒体の場合、記憶媒体ドライブ1109により)RAM1102に読み出され実行される。
【0053】
プリンタドライバ4がオペレーティングシステム2から呼び出されると、まずステップS5にて呼び出しの種類が描画指令であるか否かを判定する。呼び出しの種類が描画指令であった場合は、ステップS6にて描画処理を行い、処理を終了する。具体的には、オペレーティングシステム2を経由してアプリケーション3から指示された、文字、図形またはビットマップ等を赤、緑、青の3色を用いた各色8ビットの画像に変換し、RAM1102に記録する。
【0054】
ステップS5にて呼び出しの種類が描画指令でなかった場合は、ステップS7にて呼び出しの種類がページ終了指令であるか否かを判定する。呼び出しの種類がページ終了指令であった場合には、ステップS8にて色変換処理を行う。具体的にはステップS6にてRAM1102に記録された赤、緑、青の3色を用いた各色8ビットの画像を、所定のディザマトリックスを使用して、シアン、マゼンタ、黄、黒の4色からなるたとえば各色4ビットの画像に変換する。変換後の画像もRAM1102に記憶しておく。
【0055】
次にステップS9にて、印刷条件指定コマンド、具体的には用紙サイズ、給紙カセット、解像度、階調数、1ラインのバイト数、1ページのライン数など印刷に必要な条件を指定するコマンドを出力する。
【0056】
次にステップS10からステップS14までの各処理を、シアン、マゼンタ、黄、黒の各色に対して行い、各色毎の画像データコマンドを出力する。まずステップS10にて、ステップS8にて使用したディザマトリックスに応じた圧縮パラメタ、すなわち符号化時に使用する、COPY UPコマンドおよびCOPYLEFTコマンドが参照する位置(高順位の上参照位置、低順位の上参照位置、高順位の左参照位置、低順位の左参照位置)を出力する。次にステップS11にて、後述する符号化手順に従い、画像データを符号化する。このときに、ステップS10にて出力した圧縮パラメタが指定する、COPY UPコマンドおよびCOPY LEFTコマンドが参照する位置を用いて符号化を行う。詳細は後述する。
【0057】
次にステップS12にて、ステップS11で符号化された画像データのサイズおよびライン数を指定する画像データコマンドヘッダを出力する。次にステップS13にて、ステップS11で符号化された画像データを出力する。次にステップS14にて、シアン、マゼンタ、黄、黒の各プレーンの処理が全て終了したか否かを判定する。シアン、マゼンタ、黄、黒の各プレーンの処理が全て終了していない場合はステップS10に戻り、色を変えて次のプレーンの処理を行う。こうしてシアン、マゼンタ、黄、黒の各プレーンの処理が全て終了すると、ステップS14からステップS15に進み、ページの終了を指定する改ページコマンドを出力して処理を終了する。
【0058】
ステップS7にて呼び出しの種類がページ終了指令でなかった場合には、ステップS16にて、呼び出しの種類に応じたその他の処理、例えばページ開始指令あるいはプリンタ能力問い合わせ指令等に対応する処理を行い、終了する。
【0059】
次に、上記ステップS11における符号化処理について、同処理のフローチャートを示す図7を参照して説明する。このフローチャートに従ったプログラムは上記フローチャートのサブルーチンとしてプリンタドライバ4に組み込まれている。
【0060】
まずステップS19にて、高順位の上参照位置、低順位の上参照位置、高順位の左参照位置および低順位の左参照位置をそれぞれ所定の初期値、すなわち、上記ステップS10で求めた圧縮パラメタに従って設定する。次にステップS20にて、現在の位置、すなわち符号化する画像の位置を画像の先頭行左端に設定する。
【0061】
次にステップS21にて、現在の位置に対応する高順位の上参照位置が有効な画像データを参照しているか否かを判定する。高順位の上参照位置が有効な画像データを参照している場合には、ステップS22にて、高順位の上参照位置と一致する長さを、現在の位置から始まるバイト列と、高順位の上参照位置から始まるバイト列を比較することにより求める。なおこの際に、行末に達した場合および長さが255バイトに達した場合には処理を打ち切るものとする。次にステップS23にて、ステップS22にて求めた、高順位の上参照位置と一致する長さが0であるか否かを判定する。0でない場合にはCOPY UP1コマンドに符号化できるので、ステップS24にてCOPY UP1コマンド、すなわち符号1とそれに後続するバイト数(ステップS22で求めた長さ)を示す符号を出力し、処理をステップS40に進める。
【0062】
一方、ステップS21にて高順位の上参照位置が無効であると判定された場合、ステップS23にて、ステップS22で求めた、高順位の上参照位置と一致する長さが0であると判定された場合は、いずれもステップS25にて、現在の位置に対応する高順位の左参照位置が有効な画像データを参照しているか否かを判定する。高順位の左参照位置が有効な画像データを参照している場合には、ステップS26にて、高順位の左参照位置と一致する長さを、現在の位置から始まるバイト列と、高順位の左参照位置から始まるバイト列を比較することにより求める。なおこの際に、行末に達した場合および長さが255バイトに達した場合には処理を打ち切るものとする。次にステップS27にて、ステップS26で求めた、高順位の左参照位置と一致する長さが0であるか否かを判定する。0でない場合にはCOPY LEFT1コマンドに符号化できるので、ステップS28にてCOPY LEFT1コマンド、すなわち符号010とそれに後続するバイト数(ステップS26で求めた長さ)を示す符号を出力し、処理をステップS40に進める。
【0063】
ステップS25にて高順位の左参照位置が無効であると判定された場合、ステップS27にて、ステップS26で求めた、高順位の左参照位置と一致する長さが0であると判定された場合は、いずれもステップS29にて、現在の位置に対応する低順位の上参照位置が有効な画像データを参照しているか否かを判定する。低順位の上参照位置が有効な画像データを参照している場合には、ステップS30にて、低順位の上参照位置と一致する長さを、現在の位置から始まるバイト列と、低順位の上参照位置から始まるバイト列を比較することにより求める。なおこの際に、行末に達した場合および長さが255バイトに達した場合には処理を打ち切るものとする。次にステップS31にて、ステップS30で求めた、低順位の上参照位置と一致する長さが0であるか否かを判定する。0でない場合にはCOPY UP2コマンドに符号化できる場合ので、ステップS32にてCOPY UP2コマンド、すなわち符号011とそれに後続するバイト数(ステップS30で求めた長さ)を示す符号を出力し、次にステップS33にて高順位の上参照位置と低順位の上参照位置を入れ替え、処理をステップS40に進める。
【0064】
ステップS29にて低順位の上参照位置が無効であると判定された場合、およびステップS31にて、ステップS30で求めた、低順位の上参照位置と一致する長さが0であると判定された場合は、いずれもステップS34にて、現在の位置に対応する低順位の左参照位置が有効な画像データを参照しているか否かを判定する。低順位の左参照位置が有効な画像データを参照している場合には、ステップS35にて、低順位の左参照位置と一致する長さを、現在の位置から始まるバイト列と、低順位の左参照位置から始まるバイト列を比較することにより求める。なおこの際に、行末に達した場合および長さが255バイトに達した場合には処理を打ち切るものとする。次にステップS36にて、ステップS35で求めた、低順位の左参照位置と一致する長さが0であるか否かを判定する。0でない場合にはCOPY LEFT2コマンドに符号化できるので、ステップS37にてCOPY LEFT2コマンド、すなわち符号0001とそれに後続するバイト数(ステップS35で求めた長さ)を示す符号を出力し、次にステップS38にて高順位の左参照位置と低順位の左参照位置を入れ替え、処理をステップS40に進める。
【0065】
ステップS34にて低順位の左参照位置が無効であると判定された場合、およびステップS36にて、ステップS35で求めた、低順位の左参照位置と一致する長さが0であると判定された場合は、いずれもステップS39にて、RAWコマンド、すなわち符号001とそれに後続する現在の位置の1バイトのデータを出力し、処理をステップS40に進める。
【0066】
ステップS40では、COPY UP1、COPY UP2、COPY LEFT1、COPY LEFT2あるいはRAWコマンドで処理されたバイト数だけ現在の位置を進める。次にステップS41にて、全ての画像データを処理したか否かを判定する。全ての画像データを処理していない場合はステップS21に戻り、符号化を続ける。全ての画像データを処理し終えた場合は、ステップS42にてEOBコマンド、すなわち符号0000を出力し、次にステップS43にて符号をバイト境界に整列する。具体的には、出力した符号の総ビット数が8の整数倍でない場合に、8の整数倍に達するまでビット0を出力する。このようにして符号化の処理が終了すると復帰する。
【0067】
次に図2に示した復号回路13の構成を示す図8を用いて、同回路の詳細について説明する。図8は、図2に示した復号回路13の基本構成を示すブロック図である。
【0068】
図8において、入力バッファ21は、FIFOメモリ12から読み出した符号データを格納する。入力バッファ21は、少なくとも4バイトのデータを格納することができ、バッファに空きが生じ、かつFIFOメモリ12にデータがある場合はFIFOメモリ12からデータを読み出して格納する。入力バッファ21はまた、ビットカウンタ23に保持された、処理済ビット数が8以上になった場合には、不要になった処理済データを破棄する。
【0069】
第一のセレクタ22は、例えば18組の8入力セレクタであり、入力バッファ21に格納された符号データを、ビットカウンタ23が示す処理済ビット数に従って選択することにより、コマンドデコード回路24が処理するために必要な、コマンドの開始位置合わせを行う。これは、入力バッファ21がバイト単位にデータを保持するのに対し、コマンドはビット単位の可変長データであるため8箇所の開始位置があるために必要なものである。
【0070】
ビットカウンタ23は、入力バッファ21に格納された符号データのうち処理済みのビット数を格納する。ビットカウンタ23はまた、コマンドデコード回路24から出力された、コマンドのビット数を加算することによりビットカウンタに格納された値を更新する。ビットカウンタ23はまた、入力バッファが処理済データを破棄した場合には、破棄したビット数を減算する。ビットカウンタ23はまた、コマンドデコード回路24がEOBコマンドを復号したときに、コマンドデコード回路24からEOB信号を受信し、バイト境界合わせの処理を行う。具体的には、ビットカウンタの下位3ビットが全て0であれば何もせず、そうでなければ8を加算するとともに下位3ビットをクリアする。
【0071】
コマンドデコード回路24は、例えばリードオンリーメモリ、あるいはワイヤードロジックにより構成され、第一のセレクタ22によって位置合わせが行われた、入力バッファ21に格納された符号データを復号し、復号したコマンドがEOBコマンドの場合はビットカウンタ23、上優先FF29および左優先FF30に、復号したコマンドがCOPY UP1コマンドまたはCOPY UP2コマンドの場合は第二のセレクタ25および第三のセレクタ26に、復号したコマンドがCOPY LEFT1コマンドまたはCOPY LEFT2コマンドの場合は第四のセレクタ27および第五のセレクタ28に、復号したコマンドがRAWコマンドの場合は生データ出力回路36にそれぞれ信号を出力する。コマンドデコード回路24はまた、COPY UP1、COPY UP2、COPY LEFT1またはCOPY LEFT2コマンドを復号した場合は符号が示すバイト数をも復号し出力するとともに、RAWコマンドを復号した場合には符号が示す8ビットデータをも復号して出力する。
【0072】
25は第二のセレクタであり、上優先FF29が0を保持する場合には、コマンドデコード回路24がCOPY UP1コマンドを復号したときに出力する信号を、また上優先FF29が1を保持する場合には、コマンドデコード回路24がCOPY UP2コマンドを復号したときに出力する信号を出力する。
【0073】
26は第三のセレクタであり、上優先FF29が0を保持する場合には、コマンドデコード回路24がCOPY UP2コマンドを復号したときに出力する信号を、また上優先FF29が1を保持する場合には、コマンドデコード回路24がCOPY UP1コマンドを復号したときに出力する信号を出力する。
【0074】
27は第四のセレクタであり、左優先FF30が0を保持する場合には、コマンドデコード回路24がCOPY LEFT1コマンドを復号したときに出力する信号を、また左優先FF30が1を保持する場合には、コマンドデコード回路24がCOPY LEFT2コマンドを復号したときに出力する信号を出力する。
【0075】
28は第五のセレクタであり、左優先FF30が0を保持する場合には、コマンドデコード回路24がCOPY LEFT2コマンドを復号したことを示す信号を、また左優先FF30が1を保持する場合には、コマンドデコード回路24がCOPY LEFT1コマンドを復号したことを示す信号を出力する。
【0076】
29は上優先FFであり、第一の上複写回路31あるいは第二の上複写回路32のいずれが優先されているかを示す値を保持する。上優先FF29はまた、コマンドデコード回路24がCOPY UP2コマンドを復号したときに、保持している値を反転する。
【0077】
30は左優先FFであり、第一の左複写回路33あるいは第二の左複写回路34のいずれが優先されているかを示す値を保持する。左優先FF30はまた、コマンドデコード回路24がCOPY LEFT2コマンドを復号したときに、保持している値を反転する。
【0078】
31は第一の上複写回路であり、第二のセレクタ25から信号を受信したときに、複写すべきバイト数をあわせて受信し、受信したバイト数に応じて、ラインバッファ35からデータを読み取り、読み取ったデータを出力することを繰り返す。
【0079】
32は第二の上複写回路であり、第三のセレクタ26から信号を受信したときに、複写すべきバイト数をあわせて受信し、受信したバイト数に応じて、ラインバッファ35からデータを読み取り、読み取ったデータを出力することを繰り返す。
【0080】
33は第一の左複写回路であり、第四のセレクタ27から信号を受信したときに、複写すべきバイト数をあわせて受信し、受信したバイト数に応じて、ラインバッファ35からデータを読み取り、読み取ったデータを出力することを繰り返す。
【0081】
34は第二の左複写回路であり、第五のセレクタ28から信号を受信したときに、複写すべきバイト数をあわせて受信し、受信したバイト数に応じて、ラインバッファ35からデータを読み取り、読み取ったデータを出力することを繰り返す。
【0082】
35はラインバッファであり、複数のラインの復号データを保持するリングメモリとして動作し、第一の上複写回路31、第二の上複写回路32、第一の左複写回路33または第二の左複写回路34が出力するアドレスに格納されたデータを出力するとともに、現在アドレスレジスタ37が出力するアドレスに、復号されたデータを格納する。
【0083】
36は生データ出力回路であり、コマンドデコード回路24がRAWコマンドを復号したときに同時に出力される生データを示す8ビットのデータを受信し、受信したデータを出力する。
【0084】
37は現在アドレスレジスタであり、現在復号しようとしているデータの位置を示すアドレスを出力するとともに、復号されたデータがラインバッファ35に格納される毎にカウントアップされる。
【0085】
また、第一の上複写回路31、第二の上複写回路32、第一の左複写回路33および第二の左複写回路34には、第一の上複写位置、第二の上複写位置、第一の左複写位置および第二の左複写位置をそれぞれ示すアドレスが保持されており、現在アドレスレジスタ37がカウントアップされる毎に同様にカウントアップされる。
【0086】
コマンドデコード回路24がCOPY UP1コマンドをデコードすると、引き続くカウントをデコードし、第二のセレクタ25および第三のセレクタ26に信号を出力する。そして上優先FF29が保持する値にしたがって、第二のセレクタ25または第三のセレクタ26のいずれか一方から信号が出力され、その信号にしたがって第一の上複写回路31または第二の上複写回路32のいずれか一方が動作する。
【0087】
例えば上優先FF29が保持する値が0である場合、COPY UP1コマンドがデコードされたときに第二のセレクタ25は信号を第一の上複写回路31に出力し、第三のセレクタ26は信号を出力しない。第一の上複写回路31は、内部に保持する第一の上複写位置を示すアドレスをラインバッファ35に出力し、ラインバッファ35に格納された第一の上複写位置のデータを読み込み、読み込んだデータを復号データとしてプリンタエンジン14に出力する。現在アドレスレジスタ37は現在位置を示すアドレスを出力し、ラインバッファ35はそのアドレスに復号データを格納する。次に第一の上複写回路31、第二の上複写回路32、第一の左複写回路33および第二の左複写回路34の内部にそれぞれ保持される、第一の上複写位置を示すアドレス、第二の上複写位置を示すアドレス、第一の左複写位置を示すアドレスおよび第二の左複写位置を示すアドレス、および現在アドレスレジスタ37が保持する現在位置を示すアドレスがカウントアップされる。この動作が指定されたバイト数繰り返される。
【0088】
コマンドデコード回路24がCOPY UP2コマンドをデコードすると、引き続くカウントをデコードし、第二のセレクタ25および第三のセレクタ26に信号を出力する。そして上優先FF29が保持する値にしたがって、第二のセレクタ25または第三のセレクタ26のいずれか一方から信号が出力され、その信号に従って第一の上複写回路31または第二の上複写回路32のいずれか一方が動作する。
【0089】
例えば上優先FF29が保持する値が0である場合、COPY UP2コマンドがデコードされたときに第三のセレクタ26は信号を第二の上複写回路32に出力し、第二のセレクタ25は信号を出力しない。第二の上複写回路32は、上述の第一の上複写回路31の動作と同様に動作するが、上優先FF29は保持する値が反転して1となるため、以後のCOPY UP1コマンドは第二の上参照位置に、またCOPY UP2コマンドは第一の上参照位置に、それぞれ対応するようになる。
【0090】
コマンドデコード回路24がCOPY LEFT1コマンドおよびCOPY LEFT2コマンドをデコードした場合も、上述のCOPY UP1コマンドおよびCOPY UP2コマンドの動作と同様に動作する。
【0091】
コマンドデコード回路24がRAWコマンドをデコードすると、引き続く8ビットデータをデコードし、生データ出力回路36に信号を出力する。生データ出力回路36は、受信した8ビットデータをそのまま復号データとしてプリンタエンジン14に出力する。現在アドレスレジスタ37は現在位置を示すアドレスを出力し、ラインバッファ35はそのアドレスに復号データを格納する。次に第一の上複写回路31、第二の上複写回路32、第一の左複写回路33および第二の左複写回路34の内部にそれぞれ保持される、第一の上複写位置を示すアドレス、第二の上複写位置を示すアドレス、第一の左複写位置を示すアドレスおよび第二の左複写位置を示すアドレス、 および現在アドレスレジスタ37が保持する現在位置を示すアドレスがカウントアップされる。
【0092】
コマンドデコード回路24がEOBコマンドをデコードすると、ビットカウンタ23は前述のごとくバイト境界合わせの処理を行うとともに、上優先FF29および左優先FF30は初期値、例えば0に初期化される。
【0093】
なお、第一の上複写回路31、第二の上複写回路32、第一の左複写回路33および第二の左複写回路34の内部にそれぞれ保持される、第一の上複写位置を示すアドレス、第二の上複写位置を示すアドレス、第一の左複写位置を示すアドレスおよび第二の左複写位置を示すアドレス、および現在アドレスレジスタ37が保持する現在位置を示すアドレスには、あらかじめ制御回路15により、圧縮パラメタ指定コマンドによって指定された位置に基づいた初期値が設定されているものとする。
【0094】
また、ラインバッファ35はリングメモリとして動作するため、第一の上複写回路31、第二の上複写回路32、第一の左複写回路33および第二の左複写回路34の内部にそれぞれ保持される、第一の上複写位置を示すアドレス、第二の上複写位置を示すアドレス、第一の左複写位置を示すアドレスおよび第二の左複写位置を示すアドレス、 または現在アドレスレジスタ37が保持する現在位置を示すアドレスがラインバッファ35の末尾のアドレスである場合には、カウントアップの際にラップアラウンドしてラインバッファ35の先頭のアドレスが格納されるものとする。
【0095】
以上の説明により、本実施形態における画像符号化装置、画像復号装置によって、より長い符号に符号化される参照位置が参照された場合に、参照位置と符号の対応を入れ替えることにより、以後該参照位置が参照された際により短い符号に符号化することが出来るため、データの周期にかかわらず効率よく圧縮を行うことが出来る。
【0096】
また、画像データの周期とディザマトリクスの周期が異なる場合、注目位置の近隣でかつ減色処理の際に注目位置にて適用される演算に近い演算が適用される位置との相関が高い傾向がある。このような位置は少数の位置に限られ、またあらかじめディザマトリクスを調べることにより、あるいはあらかじめさまざまな画像データを用いて統計を取ることにより決定することができるので、このような位置およびディザマトリクスの周期だけ離れた位置の中から参照位置として複数の位置をあらかじめ選んでおくことにより、画像データの周期にかかわらず効率的に符号化することができる。
【0097】
また、画像データの周期は広い範囲で一定である傾向がある。このため、低順位の参照位置にてデータが一致した場合には、以後もその参照位置にてデータが一致する可能性が高い。したがって低順位の参照位置を識別するより長い符号を出力した際に、該参照位置の順位を上げて以後より短い符号により識別されるようになることにより、その後該参照位置にてデータが一致した場合に出力する符号が短くなるため、順位の入れ替えを行わない場合に較べて、効率的に符号化することができる。
【0098】
[第2の実施形態]
なお、上述の実施形態では、復号をハードウェアで行っているが、これに代えて復号をソフトウェアで行うようにしてもよい。
【0099】
また上述の実施形態では、符号化の単位データサイズは1バイトであったが、これに代えて他のサイズ、例えば1画素あるいは2バイトであってもよい。
【0100】
また上述の実施形態では、2つの参照位置の優先順位を切り替えているが、これに代えて3つ以上の参照位置の優先順位を切り替えるようにしてもよい。
【0101】
[他の実施形態]
本発明の目的は、前述した実施形態の機能を実現するソフトウェアのプログラムコードを記録した記憶媒体(または記録媒体)を、システムあるいは装置に供給し、そのシステムあるいは装置のコンピュータ(またはCPUやMPU)が記憶媒体に格納されたプログラムコードを読み出し実行することによっても、達成されることは言うまでもない。この場合、記憶媒体から読み出されたプログラムコード自体が前述した実施形態の機能を実現することになり、そのプログラムコードを記憶した記憶媒体は本発明を構成することになる。また、コンピュータが読み出したプログラムコードを実行することにより、前述した実施形態の機能が実現されるだけでなく、そのプログラムコードの指示に基づき、コンピュータ上で稼働しているオペレーティングシステム(OS)などが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。
【0102】
さらに、記憶媒体から読み出されたプログラムコードが、コンピュータに挿入された機能拡張カードやコンピュータに接続された機能拡張ユニットに備わるメモリに書込まれた後、そのプログラムコードの指示に基づき、その機能拡張カードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。
【0103】
【発明の効果】
以上の説明により、本発明によって、画像を効率よく、特に短い符号で符号化することができる。
【図面の簡単な説明】
【図1】本発明の実施形態における画像符号化装置として機能するコンピュータ1内の各ソフトウェア群とプリンタ6との関係を示す図である。
【図2】本発明の実施形態における画像復号装置として機能するプリンタ6の基本構成を示すブロック図である。
【図3】図1に示したプリンタドライバ3が生成する符号化テーブルの一例を示す図である。
【図4】図3に示したCOPY UP1コマンド、COPY UP2コマンド、COPY LEFT1コマンドあるいはCOPY LEFT2コマンドに後続する、長さを示す符号の符号化テーブルの一例を示す図である。
【図5】(a)は符号化対象の画像データを示す図、(b)符号化されたデータを示す図である。
【図6】プリンタドライバ4が行う処理のフローチャートである。
【図7】ステップS11における符号化処理のフローチャートである。
【図8】図2に示した復号回路13の基本構成を示すブロック図である。
【図9】コンピュータ1の基本構成を示すブロック図である。
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image encoding device that encodes an image, an image decoding device that decodes an image based on code data including a code command, an image encoding method, an image decoding method, a program, and a storage medium.
[0002]
[Prior art]
Conventionally, when compressing image data, using the fact that pixels having the same pixel value in the horizontal direction and the vertical direction tend to be continuous, a position that has a high correlation with the position of interest, or a position immediately above or directly above. It is common to perform encoding with reference.
[0003]
In addition, when the image data to be compressed is image data that has been subjected to color reduction processing using a dither matrix, different operations are applied to adjacent pixels when performing color reduction processing. Rather, the correlation with the pixels separated by the period of the dither matrix used for the color reduction processing is high. Therefore, in such a case, when the period of the dither matrix used for the color reduction process is known, there is a method in which encoding is performed with reference to the left or upper position that is separated from the target position by the period of the dither matrix. is there.
[0004]
[Problems to be solved by the invention]
However, according to the above method, when the period of the image data is different from the period of the dither matrix, the correlation between the target position and the reference position is not so high, and thus there is a disadvantage that the compression cannot be performed efficiently. For example, such a problem may occur when the image data to be compressed is image data that has been subjected to color reduction processing after performing resolution conversion on an original image having a different resolution.
[0005]
The present invention has been made in view of the above problems, and an object of the present invention is to efficiently encode an image with a particularly short code.
[0006]
[Means for Solving the Problems]
In order to achieve the object of the present invention, for example, an image encoding apparatus of the present invention comprises the following arrangement.
[0007]
  That is,Pseudo halftone processing means for performing pseudo halftone processing on an image using a matrix of n rows and m columns;
  A first reference pixel that is separated from the encoding target pixel in the row direction by a distance n × a (a> 0) in the image subjected to the pseudo halftone process, and a distance m × b in the column direction from the encoding target pixel (B> 0) a reference means for referring to a second reference pixel separated according to a set reference order;
  When the reference pixel referred to by the reference means is effective for encoding the encoding target pixel, the encoding means for encoding the encoding target pixel using the reference pixel; Prepared,
  The reference order is the encoding of the previous pixel and the previous pixel in which the positional relationship between the first reference pixel and the second reference pixel and the encoding target pixel is encoded immediately before the encoding target pixel. Sometimes it is set to refer from the reference pixel that satisfies the positional relationship with the reference pixel used by the encoding means.It is characterized by that.
[0010]
In order to achieve the object of the present invention, for example, an image encoding method of the present invention comprises the following arrangement.
[0011]
  That is,A pseudo halftone processing step of performing pseudo halftone processing on an image using a matrix of n rows and m columns;
  A first reference pixel that is separated from the encoding target pixel in the row direction by a distance n × a (a> 0) in the image subjected to the pseudo halftone process, and a distance m × b in the column direction from the encoding target pixel (B> 0) a reference step of referring to the separated second reference pixel according to the set reference order;
  An encoding step of encoding the encoding target pixel using the reference pixel when the reference pixel referred in the reference step is effective for encoding the encoding target pixel; Prepared,
  The reference order is the encoding of the previous pixel and the previous pixel in which the positional relationship between the first reference pixel and the second reference pixel and the encoding target pixel is encoded immediately before the encoding target pixel. Sometimes it is set to refer from the reference pixel that satisfies the positional relationship with the reference pixel used by the encoding means.It is characterized by that.
[0014]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, the present invention will be described in detail according to preferred embodiments with reference to the accompanying drawings.
[0015]
[First Embodiment]
FIG. 1 is a diagram showing the relationship between each software group in the computer 1 that functions as an image encoding apparatus and the printer 6 in this embodiment.
[0016]
In the figure, reference numeral 1 denotes a computer having the basic configuration shown in FIG. FIG. 10 is a block diagram showing the basic configuration of the computer 1. In FIG. 10, reference numeral 1101 denotes a CPU that controls the entire apparatus using programs and data stored in the RAM 1102 and ROM 1103, and performs output control processing for outputting an image encoding process and a print command to the printer, which will be described later. And so on. A RAM 1102 includes an area for temporarily storing programs and data loaded from the external storage device 1104 and the storage medium drive 1109, and also includes a work area used when the CPU 101 executes various processes. Reference numeral 1103 denotes a ROM which stores a program for controlling the entire apparatus, setting data, and the like.
[0017]
Reference numeral 1104 denotes an external storage device such as a hard disk, which can store the following software group and data to be encoded as files. Reference numerals 1105 and 1106 denote a keyboard and a mouse, respectively. Various instructions can be input to the apparatus as a pointing device. A display device 1107 includes a CRT, a liquid crystal screen, and the like, and can display data to be encoded, an application GUI, and the like. Reference numeral 1108 denotes an image input device, which is configured by a device such as a scanner or a digital camera that can input an image as digital data to this device. The input image is output as a file to the external storage device 1104 or the RAM 1102. The
[0018]
Reference numeral 1109 denotes a storage medium drive, which reads a program or data from a storage medium such as a CD-ROM or a DVD-ROM and outputs the read program or data to the external storage device 1104. Note that the following software group and data to be encoded may be stored in the storage medium and supplied from the storage medium drive 1109 to this apparatus. Reference numeral 1110 denotes a USB or parallel port for connecting to a LAN or the Internet via an I / F (interface). In this embodiment, a parallel port is used to connect to a printer 6 described later. It is not limited. Reference numeral 1111 denotes a bus connecting the above-described units.
[0019]
Returning to FIG. 1, reference numeral 2 denotes an operating system that manages hardware included in the computer 1 and software such as an application 3, a printer driver 4, and a port driver 5. The application 3 is application software such as a word processor, and creates / prints a document in accordance with an instruction from the operator. A printer driver 4 receives a print command issued by the application 3 via the operating system 2 and converts the print command into a printer command interpretable by the printer 6. A port driver 5 receives the printer command converted by the printer driver 4 via the operating system 2 and transmits it to the printer 6 via the parallel port.
[0020]
Software groups such as the operating system 2, the application 3, the printer driver 4, and the port driver 5 are stored in the external storage device 1104 as described above. Reference numeral 6 denotes a printer, which performs printing in accordance with a printer command received from the port driver 5.
[0021]
FIG. 2 is a block diagram showing a basic configuration of the printer 6 functioning as an image decoding apparatus in the present embodiment. In the figure, reference numeral 11 denotes a parallel port which receives a printer command from the computer 1. A FIFO (First In First Out) memory 12 stores the encoded data received by the parallel port 11 and outputs the stored data to the decoding circuit 13 in the order of first-in first-out. The decoding circuit 13 decodes the code string data stored in the FIFO memory 12 and outputs it to the printer engine 14. The printer engine 14 is a laser beam printer engine, and performs printing according to the image data output from the decoding circuit 13 according to an instruction from the control circuit 15. The image data is output in frame sequential order for each color of cyan, magenta, yellow, and black. Reference numeral 15 denotes a control circuit, which is composed of, for example, a one-chip CPU, and controls the parallel port 11, the FIFO memory 12, the decoding circuit 13, and the printer engine 14.
[0022]
Hereinafter, the printing operation will be described.
[0023]
When the operator operates the application 3 using the keyboard 1105 or the mouse 1106 on the computer 1 side to generate print data and instructs to print it, the print command is sent from the application 3 to the printer driver 4 via the operating system 2. Passed. The printer driver 4 creates RGB image data composed of three colors of red, green, and blue based on the print command issued from the application 3, and then the RGB image data is composed of four colors of cyan, magenta, yellow, and black. Convert to CMYK image data. At the same time, a color reduction process is performed using a predetermined dither matrix. Then, the printer driver 3 generates encoded data from the created image data based on an encoding procedure to be described later, and outputs the encoded data together with a print control command that specifies the paper size, the line length of the bitmap data, the number of lines, and the like. . The port driver 5 transmits to the printer 6 a series of printer commands created by the printer driver 3 and including print control commands and encoded data.
[0024]
The control circuit 15 receives a printer command via the parallel port 11. If the received printer command is a print control command, it is held inside the control circuit 15 for print control. If the received printer command is encoded data, it is stored in the FIFO memory 12. Thereafter, when it is detected that the reception of a printer command constituting one page is completed by receiving a page end command or the like, the control circuit 15 instructs the printer engine 14 to start printing.
[0025]
When the start of printing is instructed, the printer engine 14 feeds paper from the paper feed cassette, and requests the decoding circuit 13 to output image data when the paper reaches a predetermined position. The decoding circuit 13 reads out the encoded data from the FIFO memory 12 in advance, stores the decoded image data in an internal buffer, and stores the decoded image data in the internal buffer when the printer engine 14 is requested to output the image data. The image data that has been saved is output. The decoding circuit 13 reads the subsequent encoded data from the FIFO memory 12 when the buffer for holding the image data is empty, decodes it, and holds it in the internal buffer. In this way, the encoded data is sequentially decoded and output as image data. When all the output of one page of image data is completed, printing is completed.
[0026]
Next, the codes generated by the printer driver 3 shown in FIG. 1 will be described with reference to the tables shown in FIGS.
[0027]
FIG. 3 is a diagram illustrating an example of an encoding table generated by the printer driver 3 illustrated in FIG. The code described in the present embodiment has a variable length in units of bits, and is represented by a bit string from 2 bits to 18 bits, for example. Similar to the Huffman code, each code is configured such that the code can be identified by examining sequentially from the top.
[0028]
In the present embodiment, two left reference positions and two upper reference positions are referred to at the time of encoding. For example, the left reference position is matched with the characteristics of the dither matrix used at the time of color reduction processing. Are the positions one byte left and four bytes left of the target position, and the upper reference position is four lines above the target position, two lines, and two bytes left.
[0029]
As shown in FIG. 3, when the bit string of the code starts with “1”, it is a COPY UP1 command. This command is followed by a code indicating a length, which will be described later, and instructs to copy a byte string having a length indicated by the subsequent code from a predetermined high-order upper reference position.
[0030]
When the code bit string starts with “011”, it is a COPY UP2 command. This command is followed by a code indicating the length to be described later, and copies a byte sequence of the length indicated by the subsequent code from a predetermined low-order upper reference position. To replace the upper reference position.
[0031]
If the bit string of the code starts with “001”, it is a RAW command. This command is followed by 8-bit data indicating raw data, and designates 1-byte data having the value of the subsequent 8-bit data.
[0032]
When the code bit string starts with “010”, it is a COPY LEFT1 command. This command is followed by a code indicating a length to be described later, and instructs to copy a byte string having a length indicated by the subsequent code from a predetermined high-order left reference position.
[0033]
When the code bit string starts with “0001”, it is a COPY LEFT2 command. This command is followed by a code indicating the length, which will be described later, copying a byte sequence of the length indicated by the subsequent code from a predetermined low-order left reference position, Instructs to replace the left reference position of the rank.
[0034]
When the bit string of the code is “0000”, it is an EOB command and instructs the end of the code block.
[0035]
If the data matches at the low-order reference position, there is a high possibility that the data will match at the reference position. Therefore, when a longer code that identifies a lower-order reference position is output, if the rank of the reference position is raised and then identified by a shorter code, the data matches after that at the reference position. In this case, the length of the output code is shortened. Therefore, by executing the COPY UP2 command and the COPY LEFT2 command, the high-order reference position and the low-order reference position are switched, and the length of the code to be output in the future is shortened.
[0036]
FIG. 4 is an example of an encoding table of codes indicating lengths following the COPY UP1 command, COPY UP2 command, COPY LEFT1 command, or COPY LEFT2 command shown in FIG.
[0037]
As shown in FIG. 4, when the bit string of the code is “1”, the length of 1 byte is indicated.
[0038]
When the bit string of the code starts with “01”, 1-bit data follows, and indicates a length obtained by adding 2 to the subsequent 1-bit data, that is, a length of 2 bytes or 3 bytes.
[0039]
When the code bit string starts with “001”, 2 bits of data follow, and a length obtained by adding 4 to the subsequent 2 bits of data, that is, a length from 4 bytes to 7 bytes is indicated.
[0040]
When the code bit string starts with “0001”, 3 bits of data follow, and a length obtained by adding 8 to the subsequent 3 bits of data, that is, a length from 8 bytes to 15 bytes is indicated.
[0041]
When the bit string of the code starts with “00001”, 4-bit data follows, and a length obtained by adding 16 to the subsequent 4-bit data, that is, a length from 16 bytes to 31 bytes is indicated.
[0042]
When the bit string of the code starts with “000001”, 5-bit data follows, and a length obtained by adding 32 to the subsequent 5-bit data, that is, a length from 32 bytes to 63 bytes is indicated.
[0043]
When the code bit string starts with “0000001”, 6-bit data follows, and the length obtained by adding 64 to the subsequent 6-bit data, that is, the length from 64 bytes to 127 bytes is indicated.
[0044]
When the bit string of the code starts with “0000000”, 7-bit data follows, and indicates a length obtained by adding 128 to the subsequent 7-bit data, that is, a length from 128 bytes to 255 bytes.
[0045]
For these codes, the appearance frequency of each command is obtained in advance with a large number of image data, and as with the Huffman code, a short code is assigned to a command with a high appearance frequency, and a relatively long code is assigned to a command with a low appearance frequency. By assigning, the compression rate can be increased.
[0046]
Next, with reference to FIGS. 5A and 5B, the encoding process will be described with an example. FIG. 5A shows the image data to be encoded, and FIG. 5B shows the encoded data. As shown in FIG. 5A, 10 bytes of image data (attention data) 00, 00, 12, 34, 56, 78, 00, BC, DE, 00 are arranged in the bottom row from the left. Image data 12, 34, 56, 78, 9A, BC, DE, 00, 00, 00 (reference data) are arranged on the second line from the left. The image data that is currently being encoded or decoded is the bottom row, and at this point, the high-order left reference position is 1 byte to the left (that is, the low-order left reference position is 4 bytes to the left), It is assumed that the lower reference upper reference position is on the second line and two bytes to the left (that is, the higher priority upper reference position is on the fourth line).
[0047]
Here, the first byte 00 in the bottom row can be encoded into a bit string 001 00000000, that is, a RAW command indicating the raw data 00.
[0048]
Further, the next byte 00 can be encoded into a COPY LEFT1 command that copies the bit string 010 1, that is, the length of 1 byte, from the high-order left reference position, that is, the position 1 byte left.
[0049]
The next byte sequence 12, 34, 56, 78 is a bit sequence 011 001 00, that is, a COPY UP2 command for copying the length of 4 bytes from the lower-order upper reference position, that is, 2 lines and 2 bytes to the left. Can be encoded. As a result, the order of the upper reference position is switched, and the subsequent COPY UP1 command is located two lines and two bytes left from the lower order to the higher order, and the COPY UP2 command is changed from the higher order to the lower order. Refer to each position on the line.
[0050]
The next byte 00 can again be encoded into a bit string 001 00000000, ie, a RAW command indicating raw data 00.
[0051]
The next byte string BC, DE, 00 is a bit string 1 01 1, which is a code for a COPY UP1 command to copy the length of 3 bytes from the upper reference position in the highest order, that is, 2 lines and 2 bytes to the left. Can be
[0052]
As described above, the image data can be encoded. Next, details of processing of the printer driver 4 will be described with reference to a flowchart shown in FIG. FIG. 6 is a flowchart of processing performed by the printer driver 4. The program according to this flowchart is stored as the printer driver 4 in the external storage device 1104 or a storage medium as described above, and is read out and executed by the CPU 101 (in the case of a storage medium, by the storage medium drive 1109) into the RAM 1102. .
[0053]
When the printer driver 4 is called from the operating system 2, it is first determined in step S5 whether or not the call type is a drawing command. If the call type is a drawing command, a drawing process is performed in step S6, and the process ends. Specifically, a character, figure, bitmap, or the like designated by the application 3 via the operating system 2 is converted into an 8-bit image of each color using red, green, and blue, and recorded in the RAM 1102. To do.
[0054]
If the call type is not a drawing command in step S5, it is determined in step S7 whether the call type is a page end command. If the call type is a page end command, color conversion processing is performed in step S8. Specifically, an 8-bit image using the three colors red, green, and blue recorded in the RAM 1102 in step S6 is converted into four colors of cyan, magenta, yellow, and black using a predetermined dither matrix. For example, each image is converted into a 4-bit image. The converted image is also stored in the RAM 1102.
[0055]
Next, in step S9, a print condition designation command, specifically a command for designating conditions necessary for printing such as paper size, paper feed cassette, resolution, number of gradations, number of bytes of one line, number of lines of one page, etc. Is output.
[0056]
Next, each processing from step S10 to step S14 is performed for each color of cyan, magenta, yellow, and black, and an image data command for each color is output. First, in step S10, the compression parameter corresponding to the dither matrix used in step S8, that is, the position referenced by the COPY UP command and the COPYLEFT command used at the time of encoding (high-order upper reference position, lower-order upper reference). Position, high-order left reference position, and low-order left reference position). In step S11, the image data is encoded in accordance with an encoding procedure described later. At this time, encoding is performed using the positions referred to by the COPY UP command and the COPY LEFT command specified by the compression parameter output in step S10. Details will be described later.
[0057]
In step S12, an image data command header that specifies the size and the number of lines of the image data encoded in step S11 is output. In step S13, the image data encoded in step S11 is output. Next, in step S14, it is determined whether or not the processing for each of the cyan, magenta, yellow, and black planes has been completed. If the processing for each of the cyan, magenta, yellow, and black planes has not been completed, the process returns to step S10 to change the color and perform the processing for the next plane. When the processing for each of the cyan, magenta, yellow, and black planes is completed in this way, the process proceeds from step S14 to step S15, and a page break command for designating the end of the page is output to end the process.
[0058]
If the call type is not a page end command in step S7, other processing corresponding to the call type is performed in step S16, for example, a process corresponding to a page start command or a printer capability inquiry command. finish.
[0059]
Next, the encoding process in step S11 will be described with reference to FIG. 7 showing a flowchart of the process. A program according to this flowchart is incorporated in the printer driver 4 as a subroutine of the flowchart.
[0060]
First, in step S19, the higher-order upper reference position, the lower-order upper reference position, the higher-order left reference position, and the lower-order left reference position are respectively set to predetermined initial values, that is, the compression parameters obtained in step S10. Set according to. In step S20, the current position, that is, the position of the image to be encoded is set at the left end of the first line of the image.
[0061]
Next, in step S21, it is determined whether or not the higher-order upper reference position corresponding to the current position refers to valid image data. If the high-order upper reference position refers to valid image data, in step S22, the length that matches the higher-order upper reference position is set to a byte sequence starting from the current position, It is obtained by comparing byte sequences starting from the upper reference position. At this time, if the end of the line is reached or the length reaches 255 bytes, the processing is aborted. Next, in step S23, it is determined whether or not the length that is obtained in step S22 and matches the upper reference position in the higher order is zero. If it is not 0, it can be encoded into a COPY UP1 command. In step S24, a COPY UP1 command, that is, a code indicating the code 1 and the number of bytes following it (the length obtained in step S22) is output, and the process is performed. Proceed to S40.
[0062]
On the other hand, if it is determined in step S21 that the high-order upper reference position is invalid, it is determined in step S23 that the length that matches the high-order upper reference position obtained in step S22 is zero. If so, in step S25, it is determined whether or not the higher-order left reference position corresponding to the current position refers to valid image data. If the high-order left reference position refers to valid image data, in step S26, the length matching the high-order left reference position is set to a byte string starting from the current position, and the high-order left reference position. It is obtained by comparing byte sequences starting from the left reference position. At this time, if the end of the line is reached or the length reaches 255 bytes, the processing is aborted. Next, in step S27, it is determined whether or not the length that is obtained in step S26 and matches the high-order left reference position is zero. If it is not 0, it can be encoded into a COPY LEFT1 command. Therefore, in step S28, a COPY LEFT1 command, that is, a code indicating the code 010 and the number of subsequent bytes (the length obtained in step S26) is output, and the processing is performed. Proceed to S40.
[0063]
If it is determined in step S25 that the high-order left reference position is invalid, it is determined in step S27 that the length corresponding to the high-order left reference position obtained in step S26 is zero. In any case, in step S29, it is determined whether or not the lower-reference upper reference position corresponding to the current position refers to valid image data. If the lower-order upper reference position refers to valid image data, in step S30, the length matching the lower-order upper reference position is set to a byte sequence starting from the current position, and the lower-order upper reference position. It is obtained by comparing byte sequences starting from the upper reference position. At this time, if the end of the line is reached or the length reaches 255 bytes, the processing is aborted. Next, in step S31, it is determined whether or not the length obtained in step S30 and the length matching the lower reference upper reference position is zero. If it is not 0, it can be encoded into a COPY UP2 command. In step S32, a COPY UP2 command, that is, a code indicating the code 011 and the number of bytes subsequent thereto (the length obtained in step S30) is output, In step S33, the upper reference position in the higher order and the upper reference position in the lower order are exchanged, and the process proceeds to step S40.
[0064]
When it is determined in step S29 that the lower-order upper reference position is invalid, and in step S31, it is determined that the length that is obtained in step S30 and matches the lower-order upper reference position is zero. In any case, in step S34, it is determined whether or not the low-order left reference position corresponding to the current position refers to valid image data. If the low-order left reference position refers to valid image data, in step S35, the length matching the low-order left reference position is set to a byte sequence starting from the current position, and the low-order left reference position. It is obtained by comparing byte sequences starting from the left reference position. At this time, if the end of the line is reached or the length reaches 255 bytes, the processing is aborted. Next, in step S36, it is determined whether or not the length that matches the low-order left reference position obtained in step S35 is zero. If it is not 0, it can be encoded into a COPY LEFT2 command. Therefore, in step S37, a COPY LEFT2 command, that is, a code indicating the code 0001 and the number of subsequent bytes (the length obtained in step S35) is output. In S38, the high-order left reference position and the low-order left reference position are switched, and the process proceeds to Step S40.
[0065]
When it is determined in step S34 that the low-order left reference position is invalid, and in step S36, it is determined that the length that matches the low-order left reference position obtained in step S35 is zero. In either case, in step S39, the RAW command, that is, the code 001 and the subsequent 1-byte data at the current position are output, and the process proceeds to step S40.
[0066]
In step S40, the current position is advanced by the number of bytes processed by COPY UP1, COPY UP2, COPY LEFT1, COPY LEFT2, or the RAW command. Next, in step S41, it is determined whether or not all image data has been processed. If all the image data has not been processed, the process returns to step S21 to continue encoding. When all the image data has been processed, an EOB command, that is, a code 0000 is output in step S42, and then the code is aligned on a byte boundary in step S43. Specifically, if the total number of bits of the output code is not an integer multiple of 8, bit 0 is output until it reaches an integer multiple of 8. When the encoding process is completed in this way, the process returns.
[0067]
Next, details of the circuit will be described with reference to FIG. 8 showing the configuration of the decoding circuit 13 shown in FIG. FIG. 8 is a block diagram showing a basic configuration of the decoding circuit 13 shown in FIG.
[0068]
In FIG. 8, the input buffer 21 stores the code data read from the FIFO memory 12. The input buffer 21 can store at least 4 bytes of data, and when the buffer is empty and there is data in the FIFO memory 12, the data is read from the FIFO memory 12 and stored. The input buffer 21 also discards the processed data that is no longer necessary when the number of processed bits held in the bit counter 23 is 8 or more.
[0069]
The first selector 22 is, for example, 18 sets of 8-input selectors, and the command decode circuit 24 processes the code data stored in the input buffer 21 according to the number of processed bits indicated by the bit counter 23. Align the start position of the command necessary for this. This is necessary because the input buffer 21 holds data in units of bytes, whereas the command is variable-length data in units of bits, so there are eight start positions.
[0070]
The bit counter 23 stores the number of processed bits in the code data stored in the input buffer 21. The bit counter 23 also updates the value stored in the bit counter by adding the number of bits of the command output from the command decoding circuit 24. The bit counter 23 also subtracts the number of discarded bits when the input buffer discards the processed data. The bit counter 23 also receives an EOB signal from the command decode circuit 24 when the command decode circuit 24 decodes the EOB command, and performs byte boundary alignment processing. Specifically, if the lower 3 bits of the bit counter are all 0, nothing is done. Otherwise, 8 is added and the lower 3 bits are cleared.
[0071]
The command decode circuit 24 is constituted by, for example, a read-only memory or wired logic, decodes the code data stored in the input buffer 21 that has been aligned by the first selector 22, and the decoded command is an EOB command. Is the bit counter 23, the upper priority FF 29 and the left priority FF 30, and if the decoded command is a COPY UP1 command or a COPY UP2 command, the second selector 25 and the third selector 26 are decoded, and the decoded command is a COPY LEFT1 command. Alternatively, a signal is output to the fourth selector 27 and the fifth selector 28 in the case of a COPY LEFT2 command, and to the raw data output circuit 36 if the decoded command is a RAW command. The command decode circuit 24 also decodes and outputs the number of bytes indicated by the code when the COPY UP1, COPY UP2, COPY LEFT1, or COPY LEFT2 command is decoded, and when the RAW command is decoded, the 8 bits indicated by the code. Data is also decoded and output.
[0072]
Reference numeral 25 denotes a second selector. When the upper priority FF 29 holds 0, a signal output when the command decode circuit 24 decodes the COPY UP1 command, and when the upper priority FF 29 holds 1 Outputs a signal output when the command decode circuit 24 decodes the COPY UP2 command.
[0073]
Reference numeral 26 denotes a third selector. When the upper priority FF 29 holds 0, a signal output when the command decode circuit 24 decodes the COPY UP2 command, and when the upper priority FF 29 holds 1 Outputs a signal output when the command decode circuit 24 decodes the COPY UP1 command.
[0074]
Reference numeral 27 denotes a fourth selector. When the left priority FF 30 holds 0, a signal output when the command decode circuit 24 decodes the COPY LEFT1 command, and when the left priority FF 30 holds 1 Outputs a signal output when the command decode circuit 24 decodes the COPY LEFT2 command.
[0075]
Reference numeral 28 denotes a fifth selector. When the left priority FF 30 holds 0, a signal indicating that the command decode circuit 24 has decoded the COPY LEFT2 command, and when the left priority FF 30 holds 1, The command decode circuit 24 outputs a signal indicating that the COPY LEFT1 command has been decoded.
[0076]
Reference numeral 29 denotes an upper priority FF, which holds a value indicating which of the first upper copying circuit 31 or the second upper copying circuit 32 has priority. The upper priority FF 29 also inverts the value held when the command decode circuit 24 decodes the COPY UP2 command.
[0077]
Reference numeral 30 denotes a left priority FF, which holds a value indicating which of the first left copying circuit 33 or the second left copying circuit 34 has priority. The left priority FF 30 also inverts the value held when the command decode circuit 24 decodes the COPY LEFT2 command.
[0078]
Reference numeral 31 denotes a first upper copying circuit which receives the number of bytes to be copied when receiving a signal from the second selector 25 and reads data from the line buffer 35 in accordance with the received number of bytes. Repeatedly output the read data.
[0079]
Reference numeral 32 denotes a second upper copying circuit which receives the number of bytes to be copied when receiving a signal from the third selector 26 and reads data from the line buffer 35 according to the received number of bytes. Repeatedly output the read data.
[0080]
Reference numeral 33 denotes a first left copying circuit which receives the number of bytes to be copied when receiving a signal from the fourth selector 27 and reads data from the line buffer 35 in accordance with the received number of bytes. Repeatedly output the read data.
[0081]
Reference numeral 34 denotes a second left copying circuit which receives the number of bytes to be copied when receiving a signal from the fifth selector 28 and reads data from the line buffer 35 according to the received number of bytes. Repeatedly output the read data.
[0082]
Reference numeral 35 denotes a line buffer, which operates as a ring memory that holds decoded data of a plurality of lines. The first upper copying circuit 31, the second upper copying circuit 32, the first left copying circuit 33, or the second left copying circuit. The data stored in the address output from the copying circuit 34 is output, and the decoded data is stored in the address output from the current address register 37.
[0083]
A raw data output circuit 36 receives 8-bit data indicating raw data that is simultaneously output when the command decode circuit 24 decodes the RAW command, and outputs the received data.
[0084]
Reference numeral 37 denotes a current address register, which outputs an address indicating the position of data currently being decoded, and counts up every time the decoded data is stored in the line buffer 35.
[0085]
The first upper copying circuit 31, the second upper copying circuit 32, the first left copying circuit 33, and the second left copying circuit 34 include a first upper copying position, a second upper copying position, Addresses respectively indicating the first left copy position and the second left copy position are held, and are counted up in the same manner every time the current address register 37 is counted up.
[0086]
When the command decode circuit 24 decodes the COPY UP1 command, it decodes the subsequent count and outputs a signal to the second selector 25 and the third selector 26. A signal is output from either the second selector 25 or the third selector 26 according to the value held by the upper priority FF 29, and the first upper copying circuit 31 or the second upper copying circuit is output according to the signal. Any one of 32 operates.
[0087]
For example, if the value held by the upper priority FF 29 is 0, when the COPY UP1 command is decoded, the second selector 25 outputs a signal to the first upper copying circuit 31, and the third selector 26 outputs the signal. Do not output. The first upper copying circuit 31 outputs an address indicating the first upper copying position held therein to the line buffer 35, reads the data of the first upper copying position stored in the line buffer 35, and reads the data. The data is output to the printer engine 14 as decoded data. The current address register 37 outputs an address indicating the current position, and the line buffer 35 stores the decoded data at that address. Next, addresses indicating the first upper copy position respectively held in the first upper copy circuit 31, the second upper copy circuit 32, the first left copy circuit 33 and the second left copy circuit 34. The address indicating the second upper copy position, the address indicating the first left copy position and the address indicating the second left copy position, and the address indicating the current position held by the current address register 37 are counted up. This operation is repeated for the specified number of bytes.
[0088]
When the command decode circuit 24 decodes the COPY UP2 command, it decodes the subsequent count and outputs a signal to the second selector 25 and the third selector 26. A signal is output from either the second selector 25 or the third selector 26 according to the value held by the upper priority FF 29, and the first upper copying circuit 31 or the second upper copying circuit 32 is output according to the signal. Either one works.
[0089]
For example, if the value held by the upper priority FF 29 is 0, when the COPY UP2 command is decoded, the third selector 26 outputs a signal to the second upper copying circuit 32, and the second selector 25 outputs the signal. Do not output. The second upper copying circuit 32 operates in the same manner as the operation of the first upper copying circuit 31 described above. However, since the value held in the upper priority FF 29 is inverted to 1, the subsequent COPY UP1 command is the first one. The second upper reference position and the COPY UP2 command correspond to the first upper reference position, respectively.
[0090]
Even when the command decode circuit 24 decodes the COPY LEFT1 command and the COPY LEFT2 command, it operates in the same manner as the operations of the COPY UP1 command and the COPY UP2 command.
[0091]
When the command decode circuit 24 decodes the RAW command, the subsequent 8-bit data is decoded and a signal is output to the raw data output circuit 36. The raw data output circuit 36 outputs the received 8-bit data as it is to the printer engine 14 as decoded data. The current address register 37 outputs an address indicating the current position, and the line buffer 35 stores the decoded data at that address. Next, addresses indicating the first upper copy position respectively held in the first upper copy circuit 31, the second upper copy circuit 32, the first left copy circuit 33 and the second left copy circuit 34. The address indicating the second upper copy position, the address indicating the first left copy position and the address indicating the second left copy position, and the address indicating the current position held by the current address register 37 are counted up.
[0092]
When the command decode circuit 24 decodes the EOB command, the bit counter 23 performs the byte boundary alignment processing as described above, and the upper priority FF 29 and the left priority FF 30 are initialized to initial values, for example, 0.
[0093]
Addresses indicating the first upper copy positions respectively held in the first upper copy circuit 31, the second upper copy circuit 32, the first left copy circuit 33, and the second left copy circuit 34. The address indicating the second upper copy position, the address indicating the first left copy position, the address indicating the second left copy position, and the address indicating the current position held by the current address register 37 are previously set in the control circuit. 15, the initial value based on the position designated by the compression parameter designation command is set.
[0094]
Since the line buffer 35 operates as a ring memory, it is held inside the first upper copying circuit 31, the second upper copying circuit 32, the first left copying circuit 33, and the second left copying circuit 34, respectively. Held in the address indicating the first upper copying position, the address indicating the second upper copying position, the address indicating the first left copying position and the address indicating the second left copying position, or the current address register 37. When the address indicating the current position is the last address of the line buffer 35, the first address of the line buffer 35 is stored by wrapping around when counting up.
[0095]
From the above description, when a reference position encoded to a longer code is referred to by the image encoding apparatus and the image decoding apparatus according to the present embodiment, the reference position and the reference are interchanged, and then the reference is performed. Since a shorter code can be encoded when the position is referenced, compression can be performed efficiently regardless of the data cycle.
[0096]
In addition, when the period of the image data and the period of the dither matrix are different, there is a tendency that the correlation between the position near the position of interest and the position where the calculation close to the calculation applied at the position of interest is applied during the color reduction process is high . Such positions are limited to a small number of positions and can be determined by examining the dither matrix in advance or by taking statistics using various image data in advance. By selecting in advance a plurality of positions as reference positions from positions separated by a period, it is possible to efficiently encode regardless of the period of the image data.
[0097]
Also, the cycle of image data tends to be constant over a wide range. For this reason, when data matches at a low-order reference position, there is a high possibility that data will match at that reference position. Therefore, when a longer code for identifying a lower-order reference position is output, the rank of the reference position is increased, and thereafter the data is identified at the reference position by being identified by a shorter code. In this case, since the output code becomes shorter, the encoding can be performed more efficiently than the case where the order is not changed.
[0098]
[Second Embodiment]
In the above-described embodiment, decoding is performed by hardware. However, instead of this, decoding may be performed by software.
[0099]
In the above-described embodiment, the unit data size of encoding is 1 byte, but it may be another size, for example, 1 pixel or 2 bytes instead.
[0100]
In the above-described embodiment, the priority order of two reference positions is switched. Alternatively, the priority order of three or more reference positions may be switched.
[0101]
[Other Embodiments]
An object of the present invention is to supply a storage medium (or recording medium) in which a program code of software that realizes the functions of the above-described embodiments is recorded to a system or apparatus, and a computer (or CPU or MPU) of the system or apparatus Needless to say, this can also be achieved by reading and executing the program code stored in the storage medium. In this case, the program code itself read from the storage medium realizes the functions of the above-described embodiments, and the storage medium storing the program code constitutes the present invention. Further, by executing the program code read by the computer, not only the functions of the above-described embodiments are realized, but also an operating system (OS) running on the computer based on the instruction of the program code. It goes without saying that a case where the function of the above-described embodiment is realized by performing part or all of the actual processing and the processing is included.
[0102]
Furthermore, after the program code read from the storage medium is written into a memory provided in a function expansion card inserted into the computer or a function expansion unit connected to the computer, the function is determined based on the instruction of the program code. It goes without saying that the CPU or the like provided in the expansion card or the function expansion unit performs part or all of the actual processing and the functions of the above-described embodiments are realized by the processing.
[0103]
【The invention's effect】
As described above, according to the present invention, an image can be efficiently encoded with a particularly short code.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating a relationship between a software group and a printer 6 in a computer 1 that functions as an image encoding device according to an embodiment of the present invention.
FIG. 2 is a block diagram illustrating a basic configuration of a printer 6 that functions as an image decoding apparatus according to an embodiment of the present invention.
FIG. 3 is a diagram illustrating an example of an encoding table generated by the printer driver 3 illustrated in FIG. 1;
4 is a diagram illustrating an example of a coding table of codes indicating lengths subsequent to the COPY UP1 command, the COPY UP2 command, the COPY LEFT1 command, or the COPY LEFT2 command illustrated in FIG. 3;
5A is a diagram showing image data to be encoded, and FIG. 5B is a diagram showing encoded data.
FIG. 6 is a flowchart of processing performed by the printer driver 4;
FIG. 7 is a flowchart of the encoding process in step S11.
8 is a block diagram showing a basic configuration of a decoding circuit 13 shown in FIG.
FIG. 9 is a block diagram showing a basic configuration of a computer 1;

Claims (5)

画像に対して、n行m列のマトリクスを用いて擬似中間調処理を施す擬似中間調処理手段と、
前記擬似中間調処理が施された画像における符号化対象画素から行方向に距離n×a(a>0)だけ離れた第1参照画素と、前記符号化対象画素から列方向に距離m×b(b>0)離れた第2参照画素とを、設定された参照順位に従って参照する参照手段と、
前記参照手段が参照している参照画素が、前記符号化対象画素を符号化するのに有効である場合には、当該参照画素を用いて前記符号化対象画素を符号化する符号化手段とを備え、
前記参照順位は、前記第1参照画素と前記第2参照画素のうち前記符号化対象画素との位置関係が、前記符号化対象画素の直前に符号化された前画素と当該前画素の符号化時に前記符号化手段が用いた参照画素との位置関係を満たす参照画素から参照するように設定されることを特徴とする画像符号化装置。
Pseudo halftone processing means for performing pseudo halftone processing on an image using a matrix of n rows and m columns;
A first reference pixel that is separated from the encoding target pixel in the row direction by a distance n × a (a> 0) in the image subjected to the pseudo halftone process, and a distance m × b in the column direction from the encoding target pixel (B> 0) a reference means for referring to a second reference pixel separated according to a set reference order;
When the reference pixel referred to by the reference means is effective for encoding the encoding target pixel, the encoding means for encoding the encoding target pixel using the reference pixel; Prepared,
The reference order is the encoding of the previous pixel and the previous pixel in which the positional relationship between the first reference pixel and the second reference pixel and the encoding target pixel is encoded immediately before the encoding target pixel. sometimes the image coding apparatus according to the set, wherein Rukoto to refer to the reference pixels that satisfy the positional relationship between the reference pixel said encoding means are used.
前記第1参照画素は、それぞれ異なるaに対応する複数の参照画素であり、前記第2の参照画素は、それぞれ異なるbに対応する複数の参照画素であることを特徴とする請求項1に記載の画像符号化装置。The first reference pixels are a plurality of reference pixels corresponding to different a respective said second reference pixels, to claim 1, wherein the plurality of reference pixels der Rukoto corresponding to different b respectively The image encoding device described. 画像に対して、n行m列のマトリクスを用いて擬似中間調処理を施す擬似中間調処理工程と、
前記擬似中間調処理が施された画像における符号化対象画素から行方向に距離n×a(a>0)だけ離れた第1参照画素と、前記符号化対象画素から列方向に距離m×b(b>0)離れた第2参照画素とを、設定された参照順位に従って参照する参照工程と、
前記参照工程で参照している参照画素が、前記符号化対象画素を符号化するのに有効である場合には、当該参照画素を用いて前記符号化対象画素を符号化する符号化工程とを備え、
前記参照順位は、前記第1参照画素と前記第2参照画素のうち前記符号化対象画素との位置関係が、前記符号化対象画素の直前に符号化された前画素と当該前画素の符号化時に前記符号化手段が用いた参照画素との位置関係を満たす参照画素から参照するように設定されることを特徴とする画像符号化方法。
A pseudo halftone processing step of performing pseudo halftone processing on an image using a matrix of n rows and m columns;
A first reference pixel that is separated from the encoding target pixel in the row direction by a distance n × a (a> 0) in the image subjected to the pseudo halftone process, and a distance m × b in the column direction from the encoding target pixel (B> 0) a reference step of referring to the separated second reference pixel according to the set reference order;
An encoding step of encoding the encoding target pixel using the reference pixel when the reference pixel referred in the reference step is effective for encoding the encoding target pixel; Prepared,
The reference order is the encoding of the previous pixel and the previous pixel in which the positional relationship between the first reference pixel and the second reference pixel and the encoding target pixel is encoded immediately before the encoding target pixel. set the image coding method comprising Rukoto to refer to the reference pixels at satisfying the positional relationship between the reference pixel said encoding means are used.
コンピュータに請求項に記載の画像符号化方法を実行させるためのコンピュータプログラム。 Computer program for executing the image encoding method according to claim 3 on a computer. 請求項に記載のコンピュータプログラムを格納したことを特徴とする、コンピュータ読み取り可能な記憶媒体。 And characterized by storing a computer program according to claim 4, a computer-readable storage medium.
JP2002046434A 2001-12-06 2002-02-22 Image encoding apparatus, image encoding method, program, and storage medium Expired - Fee Related JP4109875B2 (en)

Priority Applications (7)

Application Number Priority Date Filing Date Title
JP2002046434A JP4109875B2 (en) 2002-02-22 2002-02-22 Image encoding apparatus, image encoding method, program, and storage medium
EP02258367.8A EP1318665B1 (en) 2001-12-06 2002-12-04 Image processing apparatus and method, program, and storage medium
CN 200810097396 CN101282406B (en) 2001-12-06 2002-12-05 Image processing apparatus
CN 200810094578 CN101282405B (en) 2001-12-06 2002-12-05 Image processing apparatus and method
CNB02155529XA CN100397866C (en) 2001-12-06 2002-12-05 Image processor, image processing method, program and memory medium
CN2008100973975A CN101282407B (en) 2001-12-06 2002-12-05 Image processing apparatus and method
US10/310,812 US7245396B2 (en) 2001-12-06 2002-12-06 Image data coding apparatus, image data decoding apparatus, image data coding method and image data decoding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002046434A JP4109875B2 (en) 2002-02-22 2002-02-22 Image encoding apparatus, image encoding method, program, and storage medium

Publications (2)

Publication Number Publication Date
JP2003250053A JP2003250053A (en) 2003-09-05
JP4109875B2 true JP4109875B2 (en) 2008-07-02

Family

ID=28659850

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002046434A Expired - Fee Related JP4109875B2 (en) 2001-12-06 2002-02-22 Image encoding apparatus, image encoding method, program, and storage medium

Country Status (1)

Country Link
JP (1) JP4109875B2 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7321623B2 (en) 2002-10-01 2008-01-22 Avocent Corporation Video compression system
US9560371B2 (en) 2003-07-30 2017-01-31 Avocent Corporation Video compression system
US7006700B2 (en) * 2004-06-25 2006-02-28 Avocent Corporation Digital video compression command priority
US7457461B2 (en) 2004-06-25 2008-11-25 Avocent Corporation Video compression noise immunity
US7782961B2 (en) 2006-04-28 2010-08-24 Avocent Corporation DVC delta commands
JP5029164B2 (en) 2006-09-25 2012-09-19 セイコーエプソン株式会社 Image processing using undeveloped image data
JP5218015B2 (en) * 2008-12-17 2013-06-26 カシオ電子工業株式会社 Data decompressor
CN101996390B (en) * 2010-10-20 2013-11-06 中兴通讯股份有限公司 Image copying method and device

Also Published As

Publication number Publication date
JP2003250053A (en) 2003-09-05

Similar Documents

Publication Publication Date Title
US20030107753A1 (en) Image processing apparatus and method, program, and storage medium
JP3902968B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
US7454070B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7680345B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP5052569B2 (en) Image compression apparatus, image compression method, image expansion apparatus, image expansion method, image forming apparatus, computer program, and recording medium
KR100491333B1 (en) Real time algorithms and architectures for coding images compressed by dwt-based techniques
US7466863B2 (en) Image encoding apparatus and method, computer program, computer-readable storage medium, and image forming apparatus
US8331705B2 (en) Image encoding apparatus and method of controlling the same
US20050276500A1 (en) Image encoding apparatus, and image processing apparatus and its control method
US7715637B2 (en) Image processing apparatus and control method therefor
US20030043905A1 (en) Image processing method and apparatus, computer program, and storage medium
US5583656A (en) Methods and apparatus for attaching compressed look-up table (LUT) representations of N to M-dimensional transforms to image data and for processing image data utilizing the attached compressed LUTs
JP4393319B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP3976353B2 (en) Digital camera
JP4109875B2 (en) Image encoding apparatus, image encoding method, program, and storage medium
US20080260273A1 (en) Image processing apparatus and method
JP2000244935A (en) Method for compressing picture data
JP4063487B2 (en) Raster data compression method
JP3970007B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP3984813B2 (en) Image processing apparatus and method, computer program, and storage medium
JP2000165681A (en) Run length encoding system used in printing system printing pixel from data source
CN110087085B (en) Image processing apparatus
JP2006238291A (en) Coding processing method of color image information, decoding processing method and printer using the same
JP4693309B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP3840076B2 (en) Image processing apparatus and method, computer program, and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20041001

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070104

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070206

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070409

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080407

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

Free format text: PAYMENT UNTIL: 20110411

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4109875

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20130411

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130411

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20140411

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees