JP3984813B2 - Image processing apparatus and method, computer program, and storage medium - Google Patents

Image processing apparatus and method, computer program, and storage medium Download PDF

Info

Publication number
JP3984813B2
JP3984813B2 JP2001315670A JP2001315670A JP3984813B2 JP 3984813 B2 JP3984813 B2 JP 3984813B2 JP 2001315670 A JP2001315670 A JP 2001315670A JP 2001315670 A JP2001315670 A JP 2001315670A JP 3984813 B2 JP3984813 B2 JP 3984813B2
Authority
JP
Japan
Prior art keywords
compression
encoded data
quantization step
encoding
memory
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
JP2001315670A
Other languages
Japanese (ja)
Other versions
JP2003125206A (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 JP2001315670A priority Critical patent/JP3984813B2/en
Priority to EP02254149.4A priority patent/EP1271926B1/en
Priority to US10/171,647 priority patent/US7106911B2/en
Priority to CN02122650.4A priority patent/CN1207897C/en
Publication of JP2003125206A publication Critical patent/JP2003125206A/en
Application granted granted Critical
Publication of JP3984813B2 publication Critical patent/JP3984813B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明はカラー画像データを圧縮符号化する画像処理装置及びその制御方法及びコンピュータプログラム並びにコンピュータ可読記憶媒体に関するものである。
【0002】
【従来の技術】
従来,静止画像の圧縮方式には,離散コサイン変換を利用したJPEG方式や,Wavelet変換を利用した方式が多く使われている。この種の符号化方式は,可変長符号化方式であるので,符号化対象の画像毎に符号量が変化するものである。
【0003】
国際標準化方式であるJPEG方式では,画像に対して1組の量子化マトリクスしか定義できない。従って、プリスキャン無しには、符号量調整が行えず、限られたメモリに記憶するシステムで使用する場合においては、メモリオーバーを起こす危険性がある。
【0004】
これを防止するために、予定した符号量よりオーバーした場合は、圧縮率を変更して、原稿の再読み込みを行なう方法や、予めプリスキャンによる符号量見積もりを行ない、符号量を調整するために,量子化パラメータの再設定を行なう方法などがとられていた。
【0005】
また、プリスキャンを行う符号量制御方式として、例えば、プリ圧縮したデータを内部バッファメモリに入れ、これを伸長し、圧縮パラメータを変え、本圧縮し、外部記憶に出力する方式がある。このとき、本圧縮では、プリ圧縮よりも圧縮率を高めにすることになる。
【0006】
また、例えば、画素ブロックごとの許容符号量を求め、符号量を減らすために、DCT係数をn回レベルシフトした係数をハフマン符号化する方式が知られており、このシフト量nは許容符号量から決定される。
【0007】
【発明が解決しようとする課題】
しかしながら、従来は、圧縮バッファとして、目標圧縮以上の圧縮バッファが必要となり,中間的に使うバッファのオーバーフローを防ぐには,原画のデータを記録できるほどの容量が必要となることは避けられない。
【0008】
さらに、符号化処理を繰り返す方法では、圧縮した全データに対して、復号、再圧縮を行なう処理が入るため、連続処理のスピードがあがらないという問題がある。
【0009】
本発明は上記従来例に鑑みて成されたものであり、1度の画像入力により、効果的に設定したサイズに収まる符号化データを生成することを可能ならしめ、特に、多値カラー画像データに対してその圧縮後の品質の劣化を最小限に抑えることを可能ならしめる画像処理装置及びその制御方法及びコンピュータプログラム及び記憶媒体を提供しようとするものである。
【0010】
【課題を解決するための手段】
かかる課題を解決するため、例えば本発明の画像処理装置は以下の構成を備える。すなわち、
カラー画像を表す輝度成分と色差成分を入力し、前記輝度成分を第1の量子化ステップを用いて圧縮し、前記色差成分を第2の量子化ステップを用いて圧縮する第1の圧縮段と、
前記第1の圧縮により生成された符号データを復号し、再圧縮することが可能な第2の圧縮段と、
前記第1の圧縮段によって生成される符号化データ量を監視し、該符号データ量が所定量に達するか否かを判断する符号量監視手段とを備え、
該符号量監視手段によって前記所定量に達したと判断した初回の時には、前記第1の圧縮手段に適用する前記第2の量子化ステップを、当該第2の量子化ステップよりも圧縮率の高い第3の量子化ステップに変更した後、後続して入力される色差成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された色差成分の符号化データを、前記第2の量子化ステップよりも圧縮率の高い前記第3の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた色差成分の符号化データを、前記第3の量子化ステップに変更した後の前記第1の圧縮手段により生成された色差成分の符号化データとして保存させ、
前記第3の量子化ステップに更新した後で前記第1の圧縮手段により生成された色差成分の符号化データを、後続の符号化データとして保存させ、
前記符号量監視手段によって前記所定量に達したと判断した2回目の時には、前記第1の圧縮手段に適用する前記第1の量子化ステップを、当該第1の量子化ステップよりも圧縮率の高い第4の量子化ステップに変更した後、後続して入力される輝度成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された輝度成分の符号化データを、前記第1の量子化ステップよりも圧縮率の高い前記第4の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた輝度成分の符号化データを、前記第4の量子化ステップに変更した後の前記第1の圧縮手段により生成された輝度成分の符号化データとして保存させ、
前記第4の量子化ステップに更新した後で前記第1の圧縮手段により生成された輝度成分の符号化データを、後続の符号化データとして保存させることを特徴とする。
【0011】
【発明の実施の形態】
以下、添付図面に従って本発明に係る実施形態を説明するが、先ず、基本部分について説明する。
【0012】
図1は、実施形態が適用する画像処理装置100の機能ブロック構成図である。以下、同図の各部を簡単に説明する。
【0013】
画像処理装置100は、イメージスキャナから画像を入力する入力部101を備えている。なお、入力部101は、ページ記述言語レンダリングなどから画像データを入力しても良いし、記憶媒体に格納された画像ファイルを読込むことで実現しても良く、場合によってはネットワークより受信するようにしても良い。
【0014】
符号化部102は、入力された画像データの符号化を行なう。なお、符号化方式は公知のJPEG符号化方式を用い、8×8画素単位に相当する画像データを直交変換し、後述する量子化ステップを用いた量子化、ハフマン符号化処理を行なうものである。
【0015】
第1のメモリ制御部103と第2のメモリ制御部105は、上記符号化部102から夫々に出力されてくる上記符号化データ(同じ符号化データ)を第1のメモリ104と第2のメモリ106へ格納する様に制御する。ここで、第1のメモリ104は、最終的に確定した(目標値以内のデータ量に圧縮し終わった)符号化データを、図1の基本構成の外部に接続されるネットワーク機器、画像出力装置や大容量記憶装置等へ出力するために、該符号化データを保持するためのメモリである。また、第2のメモリ106は、前記符号化データを第1のメモリ上に形成するための圧縮符号化処理を補助する作業用のメモリである。
【0016】
カウンタ107は、符号化部102によって圧縮符号化された画像データのデータ量をカウントし、該カウント値を保持すると共に、そのカウント結果を符号化シーケンスの制御を行なう符号化シーケンス制御部108に出力する。
【0017】
符号化シーケンス制御部108では、カウンタ107のカウント値がある設定値に達したかどうかを検出し、その設定値に達した(目標値を越えた)ことを検出した時にメモリ104内の格納済みのデータを廃棄するよう第1のメモリ制御部103に制御信号を出力する。上記第1のメモリ制御部103は、この制御信号に基づいて、メモリアドレスカウンタをクリアするか、あるいは符号化データ管理テーブルをクリアすることにより、前記格納データを廃棄する。また、このとき、符号化シーケンス制御部108は、第1のカウンタ107をゼロクリアする(入力部101からの入力は継続している)と共に、符号化部102に対して今までより、高い圧縮率で符号化を行なうよう制御する。すなわち、本装置の符号化処理で発生する符号化データのデータ量が最終的に例えば1/2になるように制御する。なお、ここでは、1/2としたが任意に設定できることは言うまでもない。
【0018】
そして、圧縮率変更後の符号化データも、これまでと同様、第1のメモリ制御部103と第2のメモリ制御部105を経て、第1のメモリ104と第2のメモリ106に夫々格納される。
【0019】
さらに、符号化シーケンス制御部108は、第2のメモリ制御部105に対して、これまでに第2のメモリ106に格納した符号化データを読み出し、符号化データ変換手段である再符号化部109に該符号化データを出力するよう制御信号を出す。
【0020】
再符号化部109は、入力された符号化データを復号化し、データ量を減らすための再量子化等を行なった後に再び符号化処理を行ない、圧縮率が変更された符号化部102と同じ圧縮率のデータ量を第2のカウンタ110に出力する。
【0021】
この再符号化部109から出力される符号化データは、第1のメモリ制御部103と第2のメモリ制御部105を経由して、それぞれ、第1のメモリ104と第2のメモリ106に格納される。
【0022】
再符号化処理が終了したかどうかは、第2のメモリ制御部が検出する。すなわち、再符号化処理するために読み出すデータが無くなれば、再符号化処理の終了を符号化シーケンス制御部108に知らせる。実際には、第2のメモリ制御部105の読みだし処理だけでなく、再符号化部109の処理も終了した後に、符号化処理が完了したことになる。
【0023】
第2のカウンタ110で得られるカウント値は、再符号化処理が完了した後、第1のカウンタ107で保持されているカウンタ値に加算される。この加算結果は再符号化処理が完了した直後における、第1のメモリ104内のデータ量の合計を表す。即ち、1画面分の符号化部102と再符号化部109の符号化処理が終了した時点では、上記加算後の第1のカウンタ107で保持されているカウンタ値は、1画面分を本装置が符号化した場合に発生した総データ量を表す(詳細は後述)。
【0024】
符号化部102は、再符号化処理の終了/未終了に関わらず、符号化するべき入力部101からの画像データが残っている限りは符号化処理を継続して行なう。
【0025】
カウンタ107のカウント値がある設定値に達したかどうかは入力部101から入力される1ページ分の画像データの符号化処理(符号化、再符号化)が終わるまで繰り返され、上述した符号化と再符号化の処理は、ここで得られる検出結果に応じた制御の上で実行される。
【0026】
また、符号シーケンス制御部108から出力される切り替え信号がセレクタ111に供給され、このセレクタ111は符号化対称信号を、再符号化部109に送るか、そのままメモリ制御部103、105に戻すかを切り替える。
【0027】
上記、図1の構成における処理のフローを表わすフローチャートを図8に示すが、説明を簡単にするため、簡略化した図3のフローチャートに従って先ず説明する。
【0028】
既に説明したように、本発明の画像処理装置100は、スキャナ等の入力部101から入力した1ページの画像データを所定のデータ量以下に圧縮符号化する装置である。該符号化処理を実現するために、前記入力部101以外に、符号化部102、再符号化部109、第1のメモリ104、第2のメモリ106等を有する。これらの機能ブロックを用い、図3に示すフローチャートに基づいて符号化処理を行なう。
【0029】
図3のフローチャートは、大別すると、下記の3つの処理フェーズに分かれる。
(1)符号化フェーズ
(2)符号化・再符号化フェーズ
(3)転送フェーズ
上記それぞれの処理フェーズおいて、どのように画像データ、符号化データ等が流れて処理され,メモリにどのように格納されるかを視覚的に解り易く示したのが図4乃至図7である。
【0030】
図4は、図3のフローチャートにおけるステップS303とS305に対応する符号化フェーズの初期状態を表わす。また、図5はステップS307〜S315に対応する符号化・再符号化フェーズの処理状態を、図6はステップS317に対応する転送フェーズの処理状態を、図7は転送フェーズ後の符号化フェーズの処理状態を表わす。以下、各フェーズについて説明する。
【0031】
<<符号化フェーズ>>
1ページ分の画像データの符号化処理は、符号化パラメータの初期設定(ステップS301)から始まる。ここでは符号化処理する画像サイズ(スキャナ等の入力部101から読み取る用紙サイズ)から一意的に定まる符号化データ量の上限値や符号化部102(ここでは公知のJPEG符号化方式を用いるものとする)に適用する量子化ステップ(Q1)といったパラメータを設定する。
【0032】
そして、ステップS303にて、第1のカウンタ107は、実際の符号化処理(画像の8×8画素単位にJPEG圧縮)を行ない、出力される符号化データのデータ量を累積カウントする。
【0033】
次にステップS305にて、該データ量のカウント値が上記上限値をオーバーしたかどうかを検知し、オーバーしていなければステップS303のJPEG符号化処理を継続する。これが初期状態の符号化フェーズである。
【0034】
符号化部102から出力する符号化データは、図4に示すように第1のメモリ104と第2のメモリ106の両方に格納されていく。縦縞で示した領域が該格納した符号を表現している。
【0035】
<<符号化・再符号化フェーズ>>
符号化部102の符号化処理が進行し、前記データ量のカウント値が設定されている上限値をオーバーすると、ステップS307にて、第1のメモリ104内の符号化データを廃棄すると共に、ステップS309にて、符号化部102の量子化ステップをQ2に変更する。
【0036】
符号化データのデータ量のカウント値が設定された上限値をオーバーするという事は、圧縮後のデータ量が目標値以内に収まらないことを意味する。よって同じ量子化ステップを用いて符号化処理を継続しても意味が無いので、前よりもデータ量が少なくなるように、Q1よりも量子化ステップ幅の大きい量子化ステップQ2に変更するわけである。
【0037】
量子化ステップを変更した後、ステップS311では符号化部102の符号化処理を再開し、図5に示すように符号化データを第2のメモリ106のみに格納する。それと並行して、ステップS313の再符号化処理を行なう。再符号化処理では、第2のメモリ106に格納済みの符号化データを読み出して、再符号化部109にて再符号化処理を行ない、前記2つのメモリ104、106に格納する。そして、縦縞▲1▼の符号を全て再符号化するまで、該符号化処理と再符号化処理を継続する。再符号化部109から出力される再符号化データは、量子化ステップ変更後に符号化部102から出力される符号化データと同じ量子化ステップで符号化して得られる符号化データと全く同一の符号化データである。
【0038】
具体的にこの再符号化処理では、符号化データを一旦ハフマン復号した後の各量子化値に対して、これら値を2nで割った結果と同様の結果が出るビットシフト処理を施した後、再度ハフマン符号化を行なうことにより実現される。この方法は、ビットシフトのみで量子化ステップを変更する点と逆直交変換や再直交変換処理を行なわない点で、高速な再符号化処理が可能である。ステップ315では、再符号化処理の終了検知が行なわれる。
【0039】
再符号化後のデータ量は再符号化前の符号化データのデータ量よりも少なくなるので、図5に示すように、再符号化前の符号を格納していたメモリ領域に再符号化後の符号化データを上書きするように格納することができる。再符号化処理が終了した時点で、縦縞▲1▼の符号化データのデータ量は図6に示すの斜め縞▲1▼の符号化データのデータ量へと減少する。
【0040】
以上で説明したステップS307〜315が、符号化・再符号化フェーズで行なう処理である。
【0041】
<<転送フェーズ>>
再符号化処理が終了したら、ステップS317では転送処理が行なわれる。該転送処理では、図6に示すように、符号化・再符号化フェーズで第2のメモリ106のみに格納した斜め縞▲2▼の符号化データを、第1のメモリ104内の斜め線▲1▼の符号化データに連結されるアドレスに転送し、格納する。その一方で、第2のメモリ106上で分散してしまっている斜め縞▲1▼の符号化データと斜め縞▲2▼の符号化データが第1のメモリ104上で連続して格納される様に、前記斜め縞▲2▼の符号化データを第2のメモリ106内で転送し、連結させる。これが、転送フェーズで行なう処理である。
【0042】
上記転送フェーズが終了したら、ステップS303、S305の符号化フェーズに戻り、図7に示すように斜め縞▲4▼の符号を符号化部102から出力して2つのメモリ104,106に格納する。この符号化フェーズは、初期状態の符号化フェーズ(図4)と少し異なり、符号化部102で符号化する際の量子化ステップがQ1からQ2に変更されていると共に、2つのメモリ104,106に格納されている符号化データも様々なフェーズで処理された符号の集まりである。それらの違いを無視すれば、転送フェーズ直後の符号化フェーズと初期状態の符号化フェーズは、同じと見なせる。
【0043】
よって、符号化フェーズ、符号化・再符号化フェーズと転送フェーズの3つを繰り返すことで、最終的に1ページの画像データをデータ量設定値以下に圧縮した符号を第1のメモリに格納することが出来る。しかも、入力部101は一連の処理が終わるまで、入力を継続するだけである。すなわち、画像を再度最初から入力し直すということが無くなる。
【0044】
図3に示したフローチャートは、説明が理解しやすいように、図4、図5、及び、図6に示した各フェーズに対応する処理のみを記述した。しかしながら実際には、1ページの画像データの入力はどこかのフェーズで終了する。従って、どのフェーズで終了したかによって、それ以降の対応も多少異なる。それを考慮した流れを示したのが図8のフローチャートである。図8のフローチャートは、1ページ分の画像データの入力完了と図3で説明した各種処理との関係を考慮したものであり、ここでは図3のフローチャートに、ステップS801、S803、S805、S807を追加している。
【0045】
ステップS801、S803、S805は、それぞれ、符号化フェーズ、符号化・再符号化フェーズ、転送フェーズにおいて、入力部101からの1ページ分の画像データの入力が終了したことを検知する。
【0046】
符号化フェーズと転送フェーズで1ページ分の画像データの入力が終了したことを検知した場合(ステップS801、S805)、ステップS807へ移り、当該ページの圧縮符号化処理を終了し、次に処理すべき1ページ以上の画像データがあれば、次の1ページ分の画像データの圧縮符号化処理を開始し、無ければ停止状態に入る。
【0047】
一方、符号化・再符号化フェーズで1ページ分の画像データの入力終了を検知した場合(ステップS803)には、符号化部102では再符号化処理する画像データが無くなるまで一旦動作を止める必要があるので、ステップS311の符号化処理をパスし、ステップS313で、今までに符号化部102で符号化済みの画像データを所定の符号化データ量に抑える為の再符号化処理のみを継続して行なう。再符号化処理が全て終了して、その後の転送処理が終わらないと、1ページ分の画像データ全体の符号化データが第1のメモリ上に集まらないため、1ページ分の画像データの入力終了後も再符号化処理及びそれに続く転送処理は継続して行われる必要がある。この場合には、ステップS315にて、再符号化処理が全て終了したことを検知すると、符号化・再符号化フェーズ中に、第2のメモリ106のみに格納された符号化データを第1のメモリに転送し(ステップS317)た後、次のステップS805にて、1ページ分の画像データの入力終了が検知されてステップS807へ移ることになる。
【0048】
以上が動作であり、図8の動作説明でもある。
【0049】
<メモリ格納方法の変形例>
図9、図10は図5、図6の概念図で示したメモリ格納方法の変形例を示す図である。
【0050】
図5の概念図においては、符号化・再符号化フェーズでは、符号化部102から出力する符号化データは第2のメモリ106のみに格納していたが、図9に示すように符号化・再符号化フェーズ中に、符号化部102から出力する符号化データを第1、第2メモリの両方に直接格納する。
【0051】
符号化部102から見ると、どのフェーズで符号化して出力する符号化データも両方のメモリへ格納することになる。また、図6の概念図とは異なり、図10に示す様に、転送フェーズでメモリ間のデータ転送が必要なくなる。またこの変形例の場合には、符号化・再符号化フェーズにおいて、符号化データと再符号化データを第1のメモリ104へ送った順序で順次格納される。そのため2種類のデータが入り混じってしまうという問題は有る。
【0052】
従って、この変形例の場合にはこれに対応する為に符号化データをある単位で区切って、ファイル或いはパケットとして管理する様にする。具体的には、ファイル管理テーブル、或いは、パケット管理テーブル等を別に作成して管理する。
【0053】
一つの手法としては、符号化部102からのデータを第1メモリ104に格納する際、適当な単位(例えば前記直交変換の単位が8×8のブロックであるので、8×i(i=1、2…の整数)ライン分のデータ)毎に、画像データの先頭から管理番号を割り当て、各管理番号に対応する符号化データの格納先頭アドレスと該符号化データ量とを、管理番号順に格納できるような管理テーブルを作成する。
【0054】
符号化部102や再符号化部109は処理中のデータの管理番号を保持し、該管理番号に基づいて、符号化データ格納時の先頭アドレスと符号化データ量とを管理テーブルに書き込む。このようにすれば、符号化部102と再符号化部109で処理した符号化データをランダムに格納したとしても、前記管理テーブルを管理番号順にアクセスし、その時読み出させる先頭アドレスと符号化データ量に基づいて、符号化データを第1メモリ104から読み出せば、画像の先頭から順番に符号化データを読み出すことができる。このような管理機構を設ければ、画像上で連続するデータをメモリ上で連続するように格納する必要性が無くなる。
【0055】
図10の概念図における転送フェーズ後の符号化フェーズは、これまで説明した2つの符号化フェーズ(図4、図7)とほとんど同じであり、第1のメモリ内における符号の格納状態が図11に示した様に若干異なるだけである。よって、先の説明と本変形例は、3つのフェーズを繰り返して処理することに変わりは無い。
【0056】
次に、本発明において特徴的な符号化処理を行なう為の、第2の基本構成の例(これまで説明した構成を第1の例という)を図2を用いて説明する。
【0057】
図2は、第2の例における画像処理装置200のブロック構成図である。
【0058】
図1の画像処理装置100と大きく異なる点は、最初に符号化を行なう符号化部が2つ並列に存在する点である。画像処理装置200は、入力部201から入力される画像データを、第1の符号化部202と第2の符号化部205で並行して符号化し、互いに圧縮率の異なる2種類の符号化データを生成する。本例でも、符号化方式は公知のJPEG符号化方式を用い、8×8画素単位に相当する画像データを直交変換し、後述する量子化ステップを用いた量子化、ハフマン符号化処理を行なうものである。
【0059】
なお、本例では第1の符号化部202よりも、第2の符号化部205の方が適用する圧縮率を高く設定する場合について説明する。具体的には、第1の符号化部202における量子化ステップをQ1、第2の符号化部205の量子化ステップをQ2(=2×Q1)とする。
【0060】
符号化部202から出力される符号化データは、第1のメモリ制御部203を経由して、第1のメモリ204に格納される。このとき、第1のカウンタ208は、符号化部202から出力される符号化データのデータ量をカウントし、これを保持すると共に、符号化シーケンス制御部209にも出力する。
【0061】
一方、符号化部205で符号化された符号化データは、第2のメモリ制御部206を経由して、第2のメモリ207に格納される。このとき、第2のカウンタ210は、符号化部205から出力される符号化データのデータ量をカウントし、これを保持する。更に、後述する第2のメモリ207に格納している符号化データを第1のメモリ204に転送する時には、それと同時に上記カウント値を、第1のカウンタ208に転送する。
【0062】
さて、第1のカウンタ208が符号化部202から出力される符号化データのデータ量をカウント中に、該カウント値がある設定値に達した時には、符号化シーケンス制御部209は、第1の例と同様、メモリ制御部203に対してメモリ204に格納されているデータを廃棄するよう制御信号を出す。
【0063】
そして、符号化シーケンス制御部209は、第2のメモリ207に格納している符号化データを読み出して第1のメモリ204に転送し、第1のメモリ204に格納するよう、メモリ制御部206とメモリ制御部203に制御信号を出力する。この結果、第2のカウンタ210のカウント値が第1のカウンタ208に転送され、その値が第1のカウンタのカウント値としてロード(上書き)される。
【0064】
要するに、上記第2のカウンタ210のカウント値は、第2のメモリ207に格納している符号化データのデータ量を表わしているので、そのカウント値と符号化データを、互いの対応付けが変わらない様に、そのまま第1のカウンタと第1のメモリへコピーしたと考えれば良い。
【0065】
さらに、符号化シーケンス制御209は、第1の符号化部202および、第2の符号化部205に対して、今までよりも、符号化データが少なくなるような符号化を行なうように制御信号を出す。
【0066】
例えば、第1の符号化部202、及び、第2の符号化部205における量子化ステップSを2倍に切り替えす。この結果、第1の符号化部202は、その直前までの第2の符号化部205における量子化ステップQ2(=2×Q1)を継承することになり、第2の符号化部205は更に大きな量子化ステップQ2×2を用いて、次のオーバーフローに備えた更に高い圧縮率の符号化処理を行うことになる。
【0067】
ここでは、量子化ステップの倍率比を2倍としたがこれに限らず、任意に設定できることは示すまでもない。切り替えられた各符号化部202、205から出力された符号化データは、それぞれ、対応するメモリ制御部203、206を経由して、対応するメモリ204、207に格納される。
【0068】
そして、符号化シーケンス制御209は、メモリ制御部206に対し、既に第2のメモリ内に格納している符号化データを読み出して、再符号化部211にデータを送るよう制御信号を出す。再符号化部211は、図1の再符号化部109と同様にして符号化データの再符号化処理を行なう。
【0069】
第3のカウンタ212は、再符号化部211が出力したデータ量をカウントするもので、再符号化処理を開始する直前にゼロにリセットされ、再符号化処理中の出力データ量をカウントする。このカウンタ212は、再符号化処理が終了した時点で、そこで得られたカウント値を第2のカウンタ210に転送する。
【0070】
第2のカウンタ210は、上記転送されてきたデータ量カウント値を、第2のカウンタ210内に保持しているカウンタ値に加算することにより、再符号化処理中にメモリ207に格納した、符号化データと再符号化データの合計のデータ量を算出する。即ち、メモリ207に格納しているデータ量とカウンタ210のカウント値とが一致する。
【0071】
再符号化処理の終了/未終了に関わらず、符号化するべき入力部201からの画像データが残っていれば、2つの符号化部202と205による符号化処理を継続して行なう。そして、カウンタ208のカウント値がある設定値に達したかどうかの監視は入力部201から入力される1ページ分の画像データの符号化処理(符号化、再符号化)が終わるまで繰り返され、上述した符号化と再符号化の処理は、ここで得られる検出結果に応じた制御の上で実行される。
【0072】
上記図2の構成における処理のフローを表わすフローチャートを図12に示す。
【0073】
図2で説明したように符号化部が2つある場合は、図12に示すフローチャートに基づいて1ページ分の画像データの符号化を行なう。なお、図12の説明は、符号化部が1つの場合のフローチャートである図8とは、大半は類似しており、当業者であれば上記説明から本第2の実施形態の特徴は十分に理解できるであろうから、符号化部1つの場合と同じように3つのフェーズで処理を説明する様にし、図8と異なる点を主に説明することとする。
【0074】
上述した図8のフローと本実施形態のフローとの一番大きな違いは、ステップS317の転送処理が、ステップS307とステップS309の間に移動していることである。要するに、符号化・再符号化フェーズと転送フェーズが入れ替わったと見なせば良い(ステップS307の符号化データの廃棄処理は例外である)。
【0075】
ステップS301の符号化パラメータの初期設定では、第1の符号化部202に量子化ステップQ1を、第2の符号化部205には量子化ステップQ2(=2×Q1)を設定する。
【0076】
符号化フェーズでは、ステップS801、S303、S305を繰り返し実行する。ステップS801とステップS305は符号化部が1つの場合と同じ処理であるが、ステップS303の符号化処理だけは図13に示すように異なっている。
【0077】
第1のメモリ204へ格納する符号化データは圧縮率が段階的に高くなるようにするため、最初に格納する符号化データは圧縮率が一番低い量子化ステップQ1で符号化したデータを格納し、第2のメモリへ格納する符号化データは量子化ステップQ2で符号化したデータを格納する。
【0078】
第1のメモリ204へ格納中のデータ量が設定されている上限値をオーバーしたら(ステップS305)、直ちに、第1のメモリ204で保持していた符号化データを廃棄し(ステップS307)、第2のメモリ207で保持している圧縮率の高い符号化データを、第1のメモリ204へ転送する(ステップS317、図14参照)。これにより、第1の実施形態(図1)で説明した1回目の再符号化処理の終了を待たずに、速やかに、上限値をオーバーしない適切な2番目の候補の符号化データを第1のメモリ207内に格納出来る。これが、図1に対する、2つの符号器を持つ図2を適用することの最大の利点である。
【0079】
本第2の実施形態では、2つのメモリ204、207で同じ圧縮率の符号化データを持っていることが無駄という考え方なので、第2のメモリ207には、第1のメモリ204に格納する符号化データよりも圧縮率の高い符号化データを格納しておくようにしている。従って、それ以降の処理もこの考え方に基づき行われるものであり、第2のメモリ207内の符号化データを第1のメモリ204に転送する処理(転送フェーズ)が終了した後は、第2のメモリ207の符号化データを、更に1段階圧縮率の高い符号化データを保持する様に再符号化することとなる。
【0080】
具体的には、まず図15に示す様に、転送フェーズの次の符号化・再符号化フェーズでは、上記再符号化の前に、2つの符号化部202,205に適用される各量子化ステップQ1、Q2をそれぞれQ2、Q3へ変更し(ステップS309)、1ページの画像データの入力が終了せずに続いていれば(ステップS803)、後続の画像データは新たな量子化ステップが設定された2つの符号化部で該入力データを符号化して(ステップS311)、対応する各メモリ204,207へ格納する。そして、上記符号化処理と並行して第2のメモリに格納されている符号化データ(第1のメモリ204に転送したもの)は、第1のメモリ内の符号化データよりも1段階高い圧縮率の符号化データに変更するべく、再符号化部211にて量子化ステップQ3を用いて符号化されたデータが得られる様な再符号化処理(S313)を行ない、再符号化データを第2のメモリ207に格納し直す。
【0081】
なお、本第2の例でも、第1の例と同様、再符号化処理では、符号化データを一旦ハフマン復号した後の各量子化値に対して、これら値を2nで割った結果と同様の結果が出るビットシフト処理を施した後、再度ハフマン符号化を行なうことにより実現される。この方法は、ビットシフトのみで量子化ステップを変更する点と逆直交変換や再直交変換処理を行わない点で、高速な再符号化処理が可能である。
【0082】
なお、本第2の実施形態の様に符号化部が2つ有る場合には、図15に示したように、第2のメモリ207に符号化データと再符号化データを混在して格納する状況が発生する。従って、前述したように、符号化データをある単位で区切って、ファイル或いはパケットとして管理することが、第2のメモリ207に対しても必要になる。その為には、例えば第1の例における変形例と同様の構成を設ければ良いであろう。
【0083】
図12において、再符号化処理の終了をステップS315で検知したら、また符号化フェーズ(ステップS801、S303)に移行する。なお、符号化・再符号化フェーズ後の符号化フェーズでは、図16に示すように、2つのメモリ204,207が保持する符号化データは圧縮率が違うだけでなく、符号化データの混在の仕方(アドレス)もかなり違ってくる。従って、再度、第1のメモリ204のデータ量が設定値をオーバーした場合には、第2のメモリ207で保持されている符号化データ(▲6▼+▲8▼の横縞の領域の符号)が第1のメモリ204へ転送される必要が出てくる。これらを考慮すると、第2のメモリ207だけでなく、第1のメモリ204でも符号化データをファイル或いはパケットとして管理する必要がある。よって、第1のメモリ204にも前述の管理テーブルを用いた管理機構が必要となる。
【0084】
図16に示された符号化フェーズの状態は、量子化ステップと符号化データの混在の仕方が、再符号化処理の前後で異なっていること以外は、初期状態の符号化フェーズ(図13)と同じである。よって、符号化フェーズ、転送フェーズと符号化・再符号化フェーズを繰り返すことで、最終的に、1ページ分の画像データを設定した上限値以下に圧縮した符号化データを確実に第1のメモリ204に格納することが出来る。
【0085】
なお、第1の例の説明とは、転送フェーズと符号化・再符号化フェーズの配置順が逆であることから、図8において転送処理後に行なっていた1ページ分の画像データの入力終了検知(ステップS805)は、符号化・再符号化フェーズで行なう1ページ分の画像データの入力終了検知(ステップS803)と、ほとんど同じタイミングになってしまう。また、2つの検知処理は、機能的にはステップS805と同じで、タイミング的にはステップS803と同じである、従って、これら2つのステップは、新たな1ページ分の画像データの入力終了を検知するステップとして統合し、ステップS1201と表記しておく。
【0086】
以上説明した第1、第2の例では、第1のメモリと第2のメモリは物理的に別のメモリであるとして説明をしてきた。これは、2つのメモリに対するアクセスが独立したものとすることができるので有利なためであり、本発明の特徴となす。しかしながら、第1のメモリと第2のメモリを、物理的に別のメモリとしない場合も本発明の範疇に含まれる。物理的に1つのメモリ上に、前記第1のメモリと第2のメモリに相当する2つの領域を確保して、第1のメモリを第1のメモリ領域、第2のメモリを第2のメモリ領域と言い直して、これまでの説明を読み直せば、本発明は、1つのメモリでも実現できることが分かる。
【0087】
また、1つのメモリで上記各実施形態を実現する場合には、前記転送フェーズで説明したデータ転送処理のいくつかは不要となる。その詳細はその都度容易に想像できるので説明は省略するが、前記2つの領域を厳密に別けて使用する場合、物理的に2つのメモリを持つ時と同じようにデータ転送処理が必要であるが、2つの領域間で同じデータを共有することになれば、データ転送処理が不要になるだけでなく記憶容量の削減も図れる。
【0088】
例えば、第2のメモリ領域で保持していた符号化データを、第1のメモリ領域へ転送する際、該符号化データが格納されている先頭アドレスとデータサイズの2つの情報を第2のメモリ制御部から第1のメモリ制御部へ転送するだけで、前記符号化データを転送したのと同じ効果が得られる。
【0089】
前記符号化データを、ファイル形式やパケット形式で格納している場合は、メモリ制御部の間で転送する情報は少し増え、該符号化データに関連する管理テーブル情報を転送する必要がある。それでも、符号化データを転送するよりは、効率が良い。
【0090】
さて、上述した画像処理装置によると、入力した画像データを符号化していく際に、目的とするサイズに越えるような場合であっても、その入力を継続しつつ目標とするサイズに収めるよう処理を継続することができるようになる。本発明では、上記構造をその基礎とし、更に、カラー画像の符号化に特に有効に機能させることを特徴とするものである。以下に、その具体的な例を実施形態として説明する。
【0091】
<第1の実施形態>
図17は本実施形態が適用するデジタル画像処理装置のブロック構成図である。
【0092】
図中、1000はカラー画像の入力ポート(像域情報及びカラー画像データ)である。この入力ポート1000には、図示に示す如く、イメージスキャナー1020及びホストコンピュータから出力されてきた印刷データに基づくレンダリングエンジン1021のいずれか一方を選択するセレクタ1023が接続されている(不図示の操作パネルで選択するか、入力があった方を自動選択する)。いずれからもカラー画像データ1031、1032と像域情報1033、1034(画素毎に、その画素が文字・線画領域か中間調領域にあるか、及び、カラーかモノクロかを識別する情報)が出力されてくるものとする。レンダリングエンジン1021においては、印刷データに基づいて像域情報を生成できる(中間調画像の場合にはホストコンピュータコンピュータからイメージデータとして転送されてくるし、文字線画の場合には描画コマンドに従うからである)。一方、イメージスキャナ部1020では、基本的に原稿画像を読み取って、その読み取った画像に基づいて文字線画領域か中間調領域かの判断、及び、カラーかモノクロかを判断する必要がある。従ってこの像域情報を生成する回路が内臓されているものとする。
【0093】
1001は入力した画像を複数ライン(後述するタイルを抽出するだけの容量)を有するラインバッファである。また、1002はカラー画像符号化器であり、図1における符号化部102に対応する。ただし、本実施形態におけるカラー画像符号化器1002内には、入力したカラー画像データを一旦、輝度信号と色差信号に変換する変換回路を備え、その変換された後のデータについて圧縮符号化するものとする。輝度、色差信号としては、Y、Cr、Cb等で代表される色空間があるが、YIQでも構わない。従って、実施形態では便宜上、輝度データをY、色差信号をC1、C2と表記することとする。
【0094】
1003は符号化されたカラー画像を記憶する外部メモリである(例えばハードディスク等)。1005は外部メモリ1004から読み込んだ符号化済み画像データに対して復号処理するために一時的に格納する復号バッファであり、1006は復号器である。1007は復号された画像を一時的に記憶するラインバッファである。1008は接続されたプリンタ部1009に、ラインバッファ1008に格納された画像を出力するための出力ポートである。なお、プリンタ部1009内には、Y、C1、C2のデータを記録色成分であるY、M、C(もしくはY、M、C、Bk)に変換する変換回路が設けられているものとする。また、プリンタ部1009の記録方式は例えばレーザビームプリンタ、インク液滴を吐出するタイプのプリンタ等、その印刷方式は如何なるものでも良い。
【0095】
また、1010は内部バッファ1003に格納される符号データ量を監視する符号量監視部であり、1011は再度符号化を行う符号変換部である。
【0096】
図1との関係からすると、内部バッファ1003が、図1における第1のメモリ、第2のメモリを兼用することになる。また、符号シーケンス制御部108、第1カウンタ107、第2カウンタ110、セレクタ111が符号量監視部1010に対応し、再符号化部109が符号変換部1011に対応することになる。
【0097】
カラー画像符号化器1002では、ラインバッファ1001に格納された画像データを8×8画素のサイズのタイルに分割し(各タイルは8×8に限らずM×M画素でも良い)、この8×8画素毎にカラー情報の符号化を行う。カラー画像については離散コサイン変換符号化(JPEG)、像域情報についてはランレングス符号化に分けて符号化される。
【0098】
像域情報は、各画素毎につけられるものであるが、本実施形態のように8×8ブロック毎にDCTで処理するものに対しては,ブロック毎に,像域フラグを代表させて用いられることになる。像域の分け方としては、先に説明したように、画像の文字領域と写真領域、カラーかモノクロかであるものとするが、これ以外であってもよいし、これに更なる成分を追加しても構わない。
【0099】
さて、符号量監視部1010は、カラー画像符号化器1002によって生成される符号量の監視を行い、設定量を超えると予想された場合は、符号化器1002に対してそれ以降に入力されるカラー画像データ(及び属性情報)についてはより高くなるように符号化を行わせ、従前に符号化されたデータについては、符号変換器1011で再符号化をしてより高い符号化を行うことになる。
【0100】
本実施形態では、符号量が設定値を越えると判断する毎に、徐々に符号化効率を上げるため、以下に説明するようにした。
【0101】
先に説明したように実施形態は、カラー画像を符号化するものである。そして、カラー画像データは輝度データYと色差データC1、C2の色空間形式で表現した。
【0102】
符号量監視部1010(図1における符号化シーケンス制御部108)は、或るページの符号化を開始してから、符号化部102で生成した符号量が目標値を越えたと判断した場合、符号化部102に対して、色差成分C1、C2を直交変換した後の交流成分(AC)について、量子化ステップをそれまでよりも高く設定して符号化させる。これにより、目標値オーバーと判断した以降に入力されるカラー画像については、より高い圧縮率で符号化がなされることになる。
【0103】
また、目標値オーバーと判断した場合の、直前までの符号化されたデータは、第2のメモリに格納されているので、第2メモリ制御部105に対して符号化された色差成分データC1、C2のみを再符号化部109に出力させ、セレクタ111に対して再符号化部109に出力するよう制御指令を発行する。また、符号化シーケンス制御部108は、再符号化部109に対して、符号化された色差データC1、C2それぞれを復号化させ、その交流成分(AC成分)の量子化ステップを高くして再符号化させる。再符号化された色差成分データは、第1のメモリ104、第2のメモリ106に格納させる。この結果、目標値オーバーとなる以前の符号化データについても、高い圧縮率で符号化が行われることになる。
【0104】
要するに、或るページのカラー画像データを入力して符号化している場合に、最初に目標値オーバとなった場合には、色差成分C1、C2に対して量子化ステップをより高くして、符号化を継続することになる。
【0105】
さて、上記のような処理をしている最中に、再度目標値オーバーとなった場合には、今度は、輝度Yの交流成分を変更対象として決定する。
【0106】
こうして、目標値オーバーとなると判断する毎に、輝度成分Y及び色差成分C1、C2それぞれの交流成分、直流成分についての量子化ステップを変更(大きく)し、圧縮率を徐々に上げていくことになる。
【0107】
この為、符号化シーケンス制御部108は、図18に示すようなシナリオテーブルを有し、或るページについて目標値オーバーとなる回数をカウントしていくに従って、図示の1番目のシナリオから2番目、3番目…と、圧縮率を徐々に上げていくよう制御する。
【0108】
従って、或るページの符号化中に最初に目標値オーバーとなった場合には、図18に従えば、色差成分C1、C2の交流成分ACが選択対象となるので、先に説明した処理が行われることになる。
【0109】
図19は、符号化進行状況とメモリ充足率との関係の説明図である。以下、同図に従って、動作シーケンスについて簡単に説明する。
【0110】
図では,2/8の時点で、初期値の条件(初期段階での符号化パラメータ)での符号化データ量がオーバーフローしたことを示している。実施形態によれば、このとき以降については、色差成分C1、C2の直交変換後の交流成分の量子化ステップを大きくしてカラー画像データを継続して符号化させ、既に符号化済みのデータについては、その中の色差成分を復号してその交流成分の量子化ステップを大きくして、再符号化処理スタートすることになる。
【0111】
また,3/8の時点では、目標値オーバーと判断されたとき以前の再符号化が完了し、第1のメモリ104への転送処理が完了したことを示している。
【0112】
また,4/8の時点で、再び、オーバーフローするので,再符号化処理をスタートする。このときのオーバーフローは2回めであるので、図18に従えば、今度は輝度成分の交流成分を選択して、処理を行うことになる。5/8の時点で、この再符号化が終了し、転送処理を完了していることを示している。
【0113】
そして、8/8の時点で、1ページの符号化が完了していることを示している。
【0114】
上記例では、3/8の時点で、メモリが約25%オーバーランしているが、これは、圧縮率と再符号化時間で、決まってくるものであり、実機では、設計パラメータとして、バッファメモリの余裕分として確保する必要があるが、それほど大きくなるものではない。処理時間は、図からわかるように、1枚画像を符号化する時間内で終了している。
【0115】
なお、上記の説明からもわかるように、実施形態では色差成分及び輝度成分について、それぞれの直流成分と交流成分の量子化ステップが独立して設定することができるようになるので、第1のメモリ104には、輝度、色差それぞれの交流成分、直流成分における量子化ステップの値を格納することになる。
【0116】
図20(a)乃至(d)は、DCT係数の直流係数(DC係数)の説明図である。同図(b)はDC係数符号化の説明図である。8×8のDCT変換されたDC係数値(図の左上の小さい正方形)とその隣接するブロックのDC係数値との差分をとり、これを可変長符号化する。
【0117】
同図(a)は符号化ブロック図であり、DC係数1205は、ブロック遅延器1201で遅延された直前のブロックのDC係数との差分が差分器1202でとられる。差分値は,グループ化処理でグループ番号SSSSに変換される。
【0118】
またグループ化部では、同図(c)で示したように、DC差分値に応じた付加ビット数が決定される。また、グループ番号SSSSは1次元ハフマン符号化器1204,同図(d)で示した表にしたがって、ハフマン符号化される。
【0119】
これらの表をみると,グループ番号が小さい方がハフマン符号と付加ビット数が少ないことがわかる(場合によっては同じ)。
【0120】
したがって、DC差分値が,1/2になると,グループ番号が1つ小さくなり、ハフマン符号と付加ビットを合わせた可変長符号部が1〜2ビット短くなることがわかる。
【0121】
図22は、DCT係数の交流係数(AC)係数の符号化方式の説明図である。
【0122】
AC係数1301は、ジグザグスキャン順に並び替えて,判定器1302で0の場合は,ランレングスカウンタ1303で0の係数の連続数(ラン長)を計数しラン長NNNN1306を出力する。また0以外の係数値は、図20と同じようにグループ化器1304でグループ番号1307と付加ビット1302を出力する。二次元ハフマン符号化器1305では,ラン長NNNNとグループ番号SSSSを組み合わせてハフマン符号化する(図23参照)。
【0123】
ラン長NNNNが15を超える場合は、ラン長16を示すZRLを必要な数だけ出力する。たとえば,ラン長35は,ZRL+ZRL+ラン長3に変換し、符号化する。
【0124】
また,最後の有効係数(0以外の係数)の後に,EOB(End of Block)を付加する。
【0125】
なお、実施形態では、8×8のブロックについてDCT処理することになるので、ジグザグスキャンする順番は図22に示すようになる。
【0126】
図24は、ラン長とサイズから引くハフマン符号テーブルの一部を示したものである。
【0127】
したがって、AC係数値が、1/2になると、グループ番号が1つ小さくなり、ハフマン符号と付加ビットを合わせた可変長符号部が1〜2ビット短くなることがわかる。
【0128】
さらに、係数値がゼロになりラン長も長くなるので、符号化対象となる優位シンボルの数も減少するので、符号長がさらに短くなる。
【0129】
<第2の実施形態>
次に、再符号化の開始ポイントにより、色信号選択テーブルのインデックスを設定する例を第2の実施形態として説明する。
【0130】
図25は、符号化進行状況とメモリ充足率との関係の説明図である。
【0131】
図では、6/8の時点で、初期値の量子化ステップでの符号化がオーバーフローして、再符号化処理スタートし、また符号化は、量子化ステップを変更して続行を行う。この例では、6/8時点で終了が近いところで、オーバーフローした例であるので、ここでもし、全色成分を再符号化すると、ここから約半分の符号に削減してしまうことになり、予定符号量より圧縮し過ぎてしまうことが充分予想される。そこで、たとえば、色選択テーブルの色差成分のAC成分のみ再符号化の対象にするように、符号化シーケンス制御部で、1枚の画像の処理量のカウントをもとに、インデックス制御すると、それ以降の、圧縮のし過ぎを防ぐことができる。
【0132】
<適用例>
上記実施形態では、イメージスキャナから画像を読み取る装置を例にし、その装置の機能動作について説明した。そして、その機能のほとんど(符号化処理も含む)は、上述した様にコンピュータプログラムによって実現できる。
【0133】
従って、本発明はパーソナルコンピュータ等の汎用情報処理装置上で動作するアプリケーションプログラムに適用しても構わない。アプリケーションプログラムに適用する場合には、圧縮元となる画像ファイルをユーザに指定させると共に、目標サイズをユーザに選択させる等のGUIを設ければ良いであろう。このときの目標値は、ユーザーが任意に設定できるものとするが、数値での設定はわかりずらいので、原稿サイズと画質(高中低等)を加味した直感的に分かりやすいメニューから選択させることで、決定するようにすれば良いであろう。
【0134】
また、符号化部の符号化パラメータとして量子化ステップを例にして説明したが、圧縮率の異なるデータが混在した際に、それらの間での画質が違和感が発生しないようにする限りは、他のパラメータを用いても良い。但し、例えば、図1の構成においては、再符号化部109からの再度符号化するデータが、パラメータ変更後の符号化部102からの符号化データと実質的に同じにするには、上記実施形態に示す如く、量子化ステップを増加する手法が好ましい。
【0135】
また、実施形態では、カラー画像を輝度、色差データとして圧縮符号化する例を説明したが、色成分を表現する色空間として輝度、色差に限定されるものではない。例えば、La*b*表色空間等を用いてもよい。
【0136】
また、メモリオーバする毎に圧縮パラメータを変更するが、その対象としては人間の視覚では判別しずらい色成分を優先して量子化ステップを大きくすることが望ましい。従って、RGB色空間よりは、むしろ、輝度、色差(色相、彩度)といった、人間の視覚特性に適合する色空間を採用することが望ましい。
【0137】
また、上記の通り、本発明は、汎用装置上で動作するアプリケーションプログラムによって実現できるものであるので、本発明はコンピュータプログラムをも含むものである。また、コンピュータプログラムは、通常、フロッピーディスクやCDROM等の記憶媒体を装置にセットしてコピー或いはインストールことで行われるので、かかる記憶媒体も本発明の範疇に当然に含まれる。
【0138】
また、実施形態では、スキャナから画像データを入力するものとして説明したが、ホストコンピュータ上で動作するプリンタドライバに適用しても良い。プリンタドライバに適用する場合には、上位処理(アプリケーション等)から印刷対象のデータを受信したときに、その時点で、そのデータが中間調画像か、文字・線画かは勿論は判別できるので、像域情報生成処理にかかる構成を省くか、或いはより簡素なものとすることができる。
【0139】
また、本発明は、コンピュータプログラムと適当なハードウェア(符号化回路等)の組み合わせにも適用できる。
【0140】
【発明の効果】
以上説明したように本発明によれば、多値カラー画像の符号化において、再入力を行うことなく、目標サイズに収まるよう符号化させ、且つ、カラー画像の品質の劣化を最小限にさせることが可能になる。
【図面の簡単な説明】
【図1】本発明を適用する画像処理装置の第1の基本構成を示す図である。
【図2】本発明を適用する画像処理装置の第2の基本構成を示す図である。
【図3】図1の構成における処理を簡略化して示したフローチャートである。
【図4】初期状態の符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図5】符号化・再符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図6】転送フェーズにおけるデータフローとメモリ内容を表わす図である。
【図7】転送フェーズ後の符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図8】図1の構成における処理の詳細を示すフローチャートである。
【図9】図1の構成の変形例における符号化・再符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図10】図9の変形例における転送フェーズにおけるデータフローとメモリ内容を表わす図である。
【図11】図9の変形例における転送フェーズ後の符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図12】図2の構成における処理手順を示すフローチャートである。
【図13】図2の構成における、初期状態の符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図14】図2に構成における、転送フェーズにおけるデータフローとメモリ内容を表わす図である。
【図15】図2の構成における、符号化・再符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図16】図2の構成における、符号化・再符号化フェーズ後の符号化フェーズにおけるデータフローとメモリ内容を表わす図である。
【図17】実施形態が適用する画像処理装置のブロック構成図である。
【図18】実施形態におけるメモリオーバ時のシナリオテーブルの内容を示す図である。
【図19】実施形態における符号量の推移を示す図である。
【図20】実施形態における直流成分の符号化の構造を動作を説明するための図である。
【図21】実施形態における交流成分の処理手順を示す図である。
【図22】DCT係数に対するジグザグスキャンを示す図である。
【図23】交流成分のグループ化のテーブルを示す図である。
【図24】ラン長とサイズから検索するハフマン符号テーブルの一部を示す図である。
【図25】第2の実施形態における符号化進行状況とメモリ充足率との関係の一例を示す図である。
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image processing apparatus that compresses and encodes color image data, a control method thereof, a computer program, and a computer-readable storage medium.
[0002]
[Prior art]
Conventionally, as a still image compression method, a JPEG method using discrete cosine transform and a method using Wavelet transform are often used. Since this type of encoding method is a variable length encoding method, the amount of code changes for each image to be encoded.
[0003]
In the JPEG method, which is an international standardization method, only one set of quantization matrices can be defined for an image. Accordingly, the code amount cannot be adjusted without pre-scanning, and there is a risk of memory over when used in a system that stores data in a limited memory.
[0004]
In order to prevent this, in order to adjust the code amount by changing the compression rate and re-reading the original when the code amount exceeds the planned code amount, or by estimating the code amount by pre-scanning in advance , The method of resetting the quantization parameter was taken.
[0005]
As a code amount control method for performing pre-scanning, for example, there is a method in which pre-compressed data is stored in an internal buffer memory, decompressed, changed in compression parameters, subjected to main compression, and output to an external storage. At this time, in the main compression, the compression rate is set higher than in the pre-compression.
[0006]
Further, for example, in order to obtain an allowable code amount for each pixel block and reduce the code amount, a method of performing Huffman coding on a coefficient obtained by level-shifting a DCT coefficient n times is known, and this shift amount n is an allowable code amount. Determined from.
[0007]
[Problems to be solved by the invention]
However, conventionally, a compression buffer larger than the target compression is required as the compression buffer, and in order to prevent an overflow of the buffer used intermediately, it is inevitable that the capacity is sufficient to record the original image data.
[0008]
Furthermore, in the method of repeating the encoding process, there is a problem that the speed of continuous processing is not increased because a process of decoding and recompressing all compressed data is performed.
[0009]
The present invention has been made in view of the above-described conventional example, and it is possible to generate encoded data that fits in an effectively set size by one image input, and in particular, multi-value color image data. An image processing apparatus, a control method thereof, a computer program, and a storage medium capable of minimizing deterioration in quality after compression are provided.
[0010]
[Means for Solving the Problems]
In order to solve this problem, for example, an image processing apparatus of the present invention comprises the following arrangement. That is,
Enter a luminance component and a chrominance component representing the color image, the luminance component is compressed using a first quantization step, a first compression means to compress using the second quantization step of the color difference component When,
Decodes the encoded data generated by said first compression hands stage, a second compression hands stage capable of re-compression,
Monitoring the encoded data amount generated by the first compression hands stage, the encoded data amount and a code amount monitoring means for determining whether reaches a predetermined amount,
At the first time when the code amount monitoring means determines that the predetermined amount has been reached, the second quantization step applied to the first compression means has a higher compression rate than the second quantization step. After changing to the third quantization step, the subsequent color difference component is compressed by the first compression means,
The second compression unit uses the third quantization step having a compression rate higher than that of the second quantization step for the encoded data of the color difference component previously generated by the first compression unit. To recompress
The encoded data of the color difference component obtained by the recompression is stored as encoded data of the color difference component generated by the first compression means after changing to the third quantization step,
The encoded data of the color difference component generated by the first compression unit after updating to the third quantization step is stored as subsequent encoded data,
At the second time when it is determined that the predetermined amount has been reached by the code amount monitoring means, the first quantization step applied to the first compression means has a compression rate higher than that of the first quantization step. After changing to a high fourth quantization step, the subsequently inputted luminance component is compressed by the first compression means,
The encoded data of the luminance component previously generated by the first compression means is converted into the second compression means by using the fourth quantization step having a compression rate higher than that of the first quantization step. To recompress
The encoded data of the luminance component obtained by the recompression is stored as encoded data of the luminance component generated by the first compression means after changing to the fourth quantization step,
The encoded data of the luminance component generated by the first compression unit after updating to the fourth quantization step is stored as subsequent encoded data .
[0011]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments according to the present invention will be described with reference to the accompanying drawings. First, basic portions will be described.
[0012]
FIG. 1 is a functional block configuration diagram of an image processing apparatus 100 to which the embodiment is applied. Hereafter, each part of the same figure is demonstrated easily.
[0013]
The image processing apparatus 100 includes an input unit 101 that inputs an image from an image scanner. The input unit 101 may input image data from page description language rendering or the like, or may be realized by reading an image file stored in a storage medium. Anyway.
[0014]
The encoding unit 102 encodes input image data. The encoding method uses a known JPEG encoding method, orthogonally transforms image data corresponding to 8 × 8 pixel units, and performs quantization and Huffman encoding processing using a quantization step described later. .
[0015]
The first memory control unit 103 and the second memory control unit 105 transmit the encoded data (the same encoded data) output from the encoding unit 102 to the first memory 104 and the second memory, respectively. Control is performed so that the data is stored in 106. Here, the first memory 104 is a network device or an image output device for connecting the encoded data finally determined (compressed to the data amount within the target value) outside the basic configuration of FIG. And a memory for holding the encoded data for output to a mass storage device or the like. The second memory 106 is a working memory that assists in the compression encoding process for forming the encoded data on the first memory.
[0016]
The counter 107 counts the data amount of the image data compressed and encoded by the encoding unit 102, holds the count value, and outputs the count result to the encoding sequence control unit 108 that controls the encoding sequence. To do.
[0017]
The encoding sequence control unit 108 detects whether or not the count value of the counter 107 has reached a certain set value. When it is detected that the set value has been reached (exceeded the target value), it has been stored in the memory 104. A control signal is output to the first memory control unit 103 so as to discard the data. The first memory control unit 103 discards the stored data by clearing the memory address counter or clearing the encoded data management table based on this control signal. At this time, the encoding sequence control unit 108 clears the first counter 107 to zero (the input from the input unit 101 continues), and the encoding unit 102 has a higher compression rate than before. To control encoding. That is, control is performed so that the amount of encoded data generated in the encoding process of this apparatus is finally reduced to, for example, ½. In addition, although it set to 1/2 here, it cannot be overemphasized that it can set arbitrarily.
[0018]
The encoded data after the compression rate change is also stored in the first memory 104 and the second memory 106 via the first memory control unit 103 and the second memory control unit 105, respectively, as before. The
[0019]
Furthermore, the encoding sequence control unit 108 reads out the encoded data stored in the second memory 106 so far to the second memory control unit 105 and re-encoding unit 109 serving as encoded data conversion means. A control signal is output to output the encoded data.
[0020]
The re-encoding unit 109 decodes the input encoded data, performs re-quantization to reduce the amount of data, etc., and then performs the encoding process again, and is the same as the encoding unit 102 whose compression rate has been changed. The data amount of the compression rate is output to the second counter 110.
[0021]
The encoded data output from the re-encoding unit 109 is stored in the first memory 104 and the second memory 106 via the first memory control unit 103 and the second memory control unit 105, respectively. Is done.
[0022]
The second memory control unit detects whether or not the re-encoding process has been completed. That is, when there is no more data to be read for the re-encoding process, the encoding sequence control unit 108 is notified of the end of the re-encoding process. Actually, not only the reading process of the second memory control unit 105 but also the process of the re-encoding unit 109 is completed, the encoding process is completed.
[0023]
The count value obtained by the second counter 110 is added to the counter value held by the first counter 107 after the re-encoding process is completed. This addition result represents the total amount of data in the first memory 104 immediately after the re-encoding process is completed. That is, at the time when the encoding process of the encoding unit 102 and the re-encoding unit 109 for one screen is completed, the counter value held in the first counter 107 after the addition is equivalent to one screen. Represents the total amount of data generated when is encoded (details will be described later).
[0024]
The encoding unit 102 continues the encoding process as long as image data from the input unit 101 to be encoded remains, regardless of whether the re-encoding process is completed or not.
[0025]
Whether or not the count value of the counter 107 has reached a certain set value is repeated until the encoding process (encoding and re-encoding) of one page of image data input from the input unit 101 is completed. The re-encoding process is executed under control according to the detection result obtained here.
[0026]
Also, a switching signal output from the code sequence control unit 108 is supplied to the selector 111, and the selector 111 sends the encoding symmetric signal to the re-encoding unit 109 or returns to the memory control units 103 and 105 as it is. Switch.
[0027]
FIG. 8 is a flowchart showing the process flow in the configuration shown in FIG.
[0028]
As described above, the image processing apparatus 100 of the present invention is an apparatus that compresses and encodes one page of image data input from the input unit 101 such as a scanner to a predetermined data amount or less. In order to realize the encoding process, in addition to the input unit 101, an encoding unit 102, a re-encoding unit 109, a first memory 104, a second memory 106, and the like are provided. Using these functional blocks, encoding processing is performed based on the flowchart shown in FIG.
[0029]
The flowchart of FIG. 3 is roughly divided into the following three processing phases.
(1) Encoding phase (2) Encoding / re-encoding phase (3) Transfer phase In each of the above processing phases, how image data, encoded data, etc. are processed and processed in the memory FIG. 4 to FIG. 7 show whether the data is stored visually.
[0030]
FIG. 4 shows an initial state of the encoding phase corresponding to steps S303 and S305 in the flowchart of FIG. 5 shows the processing state of the encoding / recoding phase corresponding to steps S307 to S315, FIG. 6 shows the processing state of the transfer phase corresponding to step S317, and FIG. 7 shows the encoding phase after the transfer phase. Indicates processing status. Hereinafter, each phase will be described.
[0031]
<< Encoding Phase >>
Encoding processing of image data for one page starts from initial setting of encoding parameters (step S301). Here, the upper limit value of the encoded data amount uniquely determined from the image size to be encoded (paper size read from the input unit 101 such as a scanner) or the encoding unit 102 (here, a known JPEG encoding method is used). Parameter such as a quantization step (Q1) to be applied.
[0032]
In step S303, the first counter 107 performs actual encoding processing (JPEG compression in units of 8 × 8 pixels of the image), and cumulatively counts the amount of encoded data to be output.
[0033]
Next, in step S305, it is detected whether the count value of the data amount has exceeded the upper limit value. If not, the JPEG encoding process in step S303 is continued. This is the initial encoding phase.
[0034]
The encoded data output from the encoding unit 102 is stored in both the first memory 104 and the second memory 106 as shown in FIG. A region indicated by vertical stripes represents the stored code.
[0035]
<< Encoding / Recoding Phase >>
When the encoding process of the encoding unit 102 proceeds and the count value of the data amount exceeds the set upper limit value, in step S307, the encoded data in the first memory 104 is discarded and the step In step S309, the quantization step of the encoding unit 102 is changed to Q2.
[0036]
That the count value of the data amount of the encoded data exceeds the set upper limit value means that the data amount after compression does not fall within the target value. Therefore, since it is meaningless to continue the encoding process using the same quantization step, it is changed to the quantization step Q2 having a larger quantization step width than Q1 so that the data amount is smaller than before. is there.
[0037]
After changing the quantization step, in step S311, the encoding process of the encoding unit 102 is restarted, and the encoded data is stored only in the second memory 106 as shown in FIG. In parallel with this, the re-encoding process in step S313 is performed. In the re-encoding process, the encoded data stored in the second memory 106 is read out, re-encoded by the re-encoding unit 109, and stored in the two memories 104 and 106. Then, the encoding process and the re-encoding process are continued until all the codes of the vertical stripes (1) are re-encoded. The re-encoded data output from the re-encoding unit 109 has exactly the same code as the encoded data obtained by encoding in the same quantization step as the encoded data output from the encoding unit 102 after changing the quantization step. Data.
[0038]
Specifically, in this re-encoding process, after the Huffman decoding of the encoded data, each quantized value is subjected to a bit shift process that produces a result similar to the result obtained by dividing these values by 2 n This is realized by performing Huffman coding again. This method enables high-speed re-encoding processing in that the quantization step is changed only by bit shift and that inverse orthogonal transformation or re-orthogonal transformation processing is not performed. In step 315, the end of the re-encoding process is detected.
[0039]
Since the amount of data after re-encoding is smaller than the amount of encoded data before re-encoding, as shown in FIG. 5, after re-encoding in the memory area where the code before re-encoding was stored Can be stored so as to be overwritten. When the re-encoding process is completed, the data amount of the encoded data of the vertical stripes (1) decreases to the data amount of the encoded data of the diagonal stripes (1) shown in FIG.
[0040]
Steps S307 to 315 described above are processes performed in the encoding / recoding phase.
[0041]
<< Transfer Phase >>
When the re-encoding process is completed, a transfer process is performed in step S317. In the transfer process, as shown in FIG. 6, encoded data of diagonal stripes (2) stored only in the second memory 106 in the encoding / re-encoding phase is converted into diagonal lines ▲ in the first memory 104. It is transferred to the address linked to the encoded data 1) and stored. On the other hand, the encoded data of the diagonal stripe {circle around (1)} and the encoded data of the diagonal stripe {circle around (2)} distributed on the second memory 106 are continuously stored on the first memory 104. Similarly, the encoded data of the diagonal stripe {circle around (2)} is transferred in the second memory 106 and connected. This is processing performed in the transfer phase.
[0042]
When the transfer phase ends, the process returns to the encoding phase of steps S303 and S305, and the code of the diagonal stripe (4) is output from the encoding unit 102 and stored in the two memories 104 and 106 as shown in FIG. This encoding phase is slightly different from the encoding phase in the initial state (FIG. 4), the quantization step at the time of encoding by the encoding unit 102 is changed from Q1 to Q2, and the two memories 104 and 106 The encoded data stored in is also a collection of codes processed in various phases. If these differences are ignored, the encoding phase immediately after the transfer phase and the initial encoding phase can be regarded as the same.
[0043]
Therefore, by repeating the encoding phase, the encoding / re-encoding phase, and the transfer phase, the code that finally compresses the image data of one page below the data amount setting value is stored in the first memory. I can do it. In addition, the input unit 101 simply continues input until a series of processing is completed. That is, it is not necessary to input the image again from the beginning.
[0044]
The flowchart shown in FIG. 3 describes only the processing corresponding to each phase shown in FIGS. 4, 5, and 6 so that the explanation can be easily understood. In practice, however, the input of image data for one page ends in some phase. Therefore, the correspondence after that is slightly different depending on which phase it is completed. FIG. 8 is a flowchart showing the flow considering this. The flowchart in FIG. 8 considers the relationship between the completion of input of image data for one page and the various processes described with reference to FIG. 3. Here, steps S801, S803, S805, and S807 are added to the flowchart in FIG. It has been added.
[0045]
Steps S801, S803, and S805 detect that the input of image data for one page from the input unit 101 has been completed in the encoding phase, the encoding / recoding phase, and the transfer phase, respectively.
[0046]
If it is detected that the input of image data for one page has been completed in the encoding phase and the transfer phase (steps S801 and S805), the process proceeds to step S807, where the compression encoding process for the page is ended, and the next process is performed. If there is more than one page of image data, the compression encoding process of the next one page of image data is started, and if there is no image data, a stop state is entered.
[0047]
On the other hand, when the end of input of image data for one page is detected in the encoding / re-encoding phase (step S803), the encoding unit 102 needs to stop operation until there is no image data to be re-encoded. Therefore, the encoding process of step S311 is passed, and in step S313, only the re-encoding process for suppressing the image data encoded by the encoding unit 102 so far to a predetermined encoded data amount is continued. And do it. When all the re-encoding processes are completed and the subsequent transfer process is not completed, the encoded data of the entire image data for one page is not collected on the first memory, so the input of the image data for one page is completed. After that, the re-encoding process and the subsequent transfer process need to be performed continuously. In this case, when it is detected in step S315 that all the re-encoding processes have been completed, the encoded data stored only in the second memory 106 is stored in the first memory during the encoding / re-encoding phase. After the transfer to the memory (step S317), in the next step S805, the input end of the image data for one page is detected, and the process proceeds to step S807.
[0048]
The above is the operation, and is also the operation description of FIG.
[0049]
<Modification of memory storage method>
9 and 10 are diagrams showing modifications of the memory storing method shown in the conceptual diagrams of FIGS.
[0050]
In the conceptual diagram of FIG. 5, in the encoding / re-encoding phase, the encoded data output from the encoding unit 102 is stored only in the second memory 106. However, as shown in FIG. During the re-encoding phase, the encoded data output from the encoding unit 102 is directly stored in both the first and second memories.
[0051]
When viewed from the encoding unit 102, encoded data to be encoded and output in any phase is stored in both memories. Further, unlike the conceptual diagram of FIG. 6, as shown in FIG. 10, it is not necessary to transfer data between memories in the transfer phase. In the case of this modification, the encoded data and the re-encoded data are sequentially stored in the order in which they are sent to the first memory 104 in the encoding / re-encoding phase. Therefore, there is a problem that two types of data are mixed.
[0052]
Therefore, in the case of this modification, the encoded data is divided into certain units and managed as a file or a packet in order to cope with this. Specifically, a file management table or a packet management table is created and managed separately.
[0053]
As one method, when data from the encoding unit 102 is stored in the first memory 104, an appropriate unit (for example, 8 × i (i = 1 because the unit of the orthogonal transform is an 8 × 8 block) 2) (integer) for each line), a management number is assigned from the top of the image data, and the storage start address of the encoded data corresponding to each management number and the amount of the encoded data are stored in the order of the management number. Create a management table that can be used.
[0054]
The encoding unit 102 and the re-encoding unit 109 hold the management number of the data being processed, and based on the management number, write the start address and the encoded data amount when storing the encoded data in the management table. In this way, even if the encoded data processed by the encoding unit 102 and the re-encoding unit 109 are randomly stored, the management table is accessed in the order of the management number, and the leading address and encoded data to be read at that time If the encoded data is read from the first memory 104 based on the amount, the encoded data can be read sequentially from the top of the image. Providing such a management mechanism eliminates the need to store continuous data on the image so as to be continuous on the memory.
[0055]
The encoding phase after the transfer phase in the conceptual diagram of FIG. 10 is almost the same as the two encoding phases described above (FIGS. 4 and 7), and the code storage state in the first memory is shown in FIG. It is only slightly different as shown in. Therefore, the above description and this modification are the same in that the three phases are repeated.
[0056]
Next, a second basic configuration example (the configuration described so far is referred to as a first example) for performing a characteristic encoding process in the present invention will be described with reference to FIG.
[0057]
FIG. 2 is a block diagram of the image processing apparatus 200 in the second example.
[0058]
A significant difference from the image processing apparatus 100 of FIG. 1 is that two encoding units that perform encoding first exist in parallel. The image processing apparatus 200 encodes image data input from the input unit 201 in parallel with the first encoding unit 202 and the second encoding unit 205, and two types of encoded data having different compression rates. Is generated. Also in this example, a known JPEG encoding method is used, image data corresponding to 8 × 8 pixel units is orthogonally transformed, and quantization and Huffman encoding processing using quantization steps described later are performed. It is.
[0059]
In this example, a case where the compression rate applied by the second encoding unit 205 is set higher than that of the first encoding unit 202 will be described. Specifically, the quantization step in the first encoding unit 202 is Q1, and the quantization step in the second encoding unit 205 is Q2 (= 2 × Q1).
[0060]
The encoded data output from the encoding unit 202 is stored in the first memory 204 via the first memory control unit 203. At this time, the first counter 208 counts the amount of encoded data output from the encoding unit 202, holds this, and also outputs it to the encoding sequence control unit 209.
[0061]
On the other hand, the encoded data encoded by the encoding unit 205 is stored in the second memory 207 via the second memory control unit 206. At this time, the second counter 210 counts the data amount of the encoded data output from the encoding unit 205 and holds it. Further, when the encoded data stored in the second memory 207 described later is transferred to the first memory 204, the count value is transferred to the first counter 208 at the same time.
[0062]
When the first counter 208 counts the data amount of the encoded data output from the encoding unit 202 and the count value reaches a certain set value, the encoding sequence control unit 209 As in the example, a control signal is issued to the memory control unit 203 so as to discard the data stored in the memory 204.
[0063]
Then, the encoding sequence control unit 209 reads the encoded data stored in the second memory 207, transfers it to the first memory 204, and stores it in the first memory 204. A control signal is output to the memory control unit 203. As a result, the count value of the second counter 210 is transferred to the first counter 208, and the value is loaded (overwritten) as the count value of the first counter.
[0064]
In short, since the count value of the second counter 210 represents the amount of encoded data stored in the second memory 207, the correspondence between the count value and the encoded data is changed. It can be considered that the data is copied to the first counter and the first memory as it is.
[0065]
Furthermore, the encoding sequence control 209 controls the first encoding unit 202 and the second encoding unit 205 so as to perform encoding so that encoded data is smaller than before. Put out.
[0066]
For example, the quantization step S in the first encoding unit 202 and the second encoding unit 205 is switched to twice. As a result, the first encoding unit 202 inherits the quantization step Q2 (= 2 × Q1) in the second encoding unit 205 up to immediately before, and the second encoding unit 205 further Using a large quantization step Q2 × 2, an encoding process with a higher compression ratio in preparation for the next overflow is performed.
[0067]
Here, although the magnification ratio of the quantization step is set to double, it is not limited to this, and needless to say, it can be arbitrarily set. The encoded data output from the switched encoding units 202 and 205 is stored in the corresponding memories 204 and 207 via the corresponding memory control units 203 and 206, respectively.
[0068]
Then, the encoding sequence control 209 reads out the encoded data already stored in the second memory to the memory control unit 206 and sends a control signal to send the data to the re-encoding unit 211. The re-encoding unit 211 performs re-encoding processing of encoded data in the same manner as the re-encoding unit 109 in FIG.
[0069]
The third counter 212 counts the amount of data output from the re-encoding unit 211, is reset to zero immediately before starting the re-encoding process, and counts the output data amount during the re-encoding process. When the re-encoding process is completed, the counter 212 transfers the count value obtained there to the second counter 210.
[0070]
The second counter 210 adds the transferred data amount count value to the counter value held in the second counter 210 to thereby store the code stored in the memory 207 during the re-encoding process. The total data amount of the encoded data and re-encoded data is calculated. That is, the amount of data stored in the memory 207 matches the count value of the counter 210.
[0071]
Regardless of whether the re-encoding process is completed or not, if the image data from the input unit 201 to be encoded remains, the encoding process by the two encoding units 202 and 205 is continued. Then, monitoring whether the count value of the counter 208 has reached a certain set value is repeated until the encoding process (encoding, re-encoding) of image data for one page input from the input unit 201 is completed, The encoding and re-encoding processes described above are executed under control according to the detection result obtained here.
[0072]
FIG. 12 is a flowchart showing the process flow in the configuration of FIG.
[0073]
As described with reference to FIG. 2, when there are two encoding units, image data for one page is encoded based on the flowchart shown in FIG. Note that the description of FIG. 12 is mostly similar to FIG. 8, which is a flowchart in the case of one encoding unit, and those skilled in the art can fully understand the features of the second embodiment from the above description. Since it will be understood, the processing will be described in three phases as in the case of one encoding unit, and differences from FIG. 8 will be mainly described.
[0074]
The biggest difference between the flow of FIG. 8 described above and the flow of the present embodiment is that the transfer processing in step S317 is moved between step S307 and step S309. In short, it can be regarded that the encoding / re-encoding phase and the transfer phase are switched (the exception is the discarded processing of the encoded data in step S307).
[0075]
In the initial setting of the encoding parameter in step S301, the quantization step Q1 is set in the first encoding unit 202, and the quantization step Q2 (= 2 × Q1) is set in the second encoding unit 205.
[0076]
In the encoding phase, steps S801, S303, and S305 are repeatedly executed. Steps S801 and S305 are the same processing as in the case of one encoding unit, but only the encoding processing in step S303 is different as shown in FIG.
[0077]
In order to increase the compression rate of the encoded data stored in the first memory 204 in stages, the encoded data stored first stores the data encoded in the quantization step Q1 having the lowest compression rate. The encoded data stored in the second memory stores the data encoded in the quantization step Q2.
[0078]
When the amount of data stored in the first memory 204 exceeds the set upper limit value (step S305), the encoded data held in the first memory 204 is immediately discarded (step S307). The encoded data having a high compression rate held in the second memory 207 is transferred to the first memory 204 (step S317, see FIG. 14). As a result, without waiting for the end of the first re-encoding process described in the first embodiment (FIG. 1), the encoded data of the appropriate second candidate that does not exceed the upper limit value can be quickly obtained. Can be stored in the memory 207. This is the greatest advantage of applying FIG. 2 with two encoders over FIG.
[0079]
In the second embodiment, since it is a wasteful idea to have encoded data having the same compression rate in the two memories 204 and 207, the second memory 207 stores the codes stored in the first memory 204. The encoded data having a higher compression rate than the encoded data is stored. Accordingly, the subsequent processing is also performed based on this concept, and after the processing (transfer phase) for transferring the encoded data in the second memory 207 to the first memory 204 is completed, the second processing is performed. The encoded data in the memory 207 is re-encoded so as to hold encoded data with a higher one-stage compression rate.
[0080]
Specifically, first, as shown in FIG. 15, in the encoding / re-encoding phase subsequent to the transfer phase, each quantization applied to the two encoding units 202 and 205 before the re-encoding. Steps Q1 and Q2 are changed to Q2 and Q3, respectively (step S309). If the input of one page of image data is not completed (step S803), the subsequent image data is set by a new quantization step. The input data is encoded by the two encoded units (step S311) and stored in the corresponding memories 204 and 207. The encoded data (transferred to the first memory 204) stored in the second memory in parallel with the encoding process is compressed one step higher than the encoded data in the first memory. In order to change to encoded data of rate, the re-encoding unit 211 performs re-encoding processing (S313) so that the data encoded using the quantization step Q3 is obtained, and the re-encoded data is 2 is stored again in the second memory 207.
[0081]
In the second example, as in the first example, the re-encoding process is the result of dividing these values by 2 n for each quantized value after the encoded data is once Huffman-decoded. This is realized by performing a Huffman coding again after performing a bit shift process that produces a similar result. This method is capable of high-speed re-encoding processing in that the quantization step is changed only by bit shift and the inverse orthogonal transformation or re-orthogonal transformation processing is not performed.
[0082]
When there are two encoding units as in the second embodiment, encoded data and re-encoded data are mixedly stored in the second memory 207 as shown in FIG. A situation occurs. Therefore, as described above, it is necessary for the second memory 207 to manage the encoded data as a file or a packet by dividing the encoded data into a certain unit. For this purpose, for example, a configuration similar to that of the modification of the first example may be provided.
[0083]
In FIG. 12, when the end of the re-encoding process is detected in step S315, the process proceeds to the encoding phase (steps S801 and S303) again. In the encoding phase after the encoding / re-encoding phase, as shown in FIG. 16, the encoded data held in the two memories 204 and 207 not only have different compression ratios but also a mixture of encoded data. The way (address) is also quite different. Accordingly, when the data amount of the first memory 204 again exceeds the set value, the encoded data held in the second memory 207 (the code of the horizontal stripe region of (6) + (8)) Needs to be transferred to the first memory 204. Considering these, it is necessary to manage the encoded data as a file or a packet not only in the second memory 207 but also in the first memory 204. Therefore, the first memory 204 also requires a management mechanism using the above-described management table.
[0084]
The state of the encoding phase shown in FIG. 16 is the initial state of the encoding phase (FIG. 13) except that the method of mixing the quantization step and the encoded data is different before and after the re-encoding process. Is the same. Therefore, by repeating the encoding phase, the transfer phase, and the encoding / re-encoding phase, the encoded data that is finally compressed to be equal to or less than the set upper limit value of the image data for one page is surely stored in the first memory. 204 can be stored.
[0085]
Note that since the arrangement order of the transfer phase and the encoding / re-encoding phase is reversed from the description of the first example, the input end detection of image data for one page, which has been performed after the transfer processing in FIG. (Step S805) has almost the same timing as the input end detection of image data for one page (step S803) performed in the encoding / recoding phase. The two detection processes are functionally the same as step S805 and the timing is the same as step S803. Therefore, these two steps detect the end of input of image data for a new page. Are integrated as a step to be performed and described as step S1201.
[0086]
In the first and second examples described above, the first memory and the second memory have been described as physically separate memories. This is advantageous because access to the two memories can be independent, which is a feature of the present invention. However, the case where the first memory and the second memory are not physically separate memories is also included in the scope of the present invention. Two areas corresponding to the first memory and the second memory are secured on one physical memory, the first memory is the first memory area, and the second memory is the second memory. It can be understood that the present invention can be realized with a single memory by re-reading the above description by rephrasing the area.
[0087]
Further, when the above embodiments are realized with one memory, some of the data transfer processes described in the transfer phase are not necessary. The details can be easily imagined each time, so the explanation will be omitted. However, when the two areas are used strictly separated, data transfer processing is necessary as in the case of physically having two memories. If the same data is shared between the two areas, not only the data transfer process becomes unnecessary, but also the storage capacity can be reduced.
[0088]
For example, when the encoded data held in the second memory area is transferred to the first memory area, two pieces of information of the head address and the data size in which the encoded data is stored are stored in the second memory. The same effect as that obtained by transferring the encoded data can be obtained only by transferring the data from the control unit to the first memory control unit.
[0089]
When the encoded data is stored in a file format or a packet format, the information transferred between the memory control units is slightly increased, and it is necessary to transfer the management table information related to the encoded data. Nevertheless, it is more efficient than transferring encoded data.
[0090]
Now, according to the above-described image processing apparatus, even when the input image data is encoded, even if it exceeds the target size, the processing is performed so as to keep the input within the target size. Will be able to continue. The present invention is based on the above-described structure, and is characterized by functioning particularly effectively for color image coding. A specific example will be described below as an embodiment.
[0091]
<First Embodiment>
FIG. 17 is a block diagram of a digital image processing apparatus to which this embodiment is applied.
[0092]
In the figure, reference numeral 1000 denotes a color image input port (image area information and color image data). As shown in the figure, the input port 1000 is connected to a selector 1023 for selecting either the image scanner 1020 or the rendering engine 1021 based on the print data output from the host computer (an operation panel not shown). Or automatically select the one with input). Color image data 1031 and 1032 and image area information 1033 and 1034 (information for identifying whether the pixel is in a character / line drawing area or a halftone area and whether it is color or monochrome) are output from both. Shall come. The rendering engine 1021 can generate image area information based on print data (because it is transferred as image data from a host computer computer in the case of a halftone image, and in accordance with a drawing command in the case of a character line image). . On the other hand, the image scanner unit 1020 basically needs to read a manuscript image, determine whether it is a character line image area or a halftone area, and determine whether it is color or monochrome based on the read image. Therefore, it is assumed that a circuit for generating the image area information is built in.
[0093]
Reference numeral 1001 denotes a line buffer having a plurality of lines of input images (capacity for extracting tiles described later). Reference numeral 1002 denotes a color image encoder, which corresponds to the encoding unit 102 in FIG. However, the color image encoder 1002 according to the present embodiment includes a conversion circuit that temporarily converts input color image data into a luminance signal and a color difference signal, and compresses and encodes the converted data. And As the luminance and color difference signals, there are color spaces represented by Y, Cr, Cb, etc., but YIQ may also be used. Therefore, in the embodiment, for the sake of convenience, the luminance data is expressed as Y, and the color difference signals are expressed as C1 and C2.
[0094]
Reference numeral 1003 denotes an external memory (for example, a hard disk) that stores an encoded color image. Reference numeral 1005 denotes a decoding buffer that temporarily stores the encoded image data read from the external memory 1004 in order to perform decoding processing. Reference numeral 1006 denotes a decoder. Reference numeral 1007 denotes a line buffer for temporarily storing the decoded image. Reference numeral 1008 denotes an output port for outputting an image stored in the line buffer 1008 to the connected printer unit 1009. The printer unit 1009 is provided with a conversion circuit that converts Y, C1, and C2 data into Y, M, and C (or Y, M, C, and Bk) that are recording color components. . In addition, the recording method of the printer unit 1009 may be any printing method such as a laser beam printer or a printer that ejects ink droplets.
[0095]
Reference numeral 1010 denotes a code amount monitoring unit that monitors the amount of code data stored in the internal buffer 1003. Reference numeral 1011 denotes a code conversion unit that performs encoding again.
[0096]
From the relationship with FIG. 1, the internal buffer 1003 also serves as the first memory and the second memory in FIG. 1. In addition, the code sequence control unit 108, the first counter 107, the second counter 110, and the selector 111 correspond to the code amount monitoring unit 1010, and the re-encoding unit 109 corresponds to the code conversion unit 1011.
[0097]
The color image encoder 1002 divides the image data stored in the line buffer 1001 into tiles having a size of 8 × 8 pixels (each tile is not limited to 8 × 8 but may be M × M pixels), and this 8 × Color information is encoded every 8 pixels. The color image is encoded by discrete cosine transform encoding (JPEG), and the image area information is encoded by run length encoding.
[0098]
The image area information is attached to each pixel. However, in the case of processing by DCT for each 8 × 8 block as in this embodiment, the image area flag is used for each block as a representative. It will be. As described above, the image area is divided into the character area and the photographic area of the image, either color or monochrome. However, it may be other than this, and additional components are added to this. It doesn't matter.
[0099]
The code amount monitoring unit 1010 monitors the code amount generated by the color image encoder 1002, and when it is predicted that the set amount will be exceeded, it is input to the encoder 1002 thereafter. The color image data (and attribute information) is encoded so as to be higher, and the previously encoded data is re-encoded by the code converter 1011 to perform higher encoding. Become.
[0100]
In the present embodiment, every time it is determined that the code amount exceeds the set value, the encoding efficiency is gradually increased, so that it will be described below.
[0101]
As described above, the embodiment encodes a color image. The color image data is expressed in the color space format of luminance data Y and color difference data C1 and C2.
[0102]
If the code amount monitoring unit 1010 (encoding sequence control unit 108 in FIG. 1) determines that the code amount generated by the encoding unit 102 has exceeded the target value after starting encoding of a certain page, The encoding unit 102 encodes the alternating current component (AC) obtained by orthogonally transforming the color difference components C1 and C2 with the quantization step set higher than before. As a result, the color image input after it is determined that the target value is exceeded is encoded at a higher compression rate.
[0103]
In addition, since the encoded data up to immediately before when it is determined that the target value is exceeded is stored in the second memory, the color difference component data C1 encoded with respect to the second memory control unit 105, Only C2 is output to the re-encoding unit 109, and a control command is issued to the selector 111 to output to the re-encoding unit 109. In addition, the encoding sequence control unit 108 causes the re-encoding unit 109 to decode the encoded color difference data C1 and C2, respectively, and increases the AC component (AC component) quantization step to re-encode. Encode. The recoded color difference component data is stored in the first memory 104 and the second memory 106. As a result, the encoded data before the target value is exceeded is also encoded at a high compression rate.
[0104]
In short, when the color image data of a certain page is input and encoded, when the target value is exceeded first, the quantization step is increased for the color difference components C1 and C2, and the encoding is performed. Will continue.
[0105]
If the target value is exceeded again during the processing as described above, the alternating current component of luminance Y is determined as a change target.
[0106]
Thus, every time it is determined that the target value is exceeded, the quantization step for the AC component and the DC component of each of the luminance component Y and the color difference components C1 and C2 is changed (larger), and the compression rate is gradually increased. Become.
[0107]
For this reason, the encoding sequence control unit 108 has a scenario table as shown in FIG. 18, and as the number of times the target value is exceeded for a certain page is counted, Third, control to gradually increase the compression rate.
[0108]
Therefore, when the target value is exceeded first during the encoding of a certain page, the AC component AC of the color difference components C1 and C2 is selected according to FIG. Will be done.
[0109]
FIG. 19 is an explanatory diagram of the relationship between the encoding progress status and the memory fullness rate. Hereinafter, the operation sequence will be briefly described with reference to FIG.
[0110]
In the figure, it is shown that the encoded data amount overflows at the initial value condition (encoding parameter at the initial stage) at the time of 2/8. According to the embodiment, after this time, the color image data is continuously encoded by increasing the quantization step of the AC component after orthogonal transformation of the color difference components C1 and C2, and the already encoded data is encoded. Will decode the chrominance component in it, increase the quantization step of the AC component, and start the re-encoding process.
[0111]
Further, at the time of 3/8, when it is determined that the target value is exceeded, the previous re-encoding is completed, and the transfer process to the first memory 104 is completed.
[0112]
Further, since overflow occurs again at 4/8, the re-encoding process is started. Since the overflow at this time is the second time, according to FIG. 18, the alternating current component of the luminance component is selected and processing is performed. At 5/8, this re-encoding is completed, indicating that the transfer process is complete.
[0113]
At 8/8, it indicates that the encoding of one page is complete.
[0114]
In the above example, the memory is about 25% overrun at 3/8. This is determined by the compression rate and the re-encoding time. In the actual machine, the buffer is used as a design parameter. It needs to be secured as a margin of memory, but it is not so large. As can be seen from the figure, the processing time ends within the time for encoding one image.
[0115]
As can be seen from the above description, in the embodiment, the quantization step of each DC component and AC component can be set independently for the color difference component and the luminance component, so that the first memory In 104, the value of the quantization step in each of the alternating current component and direct current component of luminance and color difference is stored.
[0116]
20A to 20D are explanatory diagrams of a DC coefficient (DC coefficient) of a DCT coefficient. FIG. 4B is an explanatory diagram of DC coefficient encoding. The difference between the 8 × 8 DCT-converted DC coefficient value (the small square at the upper left in the figure) and the DC coefficient value of the adjacent block is taken and variable-length encoded.
[0117]
FIG. 6A is an encoding block diagram, and the difference between the DC coefficient 1205 and the DC coefficient of the immediately preceding block delayed by the block delay unit 1201 is taken by the difference unit 1202. The difference value is converted into a group number SSSS by the grouping process.
[0118]
In the grouping unit, the number of additional bits corresponding to the DC difference value is determined as shown in FIG. The group number SSSS is Huffman encoded according to the one-dimensional Huffman encoder 1204 and the table shown in FIG.
[0119]
From these tables, it can be seen that the smaller the group number, the smaller the Huffman code and the number of additional bits (the same in some cases).
[0120]
Therefore, when the DC difference value is ½, the group number is decreased by one, and the variable length code portion including the Huffman code and the additional bits is shortened by 1 to 2 bits.
[0121]
FIG. 22 is an explanatory diagram of an AC coefficient (AC) coefficient encoding method of DCT coefficients.
[0122]
The AC coefficients 1301 are rearranged in the zigzag scan order, and when 0 is determined by the determiner 1302, the run length counter 1303 counts the number of consecutive 0 coefficients (run length) and outputs a run length NNNN 1306. For coefficient values other than 0, a group number 1307 and additional bits 1302 are output by the grouping unit 1304 as in FIG. The two-dimensional Huffman encoder 1305 performs Huffman encoding by combining the run length NNNN and the group number SSSS (see FIG. 23).
[0123]
When the run length NNNN exceeds 15, a necessary number of ZRLs indicating the run length 16 are output. For example, the run length 35 is converted into ZRL + ZRL + run length 3 and encoded.
[0124]
In addition, EOB (End of Block) is added after the last effective coefficient (coefficient other than 0).
[0125]
In the embodiment, since DCT processing is performed on an 8 × 8 block, the order of zigzag scanning is as shown in FIG.
[0126]
FIG. 24 shows a part of the Huffman code table subtracted from the run length and size.
[0127]
Therefore, it can be seen that when the AC coefficient value is ½, the group number is decreased by 1, and the variable-length code portion including the Huffman code and the additional bits is shortened by 1 to 2 bits.
[0128]
Furthermore, since the coefficient value becomes zero and the run length becomes longer, the number of dominant symbols to be encoded is also reduced, so that the code length is further shortened.
[0129]
<Second Embodiment>
Next, an example in which the index of the color signal selection table is set based on the re-encoding start point will be described as a second embodiment.
[0130]
FIG. 25 is an explanatory diagram of the relationship between the progress of encoding and the memory fullness rate.
[0131]
In the figure, at the time of 6/8, the encoding at the quantization step of the initial value overflows and the re-encoding process starts, and the encoding is continued by changing the quantization step. In this example, an overflow occurs near the end of 6/8, so if all the color components are re-encoded, the code will be reduced to about half from here. It is expected that the compression will be too much than the code amount. Therefore, for example, if the encoding sequence control unit performs index control based on the processing amount of one image so that only the AC component of the color difference component of the color selection table is subject to re-encoding, Subsequent over-compression can be prevented.
[0132]
<Application example>
In the above-described embodiment, the functional operation of the apparatus has been described using the apparatus that reads an image from the image scanner as an example. Most of the functions (including the encoding process) can be realized by the computer program as described above.
[0133]
Therefore, the present invention may be applied to an application program that operates on a general-purpose information processing apparatus such as a personal computer. In the case of application to an application program, a GUI may be provided such as allowing the user to specify an image file as a compression source and allowing the user to select a target size. The target value at this time can be set arbitrarily by the user, but setting with numerical values is difficult to understand, so it should be selected from an intuitive menu that takes into account the document size and image quality (high, medium, low, etc.). It would be good to make a decision.
[0134]
In addition, the quantization step has been described as an example of the encoding parameter of the encoding unit. The parameters may be used. However, for example, in the configuration of FIG. 1, in order to make the re-encoded data from the re-encoding unit 109 substantially the same as the encoded data from the encoding unit 102 after the parameter change, the above-described implementation is required. As shown in the embodiment, a method of increasing the quantization step is preferable.
[0135]
In the embodiment, an example in which a color image is compression-encoded as luminance and color difference data has been described. However, the color space expressing a color component is not limited to luminance and color difference. For example, a La * b * color space or the like may be used.
[0136]
In addition, the compression parameter is changed every time the memory is over, but it is desirable to increase the quantization step by giving priority to color components that are difficult to discern by human vision. Therefore, it is desirable to adopt a color space that matches human visual characteristics such as luminance and color difference (hue, saturation) rather than the RGB color space.
[0137]
Further, as described above, the present invention can be realized by an application program that runs on a general-purpose device, and therefore the present invention includes a computer program. In addition, since the computer program is usually performed by setting or copying or installing a storage medium such as a floppy disk or CDROM in the apparatus, such a storage medium is naturally included in the scope of the present invention.
[0138]
In the embodiment, the image data is input from the scanner. However, the present invention may be applied to a printer driver that operates on a host computer. In the case of application to a printer driver, when data to be printed is received from a higher-level process (such as an application), it is of course possible to determine whether the data is a halftone image or a character / line image. The configuration related to the area information generation processing can be omitted or simplified.
[0139]
The present invention can also be applied to a combination of a computer program and appropriate hardware (such as an encoding circuit).
[0140]
【The invention's effect】
As described above, according to the present invention, in encoding of a multi-value color image, encoding is performed so as to be within a target size without re-input, and deterioration of the quality of the color image is minimized. Is possible.
[Brief description of the drawings]
FIG. 1 is a diagram showing a first basic configuration of an image processing apparatus to which the present invention is applied.
FIG. 2 is a diagram illustrating a second basic configuration of an image processing apparatus to which the present invention is applied.
FIG. 3 is a flowchart showing a simplified process in the configuration of FIG. 1;
FIG. 4 is a diagram illustrating a data flow and memory contents in an encoding phase in an initial state.
FIG. 5 is a diagram showing a data flow and memory contents in an encoding / re-encoding phase.
FIG. 6 is a diagram illustrating a data flow and memory contents in a transfer phase.
FIG. 7 is a diagram illustrating a data flow and memory contents in an encoding phase after a transfer phase.
FIG. 8 is a flowchart showing details of processing in the configuration of FIG. 1;
9 is a diagram showing a data flow and memory contents in an encoding / re-encoding phase in the modification of the configuration of FIG. 1; FIG.
10 is a diagram showing a data flow and memory contents in a transfer phase in the modification of FIG. 9;
11 is a diagram showing a data flow and memory contents in an encoding phase after a transfer phase in the modification of FIG.
12 is a flowchart showing a processing procedure in the configuration of FIG. 2;
13 is a diagram showing a data flow and memory contents in an encoding phase in an initial state in the configuration of FIG.
14 is a diagram showing a data flow and memory contents in a transfer phase in the configuration shown in FIG.
15 is a diagram illustrating a data flow and memory contents in an encoding / re-encoding phase in the configuration of FIG.
16 is a diagram illustrating a data flow and memory contents in an encoding phase after an encoding / re-encoding phase in the configuration of FIG. 2;
FIG. 17 is a block diagram of an image processing apparatus to which the embodiment is applied.
FIG. 18 is a diagram illustrating the contents of a scenario table at the time of memory over in the embodiment.
FIG. 19 is a diagram illustrating changes in code amount in the embodiment.
FIG. 20 is a diagram for explaining the operation of the DC component encoding structure in the embodiment;
FIG. 21 is a diagram illustrating an AC component processing procedure in the embodiment;
FIG. 22 is a diagram showing a zigzag scan for DCT coefficients.
FIG. 23 is a diagram showing a table for grouping AC components.
FIG. 24 is a diagram showing a part of a Huffman code table searched from run length and size.
FIG. 25 is a diagram illustrating an example of a relationship between an encoding progress situation and a memory fullness rate according to the second embodiment.

Claims (4)

カラー画像を表す輝度成分と色差成分を入力し、前記輝度成分を第1の量子化ステップを用いて圧縮し、前記色差成分を第2の量子化ステップを用いて圧縮する第1の圧縮段と、
前記第1の圧縮により生成された符号データを復号し、再圧縮することが可能な第2の圧縮段と、
前記第1の圧縮段によって生成される符号化データ量を監視し、該符号データ量が所定量に達するか否かを判断する符号量監視手段とを備え、
該符号量監視手段によって前記所定量に達したと判断した初回の時には、前記第1の圧縮手段に適用する前記第2の量子化ステップを、当該第2の量子化ステップよりも圧縮率の高い第3の量子化ステップに変更した後、後続して入力される色差成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された色差成分の符号化データを、前記第2の量子化ステップよりも圧縮率の高い前記第3の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた色差成分の符号化データを、前記第3の量子化ステップに変更した後の前記第1の圧縮手段により生成された色差成分の符号化データとして保存させ、
前記第3の量子化ステップに更新した後で前記第1の圧縮手段により生成された色差成分の符号化データを、後続の符号化データとして保存させ、
前記符号量監視手段によって前記所定量に達したと判断した2回目の時には、前記第1の圧縮手段に適用する前記第1の量子化ステップを、当該第1の量子化ステップよりも圧縮率の高い第4の量子化ステップに変更した後、後続して入力される輝度成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された輝度成分の符号化データを、前記第1の量子化ステップよりも圧縮率の高い前記第4の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた輝度成分の符号化データを、前記第4の量子化ステップに変更した後の前記第1の圧縮手段により生成された輝度成分の符号化データとして保存させ、
前記第4の量子化ステップに更新した後で前記第1の圧縮手段により生成された輝度成分の符号化データを、後続の符号化データとして保存させる
ことを特徴とする画像処理装置。
Enter a luminance component and a chrominance component representing the color image, the luminance component is compressed using a first quantization step, a first compression means to compress using the second quantization step of the color difference component When,
Decodes the encoded data generated by said first compression hands stage, a second compression hands stage capable of re-compression,
Monitoring the encoded data amount generated by the first compression hands stage, the encoded data amount and a code amount monitoring means for determining whether reaches a predetermined amount,
At the first time when the code amount monitoring means determines that the predetermined amount has been reached, the second quantization step applied to the first compression means has a higher compression rate than the second quantization step. After changing to the third quantization step, the subsequent color difference component is compressed by the first compression means,
The second compression unit uses the third quantization step having a compression rate higher than that of the second quantization step for the encoded data of the color difference component previously generated by the first compression unit. To recompress
The encoded data of the color difference component obtained by the recompression is stored as encoded data of the color difference component generated by the first compression means after changing to the third quantization step,
The encoded data of the color difference component generated by the first compression unit after updating to the third quantization step is stored as subsequent encoded data,
At the second time when it is determined that the predetermined amount has been reached by the code amount monitoring means, the first quantization step applied to the first compression means has a compression rate higher than that of the first quantization step. After changing to a high fourth quantization step, the subsequently inputted luminance component is compressed by the first compression means,
The encoded data of the luminance component previously generated by the first compression means is converted into the second compression means by using the fourth quantization step having a compression rate higher than that of the first quantization step. To recompress
The encoded data of the luminance component obtained by the recompression is stored as encoded data of the luminance component generated by the first compression means after changing to the fourth quantization step,
An image processing apparatus that stores encoded data of a luminance component generated by the first compression unit after updating to the fourth quantization step as subsequent encoded data .
カラー画像を表す輝度成分と色差成分を入力し、前記輝度成分を第1の量子化ステップを用いて圧縮し、前記色差成分を第2の量子化ステップを用いて圧縮する第1の圧縮程と、
前記第1の圧縮により生成された符号データを復号し、再圧縮することが可能な第2の圧縮程と、
前記第1の圧縮程によって生成される符号化データ量を監視し、該符号データ量が所定量に達するか否かを判断する符号量監視工程とを備え、
該符号量監視工程によって前記所定量に達したと判断した初回の時には、前記第1の圧縮工程に適用する前記第2の量子化ステップを、当該第2の量子化ステップよりも圧縮率の高い第3の量子化ステップに変更した後、後続して入力される色差成分を前記第1の圧縮工程により圧縮させ、
前記第1の圧縮工程により従前に生成された色差成分の符号化データを、前記第2の量子化ステップよりも圧縮率の高い前記第3の量子化ステップを用いて、前記第2の圧縮工程により再圧縮させ、
前記再圧縮で得られた色差成分の符号化データを、前記第3の量子化ステップに変更した後の前記第1の圧縮工程により生成された色差成分の符号化データとして保存させ、
前記第3の量子化ステップに更新した後で前記第1の圧縮工程により生成された色差成 分の符号化データを、後続の符号化データとして保存させ、
前記符号量監視工程によって前記所定量に達したと判断した2回目の時には、前記第1の圧縮工程に適用する前記第1の量子化ステップを、当該第1の量子化ステップよりも圧縮率の高い第4の量子化ステップに変更した後、後続して入力される輝度成分を前記第1の圧縮工程により圧縮させ、
前記第1の圧縮工程により従前に生成された輝度成分の符号化データを、前記第1の量子化ステップよりも圧縮率の高い前記第4の量子化ステップを用いて、前記第2の圧縮工程により再圧縮させ、
前記再圧縮で得られた輝度成分の符号化データを、前記第4の量子化ステップに変更した後の前記第1の圧縮工程により生成された輝度成分の符号化データとして保存させ、
前記第4の量子化ステップに更新した後で前記第1の圧縮工程により生成された輝度成分の符号化データを、後続の符号化データとして保存させる
ことを特徴とする画像処理装置の制御方法。
Enter a luminance component and a chrominance component representing the color image, the luminance component is compressed using a first quantization step, as a first compression Engineering be compressed using a second quantization step of the color difference component When,
Decodes the encoded data generated by said first compression hands stage, and as the second compression engineering that can be recompressed,
Monitoring the encoded data amount generated by the extent of the first compression Engineering, the encoded data amount and a code amount monitoring step of determining whether reaches a predetermined amount,
At the first time when it is determined that the predetermined amount is reached by the code amount monitoring step, the second quantization step applied to the first compression step is higher in compression rate than the second quantization step. After changing to the third quantization step, the subsequently input color difference component is compressed by the first compression step,
The encoded data of the color difference component previously generated by the first compression step is converted into the second compression step by using the third quantization step having a compression rate higher than that of the second quantization step. To recompress
The encoded data of the color difference component obtained by the recompression is stored as encoded data of the color difference component generated by the first compression step after changing to the third quantization step,
The coded data of the color SaNaru component generated by the first compression step after updating the third quantization step, is stored as a subsequent encoded data,
At the second time when it is determined that the predetermined amount has been reached by the code amount monitoring step, the first quantization step applied to the first compression step is more compressed than the first quantization step. After changing to a high fourth quantization step, the subsequently input luminance component is compressed by the first compression step,
The encoded data of the luminance component previously generated by the first compression step is converted into the second compression step by using the fourth quantization step having a compression rate higher than that of the first quantization step. To recompress
The encoded data of the luminance component obtained by the recompression is stored as encoded data of the luminance component generated by the first compression step after changing to the fourth quantization step,
A control method for an image processing apparatus, wherein the encoded data of the luminance component generated by the first compression step after the update to the fourth quantization step is stored as subsequent encoded data .
コンピュータに、
カラー画像を表す輝度成分と色差成分を入力し、前記輝度成分を第1の量子化ステップを用いて圧縮し、前記色差成分を第2の量子化ステップを用いて圧縮する第1の圧縮段と、
前記第1の圧縮により生成された符号データを復号し、再圧縮することが可能な第2の圧縮段と、
前記第1の圧縮段によって生成される符号化データ量を監視し、該符号データ量が所定量に達するか否かを判断する符号量監視手段ととして機能させ、
該符号量監視手段によって前記所定量に達したと判断した初回の時には、前記第1の圧縮手段に適用する前記第2の量子化ステップを、当該第2の量子化ステップよりも圧縮率の高い第3の量子化ステップに変更した後、後続して入力される色差成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された色差成分の符号化データを、前記第2の量子化ステップよりも圧縮率の高い前記第3の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた色差成分の符号化データを、前記第3の量子化ステップに変更した後の前記第1の圧縮手段により生成された色差成分の符号化データとして保存させ、
前記第3の量子化ステップに更新した後で前記第1の圧縮手段により生成された色差成分の符号化データを、後続の符号化データとして保存させ、
前記符号量監視手段によって前記所定量に達したと判断した2回目の時には、前記第1の圧縮手段に適用する前記第1の量子化ステップを、当該第1の量子化ステップよりも圧縮率の高い第4の量子化ステップに変更した後、後続して入力される輝度成分を前記第1の圧縮手段に圧縮させ、
前記第1の圧縮手段により従前に生成された輝度成分の符号化データを、前記第1の量子化ステップよりも圧縮率の高い前記第4の量子化ステップを用いて、前記第2の圧縮手段により再圧縮させ、
前記再圧縮で得られた輝度成分の符号化データを、前記第4の量子化ステップに変更した後の前記第1の圧縮手段により生成された輝度成分の符号化データとして保存させ、
前記第4の量子化ステップに更新した後で前記第1の圧縮手段により生成された輝度成分の符号化データを、後続の符号化データとして保存させる
として機能させることを特徴とするコンピュータプログラム。
On the computer,
Enter a luminance component and a chrominance component representing the color image, the luminance component is compressed using a first quantization step, a first compression means to compress using the second quantization step of the color difference component When,
Decodes the encoded data generated by said first compression hands stage, a second compression hands stage capable of re-compression,
Said first monitor encoded data amount generated by the compression hands stage, the encoded data amount to function as a code amount monitoring means for determining whether reaches a predetermined amount,
At the first time when the code amount monitoring means determines that the predetermined amount has been reached, the second quantization step applied to the first compression means has a higher compression rate than the second quantization step. After changing to the third quantization step, the subsequent color difference component is compressed by the first compression means,
The second compression unit uses the third quantization step having a compression rate higher than that of the second quantization step for the encoded data of the color difference component previously generated by the first compression unit. To recompress
The encoded data of the color difference component obtained by the recompression is stored as encoded data of the color difference component generated by the first compression means after changing to the third quantization step,
The encoded data of the color difference component generated by the first compression unit after updating to the third quantization step is stored as subsequent encoded data,
At the second time when it is determined that the predetermined amount has been reached by the code amount monitoring means, the first quantization step applied to the first compression means has a compression rate higher than that of the first quantization step. After changing to a high fourth quantization step, the subsequently inputted luminance component is compressed by the first compression means,
The encoded data of the luminance component previously generated by the first compression means is converted into the second compression means by using the fourth quantization step having a compression rate higher than that of the first quantization step. To recompress
The encoded data of the luminance component obtained by the recompression is stored as encoded data of the luminance component generated by the first compression means after changing to the fourth quantization step,
A computer program that causes the encoded data of the luminance component generated by the first compression means after updating to the fourth quantization step to function as stored subsequent encoded data .
請求項3に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読記憶媒体。 A computer-readable storage medium storing the computer program according to claim 3.
JP2001315670A 2001-06-18 2001-10-12 Image processing apparatus and method, computer program, and storage medium Expired - Fee Related JP3984813B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2001315670A JP3984813B2 (en) 2001-10-12 2001-10-12 Image processing apparatus and method, computer program, and storage medium
EP02254149.4A EP1271926B1 (en) 2001-06-18 2002-06-13 Image processing method, apparatus and computer program for compression-encoding
US10/171,647 US7106911B2 (en) 2001-06-18 2002-06-17 Image processing apparatus and control method for inputting image data and encoding the data
CN02122650.4A CN1207897C (en) 2001-06-18 2002-06-18 Image processing method and device, computer program and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001315670A JP3984813B2 (en) 2001-10-12 2001-10-12 Image processing apparatus and method, computer program, and storage medium

Publications (2)

Publication Number Publication Date
JP2003125206A JP2003125206A (en) 2003-04-25
JP3984813B2 true JP3984813B2 (en) 2007-10-03

Family

ID=19133797

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001315670A Expired - Fee Related JP3984813B2 (en) 2001-06-18 2001-10-12 Image processing apparatus and method, computer program, and storage medium

Country Status (1)

Country Link
JP (1) JP3984813B2 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4533043B2 (en) * 2004-08-25 2010-08-25 キヤノン株式会社 Image encoding apparatus and method, computer program, and computer-readable storage medium
JP4393319B2 (en) 2004-09-08 2010-01-06 キヤノン株式会社 Image encoding apparatus and method, computer program, and computer-readable storage medium
JP2006340045A (en) * 2005-06-02 2006-12-14 Olympus Imaging Corp Image processor and image processing method
US7925098B2 (en) 2006-03-02 2011-04-12 Canon Kabushiki Kaisha Image encoding apparatus and method with both lossy and lossless means
JP4680112B2 (en) * 2006-03-30 2011-05-11 三菱電機株式会社 Image encoding device
JP2008042688A (en) 2006-08-08 2008-02-21 Canon Inc Image processing apparatus and control method thereof, and computer program and computer readable storage medium
JP4986147B2 (en) * 2007-07-23 2012-07-25 富士ゼロックス株式会社 Information processing apparatus and program
JP4697557B2 (en) 2009-01-07 2011-06-08 ソニー株式会社 Encoding apparatus, encoding method, recording medium, and image processing apparatus
US10186052B1 (en) 2018-01-19 2019-01-22 Google Llc Two-pass decoding of images

Also Published As

Publication number Publication date
JP2003125206A (en) 2003-04-25

Similar Documents

Publication Publication Date Title
JP3902968B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
US7106911B2 (en) Image processing apparatus and control method for inputting image data and encoding the data
US7257264B2 (en) Image processing apparatus and method for compression-encoding image area information
JP4533043B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7454070B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7561749B2 (en) Apparatus, method, and computer-readable storage medium for lossy and lossless encoding of image data in accordance with an attribute of the image data
US7627181B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7468803B2 (en) Image processing apparatus and image processing method
JP4533035B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP3984813B2 (en) Image processing apparatus and method, computer program, and storage medium
JP4065522B2 (en) Image processing apparatus and control method thereof
JP3902953B2 (en) Image processing apparatus and method, computer program, and storage medium
JP4124982B2 (en) Image processing apparatus and method, computer program, and storage medium
JP3835273B2 (en) Image encoding / decoding device
JP4693309B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP3902954B2 (en) Image processing apparatus and method, computer program, and storage medium
JP3840076B2 (en) Image processing apparatus and method, computer program, and storage medium
JP3902983B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP3998115B2 (en) Image processing apparatus and image processing method
JP2001217722A (en) Device and method for encoding information, and computer readable storage medium
JPH0622148A (en) Picture processor
JP4035471B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP2005086353A (en) Picture processor, control method therefor, computer program and computer readable storage medium
JPH0879477A (en) Image processing method and device therefor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040929

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060814

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060821

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061020

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070709

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

Free format text: PAYMENT UNTIL: 20100713

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100713

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110713

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120713

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120713

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130713

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees