JP2004072144A - Encoder and encoding method, program, and recording medium - Google Patents

Encoder and encoding method, program, and recording medium Download PDF

Info

Publication number
JP2004072144A
JP2004072144A JP2002224466A JP2002224466A JP2004072144A JP 2004072144 A JP2004072144 A JP 2004072144A JP 2002224466 A JP2002224466 A JP 2002224466A JP 2002224466 A JP2002224466 A JP 2002224466A JP 2004072144 A JP2004072144 A JP 2004072144A
Authority
JP
Japan
Prior art keywords
picture
value
quantization
image
encoding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2002224466A
Other languages
Japanese (ja)
Other versions
JP4186544B2 (en
Inventor
Shinpei Ikegami
池上 晋平
Hiromichi Ueno
上野 弘道
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.)
Sony Corp
Original Assignee
Sony Corp
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 Sony Corp filed Critical Sony Corp
Priority to JP2002224466A priority Critical patent/JP4186544B2/en
Publication of JP2004072144A publication Critical patent/JP2004072144A/en
Application granted granted Critical
Publication of JP4186544B2 publication Critical patent/JP4186544B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To limit the minimum value of a virtual buffer in response to a bit rate when an image pattern change is close to the value of ME residual that presence of a scene change is discriminated. <P>SOLUTION: A flowchart explaining a minimum value limit process 3 includes: a step S62 of discriminating whether or not a bit rate value is smaller than a threshold value G when a relation of ME_info-avg>E holds in step S61; a step S63 of limiting a minimum value of the virtual buffer to a first value when the bit rate is smaller than the threshold value G; a step S64 of discriminating whether or not the bit rate value is smaller than a threshold value H when the bit rate value is greater than the threshold value G; a step S65 of limiting the minimum value of the virtual buffer to a second value smaller than the case with Step S63 when the bit rate value is smaller than the threshold value H; and no minimum value is limited because a difference between a present picture and a preceding picture is a degree of not needing consideration of the minimum value of a quantization index in the case that the relation of ME_info-avg>E does not hold and because there is a sufficient margin for the rate control when the bit rate value is greater than the threshold value H. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、符号化装置および符号化方法、プログラム、並びに記録媒体に関し、特に、ローディレイコーディングを行う場合に用いて好適な、符号化装置および符号化方法、プログラム、並びに記録媒体に関する。
【0002】
【従来の技術】
近年、映像データおよび音声データを圧縮して情報量を減らす方法として、種々の圧縮符号化方法が提案されており、その代表的なものにMPEG2(Moving
Picture Experts Group Phase 2)がある。
【0003】
図1を参照して、このMPEG2方式によって映像データを圧縮符号化する場合、および圧縮符号化された画像データを復号する場合の処理について説明する。
【0004】
送信側のエンコーダ1は、ナンバ0乃至11のフレーム画像11を、フレーム内符号化画像(以下、Iピクチャと称する)、フレーム間順方向予測符号化画像(以下、Pピクチャと称する)、もしくは、双方向予測符号化画像(以下、Bピクチャと称する)の3つの画像タイプのうちのいずれの画像タイプとして処理するかを指定し、指定されたフレーム画像の画像タイプ(Iピクチャ、Pピクチャ、あるいは、Bピクチャ)に応じて、フレーム画像を符号化する順番に並び替えるリオーダリングを実行し、その順番で各フレーム画像に対して符号化処理を施して、符号化フレーム12を生成し、デコーダ2に伝送する。
【0005】
受信側のデコーダ2は、エンコーダ1によって符号化されたフレーム画像を復号した後、再度、リオーダリングして、画像フレームを元の順番に戻して、フレーム画像13を復元し、再生画像を表示する。
【0006】
エンコーダ1においては、リオーダリングした後に符号化処理を施すため、ナンバ0のフレーム画像を符号化処理するまでに、ナンバ2のフレーム画像が符号化処理されていなければならず、その分だけ遅延(以下、リオーダリングディレイと称する)が生じる。
【0007】
また、デコーダ2においても、復号した後にリオーダリングするため、ナンバ0のフレーム画像を復号して表示するまでに、ナンバ2のフレーム画像が復号されていなければならず、その分だけリオーダリングディレイが生じてしまう。
【0008】
このように、エンコーダ1およびデコーダ2においては双方でリオーダリングを行っているために、画像データを符号化してから再生画像を表示するまでの間に3フレーム分のリオーダリングディレイが生じてしまう。
【0009】
また、このMPEG2方式によって圧縮符号化された符号化データが伝送される場合、送信側の圧縮符号化装置から伝送された符号化データは、受信側のビデオSTD(System Target Decoder)バッファ(いわゆるVBV(Video Buffer Verifier)バッファ)に、ピクチャごとに格納されていく。
【0010】
図2に示されるように、VBVバッファは、そのバッファサイズ(容量)が決まっており、符号化データは、VBVバッファに、ピクチャごとに順次格納される。この場合、Iピクチャ、Pピクチャ、およびBピクチャの各符号化データは、一定の伝送レートによってVBVバッファにそれぞれ格納され、格納が終了した時点(1フレーム周期)のデコードタイミングで、デコーダに引き抜かれる。Iピクチャは、Bピクチャと比較して符号化データのデータ量が多いので、VBVバッファに格納されるまでにBピクチャよりも多くの時間を必要とする。
【0011】
このとき、データ送信側であるエンコーダ1は、デコーダ2のVBVバッファに符号化データを格納したとき、および、VBVバッファから符号化データを引き抜かれたときに、VBVバッファにおいてオーバーフロー、およびアンダーフローが生じないようにするため、VBVバッファのバッファ占有率に基づいて発生する符号化データの発生符号量を制御(レートコントロール)する必要がある。しかしながら、画面の更新に必要なIピクチャの発生符号量が多いので、Iピクチャの画像データの伝送時間が多く必要となるため、この時間が遅延となってしまう。
【0012】
テレビ電話やテレビ会議等の画像データなど、リアルタイム性を要求される実時間伝送を行う場合、上述したように、伝送時間に起因する遅延や、リオーダリングディレイが発生してしまうと、送信側から送られてきた符号化データを受信側で受信して再生画像を表示するまでに時間差が生じてしまう。これに対して、このような遅延を少なくするために、MPEG2方式では、遅延時間を150[ms]以下に短縮するローディレイコーディング(Low Delay Coding)と呼ばれる手法が規格によって用意されている。
【0013】
ローディレイコーディングにおいては、リオーダリングディレイの原因となるBピクチャ、および、発生符号量の多いIピクチャを使用せずに、Pピクチャのみを使用し、このPピクチャを、数スライスからなるイントラスライスと、残り全てのスライスからなるインタースライスとに区切ることにより、リオーダリングなしに符号化することができるようになされている。
【0014】
イントラスライスは、スライス部分の画像データがフレーム内符号化される画像部分であり、インタースライスは、スライス部分の画像データと前のフレーム画像における同じ領域の参照画像データとの差分データが符号化される画像部分である。
【0015】
ローディレイコーディングでは、例えば、図3に示されるように、エンコーダ1は、ナンバ0乃至11のフレーム画像11を全てPピクチャとし、例えば、横45マクロブロック、縦24マクロブロの画枠サイズの中で、ナンバ0のフレーム画像の上段から縦2マクロブロック、および横45マクロブロック分の領域を、イントラスライスI0、その他の領域を全てインタースライスP0として設定する。
【0016】
そして、エンコーダ1は、次のナンバ1のフレーム画像においては、ナンバ0のフレーム画像のイントラスライスI0の下方向に続く位置に、同じ面積の領域でイントラスライスI1を設定し、その他は全てインタースライスP1に設定する。以下、同様にイントラスライスとインタースライスがフレーム画像ごとに設定され、最後のナンバ11のフレーム画像についてもイントラスライスI11とインタースライスP11が設定される。
【0017】
エンコーダ1は、各フレーム画像のイントラスライスI0乃至I11を、そのまま伝送データとして符号化し、他のインタースライスP0乃至P11を、前のフレーム画像の同じ領域の参照画像との差分データに基づいて符号化する(ただし、符号化の開始時においては、インタースライスP0の参照画像となる前のフレーム画像は存在しないので、符号化の開始時のみはこの限りでない)。そして、同様の符号化処理を、ナンバ0のフレーム画像からナンバ11のフレーム画像について繰り返し実行することにより、エンコーダ1は、1枚のPピクチャにおける画面全体の画像データを符号化して符号化フレーム21を生成することができる。
【0018】
この場合、各フレーム画像におけるイントラスライスI0乃至I11の画像データサイズは全て均一であり、当然、インタースライスP0乃至P11の画像データサイズも均一であることにより、フレーム画像毎の発生符号量は、ほぼ一定の固定レートになる。
【0019】
これにより、図4に示すように、Pピクチャの各フレーム画像は全て同じ発生符号量の符号化データとなり、VBVバッファに格納されるとき、および、引き抜かれるときの、VBVバッファにおける符号化データの推移は、全て同じになる。この結果、送信側のエンコーダ1は、デコーダ2のVBVバッファにアンダーフローおよびオーバーフローを生じさせることなく、符号化データの発生符号量を容易に制御することができ、発生符号量の多いIピクチャで生じるような遅延やリオーダリングディレイによる不具合を解消することができ、再生画像を遅延なく表示することができる。
【0020】
ところで、以上説明した構成の圧縮符号化装置においては、イントラスライスI0乃至I11に関してはそのまま伝送データとして符号化し、インタースライスP0乃至P11に関しては、前のフレーム画像における同じ領域の参照画像との差分データに基づいて符号化するため、イントラスライスI0乃至I11の画像データ部分を圧縮符号化したときの実際の発生符号量は多く、インタースライスP0乃至P11の画像データ部分を圧縮符号化したときの実際の発生符号量は少なくなる。
【0021】
ところが、ピクチャ全体としての発生符号量は規定されているが、イントラスライスI0乃至I11およびインタースライスP0乃至P11毎に割り当てる発生符号量は規定されていない。すなわち、イントラスライスI0乃至I11のように符号化したときの発生符号量が多くなる画像部分に対しても、またインタースライスP0乃至P11のように符号化したときの発生符号量があまり多くならない画像データ部分に対しても、均等に発生符号量が割り当てられている。
【0022】
従って、データ量の多いイントラスライスI0乃至I11に対して割り当てられる発生符号量が少なく、データ量の少ないインタースライスP0乃至P11に対して割り当てられる発生符号量が多くなることがあり、このような場合にピクチャ全体としての画像に歪みが生じてしまうという課題があった。
【0023】
具体的には、図5に示されるように、画像の符号化難易度が低い画像31に続いて、画像の符号化難易度が高い画像32が存在した場合、符号化難易度が低い画像31は、エンコードに容易な画像であるため、Qスケールが小さくなるが、従来の方法では、それに続く、画像の符号化難易度が高い画像32に対して、小さなQスケールでエンコードを開始してしまうため、画面の途中までに、与えられたビット量を消費してしまい、画面下端に前のピクチャが残ってしまうという現象が発生する。この現象は、イントラスライスが、次に、画面下端の問題発生箇所に現れるまで、影響を及ぼしてしまう。
【0024】
この課題を解決するために、本出願人は、特開平11−205803において、ローディレイモードにおいても、復号器側において高画質な画像を再生できるような符号化データを生成し得る符号化装置および符号化方法を提案している。
【0025】
すなわち、通常のフィードバック型の量子化制御を行ってイントラスライスおよびインタースライスごとに最適な量子化ステップサイズを決定して量子化制御を行う場合において、次のピクチャが1つ前のピクチャと絵柄の大きく異なるシーンチェンジが起きた場合、1つ前のピクチャを基に算出された量子化インデックスデータQ(j+1)を用いるのではなく、これから符号化しようとするピクチャのME残差情報に基づいて、仮想バッファの初期バッファ容量d(0)を更新することにより、新たに量子化インデックスデータQ(j+1)が算出し直されるようにする。これにより、シーンチェンジが起きた場合でも、イントラスライスおよびインタースライスごとに最適な量子化ステップサイズが決定されて、量子化制御が行われる。
【0026】
ME残差とは、ピクチャ単位で算出されるものであり、1つ前のピクチャと次のピクチャにおける輝度の差分値の合計値である。従ってME残差情報が大きな値を示すときには、1つ前のピクチャの絵柄と次に符号化処理するピクチャの絵柄が大きく異なっていること(いわゆるシーンチェンジ)を表している。
【0027】
この符号化方法について、図6のフローチャートを参照して説明する。
【0028】
ステップS1において、例えば、動きベクトルを検出するときに得られるME残差情報が取得される。ここで取得されたME残差情報をME_infoとする。
【0029】
ステップS2において、取得されたME残差情報から、ME残差情報の平均値avgが減算されて、算出された値が、所定の閾値Dよりも大きいか否かが判断される。ME残差情報の平均値avgは、後述するステップS4において更新される値であり、次の式(1)で示される。
【0030】
avg=1/2(avg+ME_info)・・・(1)
【0031】
ステップS2において、算出された値は、所定の閾値Dより小さいと判断された場合、現在のピクチャにおける絵柄と、1つ前のピクチャにおける絵柄との差があまり無い、すなわちシーンチェンジがなかったと判断されるので、処理はステップS4に進む。
【0032】
ステップS2において、算出された値は、所定の閾値Dより大きいと判断された場合、現在のピクチャにおける絵柄と、1つ前のピクチャにおける絵柄との差が大きい、すなわち、シーンチェンジがあったと判断されるので、ステップS3において、式(2)、式(3)、式(4)および式(5)に基づいて、仮想バッファの初期バッファ容量d(0)が算出されて、仮想バッファが更新される。
【0033】
ピクチャ単位の画像の難しさGC(Global Complexity)を表すXは、次の式(2)で表される。
X=T×Q・・・(2)
ただし、Tは、ピクチャ単位の発生符号量であり、Qは、ピクチャ単位の量子化ステップサイズの平均値である。
【0034】
そして、ピクチャ単位の画像の難しさXを、ME残差情報ME_infoと等しいとした場合、すなわち、次の式(3)が満たされている場合、ピクチャ全体の量子化インデックスデータQは、式(4)で示される。
【0035】
X=ME_info・・・(3)
Q={d(0)×31}/{2×(br/pr)}・・・(4)
ただし、brは、ビットレートであり、prは、ピクチャレートである。
【0036】
そして、式(4)における仮想バッファの初期バッファ容量d(0)は、次の式(5)で示される。
d(0)=2×{(ME_info×br/pr)/31×T}・・・(5)
【0037】
この仮想バッファの初期バッファ容量d(0)を、再度、式(4)に代入することにより、ピクチャ全体の量子化インデックスデータQが算出される。
【0038】
ステップS2において、算出された値は、所定の閾値Dより小さいと判断された場合、もしくは、ステップS3の処理の終了後、ステップS4において、次に供給されるピクチャに備えて、ME残差情報の平均値avgが、上述した式(1)により計算されて更新され、処理は、ステップS1に戻り、それ以降の処理が繰り返される。
【0039】
図6のフローチャートを用いて説明した処理により、次のピクチャが1つ前のピクチャと絵柄の大きく異なるシーンチェンジが起きた場合には、これから符号化しようとするピクチャのME残差情報ME_infoに基づいて、仮想バッファの初期バッファ容量d(0)が更新され、この値を基に、新たに量子化インデックスデータQ(j+1)が算出されるので、シーンチェンジに対応して、イントラスライスおよびインタースライスごとに最適な量子化ステップサイズが決定される。
【0040】
【発明が解決しようとする課題】
しかしながら、特開平11−205803に記載の方法を用いた場合、符号化難易度が高い(難しい)画像から、符号化難易度が低い(易しい)画像にシーンが変わる場合などにおいても、同様のエンコード処理をしてしまうため、画質に悪影響を及ぼしてしまう。
【0041】
具体的には、易しい画像から難しい画像へシーンが変わる場合、および、難しい画像から易しい画像へシーンが変わる場合の双方に対して仮想バッファ調整を行ってしまうため、難しい画像から易しい画像へシーンが変わる場合では、エンコードに余裕があるはずの、符号化難易度が低い画像において、わざわざ画質を悪くしてしまう場合がある。
【0042】
また、例えば、図7A乃至図7Cに示されるように、ある程度複雑な画像(符号化が困難な画像)である領域41の一部に、簡単な画像(符号化が容易な画像)で構成される領域42が瞬間的に通り過ぎる(図7A乃至図7Cにおいては、図中右から左へ領域42が横切る)様な画像がエンコードされる場合、領域42の大きさによっては、シーンチェンジと判断されないことがある。
【0043】
図7Bにおいては、符号化が容易な領域42が画面上ある程度の大きさで存在するために、量子化インデックスは小さな値に設定される。しかしながら、図7Cに示される次のフレームでは、符号化が容易な領域42の部分が小さくなり、符号化が困難な領域41の部分が大きくなるのにもかかわらず、シーンチェンジと判断されなければ、前の画像(図7B)を基にした小さな量子化インデックスにより、エンコードが実行されてしまう。従って、図7Cに示される画像のエンコードにおいて、画面の途中までに、与えられたビット量を消費してしまい(画像下端をエンコードするための符号量が足らなくなり)、画面下端の領域43に前のピクチャが残ってしまう画像スキップが発生する。
【0044】
本発明はこのような状況に鑑みてなされたものであり、イントラスライスエンコードにおいて、シーンチェンジ時のみならず、シーンチェンジに近い画像の変化時においても、状況に応じて画質を向上させることができるようにするものである。
【0045】
【課題を解決するための手段】
本発明の符号化装置は、1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する第1の検出手段と、第1の検出手段による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定手段と、仮想バッファの初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定手段と、決定手段により決定された量子化インデックスデータを基に、量子化を実行する量子化手段と、量子化手段により量子化された量子化係数データを符号化する符号化手段とを備えることを特徴とする。
【0046】
設定手段には、第1の検出手段により検出された絵柄の変化量が、所定の範囲内である場合、仮想バッファの初期バッファ容量の最小値を設定させるようにすることができる。
【0047】
フレーム画像のビットレートを検出する第2の検出手段を更に備えさせるようにすることができ、設定手段には、第1の検出手段により検出された絵柄の変化量が、所定の範囲内であり、かつ、ビットレートの値が、所定の値より小さい場合、仮想バッファの初期バッファ容量の最小値を設定させるようにすることができる。
【0048】
設定手段には、ビットレートと複数の閾値とを比較させ、比較結果に基づいて、仮想バッファの初期バッファ容量の最小値を複数設定させるようにすることができる。
【0049】
第1の検出手段には、第1のピクチャの絵柄と第2のピクチャの絵柄との差分を示す指標を算出させ、指標を基に、絵柄の変化を検出させるようにすることができる。
【0050】
フレーム画像は、全て、フレーム間順方向予測符号化画像であるものとすることができる。
【0051】
本発明の符号化方法は、1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、仮想バッファの初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、決定ステップの処理により決定された量子化インデックスデータを基に、量子化を実行する量子化ステップと、量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップとを含むことを特徴とする。
【0052】
本発明の記録媒体に記録されているプログラムは、1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、仮想バッファの初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、決定ステップの処理により決定された量子化インデックスデータを基に、量子化を実行する量子化ステップと、量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップとを含むことを特徴とする。
【0053】
本発明のプログラムは、1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、仮想バッファの初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、決定ステップの処理により決定された量子化インデックスデータを基に、量子化を実行する量子化ステップと、量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップとを含むことを特徴とする。
【0054】
本発明の符号化装置および符号化方法、並びにプログラムにおいては、1つ前のピクチャである第1のピクチャと次に符号化処理するピクチャである第2のピクチャとの絵柄の変化が検出され、検出結果に基づいて、仮想バッファの初期バッファ容量の最小値が設定され、仮想バッファの初期バッファ容量の値を用いて、量子化インデックスデータが決定され、決定された量子化インデックスデータを基に、量子化が実行され、量子化された量子化係数データが符号化される。
【0055】
【発明の実施の形態】
以下、図を参照して、本発明の実施の形態について説明する。
【0056】
図8は、ビデオエンコーダ61の構成を示すブロック図である。
【0057】
ビデオエンコーダ61は、全てPピクチャを用いたローディレイコーディング方式によって、画像データを符号化するようになされている。ビデオエンコーダ61の前処理部71は、外部から供給される画像データの入力を受ける。
【0058】
前処理部71は、順次入力される画像データの各フレーム画像(この場合全てPピクチャ)を、16画素×16ラインの輝度信号、および輝度信号に対応する色差信号によって構成されるマクロブロックに分割し、これをマクロブロックデータとして、演算部72、動きベクトル検出部73、および、量子化制御部83のイントラAC算出部91に供給する。
【0059】
動きベクトル検出部73は、マクロブロックデータの入力を受け、各マクロブロックの動きベクトルを、マクロブロックデータ、および、フレームメモリ84に記憶されている参照画像データを基に算出し、動きベクトルデータとして、動き補償部81に送出する。
【0060】
演算部72は、前処理部71から供給されたマクロブロックデータについて、各マクロブロックの画像タイプに基づいて、イントラスライスI0乃至I11に対してはイントラモードで、インタースライスP0乃至P11に対しては順方向予測モードで、動き補償を行う。
【0061】
ここでイントラモードとは、符号化対象となるフレーム画像をそのまま伝送データとする方法であり、順方向予測モードとは、符号化対象となるフレーム画像と過去参照画像との予測残差を伝送データとする方法である。ビデオエンコーダ61においては、Pピクチャのみを使用して、イントラスライスI0乃至I11とインタースライスP0乃至P11に分けて符号化するようになされている。
【0062】
まず、マクロブロックデータが、イントラスライスI0乃至I11のうちの1つであった場合、マクロブロックデータはイントラモードで処理される。すなわち、演算部72は、入力されたマクロブロックデータのマクロブロックを、そのまま演算データとしてDCT(Discrete Cosine Transform :離散コサイン変換)部74に送出する。DCT部74は、入力された演算データに対しDCT変換処理を行うことによりDCT係数化し、これをDCT係数データとして、量子化部75に送出する。
【0063】
量子化部75は、発生符号量制御部92から供給される量子化インデックスデータQ(j+1)に基づいて、入力されたDCT係数データに対して量子化処理を行い、量子化DCT係数データとしてVLC(Variable Length Code;可変長符号化)部77および逆量子化部78に送出する。ここで、量子化部75は、発生符号量制御部92から供給される量子化インデックスデータQ(j+1)に応じて、量子化処理における量子化ステップサイズを調整することにより、発生する符号量を制御するようになされている。
【0064】
逆量子化部78に送出された量子化DCT係数データは、量子化部75と同じ量子化ステップサイズによる逆量子化処理を受け、DCT係数データとして、逆DCT部79に送出される。逆DCT部79は、供給されたDCT係数データに逆DCT処理を施し、生成された演算データは、演算部80に送出され、参照画像データとしてフレームメモリ84に記憶される。
【0065】
そして、マクロブロックデータがインタースライスP0乃至P11のうちの1つであった場合、演算部72はマクロブロックデータについて、順方向予測モードによる動き補償処理を行う。
【0066】
動き補償部81は、フレームメモリ84に記憶されている参照画像データを、動きベクトルデータに応じて動き補償し、順方向予測画像データを算出する。演算部72は、マクロブロックデータについて、動き補償部81より供給される順方向予測画像データを用いて減算処理を実行する。
【0067】
すなわち、動き補償部81は、順方向予測モードにおいて、フレームメモリ84の読み出しアドレスを、動きベクトルデータに応じてずらすことによって、参照画像データを読み出し、これを順方向予測画像データとして演算部72および演算部80に供給する。演算部72は、供給されたマクロブロックデータから、順方向予測画像データを減算して、予測残差としての差分データを得る。そして、演算部72は、差分データをDCT部74に送出する。
【0068】
また、演算部80には、動き補償部81より順方向予測画像データが供給されており、演算部80は、逆DCT部から供給された演算データに、順方向予測画像データを加算することにより、参照画像データを局部再生し、フレームメモリ84に出力して記憶させる。
【0069】
かくして、ビデオエンコーダ61に入力された画像データは、動き補償予測処理、DCT処理および量子化処理を受け、量子化DCT係数データとして、VLC部77に供給される。VLC部77は、量子化DCT係数データに対し、所定の変換テーブルに基づく可変長符号化処理を行い、その結果得られる可変長符号化データをバッファ82に送出するとともに、マクロブロックごとの符号化発生ビット数を表す発生符号量データB(j)を、量子化制御部83の発生符号量制御部92、およびGC(Global Complexity)算出部93にそれぞれ送出する。
【0070】
GC算出部93は、発生符号量データB(j)を、マクロブロックごとに順次蓄積し、1ピクチャ分の発生符号量データB(j)が全て蓄積された時点で、全マクロブロック分の発生符号量データB(j)を累積加算することにより、1ピクチャ分の発生符号量を算出する。
【0071】
そしてGC算出部93は、次の式(6)を用いて、1ピクチャのうちの、イントラスライス部分の発生符号量と、イントラスライス部分における量子化ステップサイズの平均値との積を算出することにより、イントラスライス部分の画像の難しさ(以下、これをGCと称する)を表すGCデータXiを求め、これを目標符号量算出部94に供給する。
【0072】
Xi=(Ti/Ni)×Qi・・・(6)
ここで、Tiは、イントラスライスの発生符号量、Niは、イントラスライス数、そして、Qiは、イントラスライスの量子化ステップサイズの平均値である。
【0073】
GC算出部93は、これと同時に、次に示す式(7)を用いて、1ピクチャのうちの、インタースライス部分の発生符号量と、このインタースライス部分における量子化ステップサイズの平均値との積を算出することにより、インタースライス部分におけるGCデータXpを求め、これを目標符号量算出部94に供給する。
【0074】
Xp=(Tp/Np)×Qp・・・(7)
ここで、Tpは、インタースライスの発生符号量、Npは、インタースライス数、Qpは、インタースライスの量子化ステップサイズの平均値である。
【0075】
目標符号量算出部94は、GC算出部93から供給されるGCデータXiを基に、次の式(8)を用いて、次のピクチャにおけるイントラスライス部分の目標発生符号量データTpiを算出するとともに、GC算出部93から供給されるGCデータXpを基に、次の式(9)を基に、次のピクチャにおけるインタースライス部分の目標発生符号量データTppを算出し、算出した目標発生符号量データTpiおよびTppを発生符号量制御部92にそれぞれ送出する。
【0076】
Tpi={(Ni×Xi)/(Np×Xp)+(Np×Xi)}×Xp・・・(8)
【0077】
Tpp={(Np×Xp)/(Np×Xp)+(Ni×Xi)}×Xp・・・(9)
【0078】
また、目標符号量算出部94は、操作入力部85を用いて、ユーザが入力したビットレートの値の入力を受け、符号量発生部92に供給する。
【0079】
ME残差算出部95は、入力されるマクロブロックデータを基に、ME残差情報ME_infoを算出して、発生符号量制御部92に出力する。ここで、ME残差情報ME_infoとは、ピクチャ単位で算出されるものであり、1つ前のピクチャと次のピクチャにおける輝度の差分値の合計値である。従って、ME残差情報ME_infoが大きな値を示すときには、1つ前のピクチャの絵柄と、次に符号化処理するピクチャの絵柄とが大きく異なっていること(いわゆるシーンチェンジ)を表している。
【0080】
1つ前のピクチャの絵柄と次に符号化処理するピクチャの絵柄が異なっている場合、1つ前のピクチャの画像データを用いて算出した目標発生符号量データTpiおよびTppを基に生成した量子化インデックスデータQ(j+1)によって、量子化部75の量子化ステップサイズを決定することは適切ではない。従って、シーンチェンジが起こった場合は、目標発生符号量データTpiおよびTppは、新たに算出されなおされるようにしても良い。
【0081】
イントラAC算出部91は、イントラAC(intra AC)を算出し、現在のイントラACの値を示すmad_infoと、一つ前のイントラACの値を示すprev_mad_infoとを、発生符号量制御部92に出力する。
【0082】
イントラACは、MPEG方式におけるDCT処理単位のDCTブロックごとの映像データとの分散値の総和として定義されるパラメータであって、映像の複雑さを指標し、映像の絵柄の難しさおよび圧縮後のデータ量と相関性を有する。すなわち、イントラACとは、DCTブロック単位で、それぞれの画素の画素値から、ブロック毎の画素値の平均値を引いたものの絶対値和の、画面内における総和である。イントラAC(IntraAC)は、次の式(10)で示される。
【0083】
【数1】

Figure 2004072144
・・・(10)
【0084】
また、式(10)において、式(11)が成り立つ。
【数2】
Figure 2004072144
・・・(11)
【0085】
画像の符号化難易度が易しいものから難しいものへのシーンチェンジ、および、難しいものから易しいものへのシーンチェンジの、双方に対して仮想バッファ調整を行ってしまった場合、難しいものから易しいものへのシーンチェンジでは、エンコードに余裕があるはずの易画像においてわざわざ画質を悪くしてしまう結果となる場合がある。また、難しいものから易しいものへのシーンチェンジであっても、その変化の大きさ、あるいは、シーンチェンジ後の画像の難易度によっては、仮想バッファの調整を行うほうがよい場合がある。しかしながら、ME残差情報のみでは、シーンチェンジの有無を判定することはできるが、シーンチェンジの内容が、易しいものから難しいものへのシーンチェンジであるか、あるいは、難しいものから易しいものへのシーンチェンジであるかを判定することができない。
【0086】
そこで、イントラAC算出部91が、イントラACを算出し、現在のイントラACの値を示すmad_infoと、一つ前のイントラACの値を示すprev_mad_infoとを、発生符号量制御部92に出力することにより、発生符号量制御部92は、シーンチェンジの状態を判定して、仮想バッファ調整を行うか否かを判断することができる。
【0087】
発生符号量制御部92は、バッファ82に格納される可変長符号化データの蓄積状態を常時監視しており、蓄積状態を表す占有量情報を基に量子化ステップサイズを決定するようになされている。
【0088】
また、発生符号量制御部92は、イントラスライス部分の目標発生符号量データTpiよりも実際に発生したマクロブロックの発生符号量データB(j)が多い場合、発生符号量を減らすために量子化ステップサイズを大きくし、また、目標発生符号量データTpiよりも実際の発生符号量データB(j)が少ない場合、発生符号量を増やすために量子化ステップサイズを小さくするようになされている。
【0089】
更に、発生符号量制御部92は、インタースライス部分の場合も同様に、目標発生符号量データTppよりも実際に発生したマクロブロックの発生符号量データB(j)が多い場合、発生符号量を減らすために量子化ステップサイズを大きくし、また、目標発生符号量データTppよりも実際の発生符号量データB(j)が少ない場合、発生符号量を増やすために量子化ステップサイズを小さくするようになされている。
【0090】
すなわち、発生符号量制御部92は、デコーダ側に設けられたVBVバッファに格納された可変長符号化データの蓄積状態の推移を想定することにより、図9に示されるように、j番目のマクロブロックにおける仮想バッファのバッファ占有量d(j)を次の式(12)によって表し、また、j+1番目のマクロブロックにおける仮想バッファのバッファ占有量d(j+1)を次の式(13)によって表し、(12)式から(13)式を減算することにより、j+1番目のマクロブロックにおける仮想バッファのバッファ占有量d(j+1)を次の式(14)として変形することができる。
【0091】
d(j)=d(0)+B(j−1)−{T×(j−1)/MBcnt}・・・(12)
【0092】
ここで、d(0)は初期バッファ容量、B(j)は、j番目のマクロブロックにおける符号化発生ビット数、MBcntは、ピクチャ内のマクロブロック数、そして、Tは、ピクチャ単位の目標発生符号量である。
【0093】
d(j+1)=d(0)+B(i)−(T×j)/MBcnt・・・(13)
【0094】
d(j+1)=d(j)+{B(j)−B(j−1)}−T/MBcnt・・・(14)
【0095】
続いて、発生符号量制御部92は、ピクチャ内のマクロブロックがイントラスライス部分とインタースライス部分とに分かれているため、図10に示されるように、イントラスライス部分のマクロブロックとインタースライス部分の各マクロブロックに割り当てる目標発生符号量TpiおよびTppをそれぞれ個別に設定する。
【0096】
グラフにおいて、マクロブロックのカウント数が0乃至s、および、t乃至endの間にあるとき、次の式(15)に、インタースライスの目標発生符号量Tppを代入することにより、インタースライス部分におけるバッファ占有量d(j+1)を得ることができる。
【0097】
d(j+1)=d(j)+{B(j)−B(j−1)}−Tpp/{MBcnt−(t−s)}・・・(15)
【0098】
また、マクロブロックのカウント数がs乃至tの間にあるときに、次の式(16)に、イントラスライスの目標発生符号量Tpiを代入することにより、イントラスライス部分におけるバッファ占有量d(j+1)を得ることができる。
【0099】
d(j+1)=d(j)+{B(j)−B(j−1)}−Tpi/(t−s)・・・(16)
【0100】
従って、発生符号量制御部92は、イントラスライス部分およびインタースライス部分におけるバッファ占有量d(j+1)、および、式(17)に示される定数rを、式(18)に代入することにより、マクロブロック(j+1)の量子化インデックスデータQ(j+1)を算出し、これを量子化部75に供給する。
【0101】
r=(2×br)/pr ・・・(17)
Q(j+1)=d(j+1)×(31/r) ・・・(18)
ここで、brは、ビットレートであり、prは、ピクチャレートである。
【0102】
量子化部75は、量子化インデックスデータQ(j+1)に基づいて、次のマクロブロックにおけるイントラスライスまたはインタースライスに応じた量子化ステップサイズを決定し、量子化ステップサイズによってDCT係数データを量子化する。
【0103】
これにより、量子化部75は、1つ前のピクチャのイントラスライス部分およびインタースライス部分における実際の発生符号量データB(j)に基づいて算出された、次のピクチャのイントラスライス部分およびインタースライス部分における目標発生符号量TppおよびTpiにとって最適な量子化ステップサイズによって、DCT係数データを量子化することができる。
【0104】
かくして、量子化部75では、バッファ82のデータ占有量に応じて、バッファ82がオーバーフローまたはアンダーフローしないように量子化し得るとともに、デコーダ側のVBVバッファがオーバーフロー、またはアンダーフローしないように量子化した量子化DCT係数データを生成することができる。
【0105】
例えば、従来の技術として上述した、特願平11−205803では、通常のフィードバック型の量子化制御を行いながら、次に符号化処理するピクチャの絵柄が大きく変化する場合には、フィードバック型の量子化制御を止め、ME残差算出部95から供給されるME残差情報に基づいて、仮想バッファの初期バッファ容量d(0)を初期化し、新たな初期バッファ容量d(0)を基に、イントラスライスおよびインタースライスごとに量子化インデックスデータQ(j+1)を新たに算出するようになされている。
【0106】
しかしながら、従来における場合のように、ME残差のみで仮想バッファ調整を行うか否かを判定してしまうと、画像難易度が易しいものから難しいものに変わった場合、および難しいものから簡単なものに変わった場合の双方に対して、仮想バッファ調整を行ってしまう。すなわち、画像難易度が難しいものから簡単なものに変わった場合では、エンコードに余裕があるはずの簡単な画像において、わざわざ画質を悪くしてしまう結果となる。
【0107】
そこで、図8のビデオエンコーダ61においては、例えば、イントラAC算出部91によって算出されるイントラACなどの情報を用いて、画像難易度が易しいものから難しいものに変わるシーンチェンジの時にのみ、仮想バッファ調整を行うようにすることにより、簡単な画像での画質の劣化を防ぐようにすることができる。
【0108】
すなわち、発生符号量制御部92は、通常のフィードバック型の量子化制御を行いながら、次に符号化処理するピクチャの絵柄が大きく変化する場合には、フィードバック型の量子化制御を止め、ME残差算出部95から供給されるME残差情報ME_info、並びに、イントラAC算出部91から供給される、prev_mad_infoおよびmad_infoを基に、仮想バッファの初期バッファ容量d(0)を初期化するか否かを判断し、仮想バッファの初期バッファ容量d(0)を初期化する場合は、ME残差算出部95から供給されるME残差情報ME_infoに基づいて、仮想バッファの初期バッファ容量d(0)を初期化する。仮想バッファの初期バッファ容量d(0)の初期化については、式(2)乃至式(5)を用いて説明した従来における場合と同様である。
【0109】
そして、発生符号量制御部92は、新たな初期バッファ容量d(0)を基に、イントラスライスおよびインタースライスごとに、式(12)乃至式(18)を用いて、量子化インデックスデータQ(j+1)を新たに算出し、量子化部75に供給する。
【0110】
更に、発生符号量制御部92は、次に符号化処理するピクチャの絵柄の変化が、シーンチェンジと判断されるほど大きくなく、しかしながら、シーンチェンジと判断されるのに近い場合、必要に応じて、仮想バッファの最小値をある一定の値より大きくなるように制限する。これにより、量子化インデックスの最小値も制限されるので、図7を用いて説明したような状況において、画像スキップの発生を抑制することができる。
【0111】
図11のフローチャートを参照して、イントラACなどの画像難易度情報を用いて、シーンチェンジは、簡単な画像から難しい画像への変化であるか否かの判定を導入して仮想バッファの調整を行う、仮想バッファ更新処理について説明する。
【0112】
ステップS21において、発生符号量制御部92は、ME残差算出部95から、ME残差情報ME_info を取得する。
【0113】
ステップS22において、発生符号量制御部92は、取得されたME残差情報から、ME残差情報の平均値avgを減算し、ME_info−avg > Dであるか否か、すなわち、算出された値が、所定の閾値Dよりも大きいか否かが判断される。ME残差情報の平均値avgは、後述するステップS26において更新される値であり、上述した式(1)で示される。なお、所定の閾値Dは、画質を検討しながらチューニングされる性質の値である。
【0114】
ステップS22において、算出された値は、所定の閾値Dより大きいと判断された場合、現在のピクチャにおける絵柄と、1つ前のピクチャにおける絵柄との差が大きい、すなわち、シーンチェンジがあったと判断されるので、ステップS23において、発生符号量制御部92は、イントラAC算出部91から取得される、このシーンチェンジの後のイントラACの値であるmad_infoと、このシーンチェンジの前のイントラACの値であるprev_mad_infoとを比較し、mad_info > prev_mad_infoであるか否かを判断する。
【0115】
ステップS23において、mad_info > prev_mad_infoではないと判断された場合、このシーンチェンジは、難しい画像から、簡単な画像へのシーンチェンジであるので、処理は、ステップS26に進む。
【0116】
ステップS23において、mad_info > prev_mad_infoであると判断された場合、このシーンチェンジは、簡単な画像から、難しい画像へのシーンチェンジであるので、ステップS24において、発生符号量制御部92は、図1を用いて説明した従来における場合と同様の処理により、仮想バッファの初期バッファ容量d(0)の更新を行う。
【0117】
すなわち、発生符号量制御部92は、上述した式(2)、式(3)、式(4)および式(5)に基づいて、仮想バッファの初期バッファ容量d(0)を算出し、仮想バッファを更新する。
【0118】
ステップS22において、算出された値は、所定の閾値Dより小さいと判断された場合、現在のピクチャにおける絵柄と、1つ前のピクチャにおける絵柄との差があまり無い、すなわちシーンチェンジがなかったと判断されるので、ステップS25において、図12を用いて後述する最小値制限処理1、図13を用いて後述する最小値制限処理2、または、図14を用いて後述する最小値制限処理3のうちのいずれかの処理が実行される。
【0119】
ステップS23において、mad_info > prev_mad_infoではないと判断された場合、ステップS24の処理の終了後、もしくは、ステップS25の処理の終了後、ステップS26において、発生符号量制御部92は、次に供給されるピクチャに備えて、ME残差情報の平均値avgを、上述した式(1)により更新し、処理は、ステップS21に戻り、それ以降の処理が繰り返される。
【0120】
図11のフローチャートを用いて説明した処理により、イントラACを用いて、画像難易度が易しいものから難しいものに変更されるシーンチェンジの時にのみ仮想バッファ調整を行うようにしたので、エンコードに余裕があるはずの簡単な画像において、更に画質を悪くしてしまうことを防ぐことができる。
【0121】
更に、シーンチェンジが検出されなかった場合は、図12を用いて後述する最小値制限処理1、図13を用いて後述する最小値制限処理2、または、図14を用いて後述する最小値制限処理3のうちのいずれかの処理が実行される。
【0122】
次に、図12のフローチャートを参照して、最小値制限処理1について説明する。
【0123】
ステップS41において、発生符号量制御部92は、図11のステップS21において取得したME残差情報ME_infoを基に、ステップS22において算出したME_info−avgの値を所定の閾値Eと比較して、ME_info−avg>Eであるか否かを判断する。ここで、閾値Eは、図11のステップS22の閾値Dよりも小さな値である。
【0124】
ステップS41において、ME_info−avg>Eであると判断された場合、ステップS42において、発生符号量制御部92は、仮想バッファの最小値を制限させるための制御信号を生成し、量子化部75に供給する。量子化部75は、発生符号量制御部92から供給された制御信号に基づいて、前の画像が簡単なものであっても、仮想バッファのバッファ容量が、少なくとも予め定められた所定の値より大きくなるように制限して、式(12)乃至式(18)を用いて説明した処理により量子化インデックスを算出する。算出された量子化インデックスも、最小値が制限されたものとなる。ステップS42の処理の終了後、処理は、図11のステップS26の処理に戻る。
【0125】
すなわち、図11のステップS22において、ME_info−avg>Dではないと判断され、ステップS41において、ME_info−avg>Eであると判断された場合、図13に示されるように、ME_info−avgの値が閾値Dより大きい場合のシーンチェンジ領域96と、ME_info−avgの値が閾値Eより小さい場合の通常領域98に挟まれた中間領域α97に、ME_info−avgが存在する(D>ME_info−avg>Eが成立する)。
【0126】
中間領域α97においては、シーンチェンジとは判断されないが、前の画像を基にフィードバックされる量子化インデックスの値が非常に小さなものであった場合、図7を用いて説明したように、画面の途中までに、与えられたビット量を消費してしまい、符号量が足らなくなり、画像スキップが発生してしまう恐れがある。従って、ステップS42において、仮想バッファの値の最小値を制限することにより、量子化インデックスの最小値も制限されるので、画像スキップの発生を抑制することができる。
【0127】
ステップS41において、ME_info−avg>Eではないと判断された場合、前の画像との差は、量子化インデックスの最小値を考慮する必要がない程度であると判断されるので、最小値制限は行われず、処理は、図11のステップS26の処理に戻る。
【0128】
図12を用いて説明した処理により、シーンチェンジとは判断されないが、従来の方法では画像スキップ(画面下端に前のピクチャが残ってしまうという現象)が発生してしまう恐れがある画像を、画面下端までエンコードすることが可能となる。
【0129】
ところで、ビットレートが高い画像をエンコードする場合のレート制御は、ビットレートが低い画像をエンコードする場合と比較して、余裕がある。レート制御に十分な余裕があるにもかかわらず、仮想バッファ(量子化インデックス)の最小値を制限してしまうと、画質が劣化してしまう。
【0130】
図14のフローチャートを参照して、ME残差に加えて、ビットレートの値を参照して、最小値制限を行うか否かを判断する最小値制限処理2について説明する。
【0131】
ステップS51において、発生符号量制御部92は、図11のステップS21において取得したME残差情報ME_infoを基に、ステップS22において算出したME_info−avgの値を、所定の閾値Eと比較して、ME_info−avg>Eであるか否かを判断する。ここで、閾値Eは、図11のステップS22の閾値Dよりも小さな値である。
【0132】
ステップS51において、ME_info−avg>Eであると判断された場合、ステップS52において、発生符号量制御部92は、目標符号量算出部94から供給されたビットレートの値は、所定の閾値Fより小さいか否かを判断する。ここで、閾値Fは、符号化する場合にレート制御に余裕が発生するか否かを判断するための値である。
【0133】
ステップS52において、ビットレートの値は、所定の閾値Fより小さいと判断された場合、ステップS53において、発生符号量制御部92は、仮想バッファの最小値を制限させるための制御信号を生成し、量子化部75に供給する。量子化部75は、発生符号量制御部92から供給された制御信号に基づいて、前の画像が簡単なものであっても、仮想バッファのバッファ容量が、少なくとも予め定められた所定の値より大きくなるように制限して、式(12)乃至式(18)を用いて説明した処理により量子化インデックスを算出する。算出された量子化インデックスも、最小値が制限されたものとなる。ステップS53の処理の終了後、処理は、図11のステップS26の処理に戻る。
【0134】
ステップS51において、ME_info−avg>Eではないと判断された場合、前の画像との差は、量子化インデックスの最小値を考慮する必要がない程度であると判断され、ステップS52において、ビットレートの値は、所定の閾値Fより大きいと判断された場合、レート制御には余裕があると判断されるので、最小値制限は行われず、処理は、図11のステップS26の処理に戻る。
【0135】
図14のフローチャートを用いて説明した処理により、レート制御に十分な余裕があるにもかかわらず、仮想バッファ(量子化インデックス)の最小値を制限して、画質が劣化してしまうことを防いで、必要な場合にのみ、仮想バッファ(量子化インデックス)の最小値を制限し、画像スキップ(画面下端に前のピクチャが残ってしまうという現象)の発生を抑制することができる。
【0136】
更に、ビットレートの値に応じて、仮想バッファ(量子化インデックス)の最小値を複数設定可能なようにすることにより、更に、画質の安定を図るようにすることができる。
【0137】
次に、図15のフローチャートを参照して、ビットレートの値に応じて、仮想バッファ(量子化インデックス)の複数の最小値を設定することができる最小値制限処理3について説明する。
【0138】
ステップS61において、発生符号量制御部92は、図11のステップS21において取得したME残差情報ME_infoを基に、ステップS22において算出したME_info−avgの値を、所定の閾値Eと比較して、ME_info−avg>Eであるか否かを判断する。ここで、閾値Eは、図11のステップS22の閾値Dよりも小さな値である。
【0139】
ステップS61において、ME_info−avg>Eであると判断された場合、ステップS62において、発生符号量制御部92は、目標符号量算出部94から供給されたビットレートの値は、所定の閾値Gより小さいか否かを判断する。ここで、閾値Gは、符号化する場合にレート制御に余裕が発生するか否かを判断するための値である。また、ビットレートが小さい場合の符号化において、最小値の制限を厳密に行うことにより、より効果的に、画質の劣化を防いで、画像スキップの発生を抑制することができるので、閾値Gは、図14を用いて説明した処理における閾値Fより小さな値とすると好適である。
【0140】
ステップS62において、ビットレートの値は、所定の閾値Gより小さいと判断された場合、ステップS63において、発生符号量制御部92は、仮想バッファの最小値を、予め定められた第1の値に制限させるための制御信号を生成し、量子化部75に供給する。量子化部75は、発生符号量制御部92から供給された制御信号に基づいて、前の画像が簡単なものであっても、仮想バッファのバッファ容量が少なくとも第1の値より大きくなるように制限して、式(12)乃至式(18)を用いて説明した処理により量子化インデックスを算出する。算出された量子化インデックスも、第1の値により最小値が制限されたものとなる。ステップS63の処理の終了後、処理は、図11のステップS26の処理に戻る。
【0141】
ステップS62において、ビットレートの値は、所定の閾値Gより大きいと判断された場合、ステップS64において、発生符号量制御部92は、目標符号量算出部94から供給されたビットレートの値は、所定の閾値Hより小さいか否かを判断する。ここで、レート制御に余裕が発生するか否かを判断するための閾値Hは、閾値Gよりも大きい値であり、例えば、図14を用いて説明した処理における閾値Fと同等の値とすると好適である。
【0142】
ステップS64において、ビットレートの値は、所定の閾値Hより小さいと判断された場合、ステップS65において、発生符号量制御部92は、仮想バッファの最小値を、ステップS63における第1の値よりも小さい、予め定められた第2の値に制限させるための制御信号を生成し、量子化部75に供給する。量子化部75は、発生符号量制御部92から供給された制御信号に基づいて、前の画像が簡単なものであっても、仮想バッファのバッファ容量が少なくとも第2の値より大きくなるように制限して、式(12)乃至式(18)を用いて説明した処理により量子化インデックスを算出する。算出された量子化インデックスも、第2の値により最小値が制限されたものとなる。ステップS65の処理の終了後、処理は、図11のステップS26の処理に戻る。
【0143】
ステップS61において、ME_info−avg>Eではないと判断された場合、前の画像との差は、量子化インデックスの最小値を考慮する必要がない程度であると判断されるので、最小値制限は行われず、処理は、図11のステップS26の処理に戻る。また、ステップS64において、ビットレートの値は、所定の閾値Hより大きいと判断された場合、レート制御には充分な余裕があると判断されるので、最小値制限は行われず、処理は、図11のステップS26の処理に戻る。
【0144】
以上説明した処理により、画像の変更量が、シーンチェンジ検出の閾値付近である場合においても、符号化処理が困難な画像を検出して、仮想バッファ(量子化インデックス)の最小値を制限したり、更に、レート制御が困難な画像を検出して、そのビットレートに対応した仮想バッファ(量子化インデックス)の最小値を設定するようにすることが可能になる。
【0145】
このことにより、ローディレイモード、低ビットレートであっても、画像スキップ(画面下端に前のピクチャが残ってしまうという現象)の発生を抑制して、安定した画質を得ることができる。
【0146】
また、上述の実施の形態においては、ローディレイコーディングとしてナンバ0乃至11の各フレーム画像を全てPピクチャとし、例えば、横45マクロブロック、縦24マクロブロックの画枠サイズの中でフレーム画像の上段から縦2マクロブロックおよび横45マクロブロック分の領域を1つのイントラスライス部分、他を全てインタースライス部分として設定するようにした場合について述べたが、本発明はこれに限らず、例えば、イントラスライス部分を縦1マクロブロック、横45マクロブロック分の領域とするなど、他の種々の大きさの領域で形成するようにしても良い。
【0147】
また、ここでは、ローディレイエンコードを行う場合を例として説明したが、本発明は、例えば、15フレームを、フレーム内符号化画像(以下、Iピクチャと称する)、フレーム間順方向予測符号化画像(以下、Pピクチャと称する)、もしくは、双方向予測符号化画像(以下、Bピクチャと称する)の3つの画像タイプのうちのいずれの画像タイプとして処理するかを指定し、指定されたフレーム画像の画像タイプ(Iピクチャ、Pピクチャ、あるいは、Bピクチャ)に応じて、フレーム画像を符号化するような場合にも適用可能である。
【0148】
更に、上述の実施の形態においては、本発明をMPEG方式によって圧縮符号化する符号化装置としてのビデオエンコーダ61に適用するようにした場合について述べたが、本発明はこれに限らず、他の種々の画像圧縮方式による符号化装置に適用するようにしても良い。
【0149】
上述した一連の処理は、ハードウエアにより実行させることもできるが、ソフトウエアにより実行させることもできる。この場合、例えば、ビデオエンコーダ61は、図16に示されるようなパーソナルコンピュータ101により構成される。
【0150】
図16において、CPU111は、ROM112に記憶されているプログラム、または記憶部118からRAM113にロードされたプログラムに従って、各種の処理を実行する。RAM113にはまた、CPU111が各種の処理を実行する上において必要なデータなども適宜記憶される。
【0151】
CPU111、ROM112、およびRAM113は、バス114を介して相互に接続されている。このバス114にはまた、入出力インタフェース115も接続されている。
【0152】
入出力インタフェース115には、キーボード、マウスなどよりなる入力部116、ディスプレイやスピーカなどよりなる出力部117、ハードディスクなどより構成される記憶部118、モデム、ターミナルアダプタなどより構成される通信部119が接続されている。通信部119は、インターネットを含むネットワークを介しての通信処理を行う。
【0153】
入出力インタフェース115にはまた、必要に応じてドライブ120が接続され、磁気ディスク131、光ディスク132、光磁気ディスク133、あるいは、半導体メモリ134などが適宜装着され、それらから読み出されたコンピュータプログラムが、必要に応じて記憶部118にインストールされる。
【0154】
一連の処理をソフトウエアにより実行させる場合には、そのソフトウエアを構成するプログラムが、専用のハードウエアに組み込まれているコンピュータ、または、各種のプログラムをインストールすることで、各種の機能を実行することが可能な、例えば汎用のパーソナルコンピュータなどに、ネットワークや記録媒体からインストールされる。
【0155】
この記録媒体は、図16に示されるように、装置本体とは別に、ユーザにプログラムを供給するために配布される、プログラムが記憶されている磁気ディスク131(フロッピディスクを含む)、光ディスク132(CD−ROM(CompactDisk−Read Only Memory),DVD(Digital Versatile Disk)を含む)、光磁気ディスク133(MD(Mini−Disk)(商標)を含む)、もしくは半導体メモリ134などよりなるパッケージメディアにより構成されるだけでなく、装置本体に予め組み込まれた状態でユーザに供給される、プログラムが記憶されているROM112や、記憶部118に含まれるハードディスクなどで構成される。
【0156】
なお、本明細書において、記録媒体に記憶されるプログラムを記述するステップは、含む順序に沿って時系列的に行われる処理はもちろん、必ずしも時系列的に処理されなくとも、並列的あるいは個別に実行される処理をも含むものである。
【0157】
【発明の効果】
本発明によれば、画像データをエンコードすることができる。
また、本発明によれば、シーンチェンジが起こっていない場合であっても、その画像の変化量が、シーンチェンジが起こったと判断される値に近い場合には、仮想バッファの最小値を制限するようにしたので、量子化インデックスはある一定の数値以上に制限され、シーンチェンジ時に画像が劣化してしまうのを防ぐようにすることができる。
【図面の簡単な説明】
【図1】MPEG2方式によって映像データを圧縮符号化する場合、および圧縮符号化された画像データを復号する場合の処理について説明する図である。
【図2】VBVバッファについて説明する図である。
【図3】ローディレイコーディングについて説明する図である。
【図4】VBVバッファについて説明する図である。
【図5】シーンチェンジについて説明する図である。
【図6】従来の仮想バッファ更新処理について説明するフローチャートである。
【図7】シーンチェンジではなく画像スキップが発生する場合について説明する図である。
【図8】本発明を適用したビデオエンコーダの構成を示すブロック図である。
【図9】仮想バッファのバッファ占有量について説明する図である。
【図10】イントラスライスおよびインタースライス毎の、仮想バッファのバッファ占有量について説明する図である。
【図11】本発明を適用した仮想バッファ更新処理について説明するフローチャートである。
【図12】最小値制限処理1について説明するフローチャートである。
【図13】シーンチェンジ領域と通常領域との間に存在する中間領域αについて説明する図である。
【図14】最小値制限処理2について説明するフローチャートである。
【図15】最小値制限処理3について説明するフローチャートである。
【図16】パーソナルコンピュータの構成を示すブロック図である。
【符号の説明】
61 ビデオエンコーダ, 71 前処理部, 72 演算部, 73 動きベクトル検出部, 74 DCT部, 75 量子化部, 77 VLC部, 78 逆量子化部, 79 逆DCT部, 80 演算部, 81 動き補償部, 82 バッファ, 83 量子化制御部, 84 フレームメモリ, 91イントラAC算出部, 92 発生符号量制御部, 93 GC算出部, 94 目標符号量算出部, 95 ME残差算出部, 97 中間領域α[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an encoding device, an encoding method, a program, and a recording medium, and particularly to an encoding device, an encoding method, a program, and a recording medium that are suitable for performing low-delay coding.
[0002]
[Prior art]
In recent years, various compression-encoding methods have been proposed as methods for reducing the amount of information by compressing video data and audio data, and MPEG2 (Moving) is a typical method.
Picture Experts Group Phase 2).
[0003]
With reference to FIG. 1, a description will be given of a process in a case where the video data is compression-encoded by the MPEG2 system and a process in a case where the compression-encoded image data is decoded.
[0004]
The encoder 1 on the transmission side converts the frame images 11 of numbers 0 to 11 into an intra-coded image (hereinafter, referred to as an I-picture), an inter-frame forward prediction-coded image (hereinafter, referred to as a P-picture), or It specifies which of the three image types of bidirectional predictive coded image (hereinafter, referred to as B picture) to process, and specifies the image type of the specified frame image (I picture, P picture, or , B pictures), reordering is performed to rearrange the frame images in the order of encoding, and the encoding process is performed on each frame image in that order to generate an encoded frame 12, and the decoder 2 To be transmitted.
[0005]
After decoding the frame image encoded by the encoder 1, the decoder 2 on the receiving side reorders again, restores the image frame to the original order, restores the frame image 13, and displays the reproduced image. .
[0006]
In the encoder 1, since the encoding process is performed after the reordering, the frame image of the number 2 must be encoded before the encoding process of the frame image of the number 0. Hereinafter, this will be referred to as a reordering delay).
[0007]
Also, since the decoder 2 performs reordering after decoding, the frame image of number 2 must be decoded before the frame image of number 0 is decoded and displayed, and the reordering delay is accordingly reduced. Will happen.
[0008]
As described above, since reordering is performed in both the encoder 1 and the decoder 2, a reordering delay of three frames occurs between the encoding of the image data and the display of the reproduced image.
[0009]
When coded data compressed and coded according to the MPEG2 system is transmitted, coded data transmitted from the compression coding apparatus on the transmission side is converted into a video STD (System Target Decoder) buffer (a so-called VBV) on the reception side. (Video Buffer Verifier) buffer for each picture.
[0010]
As shown in FIG. 2, the VBV buffer has a fixed buffer size (capacity), and encoded data is sequentially stored in the VBV buffer for each picture. In this case, each of the coded data of the I picture, the P picture, and the B picture is stored in the VBV buffer at a fixed transmission rate, and is extracted by the decoder at the decoding timing when storage is completed (one frame cycle). . Since an I picture has a larger amount of encoded data than a B picture, it requires more time than a B picture to be stored in a VBV buffer.
[0011]
At this time, when the encoded data is stored in the VBV buffer of the decoder 2 and when the encoded data is extracted from the VBV buffer, the encoder 1 on the data transmission side causes overflow and underflow in the VBV buffer. In order to prevent this, it is necessary to control (rate control) the generated code amount of the encoded data generated based on the buffer occupancy of the VBV buffer. However, since the generated code amount of the I picture necessary for updating the screen is large, a long transmission time of the image data of the I picture is required, and this time is delayed.
[0012]
When performing real-time transmission that requires real-time properties, such as image data from videophones and video conferences, as described above, if a delay due to the transmission time or a reordering delay occurs, the There is a time lag between receiving the transmitted encoded data on the receiving side and displaying the reproduced image. On the other hand, in order to reduce such a delay, in the MPEG2 system, a method called low delay coding (Low Delay Coding) for reducing the delay time to 150 [ms] or less is prepared by the standard.
[0013]
In low-delay coding, only P-pictures are used without using B-pictures that cause reordering delay and I-pictures with a large amount of generated code, and these P-pictures are used as intra-slices consisting of several slices. , And the remaining slices are divided into inter-slices, so that encoding can be performed without reordering.
[0014]
The intra slice is an image portion in which the image data of the slice portion is intra-coded, and the inter slice is the difference data between the image data of the slice portion and the reference image data of the same region in the previous frame image. Image portion.
[0015]
In the low-delay coding, for example, as shown in FIG. 3, the encoder 1 sets all the frame images 11 of numbers 0 to 11 to P-pictures and, for example, within an image frame size of 45 horizontal macroblocks and 24 vertical macroblots. , An area corresponding to two vertical macroblocks and 45 horizontal macroblocks from the top of the frame image of number 0 is set as an intra slice I0, and all other areas are set as inter slices P0.
[0016]
Then, in the frame image of the next number 1, the encoder 1 sets the intra slice I1 in the area having the same area at a position following the intra slice I0 of the frame image of the number 0, and sets all other inter slices as the inter slice. Set to P1. Hereinafter, similarly, an intra slice and an inter slice are set for each frame image, and an intra slice I11 and an inter slice P11 are also set for the frame image of the last number 11.
[0017]
The encoder 1 encodes the intra slices I0 to I11 of each frame image as it is as transmission data, and encodes the other interslices P0 to P11 based on difference data from a reference image in the same region of the previous frame image. (However, at the start of encoding, there is no frame image before becoming the reference image of the inter slice P0, so this is not limited only at the start of encoding.) By repeating the same encoding process for the frame image of number 0 to the frame image of number 11, the encoder 1 encodes the image data of the entire screen in one P-picture, and Can be generated.
[0018]
In this case, the image data sizes of the intra slices I0 to I11 in each frame image are all uniform, and naturally the image data sizes of the inter slices P0 to P11 are also uniform. It becomes a fixed fixed rate.
[0019]
As a result, as shown in FIG. 4, all the frame images of the P picture become coded data having the same generated code amount. The transitions are all the same. As a result, the encoder 1 on the transmission side can easily control the generated code amount of the encoded data without causing an underflow and an overflow in the VBV buffer of the decoder 2, and can control the I-picture having a large generated code amount. Problems caused by such a delay or a reordering delay can be solved, and a reproduced image can be displayed without delay.
[0020]
By the way, in the compression encoding apparatus having the above-described configuration, the intra slices I0 to I11 are encoded as transmission data as they are, and the inter slices P0 to P11 are difference data from the reference image in the same area in the previous frame image. , The actual amount of generated code when the image data portions of the intra slices I0 to I11 are compression-coded is large, and the actual amount of code generated when the image data portions of the inter slices P0 to P11 are compression-coded. The generated code amount is reduced.
[0021]
However, the generated code amount for the entire picture is specified, but the generated code amount allocated to each of the intra slices I0 to I11 and the inter slices P0 to P11 is not specified. In other words, even for an image portion in which the amount of generated codes when encoding is performed as in intra-slices I0 to I11, an image in which the amount of generated codes is not so large when encoded as in interslices P0 to P11. The generated code amount is evenly allocated to the data portion.
[0022]
Therefore, the generated code amount allocated to the intra slices I0 to I11 having a large data amount is small, and the generated code amount allocated to the inter slices P0 to P11 having a small data amount may be large. However, there is a problem in that the image as the whole picture is distorted.
[0023]
Specifically, as shown in FIG. 5, when an image 32 having a high encoding difficulty of an image is present after an image 31 having a low encoding difficulty of the image, an image 31 having a low encoding difficulty is present. Is an image that is easy to encode, so the Q scale is small. However, according to the conventional method, encoding is started with a small Q scale for the subsequent image 32 having a high image coding difficulty. Therefore, a phenomenon occurs in which a given bit amount is consumed in the middle of the screen, and the previous picture remains at the lower end of the screen. This phenomenon has an effect until the intra slice appears next at the problem occurrence location at the lower end of the screen.
[0024]
In order to solve this problem, the present applicant has disclosed in Japanese Patent Application Laid-Open No. H11-205803 an encoding apparatus capable of generating encoded data capable of reproducing a high-quality image on a decoder side even in a low delay mode. An encoding method is proposed.
[0025]
That is, when performing the normal feedback type quantization control to determine the optimal quantization step size for each of the intra slices and the inter slices and perform the quantization control, the next picture is the same as the previous picture and the picture. When a greatly different scene change occurs, instead of using the quantization index data Q (j + 1) calculated based on the immediately preceding picture, based on the ME residual information of the picture to be encoded, By updating the initial buffer capacity d (0) of the virtual buffer, the quantization index data Q (j + 1) is newly calculated. Thus, even when a scene change occurs, the optimal quantization step size is determined for each of the intra slices and the inter slices, and quantization control is performed.
[0026]
The ME residual is calculated for each picture, and is a total value of luminance difference values between a previous picture and a next picture. Therefore, when the ME residual information indicates a large value, it indicates that the picture of the immediately preceding picture is largely different from the picture of the next picture to be coded (so-called scene change).
[0027]
This encoding method will be described with reference to the flowchart in FIG.
[0028]
In step S1, for example, ME residual information obtained when a motion vector is detected is obtained. The obtained ME residual information is defined as ME_info.
[0029]
In step S2, the average value avg of the ME residual information is subtracted from the acquired ME residual information, and it is determined whether or not the calculated value is larger than a predetermined threshold D. The average value avg of the ME residual information is a value updated in step S4 described later, and is represented by the following equation (1).
[0030]
avg = 1/2 (avg + ME_info) (1)
[0031]
In step S2, when it is determined that the calculated value is smaller than the predetermined threshold D, it is determined that there is not much difference between the picture in the current picture and the picture in the immediately preceding picture, that is, that there is no scene change. Therefore, the process proceeds to step S4.
[0032]
In step S2, when it is determined that the calculated value is greater than the predetermined threshold D, it is determined that the difference between the pattern in the current picture and the pattern in the immediately preceding picture is large, that is, a scene change has occurred. Therefore, in step S3, the initial buffer capacity d (0) of the virtual buffer is calculated based on the equations (2), (3), (4), and (5), and the virtual buffer is updated. Is done.
[0033]
X representing the difficulty GC (Global Complexity) of an image in picture units is represented by the following equation (2).
X = T × Q (2)
Here, T is a generated code amount in a picture unit, and Q is an average value of a quantization step size in a picture unit.
[0034]
When the difficulty X of an image in picture units is assumed to be equal to the ME residual information ME_info, that is, when the following equation (3) is satisfied, the quantization index data Q of the entire picture is expressed by the equation ( 4).
[0035]
X = ME_info (3)
Q = {d (0) × 31} / {2 × (br / pr)} (4)
Here, br is a bit rate, and pr is a picture rate.
[0036]
Then, the initial buffer capacity d (0) of the virtual buffer in Expression (4) is represented by the following Expression (5).
d (0) = 2 × {(ME_info × br / pr) / 31 × T} (5)
[0037]
By substituting the initial buffer capacity d (0) of this virtual buffer again into equation (4), the quantization index data Q of the entire picture is calculated.
[0038]
When it is determined in step S2 that the calculated value is smaller than the predetermined threshold value D, or after the process of step S3 ends, in step S4, the ME residual information is prepared for the next picture to be supplied. The average value avg of is calculated and updated by the above equation (1), the process returns to step S1, and the subsequent processes are repeated.
[0039]
According to the processing described with reference to the flowchart of FIG. 6, when a scene change occurs in which the next picture has a pattern greatly different from that of the immediately preceding picture, based on the ME residual information ME_info of the picture to be coded. Thus, the initial buffer capacity d (0) of the virtual buffer is updated, and the quantization index data Q (j + 1) is newly calculated based on this value. The optimal quantization step size is determined for each case.
[0040]
[Problems to be solved by the invention]
However, when the method described in JP-A-11-205803 is used, the same encoding is performed even when the scene changes from an image with high encoding difficulty (difficult) to an image with low encoding difficulty (easy). Since the processing is performed, the image quality is adversely affected.
[0041]
Specifically, virtual buffer adjustment is performed for both the case where the scene changes from an easy image to a difficult image and the case where the scene changes to an easy image, so that the scene is changed from a difficult image to an easy image. In the case of a change, there is a case where the image quality is degraded in an image having a low encoding difficulty, which should have a margin for encoding.
[0042]
For example, as shown in FIGS. 7A to 7C, a simple image (an image that is easy to encode) is configured in a part of an area 41 that is a somewhat complicated image (an image that is difficult to encode). 7A to 7C, the region 42 is not determined to be a scene change depending on the size of the region 42. Sometimes.
[0043]
In FIG. 7B, the quantization index is set to a small value because the easy-to-encode area 42 has a certain size on the screen. However, in the next frame shown in FIG. 7C, the portion of the region 42 that is easy to encode becomes small and the portion of the region 41 that is difficult to encode becomes large, but it is not determined that a scene change has occurred. , A small quantization index based on the previous image (FIG. 7B) results in encoding being performed. Therefore, in the encoding of the image shown in FIG. 7C, a given bit amount is consumed by the middle of the screen (the code amount for encoding the lower end of the image becomes insufficient), and the area 43 at the lower end of the screen is An image skip occurs in which a picture remains.
[0044]
The present invention has been made in view of such a situation, and in intra-slice encoding, it is possible to improve the image quality according to the situation not only at the time of a scene change but also at the time of an image change close to a scene change. Is to do so.
[0045]
[Means for Solving the Problems]
The encoding apparatus according to the present invention includes: a first detection unit configured to detect a change in a picture between a first picture that is a previous picture and a second picture that is a picture to be encoded next; Setting means for setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result by the first detecting means; and determining means for determining quantization index data using the value of the initial buffer capacity of the virtual buffer. A quantization means for performing quantization based on the quantization index data determined by the determination means, and an encoding means for encoding the quantized coefficient data quantized by the quantization means. And
[0046]
The setting means may set the minimum value of the initial buffer capacity of the virtual buffer when the change amount of the picture detected by the first detecting means is within a predetermined range.
[0047]
The image processing apparatus may further include a second detection unit that detects a bit rate of the frame image, wherein the setting unit is configured such that a change amount of the pattern detected by the first detection unit is within a predetermined range. If the value of the bit rate is smaller than a predetermined value, the minimum value of the initial buffer capacity of the virtual buffer can be set.
[0048]
The setting unit may cause the setting unit to compare the bit rate with a plurality of threshold values, and set a plurality of minimum values of the initial buffer capacity of the virtual buffer based on the comparison result.
[0049]
The first detecting means may calculate an index indicating a difference between the picture of the first picture and the picture of the second picture, and may detect a change in the picture based on the index.
[0050]
All of the frame images may be inter-frame forward prediction encoded images.
[0051]
The encoding method according to the present invention includes a detecting step of detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be next encoded, and a detecting step. A setting step of setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result by the processing; a determining step of determining quantization index data using the value of the initial buffer capacity of the virtual buffer; and a determining step. A quantization step of performing quantization based on the quantization index data determined by the processing, and an encoding step of encoding the quantized coefficient data quantized by the processing of the quantization step. And
[0052]
The program recorded on the recording medium of the present invention includes a detecting step of detecting a change in a picture between a first picture as a previous picture and a second picture as a picture to be encoded next. A setting step of setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result obtained by the processing of the detecting step; and a determining step of determining quantization index data using the value of the initial buffer capacity of the virtual buffer. And a quantization step of performing quantization based on the quantization index data determined by the processing of the determination step, and an encoding step of encoding the quantized coefficient data quantized by the processing of the quantization step. It is characterized by including.
[0053]
A program according to the present invention includes a detecting step of detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be encoded next, and the processing of the detecting step. A setting step of setting the minimum value of the initial buffer capacity of the virtual buffer based on the detection result; a determining step of determining the quantization index data using the value of the initial buffer capacity of the virtual buffer; The method includes a quantization step of performing quantization based on the determined quantization index data, and an encoding step of encoding quantized coefficient data quantized by the processing of the quantization step. .
[0054]
In the encoding device, the encoding method, and the program according to the present invention, a change in a pattern between a first picture that is a previous picture and a second picture that is a picture to be encoded next is detected, Based on the detection result, the minimum value of the initial buffer capacity of the virtual buffer is set, the quantization index data is determined using the value of the initial buffer capacity of the virtual buffer, and based on the determined quantization index data, The quantization is performed, and the quantized coefficient data is encoded.
[0055]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0056]
FIG. 8 is a block diagram showing a configuration of the video encoder 61.
[0057]
The video encoder 61 encodes image data by a low delay coding method using all P pictures. The pre-processing unit 71 of the video encoder 61 receives input of image data supplied from the outside.
[0058]
The preprocessing unit 71 divides each frame image of the sequentially input image data (all P pictures in this case) into a macroblock composed of a luminance signal of 16 pixels × 16 lines and a color difference signal corresponding to the luminance signal. Then, this is supplied as macroblock data to the calculation unit 72, the motion vector detection unit 73, and the intra AC calculation unit 91 of the quantization control unit 83.
[0059]
The motion vector detection unit 73 receives the input of the macroblock data, calculates the motion vector of each macroblock based on the macroblock data and the reference image data stored in the frame memory 84, and calculates the motion vector as the motion vector data. , To the motion compensator 81.
[0060]
The arithmetic unit 72 performs the intra mode for the intra slices I0 to I11 and the inter mode for the inter slices P0 to P11 based on the image type of each macro block with respect to the macroblock data supplied from the preprocessing unit 71. Motion compensation is performed in the forward prediction mode.
[0061]
Here, the intra mode is a method in which a frame image to be encoded is directly used as transmission data, and the forward prediction mode is a method in which a prediction residual between the frame image to be encoded and a past reference image is transmitted data. It is a method. In the video encoder 61, encoding is performed using only P pictures and divided into intra slices I0 to I11 and inter slices P0 to P11.
[0062]
First, when the macroblock data is one of the intra slices I0 to I11, the macroblock data is processed in the intra mode. That is, the arithmetic unit 72 sends the macroblock of the input macroblock data to the DCT (Discrete Cosine Transform: discrete cosine transform) unit 74 as arithmetic data as it is. The DCT unit 74 converts the input operation data into DCT coefficients by performing a DCT conversion process, and sends the converted data to the quantization unit 75 as DCT coefficient data.
[0063]
The quantization unit 75 performs a quantization process on the input DCT coefficient data based on the quantization index data Q (j + 1) supplied from the generated code amount control unit 92, and generates VLC as the quantized DCT coefficient data. (Variable Length Code; variable length coding) unit 77 and inverse quantization unit 78. Here, the quantization unit 75 adjusts the quantization step size in the quantization process according to the quantization index data Q (j + 1) supplied from the generated code amount control unit 92, thereby reducing the generated code amount. Have been made to control.
[0064]
The quantized DCT coefficient data sent to the inverse quantization unit 78 undergoes an inverse quantization process with the same quantization step size as the quantization unit 75, and is sent to the inverse DCT unit 79 as DCT coefficient data. The inverse DCT unit 79 performs an inverse DCT process on the supplied DCT coefficient data, and the generated operation data is sent to the operation unit 80 and stored in the frame memory 84 as reference image data.
[0065]
If the macroblock data is one of the inter slices P0 to P11, the calculation unit 72 performs a motion compensation process on the macroblock data in the forward prediction mode.
[0066]
The motion compensation unit 81 performs motion compensation on the reference image data stored in the frame memory 84 according to the motion vector data, and calculates forward prediction image data. The calculation unit 72 performs a subtraction process on the macroblock data using the forward prediction image data supplied from the motion compensation unit 81.
[0067]
That is, in the forward prediction mode, the motion compensation unit 81 reads the reference image data by shifting the read address of the frame memory 84 according to the motion vector data, and uses the read reference image data as the forward prediction image data. It is supplied to the arithmetic unit 80. The operation unit 72 subtracts the forward prediction image data from the supplied macroblock data to obtain difference data as a prediction residual. Then, the arithmetic unit 72 sends the difference data to the DCT unit 74.
[0068]
Further, the forward prediction image data from the motion compensation unit 81 is supplied to the operation unit 80, and the operation unit 80 adds the forward prediction image data to the operation data supplied from the inverse DCT unit. , And locally reproduces the reference image data, and outputs it to the frame memory 84 for storage.
[0069]
Thus, the image data input to the video encoder 61 undergoes motion compensation prediction processing, DCT processing, and quantization processing, and is supplied to the VLC unit 77 as quantized DCT coefficient data. The VLC unit 77 performs a variable-length encoding process on the quantized DCT coefficient data based on a predetermined conversion table, sends the resulting variable-length encoded data to the buffer 82, and performs encoding for each macro block. The generated code amount data B (j) indicating the number of generated bits is sent to the generated code amount control unit 92 of the quantization control unit 83 and the GC (Global Complexity) calculation unit 93, respectively.
[0070]
The GC calculation unit 93 sequentially accumulates the generated code amount data B (j) for each macro block, and when all the generated code amount data B (j) for one picture are accumulated, the GC calculation unit 93 generates the generated code amount data B (j). The generated code amount for one picture is calculated by cumulatively adding the code amount data B (j).
[0071]
Then, the GC calculation unit 93 calculates the product of the generated code amount of the intra slice portion of one picture and the average value of the quantization step size in the intra slice portion, using the following equation (6). Thus, GC data Xi representing the difficulty of the image in the intra slice portion (hereinafter, referred to as GC) is obtained, and supplied to the target code amount calculation section 94.
[0072]
Xi = (Ti / Ni) × Qi (6)
Here, Ti is the generated code amount of the intra slice, Ni is the number of intra slices, and Qi is the average value of the quantization step size of the intra slice.
[0073]
At the same time, the GC calculation unit 93 uses the following equation (7) to calculate the generated code amount of the inter-slice portion of one picture and the average value of the quantization step size in the inter-slice portion. By calculating the product, the GC data Xp in the inter-slice part is obtained, and this is supplied to the target code amount calculation unit 94.
[0074]
Xp = (Tp / Np) × Qp (7)
Here, Tp is the generated code amount of the inter slice, Np is the number of inter slices, and Qp is the average value of the quantization step size of the inter slice.
[0075]
Based on the GC data Xi supplied from the GC calculation unit 93, the target code amount calculation unit 94 calculates the target generated code amount data Tpi of the intra slice portion in the next picture using the following equation (8). At the same time, based on the GC data Xp supplied from the GC calculation unit 93, the target generated code amount data Tpp of the inter slice portion in the next picture is calculated based on the following equation (9), and the calculated target generated code Tpp is calculated. The amount data Tpi and Tpp are sent to the generated code amount control unit 92, respectively.
[0076]
Tpi = {(Ni × Xi) / (Np × Xp) + (Np × Xi)} × Xp (8)
[0077]
Tpp = {(Np × Xp) / (Np × Xp) + (Ni × Xi)} × Xp (9)
[0078]
Further, the target code amount calculation unit 94 receives an input of the bit rate value input by the user using the operation input unit 85, and supplies the input to the code amount generation unit 92.
[0079]
The ME residual calculation unit 95 calculates ME residual information ME_info based on the input macroblock data, and outputs it to the generated code amount control unit 92. Here, the ME residual information ME_info is calculated on a picture basis, and is a total value of luminance difference values between a previous picture and a next picture. Therefore, when the ME residual information ME_info indicates a large value, it indicates that the picture of the immediately preceding picture is largely different from the picture of the next picture to be coded (so-called scene change).
[0080]
If the picture of the previous picture is different from the picture of the picture to be encoded next, the quantum generated based on the target generated code amount data Tpi and Tpp calculated using the image data of the previous picture. It is not appropriate to determine the quantization step size of the quantization unit 75 based on the quantization index data Q (j + 1). Therefore, when a scene change occurs, the target generated code amount data Tpi and Tpp may be newly calculated and re-calculated.
[0081]
The intra AC calculation unit 91 calculates the intra AC (intra AC), and outputs mad_info indicating the current value of the intra AC and prev_mad_info indicating the value of the immediately previous intra AC to the generated code amount control unit 92. I do.
[0082]
Intra AC is a parameter defined as the sum of variances with video data for each DCT block in the DCT processing unit in the MPEG system, and indicates the complexity of the video, the difficulty of the picture pattern of the video, and the Correlated with data volume. That is, the intra AC is a total sum in the screen of the absolute value sum of the pixel value of each pixel minus the average value of the pixel value of each block in DCT block units. Intra AC is represented by the following equation (10).
[0083]
(Equation 1)
Figure 2004072144
... (10)
[0084]
In the equation (10), the equation (11) is satisfied.
(Equation 2)
Figure 2004072144
... (11)
[0085]
If the virtual buffer adjustment is performed for both the scene change from easy to difficult image coding and the scene change from difficult to easy image coding, it will change from difficult to easy. In the scene change described above, the image quality may be degraded in an easy image for which there is room for encoding. In addition, even in the case of a scene change from a difficult to an easy one, it may be better to adjust the virtual buffer depending on the magnitude of the change or the difficulty of the image after the scene change. However, the presence / absence of a scene change can be determined only by ME residual information. Change cannot be determined.
[0086]
Therefore, the intra AC calculation unit 91 calculates the intra AC, and outputs to the generated code amount control unit 92 the mad_info indicating the current value of the intra AC and the prev_mad_info indicating the value of the immediately previous intra AC. Accordingly, the generated code amount control unit 92 can determine the state of the scene change and determine whether to perform the virtual buffer adjustment.
[0087]
The generated code amount control unit 92 constantly monitors the accumulation state of the variable-length encoded data stored in the buffer 82, and determines the quantization step size based on the occupation amount information indicating the accumulation state. I have.
[0088]
When the generated code amount data B (j) of the macroblock actually generated is larger than the target generated code amount data Tpi of the intra slice portion, the generated code amount control unit 92 performs quantization to reduce the generated code amount. When the step size is increased and the actual generated code amount data B (j) is smaller than the target generated code amount data Tpi, the quantization step size is reduced to increase the generated code amount.
[0089]
Further, similarly, in the case of the inter-slice portion, when the generated code amount data B (j) of the macroblock actually generated is larger than the target generated code amount data Tpp, the generated code amount control unit 92 determines the generated code amount. In order to increase the generated code amount, if the actual generated code amount data B (j) is smaller than the target generated code amount data Tpp, the quantization step size is decreased. It has been made.
[0090]
That is, the generated code amount control unit 92 assumes the transition of the accumulation state of the variable-length encoded data stored in the VBV buffer provided on the decoder side, as shown in FIG. The buffer occupancy d (j) of the virtual buffer in the block is represented by the following equation (12), and the buffer occupancy d (j + 1) of the virtual buffer in the j + 1-th macroblock is represented by the following equation (13): By subtracting equation (13) from equation (12), the buffer occupancy d (j + 1) of the virtual buffer in the (j + 1) th macroblock can be transformed into the following equation (14).
[0091]
d (j) = d (0) + B (j−1) − {T × (j−1) / MBcnt} (12)
[0092]
Here, d (0) is the initial buffer capacity, B (j) is the number of bits generated in the j-th macroblock, MBcnt is the number of macroblocks in the picture, and T is the target generation in picture units. The code amount.
[0093]
d (j + 1) = d (0) + B (i) − (T × j) / MBcnt (13)
[0094]
d (j + 1) = d (j) + {B (j) -B (j-1)}-T / MBcnt (14)
[0095]
Subsequently, since the macroblock in the picture is divided into an intra-slice part and an inter-slice part, the generated code amount control unit 92 determines whether the macro block in the intra-slice part and the Target generated code amounts Tpi and Tpp to be assigned to each macroblock are individually set.
[0096]
In the graph, when the number of macroblocks is between 0 and s and between t and end, the target generated code amount Tpp of the interslice is substituted into the following equation (15), so that The buffer occupancy d (j + 1) can be obtained.
[0097]
d (j + 1) = d (j) + {B (j) -B (j-1)}-Tpp / {MBcnt- (ts)} (15)
[0098]
Also, when the count number of the macroblock is between s and t, the target generated code amount Tpi of the intra slice is substituted into the following equation (16), whereby the buffer occupation amount d (j + 1) in the intra slice portion is obtained. ) Can be obtained.
[0099]
d (j + 1) = d (j) + {B (j) -B (j-1)}-Tpi / (ts) (16)
[0100]
Therefore, the generated code amount control unit 92 substitutes the buffer occupancy d (j + 1) in the intra-slice part and the inter-slice part and the constant r shown in the equation (17) into the equation (18), thereby obtaining the macro The quantization index data Q (j + 1) of the block (j + 1) is calculated and supplied to the quantization unit 75.
[0101]
r = (2 × br) / pr (17)
Q (j + 1) = d (j + 1) × (31 / r) (18)
Here, br is a bit rate, and pr is a picture rate.
[0102]
The quantization unit 75 determines a quantization step size corresponding to an intra slice or an inter slice in the next macroblock based on the quantization index data Q (j + 1), and quantizes the DCT coefficient data according to the quantization step size. I do.
[0103]
Thereby, the quantization unit 75 calculates the intra-slice part and the inter-slice of the next picture, which are calculated based on the actual generated code amount data B (j) in the intra-slice part and the inter-slice part of the previous picture. The DCT coefficient data can be quantized by the optimal quantization step size for the target generated code amounts Tpp and Tpi in the portion.
[0104]
Thus, the quantization unit 75 can quantize the buffer 82 so as not to overflow or underflow, and quantize the decoder-side VBV buffer so as not to overflow or underflow in accordance with the data occupancy of the buffer 82. Quantized DCT coefficient data can be generated.
[0105]
For example, in Japanese Patent Application No. 11-205803 described above as a conventional technique, when a picture of a picture to be encoded next changes greatly while performing normal feedback-type quantization control, a feedback-type quantum control is performed. The initialization control is stopped, the initial buffer capacity d (0) of the virtual buffer is initialized based on the ME residual information supplied from the ME residual calculating unit 95, and based on the new initial buffer capacity d (0), The quantization index data Q (j + 1) is newly calculated for each of the intra slice and the inter slice.
[0106]
However, as in the conventional case, when it is determined whether or not to perform the virtual buffer adjustment using only the ME residual, when the image difficulty changes from easy to difficult, and from difficult to simple, In both cases, the virtual buffer adjustment is performed. That is, when the image difficulty is changed from a difficult one to a simple one, the result is that the image quality is degraded in a simple image for which there is room for encoding.
[0107]
Therefore, in the video encoder 61 of FIG. 8, for example, using information such as the intra AC calculated by the intra AC calculator 91, the virtual buffer is used only when a scene change in which the image difficulty changes from easy to difficult occurs. By performing the adjustment, it is possible to prevent the image quality from deteriorating in a simple image.
[0108]
In other words, the generated code amount control unit 92 performs the normal feedback-type quantization control and stops the feedback-type quantization control when the picture of the next picture to be coded greatly changes, and stops the ME remaining. Whether to initialize the initial buffer capacity d (0) of the virtual buffer based on the ME residual information ME_info supplied from the difference calculation unit 95 and prev_mad_info and mad_info supplied from the intra AC calculation unit 91 Is determined, and the initial buffer capacity d (0) of the virtual buffer is initialized based on the ME residual information ME_info supplied from the ME residual calculator 95. Is initialized. The initialization of the initial buffer capacity d (0) of the virtual buffer is the same as in the conventional case described using the equations (2) to (5).
[0109]
Then, based on the new initial buffer capacity d (0), the generated code amount control unit 92 uses the equations (12) to (18) to calculate the quantized index data Q ( j + 1) is newly calculated and supplied to the quantization unit 75.
[0110]
Further, the generated code amount control unit 92 determines that the change of the picture of the picture to be coded next is not large enough to be judged as a scene change, but is close to being judged as a scene change. , The minimum value of the virtual buffer is limited to be larger than a certain value. As a result, the minimum value of the quantization index is also limited, so that it is possible to suppress the occurrence of image skipping in the situation described with reference to FIG.
[0111]
Referring to the flowchart of FIG. 11, using image difficulty information such as intra AC, a scene change is introduced to determine whether or not a change from a simple image to a difficult image is performed to adjust the virtual buffer. The virtual buffer update process to be performed will be described.
[0112]
In step S21, the generated code amount control unit 92 acquires the ME residual information ME_info from the ME residual calculation unit 95.
[0113]
In step S22, the generated code amount control unit 92 subtracts the average value avg of the ME residual information from the acquired ME residual information, and determines whether or not ME_info-avg> D, that is, the calculated value. Is larger than a predetermined threshold value D. The average value avg of the ME residual information is a value updated in step S26 described later, and is represented by the above-described equation (1). Note that the predetermined threshold value D is a value of a property that is tuned while considering image quality.
[0114]
If it is determined in step S22 that the calculated value is larger than the predetermined threshold D, it is determined that the difference between the picture in the current picture and the picture in the immediately preceding picture is large, that is, that a scene change has occurred. Therefore, in step S23, the generated code amount control unit 92 obtains the value of the intra AC after the scene change, mad_info, acquired from the intra AC calculation unit 91, and the value of the intra AC before the scene change. The value is compared with prev_mad_info, and it is determined whether or not mad_info> prev_mad_info.
[0115]
If it is determined in step S23 that mad_info is not greater than prev_mad_info, this scene change is a scene change from a difficult image to a simple image, and the process proceeds to step S26.
[0116]
If it is determined in step S23 that mad_info> prev_mad_info, this scene change is a scene change from a simple image to a difficult image, and thus in step S24, the generated code amount control unit 92 determines that FIG. The initial buffer capacity d (0) of the virtual buffer is updated by the same processing as in the conventional case described above.
[0117]
That is, the generated code amount control unit 92 calculates the initial buffer capacity d (0) of the virtual buffer based on the above equations (2), (3), (4) and (5), and Update the buffer.
[0118]
In step S22, when it is determined that the calculated value is smaller than the predetermined threshold D, it is determined that there is not much difference between the picture in the current picture and the picture in the immediately preceding picture, that is, there is no scene change. Therefore, in step S25, a minimum value restriction process 1 described later with reference to FIG. 12, a minimum value restriction process 2 described later with reference to FIG. 13, or a minimum value restriction process 3 described later with reference to FIG. Is performed.
[0119]
If it is determined in step S23 that mad_info> prev_mad_info is not satisfied, after the processing in step S24 or the processing in step S25 is completed, in step S26, the generated code amount control unit 92 is supplied next. In preparation for a picture, the average value avg of the ME residual information is updated by the above equation (1), the process returns to step S21, and the subsequent processes are repeated.
[0120]
According to the processing described using the flowchart of FIG. 11, the virtual buffer adjustment is performed only at the time of a scene change in which the image difficulty is changed from easy to difficult by using the intra AC. In a simple image that should exist, it is possible to prevent the image quality from further deteriorating.
[0121]
Further, if a scene change is not detected, a minimum value restriction process 1 described later with reference to FIG. 12, a minimum value restriction process 2 described later with reference to FIG. 13, or a minimum value restriction process 2 described later with reference to FIG. One of the processes 3 is executed.
[0122]
Next, the minimum value restriction processing 1 will be described with reference to the flowchart of FIG.
[0123]
In step S41, the generated code amount control unit 92 compares the value of ME_info-avg calculated in step S22 with a predetermined threshold value E based on the ME residual information ME_info acquired in step S21 of FIG. Determine whether −avg> E. Here, the threshold value E is a value smaller than the threshold value D in step S22 in FIG.
[0124]
When it is determined in step S41 that ME_info-avg> E, in step S42, the generated code amount control unit 92 generates a control signal for limiting the minimum value of the virtual buffer, and sends the control signal to the quantization unit 75. Supply. Based on the control signal supplied from the generated code amount control unit 92, the quantization unit 75 sets the buffer capacity of the virtual buffer to at least a predetermined value even if the previous image is simple. The quantization index is calculated by performing the processing described with reference to Expressions (12) to (18) while limiting the quantization index to be larger. The calculated quantization index also has a minimum value restricted. After the processing in step S42 ends, the processing returns to the processing in step S26 in FIG.
[0125]
That is, in step S22 of FIG. 11, it is determined that ME_info-avg> D is not satisfied, and in step S41, it is determined that ME_info-avg> E, the value of ME_info-avg is determined as shown in FIG. ME_info-avg exists in the scene change area 96 when the value of the threshold value is larger than the threshold value D, and in the intermediate area α97 between the normal area 98 when the value of the ME_info-avg value is smaller than the threshold value E (D>ME_info-avg>). E holds).
[0126]
In the intermediate region α97, it is not determined that a scene change has occurred, but if the value of the quantization index fed back based on the previous image is very small, as described with reference to FIG. There is a possibility that a given bit amount is consumed halfway, the code amount becomes insufficient, and image skipping occurs. Accordingly, in step S42, by limiting the minimum value of the value of the virtual buffer, the minimum value of the quantization index is also limited, so that the occurrence of image skipping can be suppressed.
[0127]
If it is determined in step S41 that ME_info-avg> E is not satisfied, it is determined that the difference from the previous image is such that it is not necessary to consider the minimum value of the quantization index. The process returns to step S26 in FIG. 11 without being performed.
[0128]
An image that is not determined to be a scene change by the processing described with reference to FIG. 12 but is likely to cause image skipping (a phenomenon that a previous picture remains at the lower end of the screen) in the conventional method is displayed on the screen. It is possible to encode to the lower end.
[0129]
By the way, rate control when encoding an image with a high bit rate has more margin than encoding an image with a low bit rate. If the minimum value of the virtual buffer (quantization index) is limited even though there is a sufficient margin for the rate control, the image quality deteriorates.
[0130]
With reference to the flowchart of FIG. 14, a description will be given of a minimum value restriction process 2 that determines whether to perform the minimum value restriction by referring to the bit rate value in addition to the ME residual.
[0131]
In step S51, the generated code amount control unit 92 compares the value of ME_info-avg calculated in step S22 with a predetermined threshold E based on the ME residual information ME_info acquired in step S21 of FIG. It is determined whether or not ME_info-avg> E. Here, the threshold value E is a value smaller than the threshold value D in step S22 in FIG.
[0132]
When it is determined in step S51 that ME_info-avg> E, in step S52, the generated code amount control unit 92 determines that the value of the bit rate supplied from the target code amount calculation unit 94 is smaller than a predetermined threshold F. Determine whether it is small. Here, the threshold value F is a value for determining whether or not a margin occurs in the rate control when encoding.
[0133]
If it is determined in step S52 that the value of the bit rate is smaller than the predetermined threshold F, in step S53, the generated code amount control unit 92 generates a control signal for limiting the minimum value of the virtual buffer, This is supplied to the quantization unit 75. Based on the control signal supplied from the generated code amount control unit 92, the quantization unit 75 sets the buffer capacity of the virtual buffer to at least a predetermined value even if the previous image is simple. The quantization index is calculated by performing the processing described with reference to Expressions (12) to (18) while limiting the quantization index to be larger. The calculated quantization index also has a minimum value restricted. After the end of the process in the step S53, the process returns to the process in the step S26 in FIG.
[0134]
If it is determined in step S51 that ME_info-avg> E is not satisfied, it is determined that the difference from the previous image is such that it is not necessary to consider the minimum value of the quantization index. Is determined to be larger than the predetermined threshold value F, it is determined that there is room for the rate control, so that the minimum value is not limited, and the process returns to the process of step S26 in FIG.
[0135]
By the processing described with reference to the flowchart of FIG. 14, the minimum value of the virtual buffer (quantization index) is limited to prevent the image quality from deteriorating even though the rate control has sufficient margin. Only when necessary, it is possible to limit the minimum value of the virtual buffer (quantization index) and suppress the occurrence of image skipping (a phenomenon that the previous picture remains at the lower end of the screen).
[0136]
Furthermore, by making it possible to set a plurality of minimum values of the virtual buffer (quantization index) according to the value of the bit rate, the image quality can be further stabilized.
[0137]
Next, with reference to the flowchart of FIG. 15, a description will be given of a minimum value restriction process 3 that can set a plurality of minimum values of the virtual buffer (quantization index) according to the value of the bit rate.
[0138]
In step S61, the generated code amount control unit 92 compares the value of ME_info-avg calculated in step S22 with a predetermined threshold E based on the ME residual information ME_info acquired in step S21 of FIG. It is determined whether or not ME_info-avg> E. Here, the threshold value E is a value smaller than the threshold value D in step S22 in FIG.
[0139]
If it is determined in step S61 that ME_info-avg> E, in step S62, the generated code amount control unit 92 sets the value of the bit rate supplied from the target code amount calculation unit 94 to be smaller than a predetermined threshold G. Determine whether it is small. Here, the threshold value G is a value for determining whether or not there is a margin in rate control when encoding. In addition, in encoding when the bit rate is low, by strictly limiting the minimum value, it is possible to more effectively prevent the image quality from deteriorating and suppress the occurrence of image skipping. It is preferable that the value be smaller than the threshold value F in the processing described with reference to FIG.
[0140]
If it is determined in step S62 that the value of the bit rate is smaller than the predetermined threshold value G, in step S63, the generated code amount control unit 92 sets the minimum value of the virtual buffer to a predetermined first value. A control signal for limiting is generated and supplied to the quantization unit 75. Based on the control signal supplied from the generated code amount control unit 92, the quantization unit 75 sets the buffer capacity of the virtual buffer to be at least larger than the first value even if the previous image is simple. With the restriction, the quantization index is calculated by the processing described using equations (12) to (18). The calculated quantization index is also the one whose minimum value is limited by the first value. After the processing in step S63 ends, the processing returns to the processing in step S26 in FIG.
[0141]
In step S62, when it is determined that the value of the bit rate is greater than the predetermined threshold G, in step S64, the generated code amount control unit 92 sets the bit rate value supplied from the target code amount calculation unit 94 to: It is determined whether it is smaller than a predetermined threshold value H. Here, the threshold value H for determining whether or not a margin occurs in the rate control is a value larger than the threshold value G. For example, assuming that the threshold value H is equal to the threshold value F in the processing described with reference to FIG. It is suitable.
[0142]
When it is determined in step S64 that the value of the bit rate is smaller than the predetermined threshold value H, in step S65, the generated code amount control unit 92 sets the minimum value of the virtual buffer to be smaller than the first value in step S63. A small control signal for restricting to a predetermined second value is generated and supplied to the quantization unit 75. Based on the control signal supplied from the generated code amount control unit 92, the quantization unit 75 controls the buffer capacity of the virtual buffer to be at least larger than the second value even if the previous image is simple. With the restriction, the quantization index is calculated by the processing described using equations (12) to (18). The minimum value of the calculated quantization index is also limited by the second value. After the processing in step S65 ends, the processing returns to the processing in step S26 in FIG.
[0143]
If it is determined in step S61 that ME_info-avg> E is not satisfied, it is determined that the difference from the previous image is such that it is not necessary to consider the minimum value of the quantization index. The process returns to step S26 in FIG. 11 without being performed. If it is determined in step S64 that the value of the bit rate is larger than the predetermined threshold value H, it is determined that there is sufficient margin for the rate control. It returns to the process of step S26 of FIG.
[0144]
According to the above-described processing, even when the image change amount is near the scene change detection threshold, an image that is difficult to encode is detected, and the minimum value of the virtual buffer (quantization index) is limited. Furthermore, it is possible to detect an image for which rate control is difficult and to set the minimum value of the virtual buffer (quantization index) corresponding to the bit rate.
[0145]
Thus, even in the low delay mode and the low bit rate, image skipping (a phenomenon in which the previous picture remains at the lower end of the screen) is suppressed, and stable image quality can be obtained.
[0146]
Further, in the above-described embodiment, all the frame images of numbers 0 to 11 are set as P pictures as the low delay coding, and, for example, the upper part of the frame image in the image frame size of 45 horizontal macroblocks and 24 vertical macroblocks Has described the case where the area for 2 vertical macroblocks and 45 horizontal macroblocks is set as one intra-slice part, and the others are all set as inter-slice parts. However, the present invention is not limited to this. The portion may be formed of an area of various other sizes, such as an area for one vertical macroblock and 45 horizontal macroblocks.
[0147]
Also, here, the case where low delay encoding is performed has been described as an example. However, the present invention may be applied to, for example, encoding 15 frames into an intra-frame coded image (hereinafter, referred to as an I-picture) and an inter-frame forward prediction coded image. (Hereinafter, referred to as a P picture) or a bidirectional predictive coded image (hereinafter, referred to as a B picture), which one of the three image types is to be processed. It is also applicable to the case where a frame image is encoded according to the image type (I picture, P picture, or B picture).
[0148]
Further, in the above-described embodiment, a case has been described in which the present invention is applied to the video encoder 61 as an encoding device that performs compression and encoding by the MPEG method. However, the present invention is not limited to this, and other embodiments are applicable. You may make it apply to the encoding apparatus by various image compression systems.
[0149]
The series of processes described above can be executed by hardware, but can also be executed by software. In this case, for example, the video encoder 61 is configured by a personal computer 101 as shown in FIG.
[0150]
In FIG. 16, a CPU 111 executes various processes according to a program stored in a ROM 112 or a program loaded from a storage unit 118 into a RAM 113. The RAM 113 also appropriately stores data necessary for the CPU 111 to execute various processes.
[0151]
The CPU 111, the ROM 112, and the RAM 113 are mutually connected via a bus 114. The bus 114 is also connected to an input / output interface 115.
[0152]
The input / output interface 115 includes an input unit 116 including a keyboard and a mouse, an output unit 117 including a display and a speaker, a storage unit 118 including a hard disk, and a communication unit 119 including a modem, a terminal adapter, and the like. It is connected. The communication unit 119 performs communication processing via a network including the Internet.
[0153]
A drive 120 is connected to the input / output interface 115 as necessary, and a magnetic disk 131, an optical disk 132, a magneto-optical disk 133, a semiconductor memory 134, or the like is appropriately mounted, and a computer program read out from these is loaded. Are installed in the storage unit 118 as needed.
[0154]
When a series of processing is executed by software, a program constituting the software executes various functions by installing a computer built in dedicated hardware or installing various programs. For example, it is installed in a general-purpose personal computer or the like from a network or a recording medium.
[0155]
As shown in FIG. 16, this recording medium is distributed separately from the apparatus main body to supply the program to the user, and is stored on a magnetic disk 131 (including a floppy disk) and an optical disk 132 (including a floppy disk) storing the program. It is configured by a package medium including a CD-ROM (Compact Disk-Read Only Memory), a DVD (including a Digital Versatile Disk), a magneto-optical disk 133 (including an MD (Mini-Disk) (trademark)), a semiconductor memory 134, or the like. In addition to this, it is configured with a ROM 112 storing a program, a hard disk included in a storage unit 118, and the like, which are supplied to a user in a state of being incorporated in the apparatus main body in advance.
[0156]
In the present specification, the steps of describing a program stored in a recording medium include, in addition to the processing performed in chronological order in the order in which the program is included, the processing is not necessarily performed in chronological order, but may be performed in parallel or individually. This includes the processing to be executed.
[0157]
【The invention's effect】
According to the present invention, image data can be encoded.
Further, according to the present invention, even when no scene change has occurred, the minimum value of the virtual buffer is limited when the amount of change in the image is close to the value determined to have caused the scene change. As a result, the quantization index is limited to a certain value or more, so that it is possible to prevent the image from deteriorating at the time of a scene change.
[Brief description of the drawings]
FIG. 1 is a diagram for explaining processing when video data is compression-encoded by the MPEG2 system and processing when decoding compression-encoded image data.
FIG. 2 is a diagram illustrating a VBV buffer.
FIG. 3 is a diagram illustrating low delay coding.
FIG. 4 is a diagram illustrating a VBV buffer.
FIG. 5 is a diagram illustrating a scene change.
FIG. 6 is a flowchart illustrating a conventional virtual buffer update process.
FIG. 7 is a diagram illustrating a case where an image skip occurs instead of a scene change.
FIG. 8 is a block diagram illustrating a configuration of a video encoder to which the present invention has been applied.
FIG. 9 is a diagram illustrating the buffer occupancy of a virtual buffer.
FIG. 10 is a diagram illustrating buffer occupancy of a virtual buffer for each intra slice and inter slice.
FIG. 11 is a flowchart illustrating a virtual buffer update process to which the present invention has been applied.
FIG. 12 is a flowchart illustrating minimum value restriction processing 1;
FIG. 13 is a diagram illustrating an intermediate area α existing between a scene change area and a normal area.
FIG. 14 is a flowchart illustrating minimum value restriction processing 2;
FIG. 15 is a flowchart illustrating a minimum value restriction process 3;
FIG. 16 is a block diagram illustrating a configuration of a personal computer.
[Explanation of symbols]
61 video encoder, 71 preprocessing unit, 72 operation unit, 73 motion vector detection unit, 74 DCT unit, 75 quantization unit, 77 VLC unit, 78 inverse quantization unit, 79 inverse DCT unit, 80 operation unit, 81 motion compensation Unit, 82 buffer, 83 quantization control unit, 84 frame memory, 91 intra AC calculation unit, 92 generated code amount control unit, 93 GC calculation unit, 94 target code amount calculation unit, 95 ME residual calculation unit, 97 intermediate area α

Claims (9)

フレーム画像を符号化する符号化装置において
1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する第1の検出手段と、
前記第1の検出手段による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定手段と、
前記仮想バッファの前記初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定手段と、
前記決定手段により決定された前記量子化インデックスデータを基に、量子化を実行する量子化手段と、
前記量子化手段により量子化された量子化係数データを符号化する符号化手段と
を備えることを特徴とする符号化装置。
First detecting means for detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be subjected to next encoding in a coding apparatus for coding a frame image. When,
Setting means for setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result by the first detecting means;
Using the value of the initial buffer capacity of the virtual buffer, determining means for determining quantization index data,
Based on the quantization index data determined by the determination means, quantization means for performing quantization,
An encoding unit that encodes the quantized coefficient data quantized by the quantization unit.
前記設定手段は、前記第1の検出手段により検出された前記絵柄の変化量が、所定の範囲内である場合、前記仮想バッファの前記初期バッファ容量の最小値を設定する
ことを特徴とする請求項1に記載の符号化装置。
The setting means sets a minimum value of the initial buffer capacity of the virtual buffer when a change amount of the picture detected by the first detecting means is within a predetermined range. Item 2. The encoding device according to Item 1.
前記フレーム画像のビットレートを検出する第2の検出手段を更に備え、
前記設定手段は、前記第1の検出手段により検出された前記絵柄の変化量が、所定の範囲内であり、かつ、前記ビットレートの値が、所定の値より小さい場合、前記仮想バッファの前記初期バッファ容量の最小値を設定する
ことを特徴とする請求項1に記載の符号化装置。
A second detection unit that detects a bit rate of the frame image,
The setting means, when the change amount of the pattern detected by the first detection means is within a predetermined range, and the value of the bit rate is smaller than a predetermined value, 2. The encoding apparatus according to claim 1, wherein a minimum value of the initial buffer capacity is set.
前記設定手段は、前記ビットレートと複数の閾値とを比較し、比較結果に基づいて、前記仮想バッファの前記初期バッファ容量の最小値を複数設定する
ことを特徴とする請求項3に記載の符号化装置。
4. The code according to claim 3, wherein the setting unit compares the bit rate with a plurality of thresholds, and sets a plurality of minimum values of the initial buffer capacity of the virtual buffer based on a comparison result. 5. Device.
前記第1の検出手段は、前記第1のピクチャの絵柄と前記第2のピクチャの絵柄との差分を示す指標を算出し、前記指標を基に、前記絵柄の変化を検出する
ことを特徴とする請求項1に記載の符号化装置。
The first detection means calculates an index indicating a difference between the picture of the first picture and the picture of the second picture, and detects a change in the picture based on the index. The encoding device according to claim 1.
前記フレーム画像は、全て、フレーム間順方向予測符号化画像である
ことを特徴とする請求項1に記載の符号化装置。
The encoding apparatus according to claim 1, wherein the frame images are all inter-frame forward prediction encoded images.
フレーム画像を符号化する符号化装置の符号化方法において、
1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、
前記検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、
前記仮想バッファの前記初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、
前記決定ステップの処理により決定された前記量子化インデックスデータを基に、量子化を実行する量子化ステップと、
前記量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップと
を含むことを特徴とする符号化方法。
In an encoding method of an encoding device that encodes a frame image,
A detecting step of detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be encoded next;
A setting step of setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result obtained by the processing of the detection step;
Using the value of the initial buffer capacity of the virtual buffer, determining the quantization index data,
A quantization step of performing quantization based on the quantization index data determined by the processing of the determination step;
An encoding step of encoding the quantized coefficient data quantized by the processing of the quantization step.
フレーム画像を符号化する符号化装置用のプログラムであって、
1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、
前記検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、
前記仮想バッファの前記初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、
前記決定ステップの処理により決定された前記量子化インデックスデータを基に、量子化を実行する量子化ステップと、
前記量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップと
を含むことを特徴とするコンピュータが読み取り可能なプログラムが記録されている記録媒体。
A program for an encoding device that encodes a frame image,
A detecting step of detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be encoded next;
A setting step of setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result obtained by the processing of the detection step;
Using the value of the initial buffer capacity of the virtual buffer, determining the quantization index data,
A quantization step of performing quantization based on the quantization index data determined by the processing of the determination step;
A coding step of coding the quantized coefficient data quantized by the processing of the quantization step.
フレーム画像を符号化する符号化装置を制御するコンピュータが実行可能なプログラムであって、
1つ前のピクチャである第1のピクチャと、次に符号化処理するピクチャである第2のピクチャとの、絵柄の変化を検出する検出ステップと、
前記検出ステップの処理による検出結果に基づいて、仮想バッファの初期バッファ容量の最小値を設定する設定ステップと、
前記仮想バッファの前記初期バッファ容量の値を用いて、量子化インデックスデータを決定する決定ステップと、
前記決定ステップの処理により決定された前記量子化インデックスデータを基に、量子化を実行する量子化ステップと、
前記量子化ステップの処理により量子化された量子化係数データを符号化する符号化ステップと
を含むことを特徴とするプログラム。
A computer-executable program that controls an encoding device that encodes a frame image,
A detecting step of detecting a change in a picture between a first picture which is a previous picture and a second picture which is a picture to be encoded next;
A setting step of setting a minimum value of the initial buffer capacity of the virtual buffer based on a detection result obtained by the processing of the detection step;
Using the value of the initial buffer capacity of the virtual buffer, determining the quantization index data,
A quantization step of performing quantization based on the quantization index data determined by the processing of the determination step;
A coding step of coding the quantized coefficient data quantized by the processing of the quantization step.
JP2002224466A 2002-08-01 2002-08-01 Encoding apparatus, encoding method, program, and recording medium Expired - Fee Related JP4186544B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002224466A JP4186544B2 (en) 2002-08-01 2002-08-01 Encoding apparatus, encoding method, program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002224466A JP4186544B2 (en) 2002-08-01 2002-08-01 Encoding apparatus, encoding method, program, and recording medium

Publications (2)

Publication Number Publication Date
JP2004072144A true JP2004072144A (en) 2004-03-04
JP4186544B2 JP4186544B2 (en) 2008-11-26

Family

ID=32012417

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002224466A Expired - Fee Related JP4186544B2 (en) 2002-08-01 2002-08-01 Encoding apparatus, encoding method, program, and recording medium

Country Status (1)

Country Link
JP (1) JP4186544B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100790149B1 (en) 2006-07-27 2008-01-02 삼성전자주식회사 Rate control of scene-changed video encoder

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0638191A (en) * 1992-07-20 1994-02-10 Canon Inc Animation signal coding device
JPH0795564A (en) * 1993-09-20 1995-04-07 Toshiba Corp Moving image encoder
JPH07115651A (en) * 1993-10-18 1995-05-02 Mitsubishi Electric Corp Video signal encoding system
JPH07154825A (en) * 1993-10-01 1995-06-16 Toko Inc Image transmitter
JPH11196423A (en) * 1997-12-26 1999-07-21 Sony Corp Device and method for picture processing and presentation medium
JPH11205803A (en) * 1998-01-19 1999-07-30 Sony Corp Encoding device and encoding method therefor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0638191A (en) * 1992-07-20 1994-02-10 Canon Inc Animation signal coding device
JPH0795564A (en) * 1993-09-20 1995-04-07 Toshiba Corp Moving image encoder
JPH07154825A (en) * 1993-10-01 1995-06-16 Toko Inc Image transmitter
JPH07115651A (en) * 1993-10-18 1995-05-02 Mitsubishi Electric Corp Video signal encoding system
JPH11196423A (en) * 1997-12-26 1999-07-21 Sony Corp Device and method for picture processing and presentation medium
JPH11205803A (en) * 1998-01-19 1999-07-30 Sony Corp Encoding device and encoding method therefor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100790149B1 (en) 2006-07-27 2008-01-02 삼성전자주식회사 Rate control of scene-changed video encoder

Also Published As

Publication number Publication date
JP4186544B2 (en) 2008-11-26

Similar Documents

Publication Publication Date Title
JP5180294B2 (en) Buffer-based rate control that utilizes frame complexity, buffer level, and intra-frame location in video encoding
US7301999B2 (en) Quantization method and system for video MPEG applications and computer program product therefor
JP4256574B2 (en) Image signal encoding method and image signal encoding apparatus
JP2001169281A (en) Device and method for encoding moving image
JP4221655B2 (en) Encoding apparatus, encoding method, program, and recording medium
JP5133290B2 (en) Video encoding apparatus and decoding apparatus
JP3907875B2 (en) Coding rate control device and information coding device
US20120002724A1 (en) Encoding device and method and multimedia apparatus including the encoding device
JP4532980B2 (en) Moving picture coding apparatus and method, computer program, and computer-readable storage medium
JP2004328150A (en) Moving picture coding apparatus and method
JP2007053620A (en) Image processing apparatus and image processing method
JP2007124580A (en) Moving picture encoding program, program storage medium and encoder
JP4186543B2 (en) Encoding apparatus, encoding method, program, and recording medium
JP2001309384A (en) Picture compressor
US9185420B2 (en) Moving image coding apparatus and moving image coding method
JP4586340B2 (en) Encoding apparatus, encoding method, and program
JP4228739B2 (en) Encoding apparatus, encoding method, program, and recording medium
JP4718736B2 (en) Video encoding device
JP4186544B2 (en) Encoding apparatus, encoding method, program, and recording medium
JP4325536B2 (en) Video encoding apparatus and method
JP4185413B2 (en) Flicker reduction quantizer, flicker reduction quantization method, and program thereof
JP3918208B2 (en) Video data compression apparatus and method
JPH11205803A (en) Encoding device and encoding method therefor
JP4273386B2 (en) Encoding apparatus, encoding method, program, and recording medium
JP4273385B2 (en) Encoding apparatus, encoding method, program, and recording medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050714

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070821

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070823

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070925

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080901

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

Free format text: PAYMENT UNTIL: 20110919

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees