JP4035475B2 - Image processing apparatus, control method therefor, computer program, and storage medium - Google Patents

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

Info

Publication number
JP4035475B2
JP4035475B2 JP2003111876A JP2003111876A JP4035475B2 JP 4035475 B2 JP4035475 B2 JP 4035475B2 JP 2003111876 A JP2003111876 A JP 2003111876A JP 2003111876 A JP2003111876 A JP 2003111876A JP 4035475 B2 JP4035475 B2 JP 4035475B2
Authority
JP
Japan
Prior art keywords
encoding
quantization step
amount
data
code data
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
JP2003111876A
Other languages
Japanese (ja)
Other versions
JP2004320479A (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 JP2003111876A priority Critical patent/JP4035475B2/en
Priority to US10/458,490 priority patent/US7227998B2/en
Publication of JP2004320479A publication Critical patent/JP2004320479A/en
Application granted granted Critical
Publication of JP4035475B2 publication Critical patent/JP4035475B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
本発明は、画像データを符号化する技術に関するものである。
【0002】
【従来の技術】
従来、静止画像の圧縮方式には、離散コサイン変換(以下、DCTと略す)を利用したJPEG方式や、Wavelet変換を利用した方式が多く使われている。この種の符号化方式は、可変長符号化方式であるので、符号化対象の画像毎に符号量が変化するものである。
【0003】
国際標準化方式であるJPEG方式では,画像に対して1組の量子化マトリクスしか定義できないので、プリスキャン無しには、符号量調整が行えず、限られたメモリに記憶するシステムで使用する場合においては、メモリオーバーを起こす危険性があった。
【0004】
これを防止するためには、充分なメモリ容量を確保しておくことが必要となるが、入力される画像のサイズが一律同じではなく、異なる場合もある。したがって、これまでは、その入力する可能性のある最大サイズ分に適合し得る容量のメモリを確保せざるを得ない。
【0005】
【発明が解決しようとする課題】
しかしながら、最大サイズに合わせてメモリを確保するような装置においては、それより小さなサイズの画像を入力する場合にもそのメモリが確保されることを意味することになり、メモリを有効活用しているとは到底言えない。
【0006】
そこで、確保するメモリ容量を中程度の画像に合わせることが考えられるが、今度は、符号化処理で得られた符号データがそれを越えてしまうということが発生する。
【0007】
この場合の対策として、予定した符号量よりオーバーした場合は、圧縮率を変更して、原稿の再読み込みを行なう方法や、予めプリスキャンによる符号量見積もりを行ない、符号量を調整するために、量子化パラメータの再設定を行なう方法などが知られている。
【0008】
従来、プリスキャンを行う符号量制御方式として、例えば、プリ圧縮したデータを内部バッファメモリに入れ、これを伸長し、圧縮パラメータを変え、本圧縮し、外部記憶に出力する方式が知られている。このとき、本圧縮は、プリ圧縮よりも圧縮率を高めにする必要がある。
【0009】
また、例えば、画素ブロックごとの許容符号量を求め、符号量を減らすために、DCT係数をn回レベルシフトした係数をハフマン符号化する方式が知られており、このシフト量nは許容符号量から決定される。
【0010】
本発明者らは、画像を実質的に1回の符号化処理時間内で、尚且つ、少ないメモリ量で確実に符号化する技術を既に幾つか提案している。その詳細は後述するが、簡単に説明すると、符号量が目標とするメモリ容量をオーバーフローしそうなところで、符号器の圧縮率が高くなるようにし、尚且つ、それまでに既に符号化したデータを新に設定した圧縮率で圧縮したのと等価になるように再符号化するものである。
【0011】
上記処理は非常に有効なものであるが、再符号化処理を行う再符号化部に対して高い処理能力が要求される。もし、再符号化の処理能力が低いと、その再符号化が完了する前に、再度設定した圧縮率での圧縮符号量が目標値を越えてしまうことがあり、このような事態になると再符号化処理を起動することができなくなり、結果的に、圧縮符号化が失敗することになってしまうからである。
【0012】
以上の理由により、再符号化は高い処理能力が要求されるわけであるが、実際に、上記のような事態が発生するのはむしろ希であるのも事実である。従って、再符号化について高い処理能力を満たすようにするのは、過剰なものであり、コストアップにつながる。
【0013】
本発明はかかる問題点に鑑みなされたものであり、比較的簡単な構成でもって、画像の入力を継続させながら、目標符号量以下に符号化することを確実なものとし、尚且つ、画質劣化を可能な限り抑制する技術を提供しようとするものである。
【0014】
【課題を解決するための手段】
かかる課題を解決するため、例えば本発明の画像処理装置は以下の構成を備える。すなわち、
1ページの画像データを圧縮符号化する画像処理装置であって、
量子化ステップが変更可能な第1の符号化手段と、
量子化ステップが変更可能であって、前記第1の符号化手段で圧縮した符号データを再符号化する第2の符号化手段と、
前記第1の符号化手段によって生成される符号データ量を監視すると共に、当該符号データ量が所定量になったか否かを判断する第1の判断手段と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化手段で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断手段と、
前記符号データ量に基づき、前記第1の符号化手段が次の段階の量子化ステップで圧縮符号化したと仮定した場合の前記所定量に到達する時刻T2と、現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第2の符号化手段で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断手段と、
前記第1の判断手段で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断手段での前記条件1、2の両方を満たす場合、前記第1、第2の符号化手段に次の段階の量子化ステップを設定する設定手段と、
該設定手段により量子化ステップを変更した場合、量子化ステップ変更後に入力する画像データについては前記第1の符号化手段による符号化を継続させ、量子化変更前の既に符号化された符号データについては前記第2の符号化手段によって再符号化させる制御手段とを備える。
【0015】
【発明の実施の形態】
以下、添付図面に従って本発明に係る実施形態を説明するが、先ず、基本部分について説明する。
【0016】
図1は、実施形態が適用する画像処理装置100の機能ブロック構成図である。以下、同図の各部を簡単に説明する。
【0017】
画像処理装置100は、イメージスキャナから画像を入力する入力部101を備えている。なお、入力部101は、ページ記述言語をラスターイメージにレンダリングする手段などから画像データを入力しても良いし、記憶媒体に格納された画像ファイルを読込むことで実現しても良く、場合によってはネットワークより受信するようにしても良い。
【0018】
符号化部102は、入力された画像データの符号化を行なう。なお、符号化方式は公知のJPEG符号化方式を用い、8×8画素で画像データをDCT変換し、後述する量子化ステップを用いた量子化、ハフマン符号化処理を行なうものである。
【0019】
第1のメモリ制御部103と、第2のメモリ制御部105は、上記符号化部102から出力されてくる上記符号化データ(同じ符号化データ)を第1のメモリ104と第2のメモリ106へそれぞれ格納する様に制御する。ここで、第1のメモリ104は、最終的に確定した(目標値以内のデータ量に圧縮し終わった)符号化データを、図1の基本構成の外部に接続されるネットワーク機器、画像出力装置や大容量記憶装置等へ出力するために、該符号化データを保持するためのメモリである。また、第2のメモリ106は、前記符号化データを第1のメモリ上に形成するための圧縮符号化処理を補助する作業用のメモリである。
【0020】
カウンタ107は、符号化部102によって圧縮符号化された画像データのデータ量をカウントし、該カウント値を保持すると共に、そのカウント結果により符号化シーケンスの制御を行なう符号化シーケンス制御部108に出力する。
【0021】
符号化シーケンス制御部108では、カウンタ107のカウント値がある設定値に達したかどうかを検出し、その設定値に達した(目標値を越えた)ことを検出した時にメモリ104内の格納済みの符号化データを廃棄するよう第1のメモリ制御部103に制御信号を出力する。上記第1のメモリ制御部103は、この制御信号に基づいて、メモリアドレスカウンタをクリアするか、あるいは符号化データ管理テーブルをクリアすることにより、前記格納データを廃棄する。また、このとき、符号化シーケンス制御部108は、第1のカウンタ107をゼロクリアして、第1のメモリ104におけるデータ量と一致させる(入力部101からの入力は継続している)。また、符号化部102に対して今までより、高い圧縮率で符号化を行なうよう制御する。具体的には、DCT変換係数を量子化する際の量子化ステップを2倍にするよう設定する。
【0022】
なお、ここでは、単純に量子化ステップを2倍としたが、カラー画像の場合、色変換した際に生成される1つの輝度信号(輝度データ)と、2つの色差信号(色差データ)に対して別々の量子化ステップを割り当て、片方ずつ交互に2倍にするようにする。
【0023】
そして、圧縮率変更後の符号化データも、これまでと同様、第1のメモリ制御部103と第2のメモリ制御部105を経て、第1のメモリ104と第2のメモリ106に夫々格納される。なお、第1のメモリ104には、前記廃棄動作移以降に入力されるデータを符号化処理して生成された符号を格納することになる。
【0024】
符号化シーケンス制御部108は、カウンタ107のカウント値がある設定値に達した場合に、前記制御と並行して、第2のメモリ制御部105に対して、これまでに第2のメモリ106に格納していた符号化データを読み出し、符号化データ変換手段である再符号化部109に該符号化データを出力するよう制御信号を出す。
【0025】
再符号化部109は、入力された符号化データを復号化し、データ量を減らすための再量子化等を行なった後に再び符号化処理を行ない、該符号化データは、第1、第2のメモリ制御部103、105を介して第1、第2のメモリ104、105に格納する。このときの再符号化部109における再符号化の量子化ステップは、符号化部102の更新された量子化ステップと同じである。再符号化部109で再符号化して得られる符号量は第2のカウンタ110で計数する。
【0026】
再符号化部109の再符号化処理が終了したかどうかは、第2のメモリ制御部が検出する。すなわち、再符号化処理するために読み出すデータが無くなれば、再符号化処理の終了を符号化シーケンス制御部108に知らせる。実際には、第2のメモリ制御部105の読みだし処理だけでなく、再符号化部109の処理も終了した後に、再符号化処理が完了したことになる。
【0027】
第2のカウンタ110で得られるカウント値は、再符号化処理が完了した後、第1のカウンタ107で保持されているカウンタ値に加算される。この加算は、符号化シーケンス部108が第2のメモリ制御部105から再符号化完了の通知を受信した場合に行う。この加算をした結果、第1のカウンタ107は、第1のメモリ104内のデータ量の合計を表す計数値を保持することになる。即ち、1画面分(ページ分)の符号化部102と再符号化部109の符号化処理が終了した時点では、上記加算後の第1のカウンタ107で保持されているカウンタ値は、1画面分(1ページ分)を本装置が符号化した場合に発生した総データ量を表す(詳細は後述)。
【0028】
符号化部102は、再符号化処理の終了/未終了に関わらず、符号化するべき入力部101からの画像データが残っている限りは符号化処理を継続して行なう。
【0029】
第1のカウンタ107のカウント値がある設定値に達したかどうかの検出は、入力部101から入力される1ページ分の画像データの符号化処理(符号化、再符号化)が終わるまで繰り返され、上述した符号化と再符号化の処理は、ここで得られる検出結果に応じた制御の上で実行される。
【0030】
上記処理内容をより分かりやすく説明すると次の通りである。なお、以下はモノクロ画像の符号化についてのものである。
【0031】
入力部101より入力された画像データは符号化部102にて初期段階での量子化パラメータQ1に従い圧縮符号化を行う。生成された圧縮符号データは、第1のメモリ104、第2のメモリ106にそれぞれ書き込まれていく。このとき、第1のカウンタ107は生成される符号データ量を計数していくが、設定量以下のまま圧縮符号化処理が完了した場合には、第1のメモリ104に格納されたデータを外部に出力し、後続する画像(次ページの画像)があれば、カウンタ107、110をリセットしてその入力を行う。
【0032】
一方、或るページを符号化している最中に、生成される符号化データ量が設定値に達したと符号化シーケンス制御部108が検出した場合、第1のメモリ104内のデータを破棄させ、符号化部102に対して更に高い圧縮率となるよう、次の段階の量子化パラメータQ2を設定して画像データの入力を継続させる。このとき、第1のカウンタ107をリセットする。これにより、設定値に達したと判断された以降に入力された画像データは、更に高い圧縮率で符号化が行われることになる。また、符号化データ量が設定値に達する以前の符号化データ(量子化パラメータQ1で符号化されたデータ)は、第2のメモリ106に格納されている。そこで、このデータを再符号化部109にて、再符号化を行ない、その結果を、第1のメモリ104、第2のメモリ106にそれぞれ格納する。再符号化部109で再符号化する際の量子化パラメータは、設定変更後の符号化部102の量子化パラメータQ2と同じである。第2のメモリ106に格納されていた以前の符号化データに対する再符号化が完了すると、その符号量は第2のカウンタ110に保持されているので、それを第1のカウンタ107に足しこむ。
【0033】
以上の結果、第1のメモリ104、第2のメモリ106それぞれには、1ページの先頭から量子化パラメータQ2で圧縮された符号化データが格納されることになる。この量子化パラメータQ2で圧縮符号化している最中に、再度、カウンタ107の値が設定値に達したと判断した場合、更に高い圧縮率となるべく、量子化パラメータQ3を符号化部102及び再符号化部109に設定して、上記の処理を行う。そして、量子化パラメータQ3でも設定値に達したと判断した場合には、量子化パラメータをQ4に設定することになる。
【0034】
量子化ステップは、Q2=Q1×m、Q3=Q2×m、Q4=Q3×m…と、m倍(m>1)ずつ大きくしていく(必ずしも等倍である必要はない)。量子化ステップを大きくすると、DCT変換した際の周波数成分値が小さな値、すなわち、少ないビット数で表現できるわけであるから、データ量を減らすことが可能となる。
【0035】
上記、図1の構成における処理のフローを表わすフローチャートを図8に示すが、説明を簡単にするため、簡略化した図3のフローチャートに従って先ず説明する。
【0036】
既に説明したように、本発明の画像処理装置100は、スキャナ等の入力部101から入力した1ページの画像データを所定のデータ量以下に圧縮符号化する装置である。該符号化処理を実現するために、前記入力部101以外に、符号化部102、再符号化部109、第1のメモリ104、第2のメモリ106等を有する。これらの機能ブロックを用い、図3に示すフローチャートに基づいて符号化処理を行なう。
【0037】
図3のフローチャートは、大別すると、下記の3つの処理フェーズに分かれる。
(1)符号化フェーズ
(2)符号化・再符号化フェーズ
(3)転送フェーズ
上記それぞれの処理フェーズおいて、どのように画像データ、符号化データ等が流れて処理され,メモリにどのように格納されるかを視覚的に解り易く示したのが図4乃至図7である。
【0038】
図4は、図3のフローチャートにおけるステップS303とS305に対応する符号化フェーズの初期状態を表わす。また、図5はステップS307〜S315に対応する符号化・再符号化フェーズの処理状態を、図6はステップS317に対応する転送フェーズの処理状態を、図7は転送フェーズ後の符号化フェーズの処理状態を表わす。以下、各フェーズについて説明する。
【0039】
<<符号化フェーズ>>
1ページ分の画像データの符号化処理は、符号化パラメータの初期設定(ステップS301)から始まる。ここでは符号化処理する画像サイズ(スキャナ等の入力部101から読み取る用紙サイズ)から一意的に定まる符号化データ量の上限値に基づき符号化部102に適用する量子化ステップQ1を設定する。
【0040】
そして、ステップS303にて、第1のカウンタ107は、実際の符号化処理(画像を8×8画素のブロック単位でJPEG圧縮)を行ない、出力される符号化データのデータ量を累積カウントする。
【0041】
次にステップS305にて、該データ量のカウント値が上記上限値をオーバーしたかどうかを検知し、オーバーしていなければステップS303のJPEG符号化処理を継続する。これが初期状態の符号化フェーズである。
【0042】
符号化部102から出力する符号化データは、図4に示すように第1のメモリ104と第2のメモリ106の両方に格納されていく。縦縞で示した領域が該格納した符号を表現している。
【0043】
<<符号化・再符号化フェーズ>>
符号化部102の符号化処理が進行し、前記データ量のカウント値が設定されている上限値をオーバーすると、ステップS307にて、第1のメモリ104内の符号化データを廃棄すると共に、ステップS309にて、符号化部102の量子化パラメータをQ2に変更する。
【0044】
符号化データのデータ量のカウント値が設定された上限値をオーバーするという事は、圧縮後のデータ量が目標値以内に収まらないことを意味する。よって同じ量子化ステップを用いて符号化処理を継続しても意味が無いので、前よりもデータ量が少なくなるように、Q1よりも量子化ステップ幅の大きい量子化ステップQ2に変更するわけである。
【0045】
量子化ステップ及び量子化演算内容を変更した後、ステップS311では符号化部102の符号化処理を再開し、図5に示すように符号化データを第2のメモリ106のみに格納する。それと並行して、ステップS313の再符号化処理を行なう。再符号化処理では、第2のメモリ106に格納済みの符号化データを読み出して、再符号化部109にて再符号化処理を行ない、前記2つのメモリ104、106に格納する。そして、縦縞▲1▼の符号を全て再符号化するまで、該符号化処理と再符号化処理を継続する。
【0046】
具体的にこの再符号化処理では、符号化データを一旦ハフマン復号した後の各量子化値に対して、これら値を2nで割った結果と同様の結果が出るビットシフト処理を施した後、再度ハフマン符号化を行なうことにより実現される(m=2の場合)。この方法は、ビットシフトのみで量子化ステップを変更する点と逆直交変換や再直交変換処理を行なわない点で、高速な再符号化処理が可能である。ステップ315では、再符号化処理の終了検知が行なわれる。
【0047】
再符号化後のデータ量は再符号化前の符号化データのデータ量よりも少なくなるので、図5に示すように、再符号化前の符号を格納していたメモリ領域に再符号化後の符号化データを上書きするように格納することができる。再符号化処理が終了した時点で、縦縞▲1▼の符号化データのデータ量は図6に示すの斜め縞▲1▼の符号化データのデータ量へと減少する。
【0048】
以上で説明したステップS307〜315が、符号化・再符号化フェーズで行なう処理である。
【0049】
<<転送フェーズ>>
再符号化処理が終了したら、ステップS317では転送処理が行なわれる。該転送処理では、図6に示すように、符号化・再符号化フェーズで第2のメモリ106のみに格納した斜め縞▲2▼の符号化データを、第1のメモリ104内の斜め線▲1▼の符号化データに連結されるアドレスに転送し、格納する。その一方で、第2のメモリ106上で分散してしまっている斜め縞▲1▼の符号化データと斜め縞▲2▼の符号化データが第1のメモリ104上で連続して格納される様に、前記斜め縞▲2▼の符号化データを第2のメモリ106内で転送し、連結させる。これが、転送フェーズで行なう処理である。
【0050】
上記転送フェーズが終了したら、ステップS303、S305の符号化フェーズに戻り、図7に示すように斜め縞▲4▼の符号を符号化部102から出力して2つのメモリ104,106に格納する。この符号化フェーズは、初期状態の符号化フェーズ(図4)と少し異なり、符号化部102で符号化する際の量子化ステップがQ1からQ2に変更されていると共に、2つのメモリ104,106に格納されている符号化データも様々なフェーズで処理された符号の集まりである。それらの違いを無視すれば、転送フェーズ直後の符号化フェーズと初期状態の符号化フェーズは、同じと見なせる。
【0051】
よって、符号化フェーズ、符号化・再符号化フェーズと転送フェーズの3つを繰り返すことで、最終的に1ページの画像データを設定符号量以下に圧縮した符号を第1のメモリに格納することが出来る。しかも、入力部101は一連の処理が終わるまで、入力を継続するだけである。すなわち、画像を再度最初から入力し直すということが無くなる。
【0052】
図3に示したフローチャートは、説明が理解しやすいように、図4、図5、及び、図6に示した各フェーズに対応する処理のみを記述した。しかしながら実際には、1ページの画像データの入力はどこかのフェーズで終了する。従って、どのフェーズで終了したかによって、それ以降の対応も多少異なる。それを考慮した流れを示したのが図8のフローチャートである。図8のフローチャートは、1ページ分の画像データの入力完了と図3で説明した各種処理との関係を考慮したものであり、ここでは図3のフローチャートに、ステップS801、S803、S805、S807を追加している。
【0053】
ステップS801、S803、S805は、それぞれ、符号化フェーズ、符号化・再符号化フェーズ、転送フェーズにおいて、入力部101からの1ページ分の画像データの入力が終了したことを検知する。
【0054】
符号化フェーズと転送フェーズで1ページ分の画像データの入力が終了したことを検知した場合(ステップS801、S805)、ステップS807へ移り、当該ページの圧縮符号化処理を終了し、次に圧縮処理すべき画像データがあれば、次の1ページ分の画像データの圧縮符号化処理を開始し(各カウンタをリセットし、量子化パラメータを初期値に設定する)、無ければ停止状態に入る。
【0055】
一方、符号化・再符号化フェーズで1ページ分の画像データの入力終了を検知した場合(ステップS803)には、符号化部102では再符号化処理する画像データが無くなるまで一旦動作を止める必要があるので、ステップS311の符号化処理をパスし、ステップS313で、今までに符号化部102で符号化済みの画像データを所定の符号化データ量に抑える為の再符号化処理のみを継続して行なう。再符号化処理が全て終了して、その後の転送処理が終わらないと、1ページ分の画像データ全体の符号化データが第1のメモリ上に集まらないため、1ページ分の画像データの入力終了後も再符号化処理及びそれに続く転送処理は継続して行われる必要がある。この場合には、ステップS315にて、再符号化処理が全て終了したことを検知すると、符号化・再符号化フェーズ中に、第2のメモリ106のみに格納された符号化データを第1のメモリに転送し(ステップS317)た後、次のステップS805にて、1ページ分の画像データの入力終了が検知されてステップS807へ移ることになる。
【0056】
以上が動作であり、図8の動作説明でもある。
【0057】
<メモリ格納方法の変形例>
図9、図10は図5、図6の概念図で示したメモリ格納方法の変形例を示す図である。
【0058】
図5の概念図においては、符号化・再符号化フェーズでは、符号化部102から出力する符号化データは第2のメモリ106のみに格納していたが、図9に示すように符号化・再符号化フェーズ中に、符号化部102から出力する符号化データを第1、第2メモリの両方に直接格納する。
【0059】
符号化部102から見ると、どのフェーズで符号化して出力する符号化データも両方のメモリへ格納することになる。また、図6の概念図とは異なり、図10に示す様に、転送フェーズでメモリ間のデータ転送が必要なくなる。またこの変形例の場合には、符号化・再符号化フェーズにおいて、符号化データと再符号化データを第1のメモリ104へ送った順序で順次格納される。そのため2種類のデータが入り混じってしまうという問題は有る。
【0060】
従って、この変形例の場合にはこれに対応する為に符号化データをある単位で区切って、ファイル或いはパケットとして管理する様にする。具体的には、ファイル管理テーブル、或いは、パケット管理テーブル等を別に作成して管理する。
【0061】
一つの手法としては、符号化部102からのデータを第1メモリ104に格納する際、適当な単位(例えば前記直交変換の単位が8×8のブロックであるので、8×i(i=1、2…の整数)ライン分のデータ)毎に、画像データの先頭から管理番号を割り当て、各管理番号に対応する符号化データの格納先頭アドレスと該符号化データ量とを、管理番号順に格納できるような管理テーブルを作成する。
【0062】
符号化部102や再符号化部109は処理中のデータの管理番号を保持し、該管理番号に基づいて、符号化データ格納時の先頭アドレスと符号化データ量とを管理テーブルに書き込む。このようにすれば、符号化部102と再符号化部109で処理した符号化データをランダムに格納したとしても、前記管理テーブルを管理番号順にアクセスし、その時読み出させる先頭アドレスと符号化データ量に基づいて、符号化データを第1メモリ104から読み出せば、画像の先頭から順番に符号化データを読み出すことができる。このような管理機構を設ければ、画像上で連続するデータをメモリ上で連続するように格納する必要性が無くなる。
【0063】
図10の概念図における転送フェーズ後の符号化フェーズは、これまで説明した2つの符号化フェーズ(図4、図7)とほとんど同じであり、第1のメモリ内における符号の格納状態が図11に示した様に若干異なるだけである。よって、先の説明と本変形例は、3つのフェーズを繰り返して処理することに変わりは無い。
【0064】
<第2の例>
次に、本発明において特徴的な符号化処理を行なう為の、第2の例(これまで説明した構成を第1の例という)を図2を用いて説明する。
【0065】
図2は、第2の例における画像処理装置200のブロック構成図である。
【0066】
図1の第1の例における画像処理装置100と大きく異なる点は、最初に符号化を行なう符号化部が2つ並列に存在する点である。画像処理装置200は、入力部201から入力される画像データを、第1の符号化部202と第2の符号化部205で並行して符号化し、互いに圧縮率の異なる2種類の符号化データを生成する。本第2の例でも、符号化方式は公知のJPEG符号化方式を用い、8×8画素のブロック単位で画像データをDCT変換し、後述する量子化ステップを用いた量子化、ハフマン符号化処理を行なうものである。
【0067】
なお、本例では第1の符号化部202よりも、第2の符号化部205の方が適用する圧縮率を高く設定する場合について説明する。具体的には、第1の符号化部202における量子化パラメータをQ1、第2の符号化部205の量子化パラメータをQ2(Q2の量子化ステップは、Q1の量子化ステップより大きい)とする。
【0068】
符号化部202から出力される符号化データは、第1のメモリ制御部203を経由して、第1のメモリ204に格納される。このとき、第1のカウンタ208は、符号化部202から出力される符号化データのデータ量をカウントし、これを保持すると共に、符号化シーケンス制御部209にも出力する。
【0069】
一方、符号化部205で符号化された符号化データは、第2のメモリ制御部206を経由して、第2のメモリ207に格納される。このとき、第2のカウンタ210は、符号化部205から出力される符号化データのデータ量をカウントし、これを保持する。更に、後述する第2のメモリ207に格納している符号化データを第1のメモリ204に転送する時には、それと同時に上記第2のカウンタ210のカウント値を、第1のカウンタ208に転送する。
【0070】
さて、第1のカウンタ208が符号化部202から出力される符号化データのデータ量をカウント中に、該カウント値がある設定値に達した時には、符号化シーケンス制御部209は、第1の例と同様、メモリ制御部203に対して第1のメモリ204に格納されているデータを廃棄するよう制御信号を出す。
【0071】
そして、符号化シーケンス制御部209は、第2のメモリ207に格納済みの符号化データを読み出して第1のメモリ204に転送し、第1のメモリ204に格納するよう、メモリ制御部206とメモリ制御部203に制御信号を出力する。この結果、第2のカウンタ210のカウント値が第1のカウンタ208に転送され、その値が第1のカウンタのカウント値としてロード(上書き)される。
【0072】
要するに、上記第2のカウンタ210のカウント値は、第2のメモリ207に格納している符号化データのデータ量を表わしているので、そのカウント値と対応する符号化データを、そのまま第1のカウンタと第1のメモリへコピーしたと考えれば良い。
【0073】
さらに、符号化シーケンス制御209は、第2の符号化部205に対して、今までよりも、符号化データが少なくなるような符号化を行なうように制御信号を出す。一方、第1の符号化部202に対しては、その直前までの第2の符号化部205における量子化パラメータQ2を継承するよう設定を変更する。
【0074】
例えば、第2の符号化部205における量子化ステップを2倍に切り替える。この結果、第1の符号化部202は、第2の符号化部205は更に大きな量子化ステップQ3を用いて、次のオーバーフローに備えた更に高い圧縮率の符号化処理を行うことになる。切り替えられた各符号化部202、205から出力された符号化データは、それぞれ、対応するメモリ制御部203、206を経由して、対応するメモリ204、207に格納される。
【0075】
ここでは、量子化ステップの倍率比を2倍としたがこれに限らず、任意に設定できることは示すまでもない。例えば、カラー画像の場合、色変換した際に生成される1つの輝度信号(輝度データ)と、2つの色差信号(色差データ)に対して別々の量子化ステップを割り当て、片方ずつ交互に2倍にするようにすることで、より細かな設定が可能となる。
【0076】
そして、符号化シーケンス制御209は、メモリ制御部206に対し、既に第2のメモリ207内に格納している符号化データを読み出して、再符号化部211にデータを送るよう制御信号を出す。再符号化部211は、図1の再符号化部109と同様にして符号化データの再符号化処理を行なう。
【0077】
第3のカウンタ212は、再符号化部211が出力したデータ量をカウントするもので、再符号化処理を開始する直前にゼロにリセットされ、再符号化処理中の出力データ量をカウントする。このカウンタ212は、再符号化処理が終了した時点で、そこで得られたカウント値を第2のカウンタ210に転送する。
【0078】
第2のカウンタ210は、上記転送されてきたデータ量カウント値を、第2のカウンタ210内に保持しているカウンタ値に加算することにより、再符号化処理中にメモリ207に格納した、符号化データと再符号化データの合計のデータ量を算出する。即ち、メモリ207に格納しているデータ量とカウンタ210のカウント値とが一致する。
【0079】
再符号化処理の終了/未終了に関わらず、符号化するべき入力部201からの画像データが残っていれば、2つの符号化部202と205による符号化処理を継続して行なう。そして、カウンタ208のカウント値がある設定値に達したかどうかの監視は入力部201から入力される1ページ分の画像データの符号化処理(符号化、再符号化)が終わるまで繰り返され、上述した符号化と再符号化の処理は、ここで得られる検出結果に応じた制御の上で実行される。
【0080】
上記動作を簡単にまとめると、第2の符号化部205は、第1の符号化部202よりも1つ上の圧縮率での符号化を行う。そして、第1の符号化部202で生成された符号量が設定量に達した場合、第1の符号化部202の量子化パラメータを、直前の第2の符号化部205と同じにする。また、第2の符号化部205の量子化パラメータを更に高い圧縮率となるよう設定する。そして、第1のメモリ204内のデータを破棄し、第2のメモリ207に格納されていたデータを第1のメモリ204に転送すると共に、第2のカウンタ210の値を第1のカウンタ208に書き込む。そして、第2のメモリ内のデータを更に高い圧縮率で再符号化させるため、再符号化部211に対して、第2の符号化部205に新に設定した量子化パラメータと同じにする。この結果、第2のメモリ207内のデータは、ページの先頭から新たなに設定された量子化パラメータで圧縮したのと等価の符号データが格納されることになる。
【0081】
図2で説明したように符号化部が2つある場合は、図12に示すフローチャートに基づいて1ページ分の画像データの符号化を行なうことになる。なお、図12の説明は、符号化部が1つの場合のフローチャートである図8とは、大半は類似しており、当業者であれば上記説明から本第2の例の特徴は十分に理解できるであろうから、符号化部1つの場合と同じように3つのフェーズで処理を説明する様にし、図8と異なる点を主に説明することとする。
【0082】
上述した図8のフローと本例のフローとの一番大きな違いは、ステップS317の転送処理が、ステップS307とステップS309の間に移動していることである。要するに、符号化・再符号化フェーズと転送フェーズが入れ替わったと見なせば良い(ステップS307の符号化データの廃棄処理は例外である)。
【0083】
ステップS301の符号化パラメータの初期設定では、第1の符号化部202に量子化パラメータQ1を、第2の符号化部205には量子化パラメータQ2を設定する。ただし、量子化パラメータQ2で表される量子化ステップは、Q1よりも大きい。
【0084】
符号化フェーズでは、ステップS801、S303、S305を繰り返し実行する。ステップS801とステップS305は符号化部が1つの場合と同じ処理であるが、ステップS303の符号化処理だけは図13に示すように異なっている。
【0085】
第1のメモリ204へ格納する符号化データは圧縮率が段階的に高くなるようにするため、最初に格納する符号化データは圧縮率が一番低い量子化パラメータQ1で符号化したデータを格納し、第2のメモリへ格納する符号化データは量子化パラメータQ2で符号化したデータを格納する。
【0086】
第1のメモリ204へ格納中のデータ量が設定されている上限値をオーバーしたら(ステップS305)、直ちに、第1のメモリ204で保持していた符号化データを廃棄し(ステップS307)、第2のメモリ207で保持している圧縮率の高い符号化データを、第1のメモリ204へ転送する(ステップS317、図14参照)。これにより、第1の例で説明した1回目の再符号化処理の終了を待たずに、速やかに、上限値をオーバーしない適切な2番目の候補の符号化データを第1のメモリ207内に格納出来る。これが、図1に対する、2つの符号器を持つ図2を適用することの最大の利点である。
【0087】
本第2の例では、2つのメモリ204、207で同じ圧縮率の符号化データを持っていることが無駄という考え方なので、第2のメモリ207には、第1のメモリ204に格納する符号化データよりも圧縮率の高い符号化データを格納しておくようにしている。従って、それ以降の処理もこの考え方に基づき行われるものであり、第2のメモリ207内の符号化データを第1のメモリ204に転送する処理(転送フェーズ)が終了した後は、第2のメモリ207の符号化データを、更に1段階圧縮率の高い符号化データを保持する様に再符号化することとなる。
【0088】
具体的には、まず図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に格納し直す。
【0089】
なお、本第2の例でも、第1の例と同様、再符号化処理では、符号化データを一旦ハフマン復号した後の各量子化値に対して、これら値を2nで割った結果と同様の結果が出るビットシフト処理を施した後、再度ハフマン符号化を行なうことにより実現される。この方法は、ビットシフトのみで量子化ステップを変更する点と逆直交変換や再直交変換処理を行わない点で、高速な再符号化処理が可能である。
【0090】
また、本第2の例の様に符号化部が2つ有る場合には、図15に示したように、第2のメモリ207に符号化データと再符号化データを混在して格納する状況が発生する。従って、前述したように、符号化データをある単位で区切って、ファイル或いはパケットとして管理することが、第2のメモリ207に対しても必要になる。その為には、例えば第1の例における変形例と同様の構成を設ければ良いであろう。
【0091】
図12において、再符号化処理の終了をステップS315で検知したら、また符号化フェーズ(ステップS801、S303)に移行する。なお、符号化・再符号化フェーズ後の符号化フェーズでは、図16に示すように、2つのメモリ204,207が保持する符号化データは圧縮率が違うだけでなく、符号化データの混在の仕方(アドレス)もかなり違ってくる。従って、再度、第1のメモリ204のデータ量が設定値をオーバーした場合には、第2のメモリ207で保持されている符号化データ(▲6▼+▲8▼の横縞の領域の符号)を第1のメモリ204へ転送する必要が出てくる。これらを考慮すると、第2のメモリ207だけでなく、第1のメモリ204でも符号化データをファイル或いはパケットとして管理する必要がある。よって、第1のメモリ204にも前述の管理テーブルを用いた管理機構が必要となる。
【0092】
図16に示された符号化フェーズの状態は、量子化パラメータと符号化データの混在の仕方が、再符号化処理の前後で異なっていること以外は、初期状態の符号化フェーズ(図13)と同じである。よって、符号化フェーズ、転送フェーズと符号化・再符号化フェーズを繰り返すことで、最終的に、1ページ分の画像データを設定した上限値以下に圧縮した符号化データを確実に第1のメモリ204に格納することが出来る。
【0093】
なお、第1の例に対し、転送フェーズと符号化・再符号化フェーズの配置順が逆であることから、図8において転送処理後に行なっていた1ページ分の画像データの入力終了検知(ステップS805)は、符号化・再符号化フェーズで行なう1ページ分の画像データの入力終了検知(ステップS803)と、ほとんど同じタイミングになってしまう。また、2つの検知処理は、機能的にはステップS805と同じで、タイミング的にはステップS803と同じである、従って、これら2つのステップは、新たな1ページ分の画像データの入力終了を検知するステップとして統合し、ステップS1201と表記しておく。
【0094】
以上説明した第1、第2の例では、第1のメモリと第2のメモリは物理的に別のメモリであるとして説明をしてきた。これは、2つのメモリに対するアクセスが独立している方が有利なためである。しかしながら、第1のメモリと第2のメモリを、物理的に別のメモリとしない場合も本発明の範疇に含まれる。物理的に1つのメモリ上に、前記第1のメモリと第2のメモリに相当する2つの領域を確保して、第1のメモリを第1のメモリ領域、第2のメモリを第2のメモリ領域と言い直して、これまでの説明を読み直せば、本発明は、1つのメモリでも実現できることが分かる。
【0095】
また、1つのメモリで上記各例を実現する場合には、前記転送フェーズで説明したデータ転送処理のいくつかは不要となる。その詳細はその都度容易に想像できるので説明は省略するが、前記2つの領域を厳密に別けて使用する場合、物理的に2つのメモリを持つ時と同じようにデータ転送処理が必要であるが、2つの領域間で同じデータを共有することになれば、データ転送処理が不要になるだけでなく記憶容量の削減も図れる。
【0096】
例えば、第2のメモリ領域で保持していた符号化データを、第1のメモリ領域へ転送する際、該符号化データが格納されている先頭アドレスとデータサイズの2つの情報を第2のメモリ制御部から第1のメモリ制御部へ転送するだけで、前記符号化データを転送したのと同じ効果が得られる。
【0097】
前記符号化データを、ファイル形式やパケット形式で格納している場合は、メモリ制御部の間で転送する情報は少し増え、該符号化データに関連する管理テーブル情報を転送する必要がある。それでも、符号化データを転送するよりは、効率が良い。
【0098】
<第1の実施形態>
さて、上記の第1、第2の例においては、再符号化部109或いは211の再符号化能力が低いと、その再符号化が完了する以前に、第1の符号化部202による符号量が再度目標値に到達してしまう場合がおこり得る。このような状況になってしまうと、符号化処理が続行できなくなり、原稿画像を再度読み込みが余儀なくされる。
【0099】
本発明の第1の実施形態では、図1の構成において、上記問題を解決する制御方法を提供する。
【0100】
なお、本第1の実施形態においては、第1、第2のカウンタ107、110は共に発生する符号データ量を計測するのは勿論のこと、符号データのシンボル数をも計数することとする。シンボル数を計測する理由は、再符号化部109による再符号化処理にかかる時間を高い精度で求めるためである。すなわち、再符号化部109での再符号化は、1シンボル当たり或る時間(サイクル)を要するので、シンボル数が決まるとその全体の再符号化に要する時間を簡単に、しかも精度良く算出できるためである。例えば1シンボル当たり1サイクルの時間がかかる場合、300シンボルの符号データを再符号化する際に要する時間は300/1シンボル/サイクル=300サイクルと算出でき、高い演算精度の時間情報が得られる。ただし、あまり精度を要求しないのであれば、シンボル数と符号量との関係は概略比例関係にあるので、それでもって再符号化処理に要する時間を算出するようにしても構わない。
【0101】
図17(A)は横軸が入力する画像データの量、縦軸が符号量との関係を示している。
【0102】
同図(A)では、時刻t0から入力部101からの画像データの入力を開始し、符号化部102が初期量子化ステップQ1で符号化を開始し、時刻t1で第1のカウンタ107で計数した符号データ量が上限値に達した場合を示している。時刻t1では、第1のメモリ104に格納されたデータを破棄すると共にそれ以降に入力される画像データに対して量子化ステップQ2で符号化するよう符号化部102に設定する。このとき、カウンタ107は0クリアされる。この結果、符号化部102は時刻t2以降に入力される画像データに対して、新に設定(更新)された量子化ステップQ2での符号化を継続することになる。なお、量子化ステップQ1で符号化した符号データを量子化ステップQ2で再符号化する場合には、符号データから画像データまで復号する必要は無く、DCT変換した直後の状態まで復元し、それに量子化ステップQ2を用いて再符号化すればよい。量子化ステップQ2=Q1×2の関係にある場合には、DCT変換係数を単純に1ビット下位方向にシフトすればよい。
【0103】
また、時刻t1以前の、量子化ステップQ1で圧縮符号化されたデータは第2のメモリ106に残っているので、再符号化部109は一旦復号処理し、今度は量子化ステップQ2で再符号化することになる。従って、時刻t1における再符号化部109で再符号化しなければならない符号化データ量は実質的に設定された上限値に等しく、その再符号化が行われているに従って徐々に減っていき、最終的に再符号化すべきデータが0になるまで再符号化処理が行うことになる。図示では、時刻t2で再符号化部109による再符号化処理が完了したことを示している。再符号化が完了すると、再符号化された後の符号データ量及びシンボル数が第2のカウンタ110で計数されているので、それらの値を第1のカウンタ107に足し込む。そして、最終的時刻t3で再び上限値に達したと判断され、上記の処理を繰り返すことになる。
【0104】
上記のようなシーケンスをたどる場合、格別な問題は発生しない。理由は、時刻t2≦t3となりからである。より分かりやすく言えば、第1のメモリ103に格納されるデータ量は再び上限値に到達する以前に、再符号化部109の再符号化処理が完了するからでもある。
【0105】
一方、時刻t2>t3となると、もはや正常な符号化処理が実現できないことも理解できよう。同図(B)はt2>t3となっている状況を示している。
【0106】
かかる状況を回避するためには、最初に符号化データ量が上限に達する時刻t1よりも早い時刻である時刻t1’で再符号化部109による再符号化を開始させることで、その再符号化処理が完了する時刻を時刻t3以前にすることである。
【0107】
再符号化に要する時間は、先に説明したようにシンボル数により決定されるわけであるから、或る時刻Taとしたとき、その時刻Taにおける第1のカウンタ107に保持されているシンボル数に1シンボル数当たりにかかるサイクル数を乗算して得た時間Tbを算出することで、再符号化完了時刻t2=Ta+Tbで得られる。
【0108】
一方、量子化ステップQ2と量子化ステップQ1で同じ画像データを符号化した際の符号量の比を、幾つものサンプル画像に対して実験的に求めておき、その平均値α12をテーブルに記憶しておく。これは、他の量子化ステップQ3、Q4…についても同じであり、それぞれの符号量比α13、α14…として記憶する。なお、テーブルではなく、演算式として記憶するようにしても構わない。
【0109】
従って、時刻Taにおける量子化ステップQ1での符号量をV1(実測値)としたとき、同時刻における量子化ステップQ2での予測符号量V2aは、V2a=V1×α12で演算できる。従って、座標を{時刻、符号量}としたとき、{t0、0}と{ta、V2a}を結ぶ延長線と上限値との交わる時刻が2回めの上限値に到達する予測時刻t3を算出できることがわかる。
【0110】
そこで、本第1の実施形態では、図17(B)の如く、量子化ステップQ1での符号化を行っている最中に、2回めの目標値に到達する時刻t3を予測演算し、且つ、そのときシンボル数から再符号化が完了する時刻t2を予測演算し、
t2>t3−Δt(Δtは正の値で、予め経験的に求めた所定値)
という条件を満足するとき、例え上限値に到達していなくても、上限値に到達した場合と同様の処理を開始するようにした。
【0111】
上記の例は、符号化部102が量子化ステップQ1で符号化し、次回に使用する量子化ステップがQ2である例であったが、上記に限らず、一般に、符号化部102が量子化ステップQnで符号化している最中(次回の量子化ステップがQn+1)に適用できるのは明らかである。
【0112】
かかる処理を実現するためには、先に説明した図3の処理に代わって図18、もしくは図8に代わって図19のような処理を行えば良いであろう(図18、19の処理は、符号化シーケンス制御部108が行うことになる)。
【0113】
図3と図18、図8と図19との違いは、ステップS318を追加した点にある。
【0114】
すなわち、ステップS305で符号量が上限値に達していないと判断したとしても、ステップS315に進んで、次の段階の量子化ステップでの符号化を行った場合の上限値に到達する予測時刻t3と、そのときのシンボル数Mによる再符号化が完了する予測時刻t2との間に、
t2>t3−Δt …(1)
なる関係が成立するか否かを判断する。もし、この関係が成立する場合には、ステップS307の処理に進むことで、符号量が上限値に到達した場合と同様の処理を行わせる。それ以外の処理は、先に説明した第1の例と同じであるので、説明するまでもないであろう。
【0115】
以上の説明によれば、生成される符号化データ量が上限値に再び到達する以前に、再符号化処理が完了することが可能となり、画像データの符号化処理がスムースに進むことになる。
【0116】
ところで、図17(B)に示す状況にあるとき、1ページの画像データの入力が終了する時刻がt1よりも前になることが有り得る。この場合、量子化ステップQ1で符号化し続けたとしても、上限値に到達する以前に1ページの符号化が完了するわけであるから、再符号化処理は開始させることは不要である。また、もし再符号化をさせてしまうと、本来量子化ステップQ1で符号化しても良いはずが、それより大きな量子化ステップQ2で再符号化してしまうことになる。これは、不必要な画質劣化処理を招くことを意味し、このような事態は避けることが望ましい。
【0117】
したがって、図18や図19におけるステップS318における再符号化を開始するタイミングであるか否かの上記条件である式(1)、更に、1ページの画像の符号化完了時刻をも加味して行うことが必要になる。
【0118】
実施形態における符号化部102は8×8画素単位のブロック単位にJPEG符号化を行っている。換言すれば、1つのブロックの符号化が完了する毎に次のブロックを入力し符号化を行うことになる。ここで、1ブロックの画素データを符号化する平均時間をTbとする。そして、1ページの総ブロック数をM(入力する画像サイズで一意に決定される)、現在符号化しているブロックがN番目、現在時刻がTcとするなら、1ページの符号化が終了する予測時刻Teは、
Te=Tc+(MーN)×Tb
として計算できる。なお、この時刻Teを算出するため、第1のカウンタ107は、符号化データ量、シンボル数を計数するのは勿論のこと、符号化部102から出力される符号化データをブロック単位に計数ことになる。ただし、説明するまでもないが、計数中のこのブロック数は1ページの符号化開始時にリセットされるものであり、符号量が上限値に達したとしてもリセット(ゼロクリア)されることはない。
【0119】
一方、現在時刻Tcにおける第1のカウンタ208で計数された符号化データサイズをVcとしたとき、過去の1ブロック当たりの符号量ΔVはVc/Nで算出できる。上限値を仮にVmaxとすると、このまま符号化部102での符号化処理を継続した場合に第1のカウンタ208で計数される符号化データ量が上限値Vmaxに到達する予測時刻T1は、
T1=Tc+{(Vmax−Vc)/ΔV}×Tb
として計算できる。したがって、
Te≦T1
である場合には、再符号化処理を開始させる必要がないことになる。但し、安全性を確保することが必要であるので、許容誤差をε(>0)とした場合、
Te≦T1−ε
を満たす場合には再符号化を行わないこととする。
【0120】
要するに、図18、図19のステップS318において、ステップS307に進んで再符号化を開始させるのは、
Te>T1−ε (3)
t2>t3−Δt (4)
の2つの条件(3)、(4)を満たす場合となる。そして、これら2つの条件のうち、少なくとも一方の条件が満たされない場合には、現在設定されている量子化ステップのまま符号化処理を継続する。なお、Te、T1はともにTc成分を含んでいるので、Tcは算出対象外としても構わない。この場合、Teは現在から1ページの符号化が完了するまでの時間、T1は現在から上限値に到達するまでの時間を示すことになる。
【0121】
以上説明したようにすることで、画質劣化を最低限に抑え、尚且つ、一連の符号化処理が中断することなく、1回の画像データの入力でもって目標符号化データ量以内に符号化することが可能になる。
【0122】
なお、説明するまでもないと考えるが、1ページの画像データの符号化が完了する時刻Teは、イメージスキャナ等で画像を読込む場合には、その1ページの画像データの読取りが完了する時刻と実質的に同じである。
【0123】
また、上記例では、上限値に最初に到達する時刻と、1ページの画像データの符号化が完了する時刻とを比較したが、再符号化した後の2回め以降に上限値に到達する時刻と1ページの画像データの符号化が完了する時刻についても同様であるのは明らかであるし、図18、19に対する修正はない。
【0124】
<第2の実施形態>
上記第1の実施形態は図1の構成をその基礎にしたが、図2を基礎する例を第2の実施形態として以下に説明する。
【0125】
図1と図2との違いは、先に説明したように、2つの符号化部が並列に圧縮符号化を行う点である。
【0126】
第1の実施形態では、量子化ステップQnで圧縮符号化している最中に、量子化ステップQn+1での符号量を類推し、量子化ステップQn+1で圧縮符号化したと仮定したときの上限値に到達する時刻t3を予測演算した。
【0127】
一方、本第2の実施形態では第1の符号化部202が量子化ステップQnで圧縮符号化し、第2の符号化部205が量子化ステップQn+1で圧縮符号化することになる。すなわち、量子化ステップQn+1での上限値に到達する時刻t3は、実符号データ量に基づいて演算できることになるので、その精度は第1の実施形態よりも更に高くできることになる。換言すれば、第1の実施形態におけるΔtを更に小さなものとし、再符号化を開始するタイミングを遅らせることができることになる。
【0128】
先ず、図2に適用する場合、第1のカウンタ208は符号化部202による符号化データ量を計数するだけでよく、シンボル数を計数する必要はない。その代わり、第2のカウンタ210、第3のカウンタ212は符号化データ量とシンボル数を計数する。
【0129】
以下、本第2の実施形態における動作概要を説明することとする。
【0130】
第1の符号化部202は、初期状態では量子化ステップQ1に基づいて圧縮符号化処理を行ない、生成された符号化データは第1のメモリ204に格納される。第2の符号化部205はそれより1段階大きな量子化ステップQ2で圧縮符号化し、その結果は第2のメモリ207に格納される。また、第1のカウンタ208は第1の符号化部202から出力される符号データ量を累積カウントし、第2のカウンタ210は第2の符号化部205から出力される符号化データ量を累積カウントする。
【0131】
1ページの画像の入力が完了したとき、第1のカウンタ208で計数した符号量が設定値以内であれば、第1のメモリ204に格納された符号化データを最終的な圧縮符号化データとして外部に出力する。
【0132】
一方、1ページの画像入力中に、第1の符号化部202から出力された符号量が設定値に到達してしまった場合については、図20(A)、(B)を用いて説明する。
【0133】
図20(A)において、今、時刻t1で、第1のカウンタ208で計数している符号データ量が設定上限値に到達したと判断したとする。このとき、第1のメモリ204内のデータを破棄し、第2のメモリ207のデータを第1のメモリ204に転送し、且つ、第1の符号化部202が使用する量子化ステップを、その時点で第2の符号化部205が用いていた量子化ステップQ2で更新する。この結果、画像の1ページを最初から量子化ステップQ2で圧縮していたのと等価の構成を得る。また、第2の符号化部205に対しては、更に高い圧縮率とすべく量子化ステップQ3を設定し、時刻t1以降に入力される画像データについては量子化ステップQ3で圧縮符号化を行う。ただし、時刻t1のときに第2のメモリ207に格納されている符号化データは、量子化ステップQ2に基づく符号化データであるので、それを量子化ステップQ3で再符号化する必要がある。この再符号化は再符号化部211で行う。
【0134】
この量子化ステップQ3での再符号化が完了する時刻t2は、量子化ステップQ2で符号化を開始した第1の符号化部202による符号量が再び上限値に到達する時刻t3よりも前になっている必要がある。
【0135】
つまり、同図(A)における時刻t1”よりも前のタイミングで再符号化部211での再符号化を開始させる必要がある。
【0136】
第1の実施形態ではちょうど図20の時刻t1’以前に再符号化を開始する必要があったが、図2の構成にすることで時刻t1”−t1’だけ時間的余裕が生まれることになる。
【0137】
また、同図(A)からも分かるように、再符号化部211の再符号化対象は、第2のメモリ207内の符号化データに対して行えば良く、第1の符号化部202による符号量とは直接には関係がない。従って、第2のカウンタ210、第3のカウンタ212は符号データ量及びシンボル数を計数することが必要になるものの、第1のカウンタ208は符号データ量のみを計数すればよい。
【0138】
なお、同図(A)の場合、タイミングt1のときに、第1の符号化部202、第2の符号化部205に設定する量子化ステップを更新することになるので、実際は、時刻t1で再符号化部211の再符号化処理を開始させることになる。以上は、最初に上限値に到達する場合の例であるが、2回め以降については符号化部202、210及び再符号化部211に設定する量子化ステップが異なるだけで、処理内容は同様である。
【0139】
図20(B)は、第1のカウンタ208で計数した符号データ量が上限値に到達した時刻t1で再符号化部211による再符号化を開始しても、量子化ステップQ2での符号量が再び上限値に到達する時刻t3以内に、その再符号化処理が完了できない状態を示している。すなわち、再符号化部211の処理は、同図(B)における時刻t1”以前に開始する必要があることを示している。
【0140】
この判定は、第2のカウンタ210で保持されているシンボル数に基づく再符号化部211の再符号化処理に要する時刻t2を算出し、且つ、そのときの符号量に基づいて再び上限値になる予測時刻t3を算出し、
t2>t3−Δt
なる関係にあるとき、第1のカウンタ208が例え上限値に達していなくても、上限値に達したものとして処理すれば良い。
【0141】
なお、図20(B)によれば、再符号化を開始しなければならない時刻はt1”であるが、第1の実施形態における時刻t1’よりは時間的な余裕があることもわかる。
【0142】
以上であるが、上記処理を実現するためには、例えば図12の処理に代わって図21に示す処理を行えば良い。図12との違いは、ステップS318を追加した点である。
【0143】
すなわち、ステップS305で符号量が上限値に達していないと判断したとしても、ステップS315に進んで、第2のカウンタ210に保持された符号量及びシンボル数にもとづき、次の段階の量子化ステップでの符号化を行った場合の上限値に到達する予測時刻t3と、そのときのシンボル数による再符号化が完了する予測時刻t2との間に、
t2>t3−Δt
なる関係が成立するか否かを判断する。もし、この関係が成立する場合には、ステップS307の処理に進むことで、符号量が上限値に到達した場合と同様の処理を行わせる。それ以外の処理は、先に説明した第1の例と同じであるので、説明するまでもないであろう。
【0144】
なお、本第2の実施形態の機能を実現する場合、符号化シーケンス部209は第2のカウンタ210に保持された情報(実施形態では符号化データ量及びシンボル数)をも参照することになるので、図2ではなく図22に示す構成となる。図22と図2との違いは、上記の如く、符号化シーケンス制御部209が第2のカウンタ210のデータをダイレクトに参照できるようにした点のみであるので、その詳細は説明するまでもないであろう。
【0145】
以上の説明によれば、第1の実施形態と同様の作用効果を奏することが可能となる。また、第2の実施形態の場合、2つの符号化部が並列して符号化処理を行うことになるので、その構成を利用することで再符号化処理に時間的余裕が発生する。従って、図2に相当する処理をコンピュータプログラムでもって実現する場合に都合が良い。なぜなら、例えばパーソナルコンピュータ等で画像データを入力し圧縮符号化する場合、別タスク等で予期せぬ処理が発生することがあるので、時間的に余裕のある処理が望ましいからである。また、再符号化処理に要する時間は、符号データ量でも良いが、シンボル数にすることで高い精度でその時刻を演算できるようになる。
【0146】
ただし、上記第2の実施形態でも、先に説明した第1の実施形態と同様、1ページの画像データの符号化終了時刻を加味して、再符号化を行うべきか否かを判定することが望ましい。
【0147】
すなわち、図20(B)に示す状況、すなわち、1ページの符号化終了時刻Teが時刻t1よりも前になる場合、再符号化は不要と判断する。第2の実施形態に適合する場合、2つの符号化部202、205が並行して符号化している点が第1の実施形態と異なるが、原理は同じである。
【0148】
すなわち、符号化部202の1ブロックの画素データを符号化する平均時間をTbとする。そして、1ページの総ブロック数をM(入力する画像サイズで一意に決定される)、現在符号化しているブロックがN番目、現在時刻がTcとするなら、1ページの符号化が終了する予測時刻Teは、
Te=Tc+(MーN)×Tb
として計算する。
【0149】
一方、現在時刻Tcにおける第1のカウンタ208で計数された符号化データサイズをVcとしたとき、過去の1ブロック当たりの符号量ΔVはVc/Nで算出できる。上限値を仮にVmaxとすると、このまま符号化部102での符号化処理を継続した場合に第1のカウンタ208で計数される符号化データ量が上限値Vmaxに到達する予測時刻T1は、
T1=Tc+{(Vmax−Vc)/ΔV}×Tb
として計算できる。したがって、
Te≦T1
である場合には、再符号化処理を開始させる必要がないことになる。但し、安全性を確保することが必要であるので、許容誤差をε(>0)とした場合、
Te≦T1−ε
を満たす場合には再符号化を行わないこととする。
【0150】
したがって、図21のステップS318において、ステップS307に進んで再符号化を開始させるのは、<第1の実施形態の改善例>と同様、
Te>T1−ε (3)
t2>t3−Δt (4)
の2つの条件(3)、(4)を満たす場合となる。そして、これら2つの条件のうち、少なくとも一方の条件が満たされない場合には、現在設定されている量子化ステップのまま符号化処理を継続すれば良い。
【0151】
以上説明したようにすることで、第1の実施形態と同様、画質劣化を最低限に抑え、尚且つ、一連の符号化処理が中断することなく、1回の画像データの入力でもって目標符号化データ量以内に符号化することが可能になる。
【0152】
なお、上記第1、第2の実施形態では、モノクロ画像入力の場合であったが、カラー画像の場合には、更に細かい調整が可能となる。カラー画像を符号化する場合には、公知の色変換により、輝度データ(Y)と、2つの色差データ(C)とが得られるわけであるから、次のような関係にすることが可能になる。尚、以下においてYは輝度、Cは色差を意味し、QYi(i=1,2,3…)とは輝度成分についての量子化ステップを、QCi(i=1,2,3…)は色差成分についての量子化ステップを示し、iが大きくなるほど量子化ステップが大きくなることを示している。
従前の量子化Step 量子化Step候補
(QY1,QC1) → (QY1,QC2),(QY2,QC2),(QY2,QC3),(QY3,QC3)…
(QY1,QC2) → (QY2,QC2),(QY2,QC3),(QY3,QC3),(QY3,QC4)…
(QY2,QC2) → (QY2,QC3),(QY3,QC3),(QY3,QC4),(QY4,QC4)…

また、実施形態では、圧縮率を向上させるために、量子化ステップを大きくする例を説明したが、パラメータを変更することで圧縮率が可変な符号化であれば適用できるのは上記実施形態から明らかであるので、必ずしも量子化ステップに限定されるものでもない。例えば、JPEG2000によれば、量子化した後のエントロピー符号化の際、レイヤ単位に圧縮が行える。高位のレイヤほど画質に対して支配的であるので、最下位レイヤからi個のレイヤを切り捨てる等を行えば、圧縮率を変えることができよう。
【0153】
また、上記の通り、本発明は、汎用装置上で動作するアプリケーションプログラムによって実現できるものであるので、本発明はコンピュータプログラムをも含むものである。特に、コンピュータプログラムで実現する場合、そのコンピュータの処理能力はまちまちであろうから、上記の式(3)、(4)における「ε」や「Δt」はユーザが自由に変更可能とすることが望まれる。
【0154】
また、コンピュータプログラムは、通常、フロッピー(登録商標)ディスクやCDROM等の記憶媒体を装置にセットしてコピー或いはインストールことで行われるので、かかる記憶媒体も本発明の範疇に当然に含まれる。
【0155】
また、本発明は、コンピュータプログラムと適当なハードウェア(符号化回路等)の組み合わせにも適用できる。
【0156】
【発明の効果】
以上説明したように本発明によれば、比較的簡単な構成でもって、画像の入力を継続させながら、目標符号量以下に符号化することを確実なものとし、尚且つ、画質劣化を可能な限り抑制することが可能になる。
【図面の簡単な説明】
【図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】第1の実施形態における再符号化処理開始タイミングの設定原理を説明するための図である。
【図18】第1の実施形態における処理手順を示すフローチャートである。
【図19】第1の実施形態における処理手順を示すフローチャートである。
【図20】第2の実施形態における再符号化処理開始タイミングの設定原理を説明するための図である。
【図21】第2の実施形態における処理手順を示すフローチャートである。
【図22】第2の実施形態における画像処理装置のブロック構成図である。
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a technique for encoding image data.
[0002]
[Prior art]
Conventionally, as a still image compression method, a JPEG method using discrete cosine transform (hereinafter abbreviated as DCT) and a method using Wavelet transform are often used. Since this type of encoding method is a variable-length encoding method, the code amount changes for each image to be encoded.
[0003]
In the JPEG method, which is an international standardization method, only one set of quantization matrix can be defined for an image. Therefore, the code amount cannot be adjusted without pre-scanning and used in a system that stores in a limited memory. There was a danger of causing memory over.
[0004]
In order to prevent this, it is necessary to secure a sufficient memory capacity. However, the sizes of the input images are not always the same but may be different. Therefore, until now, it has been necessary to secure a memory having a capacity that can be adapted to the maximum size that can be input.
[0005]
[Problems to be solved by the invention]
However, in a device that secures a memory in accordance with the maximum size, it means that the memory is secured even when an image having a smaller size is input, and the memory is effectively used. I can't say that.
[0006]
Therefore, it is conceivable to match the memory capacity to be secured to a medium image, but this time, the code data obtained by the encoding process will exceed that.
[0007]
As a countermeasure in this case, when the code amount exceeds the planned code amount, in order to adjust the code amount by changing the compression rate and re-reading the document or estimating the code amount by pre-scanning in advance, A method of resetting the quantization parameter is known.
[0008]
Conventionally, as a code amount control method for performing pre-scan, for example, 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 is known . At this time, the main compression needs to have a higher compression rate than the pre-compression.
[0009]
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. This shift amount n is an allowable code amount. Determined from.
[0010]
The present inventors have already proposed several techniques for reliably encoding an image within a single encoding processing time and with a small amount of memory. Although the details will be described later, in brief, when the code amount is likely to overflow the target memory capacity, the compression rate of the encoder is increased, and the data that has already been encoded is updated. Is re-encoded so that it is equivalent to being compressed at the compression rate set to.
[0011]
Although the above process is very effective, a high processing capability is required for the re-encoding unit that performs the re-encoding process. If the re-encoding processing capability is low, the compression code amount at the re-set compression rate may exceed the target value before the re-encoding is completed. This is because the encoding process cannot be started, and as a result, compression encoding fails.
[0012]
For the reasons described above, re-encoding requires a high processing capacity, but in fact, it is rare that such a situation occurs. Therefore, satisfying a high processing capacity for re-encoding is excessive, leading to an increase in cost.
[0013]
The present invention has been made in view of such problems, and with a relatively simple configuration, it is ensured that encoding is performed below the target code amount while image input is continued, and image quality is deteriorated. We intend to provide a technology that suppresses as much as possible.
[0014]
[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,
An image processing apparatus that compresses and encodes one page of image data,
First encoding means capable of changing the quantization step;
A second encoding unit that can change a quantization step and re-encodes the code data compressed by the first encoding unit;
First determination means for monitoring the amount of code data generated by the first encoding means and determining whether the amount of code data has reached a predetermined amount;
A prediction time T0 at which the encoding of one page of image data is completed, and a prediction time T1 at which the amount of code data generated by the first encoding means reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second judging means for judging whether or not
Based on the amount of code data, the first encoding means is already generated according to the time T2 when the predetermined amount is reached when it is assumed that the first encoding means has performed compression encoding in the next quantization step, and the current quantization step. A re-encoding completion time T3 when it is assumed that the encoded data is re-encoded by the second encoding unit that has set the quantization step of the next stage;
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination means for determining whether or not
When it is determined that the predetermined amount has been reached by the first determination means, or when both the conditions 1 and 2 are satisfied by the second and third determination means, the first and second codes Setting means for setting the quantization step of the next stage in the conversion means;
When the quantization step is changed by the setting means, the encoding by the first encoding means is continued for the image data input after the quantization step change, and the already encoded code data before the quantization change Comprises control means for re-encoding by the second encoding means.
[0015]
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.
[0016]
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.
[0017]
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 means for rendering a page description language into a raster image, or may be realized by reading an image file stored in a storage medium. May be received from the network.
[0018]
The encoding unit 102 encodes input image data. The encoding method uses a known JPEG encoding method, DCT transforms image data with 8 × 8 pixels, and performs quantization and Huffman encoding processing using a quantization step described later.
[0019]
The first memory control unit 103 and the second memory control unit 105 use the encoded data (the same encoded data) output from the encoding unit 102 as the first memory 104 and the second memory 106. It controls to store each. 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.
[0020]
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 it to the encoding sequence control unit 108 that controls the encoding sequence based on the count result. To do.
[0021]
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 encoded 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 to match the data amount in the first memory 104 (the input from the input unit 101 is continued). Further, the encoding unit 102 is controlled to perform encoding at a higher compression rate than before. Specifically, the quantization step for quantizing the DCT transform coefficient is set to be doubled.
[0022]
Although the quantization step is simply doubled here, in the case of a color image, one luminance signal (luminance data) generated when color conversion is performed and two color difference signals (color difference data). Assign different quantization steps and double each one alternately.
[0023]
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 The first memory 104 stores a code generated by encoding data input after the discard operation shift.
[0024]
When the count value of the counter 107 reaches a certain set value, the encoding sequence control unit 108 transfers the second memory control unit 105 to the second memory 106 so far in parallel with the control. The stored encoded data is read, and a control signal is output so that the encoded data is output to the re-encoding unit 109 serving as encoded data conversion means.
[0025]
The re-encoding unit 109 decodes the input encoded data, performs re-quantization to reduce the amount of data, and then performs the encoding process again. The encoded data includes the first and second encoded data. The data is stored in the first and second memories 104 and 105 via the memory control units 103 and 105. At this time, the re-encoding quantization step in the re-encoding unit 109 is the same as the updated quantization step in the encoding unit 102. The code amount obtained by re-encoding by the re-encoding unit 109 is counted by the second counter 110.
[0026]
The second memory control unit detects whether or not the re-encoding process of the re-encoding unit 109 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 re-encoding process is completed.
[0027]
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 is performed when the encoding sequence unit 108 receives a re-encoding completion notification from the second memory control unit 105. As a result of this addition, the first counter 107 holds a count value representing the total amount of data in the first memory 104. That is, at the time when the encoding process of the encoding unit 102 and re-encoding unit 109 for one screen (page) is completed, the counter value held by the first counter 107 after the addition is one screen. This represents the total amount of data generated when this apparatus encodes minutes (for one page) (details will be described later).
[0028]
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.
[0029]
The detection of whether or not the count value of the first counter 107 has reached a certain setting value is repeated until the encoding process (encoding and re-encoding) of image data for one page input from the input unit 101 is completed. Thus, the encoding and re-encoding processes described above are executed under control according to the detection result obtained here.
[0030]
The above processing contents will be described in a more easy-to-understand manner as follows. The following is about monochrome image encoding.
[0031]
The image data input from the input unit 101 is compressed and encoded by the encoding unit 102 in accordance with the quantization parameter Q1 at the initial stage. The generated compressed code data is written into the first memory 104 and the second memory 106, respectively. At this time, the first counter 107 counts the amount of code data to be generated. When the compression encoding process is completed while the amount is less than or equal to the set amount, the data stored in the first memory 104 is externally stored. If there is a subsequent image (image of the next page), the counters 107 and 110 are reset and input.
[0032]
On the other hand, when the encoding sequence control unit 108 detects that the amount of encoded data to be generated has reached the set value while encoding a certain page, the data in the first memory 104 is discarded. Then, the quantization parameter Q2 at the next stage is set so that the compression rate becomes higher for the encoding unit 102, and the input of the image data is continued. At this time, the first counter 107 is reset. As a result, the image data input after it is determined that the set value has been reached is encoded at a higher compression rate. Also, the encoded data (data encoded with the quantization parameter Q1) before the encoded data amount reaches the set value is stored in the second memory 106. Therefore, this data is re-encoded by the re-encoding unit 109 and the result is stored in the first memory 104 and the second memory 106, respectively. The quantization parameter at the time of re-encoding by the re-encoding unit 109 is the same as the quantization parameter Q2 of the encoding unit 102 after the setting change. When the re-encoding for the previous encoded data stored in the second memory 106 is completed, the code amount is held in the second counter 110, so that it is added to the first counter 107.
[0033]
As a result, the first memory 104 and the second memory 106 store the encoded data compressed with the quantization parameter Q2 from the top of one page. When it is determined that the value of the counter 107 has reached the set value again during compression encoding with the quantization parameter Q2, the quantization parameter Q3 is re-established with the encoding unit 102 and the re-encoder to achieve a higher compression rate. The above processing is performed by setting in the encoding unit 109. When it is determined that the set value is reached even with the quantization parameter Q3, the quantization parameter is set to Q4.
[0034]
The quantization step is increased by m times (m> 1) (Q2 = Q1 × m, Q3 = Q2 × m, Q4 = Q3 × m,... (Not necessarily equal). When the quantization step is increased, the frequency component value at the time of DCT conversion can be expressed with a small value, that is, with a small number of bits, and thus the data amount can be reduced.
[0035]
FIG. 8 is a flowchart showing the process flow in the configuration shown in FIG. 1, but for the sake of simplicity, description will be given first according to the simplified flowchart shown in FIG.
[0036]
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.
[0037]
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.
[0038]
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.
[0039]
<< Encoding Phase >>
Encoding processing of image data for one page starts from initial setting of encoding parameters (step S301). Here, the quantization step Q1 to be applied to the encoding unit 102 is set based on 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).
[0040]
In step S303, the first counter 107 performs actual encoding processing (JPEG compression of the image in units of 8 × 8 pixels) and cumulatively counts the amount of encoded data to be output.
[0041]
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.
[0042]
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.
[0043]
<< 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 S309, the quantization parameter of the encoding unit 102 is changed to Q2.
[0044]
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.
[0045]
After changing the quantization step and the contents of the quantization operation, in step S311, the encoding process of the encoding unit 102 is resumed, 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.
[0046]
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 (when m = 2). 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.
[0047]
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.
[0048]
Steps S307 to 315 described above are processes performed in the encoding / recoding phase.
[0049]
<< 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)} dispersed 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.
[0050]
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.
[0051]
Therefore, by repeating the encoding phase, the encoding / re-encoding phase, and the transfer phase, a code in which one page of image data is finally compressed to a set code amount or less 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.
[0052]
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.
[0053]
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.
[0054]
When 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 to end the compression encoding process for the page, and then the compression process If there is image data to be processed, compression encoding processing of image data for the next one page is started (respective counters are reset and quantization parameters are set to initial values).
[0055]
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.
[0056]
The above is the operation, and is also the operation description of FIG.
[0057]
<Modification of memory storage method>
9 and 10 are diagrams showing modifications of the memory storing method shown in the conceptual diagrams of FIGS.
[0058]
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.
[0059]
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.
[0060]
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.
[0061]
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.
[0062]
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 is randomly stored, the management table is accessed in the order of the management number, and the head address and the encoded data to be read at that time are read. 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.
[0063]
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.
[0064]
<Second example>
Next, a second example (the configuration described so far is referred to as the first example) for performing a characteristic encoding process in the present invention will be described with reference to FIG.
[0065]
FIG. 2 is a block diagram of the image processing apparatus 200 in the second example.
[0066]
A significant difference from the image processing apparatus 100 in the first example 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 the second example, a known JPEG encoding method is used as the encoding method, image data is DCT-converted in units of 8 × 8 pixel blocks, and quantization and Huffman encoding processing using a quantization step described later is performed. Is to do.
[0067]
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 parameter in the first encoding unit 202 is Q1, and the quantization parameter of the second encoding unit 205 is Q2 (the Q2 quantization step is larger than the Q1 quantization step). .
[0068]
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.
[0069]
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. Furthermore, when the encoded data stored in the second memory 207 described later is transferred to the first memory 204, the count value of the second counter 210 is transferred to the first counter 208 at the same time.
[0070]
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 first memory 204.
[0071]
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 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.
[0072]
In short, since the count value of the second counter 210 represents the amount of encoded data stored in the second memory 207, the encoded data corresponding to the count value is directly used as the first value. It can be considered that the data has been copied to the counter and the first memory.
[0073]
Further, the encoding sequence control 209 outputs a control signal to the second encoding unit 205 so as to perform encoding so that encoded data is smaller than before. On the other hand, for the first encoding unit 202, the setting is changed so as to inherit the quantization parameter Q2 in the second encoding unit 205 until just before.
[0074]
For example, the quantization step in the second encoding unit 205 is switched to twice. As a result, the first encoding unit 202 performs encoding processing with a higher compression ratio in preparation for the next overflow using the second encoding unit 205 using a larger quantization step Q3. 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.
[0075]
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. For example, in the case of a color image, separate quantization steps are assigned to one luminance signal (luminance data) generated at the time of color conversion and two color difference signals (color difference data), and each one is doubled alternately. By making it, it becomes possible to make finer settings.
[0076]
Then, the encoding sequence control 209 reads out the encoded data already stored in the second memory 207 and sends a control signal to the re-encoding unit 211 to the memory control unit 206. The re-encoding unit 211 performs re-encoding processing of encoded data in the same manner as the re-encoding unit 109 in FIG.
[0077]
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.
[0078]
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.
[0079]
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.
[0080]
To summarize the above operations, the second encoding unit 205 performs encoding at a compression rate that is one higher than that of the first encoding unit 202. When the code amount generated by the first encoding unit 202 reaches the set amount, the quantization parameter of the first encoding unit 202 is set to be the same as that of the second encoding unit 205 immediately before. Also, the quantization parameter of the second encoding unit 205 is set to be a higher compression rate. Then, the data in the first memory 204 is discarded, the data stored in the second memory 207 is transferred to the first memory 204, and the value of the second counter 210 is transferred to the first counter 208. Write. Then, in order to re-encode the data in the second memory at a higher compression rate, the re-encoding unit 211 is made the same as the quantization parameter newly set in the second encoding unit 205. As a result, the data in the second memory 207 stores code data equivalent to the data compressed with the newly set quantization parameter from the top of the page.
[0081]
When there are two encoding units as described with reference to FIG. 2, the 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 will fully understand the features of the second example from the above description. Since it will be possible, the process will be described in three phases as in the case of one encoding unit, and the differences from FIG. 8 will be mainly described.
[0082]
The biggest difference between the flow of FIG. 8 described above and the flow of this example 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).
[0083]
In the initial setting of the encoding parameter in step S301, the quantization parameter Q1 is set in the first encoding unit 202, and the quantization parameter Q2 is set in the second encoding unit 205. However, the quantization step represented by the quantization parameter Q2 is larger than Q1.
[0084]
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.
[0085]
In order to increase the compression rate of the encoded data stored in the first memory 204 in a stepwise manner, the encoded data stored first stores data encoded with the quantization parameter Q1 having the lowest compression rate. The encoded data stored in the second memory stores data encoded with the quantization parameter Q2.
[0086]
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 example, the appropriate second candidate encoded data that does not exceed the upper limit value is quickly stored in the first memory 207. Can be stored. This is the greatest advantage of applying FIG. 2 with two encoders over FIG.
[0087]
In this second example, 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 has the encoding stored in the first memory 204. The encoded data having a higher compression rate than the 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.
[0088]
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. The parameters 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 rate encoded data, the re-encoding unit 211 performs a re-encoding process (S313) so that data encoded using the quantization parameter Q3 is obtained, and the re-encoded data is 2 is stored again in the second memory 207.
[0089]
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.
[0090]
Further, when there are two encoding units as in the second example, as shown in FIG. 15, a situation in which encoded data and re-encoded data are mixedly stored in the second memory 207. Will occur. 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.
[0091]
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)) Need 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.
[0092]
The state of the encoding phase shown in FIG. 16 is the encoding phase in the initial state (FIG. 13) except that the method of mixing the quantization parameter 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.
[0093]
Since the arrangement order of the transfer phase and the encoding / re-encoding phase is opposite to that of the first example, the input end detection of one page of image data performed after the transfer process in FIG. S805) is 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.
[0094]
In the first and second examples described above, the first memory and the second memory have been described as physically separate memories. This is because it is advantageous that the accesses to the two memories are independent. 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.
[0095]
Further, when each of the above examples is realized with one memory, some of the data transfer processes described in the transfer phase are unnecessary. 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.
[0096]
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.
[0097]
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.
[0098]
<First Embodiment>
In the above first and second examples, if the re-encoding capability of the re-encoding unit 109 or 211 is low, the code amount by the first encoding unit 202 is completed before the re-encoding is completed. May reach the target value again. In such a situation, the encoding process cannot be continued, and the original image must be read again.
[0099]
The first embodiment of the present invention provides a control method for solving the above problem in the configuration of FIG.
[0100]
In the first embodiment, the first and second counters 107 and 110 not only measure the amount of code data generated, but also count the number of symbols of code data. The reason for measuring the number of symbols is to obtain the time required for the re-encoding process by the re-encoding unit 109 with high accuracy. That is, since re-encoding in the re-encoding unit 109 requires a certain time (cycle) per symbol, once the number of symbols is determined, the time required for the entire re-encoding can be calculated easily and accurately. Because. For example, when it takes one cycle per symbol, the time required for re-encoding the code data of 300 symbols can be calculated as 300/1 symbol / cycle = 300 cycles, and time information with high calculation accuracy can be obtained. However, if the accuracy is not so required, the relationship between the number of symbols and the amount of codes is approximately proportional, so that the time required for the re-encoding process may be calculated.
[0101]
FIG. 17A shows the relationship between the amount of image data input on the horizontal axis and the amount of code on the vertical axis.
[0102]
In FIG. 9A, input of image data from the input unit 101 is started at time t0, the encoding unit 102 starts encoding at the initial quantization step Q1, and is counted by the first counter 107 at time t1. This shows a case where the amount of encoded data reaches the upper limit value. At time t1, the encoding unit 102 is set to discard the data stored in the first memory 104 and to encode image data input thereafter thereafter in the quantization step Q2. At this time, the counter 107 is cleared to zero. As a result, the encoding unit 102 continues the encoding in the newly set (updated) quantization step Q2 for the image data input after time t2. When the code data encoded in the quantization step Q1 is re-encoded in the quantization step Q2, it is not necessary to decode from the code data to the image data. What is necessary is just to re-encode using encoding step Q2. If there is a relationship of quantization step Q2 = Q1 × 2, the DCT transform coefficient may be simply shifted down by 1 bit.
[0103]
In addition, since the data compression-encoded in the quantization step Q1 before time t1 remains in the second memory 106, the re-encoding unit 109 performs a decoding process once and re-encodes in the quantization step Q2 this time. It will become. Accordingly, the amount of encoded data that must be re-encoded by the re-encoding unit 109 at time t1 is substantially equal to the set upper limit value, and gradually decreases as the re-encoding is performed. Therefore, the re-encoding process is performed until the data to be re-encoded becomes zero. In the figure, the re-encoding process by the re-encoding unit 109 is completed at time t2. When re-encoding is completed, the amount of code data and the number of symbols after re-encoding are counted by the second counter 110, and these values are added to the first counter 107. Then, it is determined that the upper limit value has been reached again at the final time t3, and the above processing is repeated.
[0104]
When following the above sequence, no particular problem occurs. The reason is that time t2 ≦ t3. In other words, the re-encoding process of the re-encoding unit 109 is completed before the amount of data stored in the first memory 103 reaches the upper limit again.
[0105]
On the other hand, it will be understood that when time t2> t3, normal encoding processing can no longer be realized. FIG. 5B shows a situation where t2> t3.
[0106]
In order to avoid such a situation, the re-encoding unit 109 starts re-encoding at the time t1 ′ that is earlier than the time t1 when the amount of encoded data reaches the upper limit first. The time for completing the process is to be before time t3.
[0107]
Since the time required for re-encoding is determined by the number of symbols as described above, when a certain time Ta is set, the number of symbols held in the first counter 107 at that time Ta is set. By calculating the time Tb obtained by multiplying the number of cycles per symbol number, the re-encoding completion time t2 = Ta + Tb is obtained.
[0108]
On the other hand, the ratio of the code amount when the same image data is encoded in the quantization step Q2 and the quantization step Q1 is experimentally obtained for several sample images, and the average value α12 is stored in the table. Keep it. This is the same for the other quantization steps Q3, Q4..., And is stored as the respective code amount ratios α13, α14. In addition, you may make it memorize | store as an arithmetic expression instead of a table.
[0109]
Accordingly, when the code amount at the quantization step Q1 at time Ta is V1 (actual value), the predicted code amount V2a at the quantization step Q2 at the same time can be calculated by V2a = V1 × α12. Therefore, when the coordinate is {time, code amount}, the predicted time t3 when the time at which the extension line connecting {t0, 0} and {ta, V2a} intersects the upper limit value reaches the second upper limit value is It can be seen that it can be calculated.
[0110]
Therefore, in the first embodiment, as shown in FIG. 17B, during the encoding in the quantization step Q1, the time t3 when the second target value is reached is predicted and calculated. At that time, the time t2 when the re-encoding is completed is predicted from the number of symbols,
t2> t3−Δt (Δt is a positive value, and is a predetermined value obtained empirically in advance)
When the above condition is satisfied, even if the upper limit value is not reached, the same processing as when the upper limit value is reached is started.
[0111]
The above example is an example in which the encoding unit 102 performs the encoding in the quantization step Q1 and the next quantization step to be used is Q2. However, the present invention is not limited to the above example. It is clear that the present invention can be applied during encoding with Qn (the next quantization step is Qn + 1).
[0112]
In order to realize such processing, the processing shown in FIG. 18 or FIG. 19 may be performed instead of the processing shown in FIG. 3 described above (the processing shown in FIGS. The encoding sequence control unit 108 performs this).
[0113]
3 and 18 and FIG. 8 and FIG. 19 is that step S318 is added.
[0114]
That is, even if it is determined in step S305 that the code amount has not reached the upper limit value, the process proceeds to step S315, where the predicted time t3 when the encoding is performed in the next quantization step reaches the upper limit value. And the predicted time t2 when the re-encoding with the number of symbols M at that time is completed,
t2> t3-Δt (1)
It is determined whether or not the relationship is established. If this relationship is established, the process proceeds to step S307 to perform the same process as when the code amount reaches the upper limit value. The other processes are the same as those in the first example described above, and need not be described.
[0115]
According to the above description, the re-encoding process can be completed before the generated encoded data amount reaches the upper limit again, and the image data encoding process proceeds smoothly.
[0116]
By the way, in the situation shown in FIG. 17B, the time at which the input of the image data for one page ends may be before t1. In this case, even if the encoding is continued in the quantization step Q1, the encoding of one page is completed before the upper limit value is reached, so it is not necessary to start the re-encoding process. Further, if re-encoding is performed, it should be originally encoded in the quantization step Q1, but re-encoding is performed in a larger quantization step Q2. This means that unnecessary image quality deterioration processing is caused, and it is desirable to avoid such a situation.
[0117]
Therefore, the calculation is performed in consideration of the expression (1), which is the above condition indicating whether it is the timing to start re-encoding in step S318 in FIG. 18 and FIG. It will be necessary.
[0118]
The encoding unit 102 in the embodiment performs JPEG encoding on a block basis of 8 × 8 pixels. In other words, every time encoding of one block is completed, the next block is input and encoding is performed. Here, an average time for encoding pixel data of one block is Tb. If the total number of blocks in one page is M (uniquely determined by the input image size), the current encoding block is Nth, and the current time is Tc, the prediction of the end of encoding for one page is completed. Time Te is
Te = Tc + (MN) × Tb
Can be calculated as In order to calculate this time Te, the first counter 107 not only counts the amount of encoded data and the number of symbols, but also counts the encoded data output from the encoding unit 102 in units of blocks. become. However, it goes without saying that the number of blocks being counted is reset at the start of encoding of one page, and is not reset (zero cleared) even if the code amount reaches the upper limit.
[0119]
On the other hand, when the encoded data size counted by the first counter 208 at the current time Tc is Vc, the past code amount ΔV per block can be calculated as Vc / N. Assuming that the upper limit value is Vmax, the predicted time T1 when the encoded data amount counted by the first counter 208 reaches the upper limit value Vmax when the encoding process in the encoding unit 102 is continued is as follows:
T1 = Tc + {(Vmax−Vc) / ΔV} × Tb
Can be calculated as Therefore,
Te ≦ T1
In this case, it is not necessary to start the re-encoding process. However, since it is necessary to ensure safety, if the tolerance is ε (> 0),
Te ≦ T1-ε
If the condition is satisfied, re-encoding is not performed.
[0120]
In short, in step S318 in FIG. 18 and FIG. 19, the process proceeds to step S307 to start re-encoding.
Te> T1-ε (3)
t2> t3-Δt (4)
The two conditions (3) and (4) are satisfied. If at least one of these two conditions is not satisfied, the encoding process is continued with the currently set quantization step. Since Te and T1 both include a Tc component, Tc may be excluded from the calculation target. In this case, Te indicates the time from the present until the encoding of one page is completed, and T1 indicates the time from the present until the upper limit is reached.
[0121]
As described above, image quality deterioration is minimized, and encoding is performed within the target encoded data amount with a single input of image data without interruption of a series of encoding processes. It becomes possible.
[0122]
Although it is not necessary to explain, the time Te at which the encoding of one page of image data is completed is the time at which the reading of the image data of one page is completed when the image is read by an image scanner or the like. Is substantially the same.
[0123]
In the above example, the time at which the upper limit value is first reached is compared with the time at which the encoding of one page of image data is completed, but the upper limit value is reached after the second time after re-encoding. It is clear that the same is true for the time and the time when the encoding of one page of image data is completed, and there is no correction to FIGS.
[0124]
<Second Embodiment>
The first embodiment is based on the configuration of FIG. 1, but an example based on FIG. 2 will be described below as a second embodiment.
[0125]
The difference between FIG. 1 and FIG. 2 is that the two encoding units perform compression encoding in parallel as described above.
[0126]
In the first embodiment, when compression coding is performed in the quantization step Qn, it is assumed that the code amount in the quantization step Qn + 1 is estimated and compression coding is performed in the quantization step Qn + 1. The time t3 when reaching the upper limit value of was predicted.
[0127]
On the other hand, in the second embodiment, the first encoding unit 202 performs compression encoding at the quantization step Qn, and the second encoding unit 205 performs compression encoding at the quantization step Qn + 1. That is, the time t3 at which the upper limit value in the quantization step Qn + 1 is reached can be calculated based on the actual code data amount, so that the accuracy can be made higher than in the first embodiment. In other words, Δt in the first embodiment can be further reduced, and the timing for starting re-encoding can be delayed.
[0128]
First, when applied to FIG. 2, the first counter 208 only needs to count the amount of data encoded by the encoding unit 202, and does not need to count the number of symbols. Instead, the second counter 210 and the third counter 212 count the amount of encoded data and the number of symbols.
[0129]
Hereinafter, an outline of the operation in the second embodiment will be described.
[0130]
The first encoding unit 202 performs compression encoding processing based on the quantization step Q1 in the initial state, and the generated encoded data is stored in the first memory 204. The second encoding unit 205 performs compression encoding at a quantization step Q2 that is one step larger than that, and the result is stored in the second memory 207. The first counter 208 cumulatively counts the amount of code data output from the first encoding unit 202, and the second counter 210 accumulates the amount of encoded data output from the second encoding unit 205. Count.
[0131]
If the code amount counted by the first counter 208 is within the set value when the input of the image of one page is completed, the encoded data stored in the first memory 204 is used as the final compressed encoded data. Output to the outside.
[0132]
On the other hand, the case where the code amount output from the first encoding unit 202 reaches the set value during image input for one page will be described with reference to FIGS. .
[0133]
In FIG. 20A, it is now assumed that the code data amount counted by the first counter 208 has reached the set upper limit value at time t1. At this time, the data in the first memory 204 is discarded, the data in the second memory 207 is transferred to the first memory 204, and the quantization step used by the first encoding unit 202 is Updating is performed at the quantization step Q2 used by the second encoding unit 205 at the time. As a result, a configuration equivalent to one page of the image being compressed from the beginning in the quantization step Q2 is obtained. Further, the quantization step Q3 is set for the second encoding unit 205 so that the compression rate is higher, and the image data input after the time t1 is compressed and encoded at the quantization step Q3. . However, since the encoded data stored in the second memory 207 at time t1 is encoded data based on the quantization step Q2, it is necessary to re-encode it in the quantization step Q3. This re-encoding is performed by the re-encoding unit 211.
[0134]
The time t2 at which the re-encoding at the quantization step Q3 is completed is before the time t3 at which the code amount by the first encoding unit 202 that has started the encoding at the quantization step Q2 reaches the upper limit again. It needs to be.
[0135]
That is, it is necessary to start the re-encoding in the re-encoding unit 211 at a timing before the time t1 ″ in FIG.
[0136]
In the first embodiment, it is necessary to start re-encoding just before the time t1 ′ of FIG. 20, but by using the configuration of FIG. 2, a time margin is generated only by the time t1 ″ −t1 ′. .
[0137]
Further, as can be seen from FIG. 5A, the re-encoding target of the re-encoding unit 211 may be performed on the encoded data in the second memory 207, and the first encoding unit 202 It is not directly related to the code amount. Therefore, although the second counter 210 and the third counter 212 need to count the amount of code data and the number of symbols, the first counter 208 only needs to count the amount of code data.
[0138]
In the case of FIG. 9A, since the quantization steps set in the first encoding unit 202 and the second encoding unit 205 are updated at the timing t1, in practice, at the time t1. The re-encoding process of the re-encoding unit 211 is started. The above is an example when the upper limit value is reached first, but for the second and subsequent times, only the quantization steps set in the encoding units 202 and 210 and the re-encoding unit 211 are different, and the processing contents are the same. It is.
[0139]
FIG. 20B shows the code amount in the quantization step Q2 even if re-encoding by the re-encoding unit 211 is started at time t1 when the amount of code data counted by the first counter 208 reaches the upper limit value. This shows a state in which the re-encoding process cannot be completed within the time t3 when it reaches the upper limit again. That is, the processing of the re-encoding unit 211 needs to be started before the time t1 ″ in FIG.
[0140]
In this determination, the time t2 required for the re-encoding process of the re-encoding unit 211 based on the number of symbols held in the second counter 210 is calculated, and the upper limit value is set again based on the code amount at that time. A predicted time t3
t2> t3-Δt
If the first counter 208 does not reach the upper limit value, the first counter 208 may be processed as having reached the upper limit value.
[0141]
Note that, according to FIG. 20B, the time at which the re-encoding needs to be started is t1 ″, but it can also be seen that there is a time margin than time t1 ′ in the first embodiment.
[0142]
As described above, in order to realize the above processing, for example, the processing shown in FIG. 21 may be performed instead of the processing in FIG. The difference from FIG. 12 is that step S318 is added.
[0143]
That is, even if it is determined in step S305 that the code amount has not reached the upper limit value, the process proceeds to step S315, and the quantization step in the next stage is performed based on the code amount and the number of symbols held in the second counter 210. Between the predicted time t3 when reaching the upper limit when encoding is performed and the predicted time t2 when the re-encoding by the number of symbols at that time is completed,
t2> t3-Δt
It is determined whether or not the relationship is established. If this relationship is established, the process proceeds to step S307 to perform the same process as when the code amount reaches the upper limit value. The other processes are the same as those in the first example described above, and need not be described.
[0144]
When realizing the functions of the second embodiment, the encoding sequence unit 209 also refers to the information held in the second counter 210 (encoded data amount and number of symbols in the embodiment). Therefore, it becomes the structure shown in FIG. 22 instead of FIG. The difference between FIG. 22 and FIG. 2 is only that the coding sequence control unit 209 can directly refer to the data of the second counter 210 as described above, and need not be described in detail. Will.
[0145]
According to the above description, the same operational effects as those of the first embodiment can be achieved. In the case of the second embodiment, since two encoding units perform encoding processing in parallel, a time margin is generated in the re-encoding processing by using the configuration. Therefore, it is convenient when the process corresponding to FIG. 2 is realized by a computer program. This is because, for example, when image data is input and compressed and encoded by a personal computer or the like, an unexpected process may occur in another task or the like, and therefore, a process with sufficient time is desirable. The time required for the re-encoding process may be the amount of code data, but the time can be calculated with high accuracy by using the number of symbols.
[0146]
However, in the second embodiment as well, as in the first embodiment described above, it is determined whether re-encoding should be performed in consideration of the encoding end time of one page of image data. Is desirable.
[0147]
That is, in the situation shown in FIG. 20B, that is, when the encoding end time Te of one page is before the time t1, it is determined that re-encoding is unnecessary. When conforming to the second embodiment, the two encoding units 202 and 205 are different from the first embodiment in that they are encoded in parallel, but the principle is the same.
[0148]
That is, the average time for encoding the pixel data of one block of the encoding unit 202 is Tb. If the total number of blocks in one page is M (uniquely determined by the input image size), the current encoding block is Nth, and the current time is Tc, the prediction of the end of encoding for one page is completed. Time Te is
Te = Tc + (MN) × Tb
Calculate as
[0149]
On the other hand, when the encoded data size counted by the first counter 208 at the current time Tc is Vc, the past code amount ΔV per block can be calculated as Vc / N. Assuming that the upper limit value is Vmax, the predicted time T1 when the encoded data amount counted by the first counter 208 reaches the upper limit value Vmax when the encoding process in the encoding unit 102 is continued is as follows:
T1 = Tc + {(Vmax−Vc) / ΔV} × Tb
Can be calculated as Therefore,
Te ≦ T1
In this case, it is not necessary to start the re-encoding process. However, since it is necessary to ensure safety, if the tolerance is ε (> 0),
Te ≦ T1-ε
If the condition is satisfied, re-encoding is not performed.
[0150]
Therefore, in step S318 in FIG. 21, the process proceeds to step S307 to start re-encoding, as in <Improvement of first embodiment>.
Te> T1-ε (3)
t2> t3-Δt (4)
The two conditions (3) and (4) are satisfied. If at least one of the two conditions is not satisfied, the encoding process may be continued with the currently set quantization step.
[0151]
As described above, as in the first embodiment, image quality degradation is minimized, and the target code can be input by inputting image data once without interrupting a series of encoding processes. It becomes possible to encode within the encoded data amount.
[0152]
In the first and second embodiments, a monochrome image is input. However, in the case of a color image, finer adjustment is possible. When a color image is encoded, luminance data (Y) and two color difference data (C) are obtained by known color conversion, so that the following relationship can be obtained. Become. In the following, Y means luminance, C means color difference, QYi (i = 1, 2, 3...) Is a quantization step for luminance components, and QCi (i = 1, 2, 3...) Is color difference. The quantization step for the component is shown, and the quantization step increases as i increases.
Previous quantization step Quantization step candidate
(QY1, QC1) → (QY1, QC2), (QY2, QC2), (QY2, QC3), (QY3, QC3) ...
(QY1, QC2) → (QY2, QC2), (QY2, QC3), (QY3, QC3), (QY3, QC4) ...
(QY2, QC2) → (QY2, QC3), (QY3, QC3), (QY3, QC4), (QY4, QC4) ...
:
Further, in the embodiment, an example in which the quantization step is increased in order to improve the compression rate has been described. However, the present invention can be applied to any coding in which the compression rate is variable by changing parameters. Obviously, it is not necessarily limited to the quantization step. For example, according to JPEG2000, compression can be performed in units of layers when entropy encoding is performed after quantization. The higher the layer, the more dominant the image quality, so the compression rate can be changed by cutting off i layers from the lowest layer.
[0153]
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 particular, when realized by a computer program, the processing capability of the computer will vary, so that “ε” and “Δt” in the above formulas (3) and (4) can be freely changed by the user. desired.
[0154]
Further, since the computer program is normally performed by setting or copying or installing a storage medium such as a floppy (registered trademark) disk or CDROM in the apparatus, such a storage medium is naturally included in the scope of the present invention.
[0155]
The present invention can also be applied to a combination of a computer program and appropriate hardware (such as an encoding circuit).
[0156]
【The invention's effect】
As described above, according to the present invention, with a relatively simple configuration, it is ensured that encoding is performed below the target code amount while image input is continued, and image quality degradation is possible. As long as it can be suppressed.
[Brief description of the drawings]
FIG. 1 is a block diagram of an image processing apparatus according to a first example which is a premise of the present invention.
FIG. 2 is a block configuration diagram of an image processing apparatus in a second example.
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 diagram for explaining the principle of setting the re-encoding process start timing in the first embodiment.
FIG. 18 is a flowchart showing a processing procedure in the first embodiment.
FIG. 19 is a flowchart showing a processing procedure in the first embodiment.
FIG. 20 is a diagram for explaining the principle of setting the re-encoding processing start timing in the second embodiment.
FIG. 21 is a flowchart showing a processing procedure in the second embodiment.
FIG. 22 is a block configuration diagram of an image processing apparatus according to a second embodiment.

Claims (10)

1ページの画像データを圧縮符号化する画像処理装置であって、
量子化ステップが変更可能な第1の符号化手段と、
量子化ステップが変更可能であって、前記第1の符号化手段で圧縮した符号データを再符号化する第2の符号化手段と、
前記第1の符号化手段によって生成される符号データ量を監視すると共に、当該符号データ量が所定量になったか否かを判断する第1の判断手段と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化手段で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断手段と、
前記符号データ量に基づき、前記第1の符号化手段が次の段階の量子化ステップで圧縮符号化したと仮定した場合の前記所定量に到達する時刻T2と、現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第2の符号化手段で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断手段と、
前記第1の判断手段で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断手段での前記条件1、2の両方を満たす場合、前記第1、第2の符号化手段に次の段階の量子化ステップを設定する設定手段と、
該設定手段により量子化ステップを変更した場合、量子化ステップ変更後に入力する画像データについては前記第1の符号化手段による符号化を継続させ、量子化変更前の既に符号化された符号データについては前記第2の符号化手段によって再符号化させる制御手段と
を備えることを特徴とする画像処理装置。
An image processing apparatus that compresses and encodes one page of image data,
First encoding means capable of changing the quantization step;
A second encoding unit that can change a quantization step and re-encodes the code data compressed by the first encoding unit;
First determination means for monitoring the amount of code data generated by the first encoding means and determining whether the amount of code data has reached a predetermined amount;
A prediction time T0 at which the encoding of one page of image data is completed, and a prediction time T1 at which the amount of code data generated by the first encoding means reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second judging means for judging whether or not
Based on the amount of code data, the first encoding means is already generated according to the time T2 when the predetermined amount is reached when it is assumed that the first encoding means has performed compression encoding in the next quantization step, and the current quantization step. A re-encoding completion time T3 when it is assumed that the encoded data is re-encoded by the second encoding unit that has set the quantization step of the next stage;
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination means for determining whether or not
When it is determined that the predetermined amount has been reached by the first determination means, or when both the conditions 1 and 2 are satisfied by the second and third determination means, the first and second codes Setting means for setting the quantization step of the next stage in the conversion means;
When the quantization step is changed by the setting means, the encoding by the first encoding means is continued for the image data input after the quantization step change, and the already encoded code data before the quantization change And an image processing apparatus comprising control means for re-encoding by the second encoding means.
前記第3の判断手段で判断の元になる符号データ量には、シンボル数が含まれることを特徴とする請求項1に記載の画像処理装置。The image processing apparatus according to claim 1, wherein the number of symbols included in the amount of code data based on which the third determination unit determines. 前記第2の圧縮符号化手段は、再符号化対象の符号化データを画像データに復号することなく、周波数成分のデータ形式まで復元してから再符号化することを特徴とする請求項1又は2に記載の画像処理装置。The second compression encoding means re-encodes after reconstructing the data format of the frequency component without decoding the encoded data to be re-encoded into image data. 2. The image processing apparatus according to 2. 1ページの画像データを圧縮符号化する画像処理装置の制御方法であって、
量子化ステップが変更可能な第1の符号化工程と、
量子化ステップが変更可能であって、前記第1の符号化工程で圧縮した符号データを再符号化する第2の符号化工程と、
前記第1の符号化工程によって生成される符号データ量を監視すると共に、当該符号データ量が所定量になったか否かを判断する第1の判断工程と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化工程で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断工程と、
前記符号データ量に基づき、前記第1の符号化工程が次の段階の量子化ステップで圧縮符号化したと仮定した場合の前記所定量に到達する時刻T2と、現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第2の符号化工程で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断工程と、
前記第1の判断工程で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断工程での前記条件1、2の両方を満たす場合、前記第1、第2の符号化工程に次の段階の量子化ステップを設定する設定工程と、
該設定工程により量子化ステップを変更した場合、量子化ステップ変更後に入力する画像データについては前記第1の符号化工程による符号化を継続させ、量子化変更前の既に符号化された符号データについては前記第2の符号化工程によって再符号化させる制御工程と
を備えることを特徴とする画像処理装置の制御方法。
A method for controlling an image processing apparatus that compresses and encodes one page of image data,
A first encoding step in which the quantization step can be changed;
A second encoding step in which the quantization step can be changed, and the code data compressed in the first encoding step is re-encoded;
A first determination step of monitoring the amount of code data generated by the first encoding step and determining whether the amount of code data has reached a predetermined amount;
A prediction time T0 at which encoding of one page of image data is completed and a prediction time T1 at which the amount of code data generated in the first encoding step reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second determination step of determining whether or not
Based on the code data amount, the first encoding step is already generated according to the current quantization step and the time T2 when the predetermined amount is reached assuming that the first encoding step is compression encoded in the next quantization step. Re-encoding completion time T3 when it is assumed that the encoded data is re-encoded in the second encoding step in which the quantization step of the next stage is set,
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination step for determining whether or not
When it is determined that the predetermined amount has been reached in the first determination step, or when both of the conditions 1 and 2 in the second and third determination steps are satisfied, the first and second codes A setting process for setting a quantization step of the next stage in the conversion process;
When the quantization step is changed by the setting step, the encoding by the first encoding step is continued for the image data input after the quantization step change, and the already encoded code data before the quantization change And a control step of re-encoding by the second encoding step.
1ページの画像データを圧縮符号化する画像処理装置として機能するコンピュータプログラムであって、
量子化ステップが変更可能な第1の符号化手段と、
量子化ステップが変更可能であって、前記第1の符号化手段で圧縮した符号データを再符号化する第2の符号化手段と、
前記第1の符号化手段によって生成される符号データ量を監視すると共に、当該符号データ量が所定量になったか否かを判断する第1の判断手段と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化手段で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断手段と、
前記符号データ量に基づき、前記第1の符号化手段が次の段階の量子化ステップで圧縮符号化したと仮定した場合の前記所定量に到達する時刻T2と、現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第2の符号化手段で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断手段と、
前記第1の判断手段で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断手段での前記条件1、2の両方を満たす場合、前記第1、第2の符号化手段に次の段階の量子化ステップを設定する設定手段と、
該設定手段により量子化ステップを変更した場合、量子化ステップ変更後に入力する画像データについては前記第1の符号化手段による符号化を継続させ、量子化変更前の既に符号化された符号データについては前記第2の符号化手段によって再符号化させる制御手段
として機能することを特徴とするコンピュータプログラム。
A computer program that functions as an image processing apparatus that compresses and encodes one page of image data,
First encoding means capable of changing the quantization step;
A second encoding unit that can change a quantization step and re-encodes the code data compressed by the first encoding unit;
First determination means for monitoring the amount of code data generated by the first encoding means and determining whether the amount of code data has reached a predetermined amount;
A prediction time T0 at which the encoding of one page of image data is completed, and a prediction time T1 at which the amount of code data generated by the first encoding means reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second judging means for judging whether or not
Based on the amount of code data, the first encoding means is already generated according to the time T2 when the predetermined amount is reached when it is assumed that the first encoding means has performed compression encoding in the next quantization step, and the current quantization step. A re-encoding completion time T3 when it is assumed that the encoded data is re-encoded by the second encoding unit that has set the quantization step of the next stage;
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination means for determining whether or not
When it is determined that the predetermined amount has been reached by the first determination means, or when both the conditions 1 and 2 are satisfied by the second and third determination means, the first and second codes Setting means for setting the quantization step of the next stage in the conversion means;
When the quantization step is changed by the setting means, the encoding by the first encoding means is continued for the image data input after the quantization step change, and the already encoded code data before the quantization change Functions as control means for re-encoding by the second encoding means.
請求項5に記載のコンピュータプログラムを格納することを特徴とするコンピュータ可読記憶媒体。A computer-readable storage medium storing the computer program according to claim 5. 1ページの画像データを圧縮符号化する画像処理装置であって、
量子化ステップが変更可能な第1の符号化手段と、
量子化ステップが変更可能で、少なくとも前記第1の符号化手段の量子化ステップよりも大きな量子化ステップで符号化する第2の符号化手段と、
量子化ステップが変更可能であって、前記第2の符号化手段で圧縮した符号データを再符号化する第3の符号化手段と、
入力中の画像データを前記第1、第2の符号化手段で生成された符号データ量を監視する監視手段と、
該監視手段で監視されている前記第1の符号化手段による符号データ量が所定量になったか否かを判断する第1の判断手段と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化手段で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断手段と、
前記監視手段で監視されている前記第2の符号化手段による符号データ量に基づき、当該第2の符号化手段による符号化を継続して前記所定量に到達する予測時刻をT2、前記第2の符号化手段の現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第3の符号化手段で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断手段と、
前記第1の判断工程で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断工程での前記条件1、2の両方を満たすと判断した場合、前記第1の符号化手段の量子化ステップを前記第2の符号化手段で設定していた量子化ステップで更新し、前記第2、第3の符号化手段の量子化ステップを更に高い量子化ステップに更新する量子化ステップ更新手段と、
該量子化ステップ更新手段で量子化ステップを更新する場合、前記第2の符号化手段により従前に生成された従前符号データで、前記第1の符号化手段の従前符号化データを更新し、前記第2の符号化手段による従前符号データを前記第3の符号化手段で再符号化して更新する制御手段と
を備えることを特徴とする画像処理装置。
An image processing apparatus that compresses and encodes one page of image data,
First encoding means capable of changing the quantization step;
A second encoding unit that can change a quantization step and encodes at least a quantization step larger than the quantization step of the first encoding unit;
A third encoding unit that can change a quantization step and re-encodes the code data compressed by the second encoding unit;
Monitoring means for monitoring the amount of code data generated by the first and second encoding means for the image data being input;
First determination means for determining whether or not the amount of code data by the first encoding means monitored by the monitoring means has reached a predetermined amount;
A prediction time T0 at which the encoding of one page of image data is completed, and a prediction time T1 at which the amount of code data generated by the first encoding means reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second judging means for judging whether or not
Based on the amount of code data by the second encoding means monitored by the monitoring means, the predicted time to continue the encoding by the second encoding means and reach the predetermined amount is T2, the second Re-encoding when it is assumed that the code data already generated according to the current quantization step of the encoding means is re-encoded by the third encoding means in which the quantization step of the next stage is set. Calculate completion time T3,
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination means for determining whether or not
When it is determined that the predetermined amount has been reached in the first determination step, or when it is determined that both the conditions 1 and 2 in the second and third determination steps are satisfied, the first code The quantization step of the encoding means is updated with the quantization step set by the second encoding means, and the quantization step of the second and third encoding means is updated to a higher quantization step. Update step update means;
When updating the quantization step by the quantization step updating means, the previous encoded data of the first encoding means is updated with the previous encoded data previously generated by the second encoding means, An image processing apparatus comprising: control means for re-encoding and updating the previous code data by the second encoding means by the third encoding means.
1ページの画像データを圧縮符号化する画像処理装置の制御方法であって、
量子化ステップが変更可能な第1の符号化工程と、
量子化ステップが変更可能で、少なくとも前記第1の符号化工程の量子化ステップよりも大きな量子化ステップで符号化する第2の符号化工程と、
量子化ステップが変更可能であって、前記第2の符号化工程で圧縮した符号データを再符号化する第3の符号化工程と、
入力中の画像データを前記第1、第2の符号化工程で生成された符号データ量を監視する監視工程と、
該監視工程で監視されている前記第1の符号化工程による符号データ量が所定量になったか否かを判断する第1の判断工程と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化工程で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断工程と、
前記監視工程で監視されている前記第2の符号化工程による符号データ量に基づき、当該第2の符号化工程による符号化を継続して前記所定量に到達する予測時刻をT2、前記第2の符号化工程の現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第3の符号化工程で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断工程と、
前記第1の判断工程で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断工程での前記条件1、2の両方を満たすと判断した場合、前記第1の符号化工程の量子化ステップを前記第2の符号化工程で設定していた量子化ステップで更新し、前記第2、第3の符号化工程の量子化ステップを更に高い量子化ステップに更新する量子化ステップ更新工程と、
該量子化ステップ更新工程で量子化ステップを更新する場合、前記第2の符号化工程により従前に生成された従前符号データで、前記第1の符号化工程の従前符号化データを更新し、前記第2の符号化工程による従前符号データを前記第3の符号化工程で再符号化して更新する制御工程と
を備えることを特徴とする画像処理装置の制御方法。
A method for controlling an image processing apparatus that compresses and encodes one page of image data,
A first encoding step in which the quantization step can be changed;
A second encoding step in which the quantization step can be changed, and at least a quantization step larger than the quantization step of the first encoding step is encoded;
A third encoding step that can change the quantization step and re-encodes the code data compressed in the second encoding step;
A monitoring step of monitoring the amount of code data generated in the first and second encoding steps for the image data being input;
A first determination step of determining whether or not the amount of code data by the first encoding step monitored in the monitoring step has reached a predetermined amount;
A prediction time T0 at which encoding of one page of image data is completed and a prediction time T1 at which the amount of code data generated in the first encoding step reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second determination step of determining whether or not
Based on the amount of code data in the second encoding step monitored in the monitoring step, the predicted time to continue the encoding in the second encoding step and reach the predetermined amount is T2, the second Re-encoding when it is assumed that the code data already generated according to the current quantization step of the encoding step is re-encoded in the third encoding step in which the quantization step of the next step is set. Calculate completion time T3,
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination step for determining whether or not
When it is determined that the predetermined amount has been reached in the first determination step, or when it is determined that both the conditions 1 and 2 in the second and third determination steps are satisfied, the first code The quantization step of the encoding step is updated with the quantization step set in the second encoding step, and the quantization step of the second and third encoding steps is updated to a higher quantization step. Update step update process,
When updating the quantization step in the quantization step updating step, the previous encoded data of the first encoding step is updated with the previous encoded data previously generated by the second encoding step, And a control step of re-encoding and updating the previous encoded data in the second encoding step in the third encoding step.
1ページの画像データを圧縮符号化する画像処理装置として機能するコンピュータプログラムであって、
量子化ステップが変更可能な第1の符号化手段と、
量子化ステップが変更可能で、少なくとも前記第1の符号化手段の量子化ステップよりも大きな量子化ステップで符号化する第2の符号化手段と、
量子化ステップが変更可能であって、前記第2の符号化手段で圧縮した符号データを再符号化する第3の符号化手段と、
入力中の画像データを前記第1、第2の符号化手段で生成された符号データ量を監視する監視手段と、
該監視手段で監視されている前記第1の符号化手段による符号データ量が所定量になったか否かを判断する第1の判断手段と、
1ページの画像データの符号化が完了する予測時刻T0、及び、前記第1の符号化手段で生成される符号データ量が前記所定量に到達する予測時刻T1を算出し、
条件1: T0>T1−Δt1
(ここで、Δt1は所定の正の値)
を満たすか否かを判断する第2の判断手段と、
前記監視手段で監視されている前記第2の符号化手段による符号データ量に基づき、当該第2の符号化手段による符号化を継続して前記所定量に到達する予測時刻をT2、前記第2の符号化手段の現在の量子化ステップに従って既に生成された符号データを、次の段階の量子化ステップを設定した前記第3の符号化手段で再符号化させたと仮定した場合の再符号化の完了時刻T3を算出し、
条件2:T3>T2−Δt2
(ここで、Δt2は所定の正の値)
を満たすか否かを判断する第3の判断手段と、
前記第1の判断工程で前記所定量に到達したと判断した場合、或いは、前記第2、第3の判断工程での前記条件1、2の両方を満たすと判断した場合、前記第1の符号化手段の量子化ステップを前記第2の符号化手段で設定していた量子化ステップで更新し、前記第2、第3の符号化手段の量子化ステップを更に高い量子化ステップに更新する量子化ステップ更新手段と、
該量子化ステップ更新手段で量子化ステップを更新する場合、前記第2の符号化手段により従前に生成された従前符号データで、前記第1の符号化手段の従前符号化データを更新し、前記第2の符号化手段による従前符号データを前記第3の符号化手段で再符号化して更新する制御手段
として機能することを特徴とするコンピュータプログラム。
A computer program that functions as an image processing apparatus that compresses and encodes one page of image data,
First encoding means capable of changing the quantization step;
A second encoding unit that can change a quantization step and encodes at least a quantization step larger than the quantization step of the first encoding unit;
A third encoding unit that can change a quantization step and re-encodes the code data compressed by the second encoding unit;
Monitoring means for monitoring the amount of code data generated by the first and second encoding means for the image data being input;
First determination means for determining whether or not the amount of code data by the first encoding means monitored by the monitoring means has reached a predetermined amount;
A prediction time T0 at which the encoding of one page of image data is completed, and a prediction time T1 at which the amount of code data generated by the first encoding means reaches the predetermined amount;
Condition 1: T0> T1-Δt1
(Where Δt1 is a predetermined positive value)
A second judging means for judging whether or not
Based on the amount of code data by the second encoding means monitored by the monitoring means, the predicted time to continue the encoding by the second encoding means and reach the predetermined amount is T2, the second Re-encoding when it is assumed that the code data already generated according to the current quantization step of the encoding means is re-encoded by the third encoding means in which the quantization step of the next stage is set. Calculate completion time T3,
Condition 2: T3> T2-Δt2
(Where Δt2 is a predetermined positive value)
A third determination means for determining whether or not
When it is determined that the predetermined amount has been reached in the first determination step, or when it is determined that both the conditions 1 and 2 in the second and third determination steps are satisfied, the first code The quantization step of the encoding means is updated with the quantization step set by the second encoding means, and the quantization step of the second and third encoding means is updated to a higher quantization step. Update step update means;
When updating the quantization step by the quantization step updating means, the previous encoded data of the first encoding means is updated with the previous encoded data previously generated by the second encoding means, A computer program that functions as a control unit that re-encodes and updates the previous encoded data by the second encoding unit by the third encoding unit.
請求項9に記載のコンピュータプログラムを格納することを特徴とするコンピュータ可読記憶媒体。A computer-readable storage medium storing the computer program according to claim 9.
JP2003111876A 2002-06-11 2003-04-16 Image processing apparatus, control method therefor, computer program, and storage medium Expired - Fee Related JP4035475B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2003111876A JP4035475B2 (en) 2003-04-16 2003-04-16 Image processing apparatus, control method therefor, computer program, and storage medium
US10/458,490 US7227998B2 (en) 2002-06-11 2003-06-11 Image processing apparatus, control method of the same, computer program, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003111876A JP4035475B2 (en) 2003-04-16 2003-04-16 Image processing apparatus, control method therefor, computer program, and storage medium

Publications (2)

Publication Number Publication Date
JP2004320479A JP2004320479A (en) 2004-11-11
JP4035475B2 true JP4035475B2 (en) 2008-01-23

Family

ID=33472315

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003111876A Expired - Fee Related JP4035475B2 (en) 2002-06-11 2003-04-16 Image processing apparatus, control method therefor, computer program, and storage medium

Country Status (1)

Country Link
JP (1) JP4035475B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9307245B2 (en) 2012-09-19 2016-04-05 Nec Corporation Moving image encoding device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4715175B2 (en) * 2004-11-29 2011-07-06 富士ゼロックス株式会社 Image forming apparatus and method
WO2014155919A1 (en) 2013-03-27 2014-10-02 日本電気株式会社 Image encoding device, image encoding method and image encoding program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9307245B2 (en) 2012-09-19 2016-04-05 Nec Corporation Moving image encoding device

Also Published As

Publication number Publication date
JP2004320479A (en) 2004-11-11

Similar Documents

Publication Publication Date Title
EP1271926B1 (en) Image processing method, apparatus and computer program for compression-encoding
US7680345B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7227998B2 (en) Image processing apparatus, control method of the same, computer program, and computer-readable storage medium
US7627181B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
US7257264B2 (en) Image processing apparatus and method for compression-encoding image area information
JP3902968B2 (en) Image processing apparatus, control method therefor, computer program, and 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
EP1446952B1 (en) Method and system for rate control during video transcoding
US7454070B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP2003244446A (en) Image processor and image processing method
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
JP3984813B2 (en) Image processing apparatus and method, computer program, and storage medium
JP4035475B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP4035471B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP4693309B2 (en) Image processing apparatus, control method therefor, computer program, and storage medium
JP3902983B2 (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
JP3902987B2 (en) Image encoding apparatus, image encoding method, program, and storage medium
JP2000228772A (en) Moving picture data quantity reduction device and storage medium storing moving picture data quantity reduction program
JP2003199041A (en) Image compressing program, computer-readable recording medium having the recorded same program, and image compressing apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060412

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20071012

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20071029

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

Free format text: PAYMENT UNTIL: 20101102

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20111102

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20121102

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20131102

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees