JP3812269B2 - Video encoding apparatus and method - Google Patents

Video encoding apparatus and method Download PDF

Info

Publication number
JP3812269B2
JP3812269B2 JP2000047245A JP2000047245A JP3812269B2 JP 3812269 B2 JP3812269 B2 JP 3812269B2 JP 2000047245 A JP2000047245 A JP 2000047245A JP 2000047245 A JP2000047245 A JP 2000047245A JP 3812269 B2 JP3812269 B2 JP 3812269B2
Authority
JP
Japan
Prior art keywords
image
encoded
picture
quantization scale
code amount
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2000047245A
Other languages
Japanese (ja)
Other versions
JP2001238217A (en
Inventor
一彦 森田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Victor Company of Japan Ltd
Original Assignee
Victor Company of Japan Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Victor Company of Japan Ltd filed Critical Victor Company of Japan Ltd
Priority to JP2000047245A priority Critical patent/JP3812269B2/en
Publication of JP2001238217A publication Critical patent/JP2001238217A/en
Application granted granted Critical
Publication of JP3812269B2 publication Critical patent/JP3812269B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、動画像の高能率符号化に係り、特に、符号化画像の発生符号量と平均量子化スケールから、マクロブロック単位に量子化スケールの値を変更することによって符号量制御を行う、符号量制御装置及びその方法に関する。
【0002】
【従来の技術】
TV信号などの動画像を高能率に符号化する技術の国際標準として既にMPEG2が規定されている。
MPEG2は、動画像を構成する「フレーム」画像を「マクロブロック」と呼ばれる16×16画素のブロックに分割し、各マクロブロック単位に、時間的に前または後に所定の数フレーム離れた参照画像と符号化画像の間で「動きベクトル」と呼ばれる動き量を求め、この動き量を基に参照画像から符号化画像を構成する「動き補償予測」技術と、動き補償予測の誤差信号または符号化画像そのものに対して、直交変換の一種であるDCT(離散コサイン変換)を用いて情報量を圧縮する「変換符号化」技術の2つの画像符号化の要素技術をベースに規定されている。
【0003】
従来の一般的なMPEG2の動画像符号化装置の一構成例を図6に示す。
また、符号化ピクチャ構造の一例を図5に示す。
図5に示される符号化ピクチャ構造のように、動き補償予測は、Iピクチャ(フレーム内符号化)、Pピクチャ(順方向予測符号化)、Bピクチャ(双方向予測符号化)と呼ばれる、予測方法の異なる3種類のピクチャの組合せによって構成される。
【0004】
図6に示されるように、変換符号化では、Iピクチャでは符号化画像そのものに対し、P、Bピクチャでは動き補償器79による動き補償予測の誤差信号である減算器71の出力に対して、DCTがDCT器72で施される。
【0005】
このDCT器72で得られたDCT係数に対して量子化が、符号量制御部90の出力により制御して量子化器73によってなされる。
量子化器73の出力は、動きベクトル等のその他の付帯情報と共に可変長符号化が可変長符号化器75でなされ、符号列が「ビットストリーム」としてバッファ76に記憶された後に出力される。この際、バッファ76の充足度に応じて符号量制御部90で量子化スケールが制御される。
【0006】
一方、量子化器73の出力係数は、逆量子化器77、IDCT器78に供給されて、局部復号されてブロック毎に、加算器80を介してフレームメモリ81に貯えられる。
【0007】
MPEG2は可変長符号化であるため、単位時間当りの発生符号量(ビットレート)は一定ではない。
そこで量子化器73での量子化の際の量子化スケールをマクロブロック単位に適宜変更することにより、所要のビットレートに制御することが可能になっている。
MPEG2Test Model5では、GOP単位で発生符号量を一定にする固定ビットレート制御方法が提案されている。この固定ビットレート制御方法は、一定の転送レートが要求される用途に適した方法である。
【0008】
Test Model 5における、図6の符号量制御部90の動作に相当する、固定ビットレート制御方法の概略は次の通りである。
目標ビットレートをBitRate、1秒当りのフレーム数をPictureRate、1つの符号化単位である1GOP(通常はIピクチャの間隔)のフレーム数をNとすると、1GOPに割当てられる符号量Rは次式(1)で与えられる。
R = (BitRate/PictureRate)・N (1)
【0009】
(1)式の符号量RをGOP内の各画像に配分することになるが、ここで各ピクチャタイプの符号化直後の画像について、1フレームの発生符号量と平均量子化スケールの積をComplexity(画面複雑度) Xi(Iピクチャ)、Xp(Pピクチャ)、Xb(Bピクチャ)として求め、これから符号化する画像を含むGOP内の画像が一様に前記Complexityに等しいと仮定して、これから符号化する画像の目標割当符号量を決定する。
【0010】
現在のGOPで符号化の終了していないP、Bピクチャのフレーム数をNp、Nb、Iピクチャに対するP、Bピクチャの量子化スケールの設定比率をKp、Kbとする。
この時、I、P、B各ピクチャタイプの目標割当符号量Ti, Tp, Tbは次式(2)(3)(4)で与えられる。なおMAX[A, B]はAとBのいずれか大きい方を選択する動作を示す。
【0011】

Figure 0003812269
【0012】
なお、符号量Rの値は1フレーム符号化が終了する毎に、そのフレームの発生符号量を減算し、GOPの先頭(Iピクチャ)において、(1)式の値を加算する。
【0013】
つぎに、上式(2)(3)(4)で決定した目標割当符号量と、バッファ76で検出される各マクロブロックの発生符号量をもとに、各マクロブロックの量子化スケールを決定する。
各ピクチャタイプについて、j番目(0<j<(マクロブロック数))のマクロブロックを符号化する際に、その時の仮想バッファの充足度dj-k (k=i,p,b)を以下の式(5)によって計算する。
【0014】
dj-k=d0-k+Bj-1−Tk・(j−1)/(MB数)
但し k=i,p,b
d0-k:現在の画像におけるdj-kの初期値
Bj-1:現在の画像の(j-)番目までの発生符号量の総和
Tk:(2)〜(4)式で求めた現在の画像の目標割当符号量
(MB数):その画像のマクロブロックの総数 (5)
【0015】
MPEG2Test Model5では、(5)式において、各ピクチャタイプで最初に符号化する画像を除いてはd0-kの値を、同じピクチャタイプの直前に符号化した画像の最後のマクロブロックの符号化結果におけるdj-kの値で定めている。
つぎに符号化するj番目のマクロブロックの量子化スケールQjは次式(6)によって決定する。
【0016】
Qj = dj・31/(2・BitRate/PictureRate) (6)
(5)(6)式より、各マクロブロックの発生符号量が、マクロブロック当りの目標割当符号量より多い場合は、量子化スケールを大きくし、逆に発生符号量がマクロブロック当りの目標割当符号量より少ない場合は、量子化スケールが小さくなるように制御される。
【0017】
なお、上記したMPEG2Test Model5のような固定ビットレート制御方法の他に、入力画像の内容(複雑度)に応じて、一定区間におけるビットレートを所定の範囲内で変化させる可変ビットレート制御方法も存在する。
【0018】
【発明が解決しようとする課題】
上記の従来例ではこれから符号化する現在の画像における仮想バッファの初期値であるd0-kの値を、同じピクチャタイプの直前に符号化した画像の最後のマクロブロックの符号化結果より定めていた。
しかしながら、入力動画像にシーンチェンジのような大きな変化が生じた場合、現在の画像の量子化スケールは直前に符号化した画像に比べて大きく変化することが予想されるにもかかわらず、仮想バッファの初期値d0-kは直前に符号化した画像を基準としているため、画像の先頭部分では不適切な量子化スケールの決定が行われる可能性が高い。
【0019】
そのような画像でも符号化の進展に伴い、(5)(6)式の制御によって次第に目標割当符号量に近付くよう量子化スケールの値が変化していくが、量子化スケールが安定化するまで符号量が不足したり、逆に符号量が過剰になり無駄に符号量を与えてしまうという問題があった。
【0020】
本発明は以上の問題を解決して、入力動画像にシーンチェンジのような大きな変化が発生した場合でも、画像の先頭部分から、より適切な符号量割当を行うことが出来る符号量制御方法を実現することを目的とする。
【0021】
【課題を解決するための手段】
本発明は、上記課題を解決するために、以下1)〜10)に記載の手段よりなる。
すなわち、
1)入力動画像を動き補償予測手段、直交変換手段、量子化手段、及び可変長符号化手段を有して符号化する動画像符号化装置において、
前記入力動画像の各画像の発生符号量を検出する手段と、
前記入力動画像の各画像の平均量子化スケールを検出する手段と、
前記入力動画像及び前記動き補償予測手段によって生成される動き補償予測画像のうち、少なくとも前記入力動画像の輝度値の分散、または、画素間差分値によりアクティビティを検出して前記入力動画像の符号化画像特性を得るための手段と、
前記符号化画像特性を得るための手段によって得た次に符号化する画像の符号化画像特性を前記次に符号化する画像の直前のIまたはPピクチャの符号化画像特性とBピクチャの符号化画像特性との平均値を基準符号化画像特性とし、この基準符号化画像特性で除算した値に、前記可変長符号化手段で予め定められた量子化スケールを乗算することにより前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定する手段と、
前記決定した次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値から、前記次に符号化する画像の各マクロブロックにおける量子化スケールを決定する手段と
を備えたことを特徴とする動画像符号化装置。
2)1)に記載された動画像符号化装置において、
前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定する手段は、
前記平均量子化スケールを検出する手段によって検出されたピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別に直前の画像における平均量子化スケールから、目標ビットレートが大きくなるに応じて量子化スケールが小さくなる関数によって基準量子化スケールを算出し、
前記符号化画像特性を得るための手段によって得られたピクチャタイプ別に直前の画像における符号化画像特性から、前記各ピクチャタイプの符号化画像特性を加算平均する関数によって基準符号化画像特性を算出し、
前記算出した基準量子化スケールと前記算出した基準符号化画像特性に対する前記現在の画像における符号化画像特性の比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数によって次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を算出し、
前記発生符号量を検出する手段によって検出された発生符号量と、目標ビットレートによる割当符号量と、の差に基づいて前記算出した量子化スケールの初期値と、過去の画像の符号化結果から得られる量子化スケールと、のいずれかを選択するようにしたことを特徴とする動画像符号化装置。
3)1)、2)のいずれかに記載された動画像符号化装置において、
前記次に符号化する画像の割当符号量を決定する手段は、
前記発生符号量を検出する手段によって検出された発生符号量、前記平均量子化スケールを検出する手段によって検出された平均量子化スケールから、過去の画像の実測画面複雑度を算出する手段と、
前記符号化画像特性を得るための手段によって得られた現在の画像の符号化画像特性と、それと同じピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)の直前の画像において検出された符号化画像特性との比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数を、前記直前の画像における前記過去の画像の実測画面複雑度に乗算することによって現在の画像の推定画面複雑度を算出する手段と、
前記実測画面複雑度を算出する手段によって算出された過去の画像の実測画面複雑度、もしくは前記現在の画像の推定画面複雑度を算出する手段によって算出された現在の画像の推定画面複雑度と、前記発生符号量を検出する手段によって検出された発生符号量、前記平均量子化スケールを検出する手段によって検出された平均量子化スケール、前記符号化画像特性を得るための手段によって得られた符号化画像特性から、次に符号化する画像の割当符号量を決定する手段と、
を備えたことを特徴とする動画像符号化装置。
4)3)に記載された動画像符号化装置において、
前記発生符号量と前記実測画面複雑度、もしくは前記推定画面複雑度から次に符号化する画像の割当符号量を決定する手段は、
前記実測画面複雑度の一定期間における平均値に対する前記推定画面複雑度の割合を、平均割当符号量に乗ずることによって前記割当符号量を決定することを特徴とする動画像符号化装置。
5)1)乃至4)のいずれかに記載された動画像符号化装置において、
前記入力動画像または動き補償予測画像の符号化画像特性を得るための手段は、前記入力動画像の画像特性を検出する手段、動き補償予測画像の誤差画像の画像特性を検出する手段、及び動き補償予測における動きベクトル特性を検出する手段より構成され、
ピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別及び予測モード別の定数を、前記検出した入力動画像の画像特性、動き補償予測画像の誤差画像の画像特性、及び動き補償予測における動きベクトル特性の前記各特性値に対して乗じた上で加算することによって、前記符号化画像特性を得ることを特徴とする動画像符号化装置。
6)入力動画像を動き補償予測ステップ、直交変換ステップ、量子化ステップ、及び可変長符号化ステップを有して符号化する動画像符号化方法において、
前記入力動画像の各画像の発生符号量を検出するステップと、
前記入力動画像の各画像の平均量子化スケールを検出するステップと、
前記入力動画像及び前記動き補償予測ステップによって生成される動き補償予測画像のうち、少なくとも前記入力動画像の輝度値の分散、または、画素間差分値によりアクティビティを検出して前記入力動画像の符号化画像特性を得るためのステップと、
前記発生符号量を得るためのステップによって得た次に符号化する画像の符号化画像特性を前記次に符号化する画像の直前のIまたはPピクチャの符号化画像特性とBピクチャの符号化画像特性との平均値を基準符号化画像特性とし、この基準符号化画像特性で除算した値に、前記可変長符号化ステップで予め定められた量子化スケールを乗算することにより前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定するステップと、
前記決定した次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値から、前記次に符号化する画像の各マクロブロックにおける量子化スケールを決定するステップと、
を備えたことを特徴とする動画像符号化方法。
7)6)に記載された動画像符号化方法において、
前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定するステップは、
前記平均量子化スケールを検出するステップによって検出されたピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別に直前の画像における平均量子化スケールから、目標ビットレートが大きくなるに応じて量子化スケールが小さくなる関数によって基準量子化スケールを算出し、
前記符号化画像特性を得るためのステップによって得られたピクチャタイプ別に直前の画像における符号化画像特性から、前記各ピクチャタイプの符号化画像特性を加算平均する関数によって基準符号化画像特性を算出し、
前記算出した基準量子化スケールと前記算出した基準符号化画像特性に対する前記現在の画像における符号化画像特性の比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数によって次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を算出し、
前記発生符号量を検出するステップによって検出された発生符号量と、目標ビットレートによる割当符号量と、の差に基づいて前記算出した量子化スケールの初期値と、過去の画像の符号化結果から得られる量子化スケールと、のいずれかを選択するようにしたことを特徴とする動画像符号化方法。
8)6)、7)のいずれかに記載された動画像符号化方法において、
前記次に符号化する画像の割当符号量を決定するステップは、
前記発生符号量を検出するステップによって検出された発生符号量、前記平均量子化スケールを検出するステップによって検出された平均量子化スケールから、過去の画像の実測画面複雑度を算出するステップと、
前記符号化画像特性を得るためのステップによって得られた現在の画像の符号化画像特性と、それと同じピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)の直前の画像において検出された符号化画像特性との比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数を、前記直前の画像における前記過去の画像の実測画面複雑度に乗算することによって現在の画像の推定画面複雑度を算出するステップと、
前記実測画面複雑度を算出するステップによって算出された過去の画像の実測画面複雑度、もしくは前記現在の画像の推定画面複雑度を算出するステップによって算出された現在の画像の推定画面複雑度と、前記発生符号量を検出するステップによって検出された発生符号量、前記平均量子化スケールを検出するステップによって検出された平均量子化スケール、前記符号化画像特性を得るためのステップによって得られた符号化画像特性から、次に符号化する画像の割当符号量を決定するステップと、
を備えたことを特徴とする動画像符号化方法。
9)8)に記載された動画像符号化方法において、
前記発生符号量と前記実測画面複雑度、もしくは前記推定画面複雑度から次に符号化する画像の割当符号量を決定するステップは、
前記実測画面複雑度の一定期間における平均値に対する前記推定画面複雑度の割合を、平均割当符号量に乗ずることによって前記割当符号量を決定することを特徴とする動画像符号化方法。
10)6)乃至9)のいずれかに記載された動画像符号化方法において、
前記入力動画像または動き補償予測画像の符号化画像特性を得るためのステップは、前記入力動画像の画像特性を検出するステップ、動き補償予測画像の誤差画像の画像特性を検出するステップ、及び動き補償予測における動きベクトル特性を検出するステップより構成され、
ピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別及び予測モード別の定数を、前記検出した入力動画像の画像特性、動き補償予測画像の誤差画像の画像特性、及び動き補償予測における動きベクトル特性の前記各特性値に対して乗じた上で加算することによって、前記符号化画像特性を得ることを特徴とする動画像符号化方法。
【0022】
よって、本発明では、MPEG2等の動き補償予測、直交変換、量子化、可変長符号化の各手段を備え、各画像の発生符号量と平均量子化スケールから符号量制御を行う動画像符号化装置において、各画像の符号化画像特性(アクティビティ)を検出し、直前のIまたはPピクチャと、Bピクチャの符号化画像特性(アクティビティ)の平均値を取り、これを直前の画像の基準アクティビティとする。
同様に直前のIまたはPピクチャと、Bピクチャの平均量子化スケールの平均値を取り、これを直前の画像の基準量子化スケールとする。
これから符号化する現在の画像の、先頭のマクロブロックにおける量子化スケールを定める仮想バッファの初期値d0-kの値を、直前の画像の基準量子化スケールと、直前の画像の基準アクティビティに対する現在の画像のアクティビティの比を因数とする所定の関数によって決定することにより、入力動画像にシーンチェンジのような大きな変化が生じた場合でも、画像の先頭部分からアクティビティの変化に見合った量子化スケールを定めることが可能になる。
【0023】
【発明の実施の形態】
(第1の実施例)
本発明の動画像符号化装置の第1の実施例について、図1と共に以下に説明する。
図1に示されている本発明の動画像符号化装置の第1の実施例は、減算器11、
DCT器12、量子化器13、符号量制御器14、可変長符号化器15、バッファ16、逆量子化器17、IDCT器18、動き補償予測器19、加算器20、フレームメモリ21、平均量子化スケール検出器22、発生符号量検出器23、画面複雑度算出器24、画像特性検出器25、及びd0算出器30より構成されている。
【0024】
第1の実施例は本発明を固定ビットレート符号化に適用した場合である。
原動画像は図示されていない画像ブロック分割器によって、予めマクロブロック単位に分割されているものとする。
分割された原動画像は、Iピクチャについては動き補償予測が行われず、原動画像ブロックそのものが減算器11を介してDCT器12に送られ、DCTされた後に量子化器13で符号量制御器14から送られる量子化スケールによって量子化される。
【0025】
その量子化された信号は、可変長符号化器15で符号に変換されて、次のバッファ16で調整された後に符号が出力される。
一方、量子化器13の出力係数は逆量子化器17、IDCT器18で局部復号されて、動き補償予測器19の出力が加算器20で加算されることなく、ブロック毎にフレームメモリ21に貯えられる。
【0026】
P及びBピクチャについては、分割された原動画像とフレームメモリ21に貯えられた所定の局部復号画像ブロックが動き補償予測器19に供給され、ここで動きベクトル検出及び動き補償が行われて、予測画像ブロックが減算器11で原画像ブロックとの間で画素間差分が取られ、差分値である誤差画像ブロックがDCT器12に送られる。
【0027】
この後はIピクチャと同様にして、DCT器12で差分値がDCTされ、量子化器13で符号量制御器14から送られる量子化スケールによって量子化された後に、可変長符号化器15で符号に変換されて、次のバッファ16で調整された後に符号が出力される。
【0028】
一方、量子化器13の出力係数は、逆量子化器17とIDCT器18とで局部復号された後に前記予測画像ブロックが加算器20によって画素毎に加算され、ブロック毎にフレームメモリ21に貯えられる。
また、各ピクチャについて、量子化器13からマクロブロック毎の量子化スケールが平均量子化スケール検出器22に送られ、そこで1フレーム分の量子化スケールが加算され、1フレームの平均量子化スケールが算出される。
【0029】
一方、バッファ16において発生符号量が監視され、その値が発生符号量検出器23に送られる。
この発生符号量検出器23において、発生符号量がフレーム単位に加算され、1フレームの発生符号量が検出される。
フレーム毎について検出された前記平均量子化スケール、及び前記発生符号量は各々画面複雑度算出器24及び仮想バッファ初期値d0算出器(以下、d0算出器と記す)30にフレーム毎に送られる。
【0030】
画面複雑度算出器24では、供給された各フレームの平均量子化スケールと発生符号量が乗じられた後に所定の操作を施して、MPEG2Test Model5におけるComplexityに相当する各フレームの画面複雑度Xi, Xp, Xbが求められる。
【0031】
各フレームの画面複雑度Xi, Xp, Xbは符号量制御器14に送られ、ここでこれから符号化する画像の目標割当符号量Ti, Tp, Tbが決定される。
例えばMPEG2Test Model5による制御の場合、画面複雑度Xi, Xp, Xbの値を前記(2)〜(4)式に代入することにより、これから符号化する画像の目標割当符号量Ti, Tp, Tbを決定する。
【0032】
一方、画像特性検出器25では、入力時に原画像を分割した原動画像が供給され、原動画像の各フレームについてマクロブロック単位に画像特性を示すパラメータであるアクティビティが検出され、フレーム単位に加算されて、その結果が1フレーム毎に仮想バッファ初期値d0算出器30に送られる。
【0033】
ここで、画像特性検出器25で画像特性を検出する動作は、実際の符号化動作に先行して検出している。
画像特性を示すパラメータとしては輝度値の分散、画素間差分値などが考えられるが、画像特性を示すものであれば、その他のパラメータでも当然よい。
仮想バッファ初期値d0を算出するd0算出器30では、1フレームの符号化が終了する毎に平均量子化スケール検出器22から平均量子化スケールが供給され、IまたはPピクチャと、Bピクチャとで別々に、符号化の終了した(画像入力順で)直前の画像における値が格納されている。
【0034】
また同時に、発生符号量検出器23から発生符号量が供給され、目標ビットレートによる割当符号量との差が検出される。
また、画像特性検出器25から符号化に先立って現在の画像の符号化画像特性が供給されるが、同時に平均量子化スケールが格納されている画像と同一の画像 (IまたはPピクチャと、Bピクチャ別)における符号化画像特性も格納されている。
【0035】
d0算出器30では、これから符号化する現在の画像の先頭のマクロブロックにおける仮想バッファ初期値d0の値を、図2に示した処理の流れによって算出する。
図2に示される処理では、まず直前のIまたはPピクチャと、Bピクチャの平均量子化スケール、符号化画像特性(図2のS1)(S2)の平均値が取られ(S4)(S5)、各々基準量子化スケール(S6)、基準アクティビティ(S7)とする。
【0036】
つぎに、これから符号化する現在の画像の、先頭のマクロブロックにおける量子化スケールを定める仮想バッファの初期値d0-k(k=i,p,b)の値を、直前の画像の基準量子化スケール(ppMq)(S6)と、直前の画像の基準アクティビティに対する現在の画像のアクティビティの比(ActRatio)(S8)(S9)を因数とする所定の関数(S10)によって決定する(S11)。
所定の関数とは、一実施例としては次の(7)式が考えられる。
【0037】
Figure 0003812269
【0038】
なお、検出された発生符号量と目標ビットレートによる割当符号量との差が所定範囲を超える(割当符号量が不足する方向)場合、(7)式によってd0-kを小さく(量子化スケールを小さく)なるように制御すると符号量の不足が顕著になってその後の符号量制御に支障を生じる。
そこで、このような場合には(7)式によるd0-kの決定を行わずに、上記の式(5)の個所で説明したように、同じピクチャタイプの直前の画像の符号化結果による、先頭ブロックの仮想バッファ初期値d0の値を(図2のSWを切り替えて)(S13)代りに用いて仮想バッファ初期値d0の決定を行なう(S14)。
【0039】
また、符号化開始時点においては、予め幾つかの画像で符号化を行って、基準量子化スケール(目標ビットレートにより変化)、基準アクティビティの値を統計的に求めておき、最初に符号化する画像(Iピクチャ)のアクティビティを画像特性検出器25から得た上で、最初のIピクチャのアクティビティと統計的に求めた基準量子化スケール(与えた目標ビットレートの時の)、基準アクティビティを上記の(7)式に代入して、d0-iの初期値を求めればよい。
【0040】
その次の最初のBピクチャの場合は、符号化したIピクチャの平均量子化スケール、アクティビティを基準量子化スケール、基準アクティビティとするか、統計的に求めた平均的なBピクチャの平均量子化スケール、平均アクティビティと、符号化したIピクチャの平均量子化スケール、アクティビティを平均して基準量子化スケール、基準アクティビティとして、d0-bの初期値を求めればよい。
【0041】
このようにして各画像の先頭において、d0-kの値を決定した上で、例えばMPEG2Test Model5による制御の場合、前記(5)(6)式から各マクロブロックの量子化スケールを決定する。
これにより、シーンチェンジ等の画像の大きな変化が発生しても、各画像の先頭付近のマクロブロックから、より適切な量子化スケールによって符号化することが出来る。
【0042】
なお、画像特性検出器25からは符号量制御器14へも各マクロブロックのアクティビティが送られ、MPEG2Test Model5におけるアクティビティに基づいて各マクロブロックの量子化スケールを変更する適応量子化制御に使用されるが、この適応量子化制御は行わなくてもよい。
【0043】
符号量制御器14から出力される各マクロブロックの量子化スケールが量子化器13に送られ、現在の画像(DCT後の分割された原動画像または動き補償予測の誤差画像ブロック)がこの量子化スケールで量子化器13で量子化され、可変長符号化器15で可変長符号化されて、次のバッファ16で調整された後に符号が出力される。
【0044】
量子化器13のマクロブロック毎の量子化スケール、バッファ16で監視される発生符号量がそれぞれ、平均量子化スケール検出器22、発生符号量検出器23に送られ、次のピクチャの符号量制御に使用される。
【0045】
なお、本実施例ではMPEG2Test Model 5に本発明を適用した例であるが、本発明はそれに限らず、各画像の先頭のマクロブロックの量子化スケールを(同じピクチャタイプまたは1つ前の)直前の画像の符号化結果から決定する形態をとる、符号量制御全般に適用可能である。
(7)式を、直接先頭のマクロブロックの量子化スケールQ0を決定するように変更すると、次の(8)式のようになる。
【0046】
先頭マクロブロックの量子化スケール Q0=g(ppMq)・f(ActRatio)
但しppMq:基準量子化スケール
ActRatio=(現在の画像のアクティビティ)/(基準アクティビティ)
f(ActRatio):ActRatioを非線型変換する関数
g(ppMq):ppMqを因数とする所定の関数
(例:g(ppMq)=ppMq)
ppMq, ActRatio, f(ActRatio) は(7)式と同様 (8)
【0047】
(第2の実施例)
つぎに、本発明の動画像符号化装置の第2の実施例について、図3と共に以下に説明する。
第2の実施例は本発明を1パス方式の可変ビットレート符号化に適用した場合であり、第1の実施例と比較して、平均画面複雑度算出器29が追加され、画面複雑度算出器24、符号量制御器14と、図4に示す画像特性検出器25の構成とその動作及び、情報の内容のみが異なり、また図3は画像特性検出器25に対して動き補償予測器19より動き補償信号が供給されている点が図1と異なっており、それ以外の同じ部分についての説明は省略する。
【0048】
図4に示す画像特性検出器25は、ACTcur検出器25J、ACTpred検出器25K、ACTmv検出器25L、及びピクチャアクティビティ算出器25Mより構成されており、図1の第1の実施例における画像特性検出器25は、図4のACTcur検出器25Jに相当するものである。
【0049】
図3、図4の実施例において、画像特性検出器25への入力は、Iピクチャの場合は動き補償予測が行われないため、第1の実施例と同じくマクロブロック単位に分割された原動画像のみが入力され、マクロブロック単位に画像特性を示すパラメータであるアクティビティ(ACTcur)が検出され、フレーム単位に加算され、IピクチャのアクティビティACTiとして画面複雑度算出器24及びd0算出器30に送出されている。
【0050】
一方、図4に示す画像特性検出器25への入力は、P及びBピクチャの場合は分割された原動画像の他に、マクロブロック単位の動き補償予測における誤差画像または動きベクトル検出における符号化画像と参照画像との差分画像と、動き補償予測で使用した動きベクトルが図3に示す動き補償予測器19から入力される。
分割された原動画像からはIピクチャの場合と同様にマクロブロック単位に(原画像)アクティビティACTcurが検出される。
【0051】
一方、マクロブロック単位の動き補償予測における誤差画像または動きベクトル検出における符号化画像と参照画像との差分画像は、その中で絶対値和または2乗誤差和がとられ、予測アクティビティACTpredとして検出される。
【0052】
さらに、動き補償予測で使用した動きベクトルの方は、隣接マクロブロックとの間で各成分毎に差分の絶対値がとられるなどして、動きベクトルアクティビティACTmvとして検出される。
そして、各マクロブロック毎に次式(9)の演算により、マクロブロックアクティビティACTmbが算出され、それが1フレーム分加算されて、P及びBピクチャのアクティビティACTp及びACTbとして画面複雑度算出器24及びd0算出器30に送出されている。
【0053】
マクロブロックアクティビティ
ACTmb = a・ACTcur + b・ACTpred + c・ACTmv (9)
なお、各定数a、b、cの値はピクチャ別、マクロブロックの予測モード別(イントラか片方向予測か双方向予測か)などで変化させる。
例えばイントラの場合はIピクチャと同様に予測を行わないので、b=c=0となり、予測を行うブロックに比べて発生符号量が多くなると考えられるので、aの値を大きくする。
【0054】
画面複雑度算出器24には第1の実施例と同様に、フレーム毎に平均量子化スケールと発生符号量が送られると共に、画像特性検出器25から各フレームの画像特性、すなわちアクティビティが供給される。
画面複雑度算出器24では、供給された各フレームの平均量子化スケールと発生符号量が乗じられた後に乗算結果に所定の変換が施されて、それを基準として各フレームの実測画面複雑度が求められる。
【0055】
実測画面複雑度は平均画面複雑度算出器29に送られ、ここで符号化ピクチャタイプ別に一定期間内の値が加算された後に、その期間内の同じピクチャタイプのフレーム数で除算されて、I、P、B各ピクチャタイプの平均画面複雑度 Xi-ave(Iピクチャ)、Xp-ave(Pピクチャ)、Xb-ave(Bピクチャ) が算出される。
【0056】
ここで言う一定期間内は、符号化の終了したばかりの画像から時間的に前に予め定めるフレーム数、例えば15フレームとか、300フレームといった一定のフレーム数の場合もあり、符号化開始フレームから符号化の終了したばかりの画像までのように、順次フレーム数が増加する場合もある。
なお前者の一定フレーム数の場合でも、符号化したフレーム数が定めた一定期間を満たさない場合は後者と同様に順次フレーム数が増加していくことになる。
【0057】
つぎに画面複雑度算出器24では、求めた実測画面複雑度と平均画面複雑度算出器で求めた平均画面複雑度、及びアクティビティから画面複雑度の推定を行う。
これから符号化する現在の画像の画面複雑度 Xi, Xp, Xb は、現在の画像のアクティビティACTi, ACTp, ACTb、直前に符号化した同じピクチャタイプの画像の画面複雑度 Xi-p, Xp-p, Xb-p、直前に符号化した同じピクチャタイプの画像のアクティビティACTi-p, ACTp-p, ACTb-pより、つぎの(10)(11)(12)式で推定出来る。
【0058】
(Iピクチャ)
Xi=Xi-p・(ACTi / ACTi-p) (10)
(Pピクチャ)
Xp=Xp-p・(ACTp / ACTp-p) (11)
(Bピクチャ)
Xb=Xb-p・(ACTb / ACTb-p) (12)
【0059】
なお、初期状態において、同じピクチャタイプの符号化の終了したフレームが存在しない場合は予めいくつかの画像で各ピクチャタイプの画像の画面複雑度とアクティビティを求めておき、それを平均的な動画像の発生頻度に合わせて統計的に平均してそれを初期値とすればよい。
【0060】
これから符号化する現在の画像の推定画面複雑度 Xi, Xp, Xbと、各ピクチャタイプの平均画面複雑度 Xi-ave, Xp-ave, Xb-aveは符号量制御器14に送られる。
符号量制御器14では、次に(これから)符号化する画像の割当符号量の設定(決定)、及び可変ビットレート制御のための量子化スケールの設定(決定)が行われる。
【0061】
目標平均ビットレートをBitRate、1秒当りのフレーム数をPictureRate、1つの符号化単位である1GOP(通常はIピクチャの間隔)のフレーム数をNとすると、1GOPの平均割当符号量Raveは次式(13)で与えられる。
Rave = (BitRate/PictureRate)・N (13)
【0062】
上式のRaveは平均画面複雑度の時の1GOPの必要割当符号量とすると、これから符号化する現在の画像を含む1GOPの画像が一様に前記画面複雑度算出器
24で求めた現在の画像の推定画面複雑度に等しいと仮定すると、画質を一定に保つ場合に必要な1GOPの必要割当符号量Rcは次式(14)(15) (16)で与えられる。
【0063】
(Iピクチャ)
Rc = Rave・( Xi / Xi-ave ) (14)
(Pピクチャ)
Rc = Rave・( Xp / Xp-ave ) (15)
(Bピクチャ)
Rc = Rave・( Xb / Xb-ave ) (16)
【0064】
これら上式の必要割当符号量Rcを1GOPの各ピクチャに適切に割り振ることにより、これから符号化する現在の画像の目標符号量を算出し、各マクロブロックの量子化スケールを決定する。
例えばMPEG2 Test Model 5の方法を用いると、上で求めた現在の画像の推定画面複雑度 Xi, Xp, Xbを(2)〜(4)式のXi, Xp, Xbに、割当符号量Rcを(2)〜(4)式のRに代入して、これから符号化する画像の目標割当符号量Ti, Tp, Tbを決定する。
【0065】
但し、第2の実施例においては、GOP毎に一定符号量にする必要がないので、Rcの値は(2)〜(4)式のRのように各フレームの発生符号量で減算したり、GOPの先頭で加算する必要はない。また(2)〜(4)式のNp, Nbは常に一定値(GOP先頭での値)となる。
【0066】
その後は第1の実施例と同様に、d0算出器において、これから符号化する現在の画像の先頭のマクロブロックにおけるd0-k(k=i,p,b)の値を、入力された各画像の平均量子化スケール、アクティビティから定められる基準量子化スケール、基準アクティビティと、現在の画像のアクティビティから、図2に示した処理の流れによって算出する。
【0067】
そして例えばMPEG2Test Model5による制御の場合、d0-kの値と目標割当符号量と、バッファで検出される各マクロブロックの発生符号量を前記(5)(6)式に代入して、各マクロブロックの量子化スケールを決定し、必要に応じて各マクロブロックのアクティビティによって量子化スケールを変更する適応量子化制御を行う。
このようにして、1パス方式の可変ビットレート制御においても、シーンチェンジ等の画像の大きな変化が生じても、各画像の先頭付近のマクロブロックから、より適切な量子化スケールによって符号化することが出来る。
【0068】
【発明の効果】
以上のように本発明によると、動画像を符号化する際に、マクロブロック単位に量子化スケールの値を変更することによって行われる符号量制御において、符号化の終了した一定区間の画像の発生符号量と平均量子化スケールと、一定区間及びこれから符号化する現在の画像の符号化画像特性(アクティビティ)を検出し、直前のIまたはPピクチャと、Bピクチャの平均量子化スケールの平均値と、それらの画像におけるアクティビティの平均値に対する現在の画像のアクティビティの比を因数とする所定の関数によって、現在の画像の先頭のマクロブロックにおける量子化スケールを定める仮想バッファの初期値d0-kの値を決定することにより、動画像にシーンチェンジのような大きな変化が生じた場合でも、画像の先頭部分からアクティビティの変化に見合った量子化スケールを定めることが可能になる。
【図面の簡単な説明】
【図1】本発明の動画像符号化装置及びその方法の第1の実施例のブロック構成を示した図である。
【図2】本発明の動画像符号化装置及びその方法の第1の実施例の仮想バッファ初期値d0算出器におけるd0算出処理の流れを示した図である。
【図3】本発明の動画像符号化装置及びその方法の第2の実施例のブロック構成を示した図である。
【図4】本発明の動画像符号化装置及びその方法の第2の実施例における画像特性検出器を示した図である。
【図5】符号化ピクチャ構造の一実施例を示した図である。
【図6】従来における一般的な動画像符号化装置の一構成例のブロック構成を示した図である。
【符号の説明】
11 減算器
12 DCT器(直交変換器)
13 量子化器
14 符号量制御器
15 可変長符号化器
16 バッファ
17 逆量子化器
18 IDCT器
19 動き補償予測器
20 加算器
21 フレームメモリ
22 平均量子化スケール検出器
23 発生符号量検出器
24 画面複雑度算出器
25 画像特性検出器
25A,25J ACTcur検出器
25B,25K ACTpred検出器
25C,25L ACTmv検出器
25G,25M ピクチャアクティビティ算出器
29 平均画面複雑度算出器
30 仮想バッファ初期値d0算出器(量子化スケールの初期値を決定する手段)
ActRatio (現在の画像のアクティビティ)/(基準アクティビティ)
ACTcur 原画像アクティビティ
ACTi, ACTp, ACTb 現在の画像のアクティビティ
ACTi-p, ACTp-p, ACTb-p 直前に符号化した同じピクチャタイプの画像のアクティビティ
ACTmb マクロブロックアクティビティ
ACTmv 動きベクトル特性
ACTpred 誤差画像アクティビティ
R 符号量
Rave 平均割当符号量
Rc 画像の割当符号量
Xi, Xp, Xb 現在の画像の画面複雑度
Xi-ave, Xp-ave, Xb-ave 平均画面複雑度
Xi-p, Xp-p, Xb-p 各フレームの実測画面複雑度
d0 先頭ブロックの仮想バッファ初期値
ppMq 基準量子化スケール
r 2・BitRate/PictureRate[0001]
BACKGROUND OF THE INVENTION
The present invention relates to high-efficiency encoding of moving images, and in particular, performs code amount control by changing the value of the quantization scale in units of macroblocks from the generated code amount and average quantization scale of the encoded image. The present invention relates to a code amount control apparatus and method.
[0002]
[Prior art]
MPEG2 has already been defined as an international standard for technology for efficiently encoding moving images such as TV signals.
MPEG2 divides a “frame” image constituting a moving image into blocks of 16 × 16 pixels called “macroblocks”, and a reference image separated by a predetermined number of frames before or after in time for each macroblock unit. “Motion compensated prediction” technology that obtains a motion amount called “motion vector” between encoded images and constructs an encoded image from a reference image based on this motion amount, and an error signal or encoded image of motion compensated prediction On the other hand, it is defined based on two image encoding elemental technologies of “transform encoding” that compresses the amount of information using DCT (Discrete Cosine Transform), which is a kind of orthogonal transform.
[0003]
An example of the configuration of a conventional general MPEG2 moving image encoding apparatus is shown in FIG.
An example of the coded picture structure is shown in FIG.
Like the coded picture structure shown in FIG. 5, motion compensated prediction is a prediction called I picture (intraframe coding), P picture (forward prediction coding), or B picture (bidirectional prediction coding). It consists of a combination of three types of pictures with different methods.
[0004]
As shown in FIG. 6, in transform coding, for an I picture, for an encoded image itself, for P and B pictures, for an output of a subtractor 71, which is an error signal of motion compensation prediction by a motion compensator 79, DCT is performed by the DCT device 72.
[0005]
The DCT coefficient obtained by the DCT unit 72 is quantized by the quantizer 73 under the control of the output of the code amount control unit 90.
The output of the quantizer 73 is subjected to variable length coding by the variable length encoder 75 together with other incidental information such as motion vectors, and the code string is stored in the buffer 76 as a “bit stream” and output. At this time, the quantization scale is controlled by the code amount control unit 90 in accordance with the sufficiency of the buffer 76.
[0006]
On the other hand, the output coefficient of the quantizer 73 is supplied to the inverse quantizer 77 and the IDCT device 78, and is locally decoded and stored in the frame memory 81 via the adder 80 for each block.
[0007]
Since MPEG2 is variable length coding, the generated code amount (bit rate) per unit time is not constant.
Therefore, it is possible to control to a required bit rate by appropriately changing the quantization scale at the time of quantization in the quantizer 73 in units of macroblocks.
MPEG2 Test Model 5 proposes a fixed bit rate control method in which the amount of generated code is constant in GOP units. This fixed bit rate control method is suitable for applications that require a constant transfer rate.
[0008]
The outline of the fixed bit rate control method corresponding to the operation of the code amount control unit 90 of FIG. 6 in Test Model 5 is as follows.
If the target bit rate is BitRate, the number of frames per second is PictureRate, and the number of frames of 1 GOP (usually the interval of I pictures) as one coding unit is N, the code amount R allocated to 1 GOP is given by Given in 1).
R = (BitRate / PictureRate) ・ N (1)
[0009]
The code amount R in equation (1) is allocated to each image in the GOP. Here, for an image immediately after encoding of each picture type, the product of the generated code amount of one frame and the average quantization scale is calculated as Complexity. (Screen complexity) Xi (I picture), Xp (P picture), and Xb (B picture) are obtained, and it is assumed that an image in a GOP including an image to be encoded is uniformly equal to the Complexity. A target allocation code amount of an image to be encoded is determined.
[0010]
The number of frames of P and B pictures that have not been encoded in the current GOP is Np, Nb, and the setting ratio of the quantization scale of P and B pictures for I pictures is Kp and Kb.
At this time, the target allocation code amounts Ti, Tp, and Tb for the I, P, and B picture types are given by the following equations (2), (3), and (4). Note that MAX [A, B] indicates the operation of selecting the larger of A and B.
[0011]
Figure 0003812269
[0012]
Note that the code amount R is subtracted from the generated code amount of each frame every time one frame encoding is completed, and the value of equation (1) is added at the head (I picture) of the GOP.
[0013]
Next, the quantization scale of each macroblock is determined based on the target allocation code amount determined by the above equations (2), (3), and (4) and the generated code amount of each macroblock detected by the buffer 76. To do.
For each picture type, when the jth (0 <j <(number of macroblocks)) macroblock is encoded, the fullness dj-k (k = i, p, b) of the virtual buffer at that time is expressed as follows: Calculated by equation (5).
[0014]
dj-k = d0-k + Bj-1-Tk. (j-1) / (number of MB)
Where k = i, p, b
d0-k: initial value of dj-k in the current image
Bj-1: Sum of generated code amount up to (j-) th of current image
Tk: Target allocation code amount of the current image obtained by equations (2) to (4)
(MB): Total number of macroblocks in the image (5)
[0015]
In MPEG2 Test Model 5, in equation (5), except for the first image to be encoded with each picture type, the value of d0-k is the encoding result of the last macroblock of the image encoded immediately before the same picture type. It is determined by the value of dj-k.
Next, the quantization scale Qj of the j-th macroblock to be encoded is determined by the following equation (6).
[0016]
Qj = dj · 31 / (2 · BitRate / PictureRate) (6)
(5) From equation (6), if the generated code amount of each macroblock is larger than the target assigned code amount per macroblock, the quantization scale is increased, and conversely, the generated code amount is the target assigned amount per macroblock. When the amount is smaller than the code amount, the quantization scale is controlled to be small.
[0017]
In addition to the fixed bit rate control method such as MPEG2 Test Model 5 described above, there is also a variable bit rate control method that changes the bit rate in a predetermined section within a predetermined range according to the content (complexity) of the input image. To do.
[0018]
[Problems to be solved by the invention]
In the above conventional example, the value of d0-k, which is the initial value of the virtual buffer in the current image to be encoded, is determined from the encoding result of the last macroblock of the image encoded immediately before the same picture type. .
However, if a large change such as a scene change occurs in the input moving image, the quantization scale of the current image is expected to change significantly compared to the image encoded immediately before, but the virtual buffer Since the initial value d0-k is based on the image coded immediately before, there is a high possibility that an inappropriate quantization scale is determined at the head portion of the image.
[0019]
Even with such images, as the coding progresses, the value of the quantization scale gradually changes to approach the target allocated code amount by the control of Equations (5) and (6), but until the quantization scale stabilizes. There has been a problem that the code amount is insufficient, or conversely, the code amount becomes excessive and the code amount is unnecessarily given.
[0020]
The present invention solves the above problems and provides a code amount control method capable of performing more appropriate code amount allocation from the head portion of an image even when a large change such as a scene change occurs in an input moving image. It aims to be realized.
[0021]
[Means for Solving the Problems]
In order to solve the above problems, the present invention comprises means described in 1) to 10) below.
That is,
1) In a moving image encoding apparatus that encodes an input moving image by including motion compensation prediction means, orthogonal transform means, quantization means, and variable length encoding means,
Means for detecting a generated code amount of each image of the input moving image;
Means for detecting an average quantization scale of each image of the input moving image;
A motion compensated prediction image generated by the input moving image and the motion compensation prediction means. Small At least the input video The activity is detected by the variance of luminance values or the difference value between pixels, and the input moving image Encode image characteristics To get Means,
The encoded image characteristics To get By means Of the next image to be encoded Encoded image characteristics A value obtained by dividing the average value of the encoded image characteristics of the I or P picture immediately before the image to be encoded next and the encoded image characteristics of the B picture as the reference encoded image characteristics, and dividing by the reference encoded image characteristics By multiplying a predetermined quantization scale by the variable length encoding means. Means for determining an initial value of a quantization scale in the first macroblock of an image to be encoded next;
Said decision Next Means for determining the quantization scale in each macroblock of the next image to be encoded from the initial value of the quantization scale in the first macroblock of the image to be encoded
A moving picture encoding apparatus comprising:
2) In the video encoding apparatus described in 1),
The means for determining the initial value of the quantization scale in the first macroblock of the next image to be encoded is:
For each picture type (I picture, P picture, B picture) detected by the means for detecting the average quantization scale, the quantization scale decreases as the target bit rate increases from the average quantization scale in the immediately preceding image. The reference quantization scale is calculated by the function
The encoded image characteristics To get By means Obtained From the encoded image characteristics in the immediately preceding image for each picture type, a reference encoded image characteristic is calculated by a function that averages the encoded image characteristics of each picture type,
A factor of the ratio of the encoded image characteristic in the current image to the calculated reference quantization scale and the calculated reference encoded image characteristic is a factor. The output is stepped according to the input range of The initial value of the quantization scale in the first macroblock of the image to be encoded next is calculated by a non-linear function as a value,
From the initial value of the quantization scale calculated based on the difference between the generated code amount detected by the means for detecting the generated code amount and the allocated code amount based on the target bit rate, and the past image encoding result One of the obtained quantization scales is selected, and a moving picture coding apparatus is characterized.
3) In the video encoding device described in any one of 1) and 2),
The means for determining the allocated code amount of the next image to be encoded is:
Means for calculating the actual screen complexity of past images from the generated code amount detected by the means for detecting the generated code amount, the average quantization scale detected by the means for detecting the average quantization scale;
The encoded image characteristics To get By means Obtained The factor is the ratio between the encoded image characteristic of the current image and the encoded image characteristic detected in the immediately preceding image of the same picture type (I picture, P picture, B picture). The output is stepped according to the input range of Means for calculating an estimated screen complexity of the current image by multiplying a nonlinear function as a value by an actual screen complexity of the past image in the immediately preceding image;
The measured screen complexity of the past image calculated by the means for calculating the measured screen complexity, or the estimated screen complexity of the current image calculated by the means for calculating the estimated screen complexity of the current image; The generated code amount detected by the means for detecting the generated code amount, the average quantization scale detected by the means for detecting the average quantization scale, and the encoded image characteristics To get By means Obtained Means for determining an assigned code amount of an image to be encoded next from encoded image characteristics;
A moving picture encoding apparatus comprising:
4) In the video encoding device described in 3),
Means for determining an assigned code amount of an image to be encoded next from the generated code amount and the measured screen complexity or the estimated screen complexity,
The moving picture coding apparatus, wherein the allocated code amount is determined by multiplying an average allocated code amount by a ratio of the estimated screen complexity to an average value of the measured screen complexity over a certain period.
5) In the video encoding device described in any one of 1) to 4),
The encoded image characteristics of the input moving image or motion compensated prediction image To get The means is configured by means for detecting an image characteristic of the input moving image, means for detecting an image characteristic of an error image of the motion compensated prediction image, and means for detecting a motion vector characteristic in the motion compensated prediction,
Constants for each picture type (I-picture, P-picture, B-picture) and prediction mode are set as the image characteristics of the detected input moving image, the image characteristics of the error image of the motion compensation prediction image, and the motion vector characteristics in motion compensation prediction. By multiplying each characteristic value of obtain A moving picture coding apparatus characterized by the above.
6) In a video encoding method for encoding an input video including a motion compensation prediction step, an orthogonal transformation step, a quantization step, and a variable length encoding step,
Detecting a generated code amount of each image of the input moving image;
Detecting an average quantization scale of each image of the input moving image;
A motion compensated prediction image generated by the input moving image and the motion compensated prediction step. Small At least the input video The activity is detected by the variance of luminance values or the difference value between pixels, and the input moving image Encode image characteristics To get Steps,
The generated code amount To get By step Of the next image to be encoded Encoded image characteristics A value obtained by dividing the average value of the encoded image characteristics of the I or P picture immediately before the image to be encoded next and the encoded image characteristics of the B picture as the reference encoded image characteristics, and dividing by the reference encoded image characteristics By multiplying by a predetermined quantization scale in the variable length encoding step. Determining an initial value of the quantization scale in the first macroblock of the next image to be encoded;
Said decision Next Determining the quantization scale in each macroblock of the next image to be encoded from the initial value of the quantization scale in the first macroblock of the image to be encoded
A moving picture encoding method comprising:
7) In the video encoding method described in 6),
Determining the initial value of the quantization scale in the first macroblock of the next encoded image;
For each picture type (I picture, P picture, B picture) detected by the step of detecting the average quantization scale, the quantization scale decreases as the target bit rate increases from the average quantization scale in the immediately preceding image. The reference quantization scale is calculated by the function
The encoded image characteristics To get By step Obtained From the encoded image characteristics in the immediately preceding image for each picture type, a reference encoded image characteristic is calculated by a function that averages the encoded image characteristics of each picture type,
A factor of the ratio of the encoded image characteristic in the current image to the calculated reference quantization scale and the calculated reference encoded image characteristic is a factor. The output is stepped according to the input range of The initial value of the quantization scale in the first macroblock of the image to be encoded next is calculated by a non-linear function as a value,
The initial value of the quantization scale calculated based on the difference between the generated code amount detected by the step of detecting the generated code amount and the allocated code amount based on the target bit rate, and the past image encoding result One of the obtained quantization scales is selected, and the moving picture coding method is characterized in that it is selected.
8) In the video encoding method described in any one of 6) and 7),
The step of determining the allocated code amount of the next image to be encoded includes:
A step of calculating a measured screen complexity of a past image from a generated code amount detected by the step of detecting the generated code amount, an average quantization scale detected by the step of detecting the average quantization scale;
The encoded image characteristics To get By step Obtained This factor is the ratio of the encoded image characteristic of the current image to the encoded image characteristic detected in the immediately preceding image of the same picture type (I picture, P picture, B picture). The output is stepped according to the input range of Calculating an estimated screen complexity of the current image by multiplying a non-linear function as a value by the measured screen complexity of the past image in the previous image;
An actual screen complexity of the past image calculated by the step of calculating the actual screen complexity, or an estimated screen complexity of the current image calculated by the step of calculating the estimated screen complexity of the current image; The generated code amount detected by the step of detecting the generated code amount, the average quantization scale detected by the step of detecting the average quantization scale, and the encoded image characteristic To get By step Obtained Determining an assigned code amount of an image to be encoded next from encoded image characteristics;
A moving picture encoding method comprising:
9) In the video encoding method described in 8),
Determining an assigned code amount of an image to be encoded next from the generated code amount and the measured screen complexity or the estimated screen complexity,
A moving picture encoding method, wherein the allocated code amount is determined by multiplying an average allocated code amount by a ratio of the estimated screen complexity to an average value of the measured screen complexity for a certain period.
10) In the video encoding method described in any one of 6) to 9),
The encoded image characteristics of the input moving image or motion compensated prediction image To get The step includes detecting an image characteristic of the input moving image, detecting an image characteristic of an error image of the motion compensated prediction image, and detecting a motion vector characteristic in the motion compensated prediction.
Constants for each picture type (I-picture, P-picture, B-picture) and prediction mode are set as the image characteristics of the detected input moving image, the image characteristics of the error image of the motion compensation prediction image, and the motion vector characteristics in motion compensation prediction. By multiplying each characteristic value of obtain A video encoding method characterized by the above.
[0022]
Therefore, in the present invention, moving picture coding that includes motion compensation prediction such as MPEG2, orthogonal transform, quantization, and variable length coding, and performs code amount control from the generated code amount and average quantization scale of each image. In the apparatus, the encoded image characteristic (activity) of each image is detected, an average value of the encoded image characteristics (activity) of the immediately preceding I or P picture and B picture is taken, and this is taken as the reference activity of the immediately preceding image. To do.
Similarly, the average value of the average quantization scale of the immediately preceding I or P picture and the B picture is taken, and this is used as the reference quantization scale of the immediately preceding image.
The initial value d0-k of the virtual buffer that defines the quantization scale in the first macroblock of the current image to be encoded is set to the reference quantization scale of the immediately preceding image and the current activity for the reference activity of the immediately preceding image. Even if a large change such as a scene change occurs in the input moving image, the quantization scale corresponding to the change in the activity is selected from the beginning of the image by determining it with a predetermined function whose factor is the ratio of the activity of the image. It becomes possible to determine.
[0023]
DETAILED DESCRIPTION OF THE INVENTION
(First embodiment)
A first embodiment of the moving picture coding apparatus of the present invention will be described below with reference to FIG.
The first embodiment of the moving picture coding apparatus of the present invention shown in FIG.
DCT unit 12, quantizer 13, code amount controller 14, variable length encoder 15, buffer 16, inverse quantizer 17, IDCT unit 18, motion compensation predictor 19, adder 20, frame memory 21, average It comprises a quantization scale detector 22, a generated code amount detector 23, a screen complexity calculator 24, an image characteristic detector 25, and a d0 calculator 30.
[0024]
The first embodiment is a case where the present invention is applied to constant bit rate coding.
It is assumed that the original moving image is divided into macroblock units in advance by an image block divider (not shown).
The divided original moving image is not subjected to motion compensated prediction for the I picture, and the original moving image block itself is sent to the DCT unit 12 via the subtractor 11, and after DCT, the quantizer 13 performs a code amount controller 14. Quantized by the quantization scale sent from.
[0025]
The quantized signal is converted into a code by the variable length encoder 15, adjusted by the next buffer 16, and then the code is output.
On the other hand, the output coefficient of the quantizer 13 is locally decoded by the inverse quantizer 17 and the IDCT unit 18, and the output of the motion compensation predictor 19 is not added by the adder 20, but is added to the frame memory 21 for each block. Stored.
[0026]
For P and B pictures, the divided original moving image and a predetermined locally decoded image block stored in the frame memory 21 are supplied to the motion compensation predictor 19, where motion vector detection and motion compensation are performed, and prediction is performed. An inter-pixel difference is taken between the image block and the original image block by the subtractor 11, and an error image block as a difference value is sent to the DCT unit 12.
[0027]
After that, similarly to the I picture, the difference value is DCTed by the DCT unit 12, quantized by the quantization scale by the quantization scale sent from the code amount controller 14, and then changed by the variable length encoder 15. After being converted into a code and adjusted in the next buffer 16, the code is output.
[0028]
On the other hand, the output coefficient of the quantizer 13 is locally decoded by the inverse quantizer 17 and the IDCT unit 18 and then the predicted image block is added for each pixel by the adder 20 and stored in the frame memory 21 for each block. It is done.
For each picture, the quantization scale for each macroblock is sent from the quantizer 13 to the average quantization scale detector 22, where the quantization scale for one frame is added, and the average quantization scale for one frame is obtained. Calculated.
[0029]
On the other hand, the generated code amount is monitored in the buffer 16 and the value is sent to the generated code amount detector 23.
In the generated code amount detector 23, the generated code amount is added in units of frames, and the generated code amount of one frame is detected.
The average quantization scale and the generated code amount detected for each frame are sent to the screen complexity calculator 24 and the virtual buffer initial value d0 calculator (hereinafter referred to as d0 calculator) 30 for each frame.
[0030]
The screen complexity calculator 24 performs a predetermined operation after multiplying the supplied average quantization scale and the amount of generated codes and performs screen complexity Xi, Xp of each frame corresponding to Complexity in MPEG2 Test Model 5 , Xb is required.
[0031]
The screen complexity Xi, Xp, Xb of each frame is sent to the code amount controller 14, where the target assigned code amounts Ti, Tp, Tb of the image to be encoded are determined.
For example, in the case of control by MPEG2 Test Model 5, by substituting the values of screen complexity Xi, Xp, and Xb into the expressions (2) to (4), the target assigned code amounts Ti, Tp, and Tb of the image to be encoded are decide.
[0032]
On the other hand, in the image characteristic detector 25, an original moving image obtained by dividing the original image at the time of input is supplied, and an activity, which is a parameter indicating image characteristics for each macroblock, is detected for each frame of the original moving image and added to each frame. The result is sent to the virtual buffer initial value d0 calculator 30 every frame.
[0033]
Here, the operation of detecting the image characteristic by the image characteristic detector 25 is detected prior to the actual encoding operation.
As the parameter indicating the image characteristics, dispersion of luminance values, inter-pixel difference values, and the like can be considered, but other parameters may be used as long as they indicate the image characteristics.
In the d0 calculator 30 for calculating the virtual buffer initial value d0, an average quantization scale is supplied from the average quantization scale detector 22 every time one frame is encoded, and an I or P picture and a B picture are used. Separately, values in the immediately preceding image for which encoding has been completed (in image input order) are stored.
[0034]
At the same time, the generated code amount is supplied from the generated code amount detector 23, and the difference from the allocated code amount according to the target bit rate is detected.
In addition, the encoded image characteristics of the current image are supplied from the image characteristic detector 25 prior to encoding, and at the same time, the same image (I or P picture, B) The encoded image characteristics for each picture) are also stored.
[0035]
The d0 calculator 30 calculates the value of the virtual buffer initial value d0 in the first macroblock of the current image to be encoded by the processing flow shown in FIG.
In the process shown in FIG. 2, first, the average value of the average quantization scale and the encoded image characteristics (S1 and S2 in FIG. 2) of the immediately preceding I or P picture and B picture is taken (S4) (S5). Reference quantization scale (S6) and reference activity (S7), respectively.
[0036]
Next, the initial value d0-k (k = i, p, b) of the virtual buffer that determines the quantization scale in the first macroblock of the current image to be encoded is used as the reference quantization of the immediately preceding image. The scale (ppMq) (S6) and a ratio (ActRatio) (S8) (S9) of the current image activity to the reference activity of the immediately preceding image are determined by a predetermined function (S10) as a factor (S11).
As an example of the predetermined function, the following equation (7) can be considered.
[0037]
Figure 0003812269
[0038]
When the difference between the detected generated code amount and the allocated code amount based on the target bit rate exceeds a predetermined range (in the direction where the allocated code amount is insufficient), d0-k is reduced (the quantization scale is reduced) according to Equation (7). If the control is performed so that the code amount is small, the shortage of the code amount becomes remarkable, and the subsequent code amount control is hindered.
Therefore, in such a case, without determining d0-k by the equation (7), as described in the above equation (5), according to the encoding result of the immediately preceding image of the same picture type, The virtual buffer initial value d0 is determined by using the value of the virtual buffer initial value d0 of the first block instead of (switching SW in FIG. 2) (S13) (S14).
[0039]
In addition, at the start of encoding, encoding is performed on several images in advance, and the reference quantization scale (which varies depending on the target bit rate) and the reference activity value are statistically calculated and encoded first. After obtaining the activity of the image (I picture) from the image characteristic detector 25, the activity of the first I picture, the reference quantization scale obtained statistically (at the given target bit rate), and the reference activity are described above. Substituting into the equation (7), the initial value of d0-i may be obtained.
[0040]
In the case of the next first B picture, the average quantization scale of the encoded I picture, the activity as the reference quantization scale, the reference activity, or the average quantization scale of the average B picture obtained statistically The average activity, the average quantization scale of the encoded I picture, and the activity may be averaged to obtain the initial value of d0-b as the reference quantization scale and the reference activity.
[0041]
In this way, after determining the value of d0-k at the head of each image, for example, in the case of control by MPEG2 Test Model 5, the quantization scale of each macroblock is determined from the equations (5) and (6).
As a result, even if a large change in the image such as a scene change occurs, encoding can be performed with a more appropriate quantization scale from a macroblock near the head of each image.
[0042]
It should be noted that the activity of each macroblock is also sent from the image characteristic detector 25 to the code amount controller 14 and used for adaptive quantization control for changing the quantization scale of each macroblock based on the activity in the MPEG2 Test Model 5. However, this adaptive quantization control may not be performed.
[0043]
The quantization scale of each macroblock output from the code amount controller 14 is sent to the quantizer 13, and the current image (the divided original image after DCT or the error-compensated image of motion compensation prediction) is quantized. The scale is quantized by the quantizer 13, variable-length encoded by the variable-length encoder 15, adjusted by the next buffer 16, and then the code is output.
[0044]
The quantization scale for each macroblock of the quantizer 13 and the generated code amount monitored by the buffer 16 are sent to the average quantization scale detector 22 and the generated code amount detector 23, respectively, to control the code amount of the next picture. Used for.
[0045]
In the present embodiment, the present invention is applied to MPEG2 Test Model 5. However, the present invention is not limited to this, and the quantization scale of the first macroblock of each image is set to the immediately preceding (same picture type or the previous one). The present invention can be applied to general code amount control that takes a form determined from the encoding result of the image.
When the equation (7) is changed so as to directly determine the quantization scale Q0 of the first macroblock, the following equation (8) is obtained.
[0046]
Quantization scale of the first macroblock Q0 = g (ppMq) · f (ActRatio)
PpMq: Reference quantization scale
ActRatio = (Current image activity) / (Standard activity)
f (ActRatio): Function that converts ActRatio to nonlinear
g (ppMq): Predetermined function with ppMq as a factor
(Example: g (ppMq) = ppMq)
ppMq, ActRatio, and f (ActRatio) are the same as in equation (7) (8)
[0047]
(Second embodiment)
Next, a second embodiment of the moving picture coding apparatus of the present invention will be described below with reference to FIG.
The second embodiment is a case where the present invention is applied to the variable bit rate encoding of the one-pass method. Compared with the first embodiment, an average screen complexity calculator 29 is added, and the screen complexity is calculated. 4 and the code amount controller 14 are different from the image characteristic detector 25 shown in FIG. 4 only in the configuration and operation thereof, and the contents of the information. FIG. 1 is different from FIG. 1 in that a motion compensation signal is supplied, and the description of the other parts other than that is omitted.
[0048]
The image characteristic detector 25 shown in FIG. 4 includes an ACTcur detector 25J, an ACTpred detector 25K, an ACTmv detector 25L, and a picture activity calculator 25M. The image characteristic detector in the first embodiment of FIG. The device 25 corresponds to the ACTcur detector 25J of FIG.
[0049]
In the embodiment of FIGS. 3 and 4, since the motion compensated prediction is not performed for the input to the image characteristic detector 25 in the case of an I picture, the original moving image divided in units of macroblocks as in the first embodiment. Is input, and an activity (ACTcur), which is a parameter indicating image characteristics in units of macroblocks, is detected, added in units of frames, and sent to the screen complexity calculator 24 and the d0 calculator 30 as I-picture activities ACTi. ing.
[0050]
On the other hand, in the case of P and B pictures, the input to the image characteristic detector 25 shown in FIG. 4 is an error image in motion compensation prediction in macroblock units or a coded image in motion vector detection in addition to the divided original moving image. 3 and a reference image and a motion vector used in motion compensation prediction are input from a motion compensated predictor 19 shown in FIG.
As in the case of an I picture, the (actual image) activity ACTcur is detected from the divided original moving image in units of macroblocks.
[0051]
On the other hand, an error image in motion compensation prediction in macroblock units or a difference image between a coded image and a reference image in motion vector detection is detected as a prediction activity ACTpred in which an absolute value sum or a square error sum is taken. The
[0052]
Further, the motion vector used in the motion compensation prediction is detected as a motion vector activity ACTmv by taking the absolute value of the difference for each component between adjacent macroblocks.
Then, for each macroblock, the macroblock activity ACTmb is calculated by the calculation of the following equation (9), and is added by one frame, and the screen complexity calculator 24 and the activities ACtp and ACTb of P and B pictures are added. It is sent to the d0 calculator 30.
[0053]
Macroblock activity
ACTmb = a · ACTcur + b · ACTpred + c · ACTmv (9)
Note that the values of the constants a, b, and c are changed for each picture and for each macroblock prediction mode (intra, unidirectional or bidirectional prediction).
For example, in the case of an intra, since prediction is not performed as in the case of an I picture, b = c = 0, and it is considered that the amount of generated codes is larger than that of a block to be predicted.
[0054]
Similarly to the first embodiment, the screen complexity calculator 24 is supplied with an average quantization scale and a generated code amount for each frame, and is supplied with image characteristics of each frame, that is, activities, from the image characteristic detector 25. The
The screen complexity calculator 24 multiplies the average quantization scale and generated code amount of each supplied frame, and then performs a predetermined transformation on the multiplication result. Based on this, the actual screen complexity of each frame is determined. Desired.
[0055]
The actually measured screen complexity is sent to the average screen complexity calculator 29, where a value within a certain period is added for each encoded picture type, and then divided by the number of frames of the same picture type within that period. The average screen complexity Xi-ave (I picture), Xp-ave (P picture), and Xb-ave (B picture) of the picture types P, B, and B are calculated.
[0056]
Within a certain period of time here, there may be a fixed number of frames, such as 15 frames or 300 frames, which is predetermined in time from the image that has just been encoded. There may be a case where the number of frames sequentially increases as in the case of an image that has just been converted.
Even in the case of the former fixed number of frames, if the number of encoded frames does not satisfy the predetermined period, the number of frames increases sequentially as in the latter case.
[0057]
Next, the screen complexity calculator 24 estimates the screen complexity from the actually measured screen complexity obtained, the average screen complexity obtained by the average screen complexity calculator, and the activity.
The screen complexity Xi, Xp, Xb of the current image to be encoded is the activity ACTi, ACTp, ACTb of the current image, and the screen complexity Xi-p, Xp-p of the image of the same picture type that was encoded immediately before , Xb-p, and the following picture (10), (11), and (12) can be estimated from the activities ACTi-p, ACTp-p, and ACTb-p of the same picture type encoded immediately before.
[0058]
(I picture)
Xi = Xi-p ・ (ACTi / ACTi-p) (10)
(P picture)
Xp = Xp-p ・ (ACTp / ACTp-p) (11)
(B picture)
Xb = Xb-p ・ (ACTb / ACTb-p) (12)
[0059]
In the initial state, when there is no frame that has been encoded with the same picture type, the screen complexity and activity of each picture type image are obtained in advance for several images, and the average moving image is obtained. According to the frequency of occurrence, it may be statistically averaged and used as an initial value.
[0060]
The estimated screen complexity Xi, Xp, Xb of the current image to be encoded and the average screen complexity Xi-ave, Xp-ave, Xb-ave of each picture type are sent to the code amount controller 14.
The code amount controller 14 sets (determines) an assigned code amount of an image to be encoded next (from now on) and sets (determines) a quantization scale for variable bit rate control.
[0061]
Assuming that the target average bit rate is BitRate, the number of frames per second is PictureRate, and the number of frames in 1 GOP (usually the interval between I pictures) as one coding unit is N, the average allocated code amount Rave for 1 GOP is Given in (13).
Rave = (BitRate / PictureRate) ・ N (13)
[0062]
Rave in the above equation is the required allocation code amount of 1 GOP at the time of average screen complexity, and 1 GOP image including the current image to be encoded is uniformly calculated by the screen complexity calculator
Assuming that it is equal to the estimated screen complexity of the current image obtained in 24, a necessary allocation code amount Rc of 1 GOP required for maintaining a constant image quality is given by the following equations (14), (15), and (16).
[0063]
(I picture)
Rc = Rave (Xi / Xi-ave) (14)
(P picture)
Rc = Rave (Xp / Xp-ave) (15)
(B picture)
Rc = Rave (Xb / Xb-ave) (16)
[0064]
By appropriately allocating the necessary allocation code amount Rc of the above equation to each picture of 1 GOP, the target code amount of the current image to be encoded is calculated, and the quantization scale of each macroblock is determined.
For example, when using the method of MPEG2 Test Model 5, the estimated screen complexity Xi, Xp, Xb of the current image obtained above is changed to Xi, Xp, Xb in equations (2) to (4), and the allocated code amount Rc is Substituting into R in equations (2) to (4), the target assigned code amounts Ti, Tp, and Tb of the image to be encoded are determined.
[0065]
However, in the second embodiment, since it is not necessary to set a constant code amount for each GOP, the value of Rc is subtracted by the generated code amount of each frame as R in equations (2) to (4). There is no need to add at the beginning of the GOP. In addition, Np and Nb in the expressions (2) to (4) are always constant values (values at the beginning of the GOP).
[0066]
Thereafter, as in the first embodiment, the d0 calculator calculates the value of d0-k (k = i, p, b) in the first macroblock of the current image to be encoded as each input image. 2 is calculated from the average quantization scale, the reference quantization scale determined from the activity, the reference activity, and the current image activity, according to the processing flow shown in FIG.
[0067]
For example, in the case of control by MPEG2 Test Model 5, the value of d0-k, the target assigned code amount, and the generated code amount of each macroblock detected in the buffer are substituted into the above equations (5) and (6), and each macroblock Quantization scale is determined, and adaptive quantization control is performed to change the quantization scale according to the activity of each macroblock as necessary.
In this way, even in a one-pass variable bit rate control, even if a large change in an image such as a scene change occurs, encoding is performed from a macroblock near the beginning of each image with a more appropriate quantization scale. I can do it.
[0068]
【The invention's effect】
As described above, according to the present invention, when encoding a moving image, in the code amount control performed by changing the value of the quantization scale in units of macroblocks, the generation of an image in a certain section where encoding has been completed is generated. The code amount, the average quantization scale, and the encoded image characteristics (activity) of the current image to be encoded in a certain interval and the future are detected, and the average value of the average quantization scale of the immediately preceding I or P picture and B picture The initial value d0-k of the virtual buffer that determines the quantization scale in the first macroblock of the current image by a predetermined function factored by the ratio of the activity of the current image to the average value of the activity in those images Even if a large change such as a scene change occurs in the moving image, the It is possible to determine the quantizer scale commensurate with changes in the tee.
[Brief description of the drawings]
FIG. 1 is a diagram showing a block configuration of a first embodiment of a moving picture encoding apparatus and method according to the present invention.
FIG. 2 is a diagram showing a flow of d0 calculation processing in a virtual buffer initial value d0 calculator of the first embodiment of the moving picture encoding apparatus and method according to the present invention.
FIG. 3 is a diagram showing a block configuration of a second embodiment of the moving picture coding apparatus and method according to the present invention.
FIG. 4 is a diagram showing an image characteristic detector in a second embodiment of the moving picture coding apparatus and method according to the present invention.
FIG. 5 is a diagram illustrating an example of a coded picture structure.
FIG. 6 is a diagram illustrating a block configuration of a configuration example of a conventional general video encoding device.
[Explanation of symbols]
11 Subtractor
12 DCT unit (orthogonal transformer)
13 Quantizer
14 Code amount controller
15 Variable length encoder
16 buffers
17 Inverse quantizer
18 IDCT device
19 Motion compensated predictor
20 Adder
21 frame memory
22 Average quantization scale detector
23 Generated code amount detector
24 Screen complexity calculator
25 Image characteristic detector
25A, 25J ACTcur detector
25B, 25K ACTpred detector
25C, 25L ACTmv detector
25G, 25M picture activity calculator
29 Average screen complexity calculator
30 virtual buffer initial value d0 calculator (means for determining the initial value of the quantization scale)
ActRatio (Current image activity) / (Standard activity)
ACTcur Original image activity
ACTi, ACTp, ACTb Current image activity
ACTi-p, ACTp-p, ACTb-p Activity of images of the same picture type coded immediately before
ACTmb macroblock activity
ACTmv motion vector characteristics
ACTpred error image activity
R code amount
Rave average allocated code amount
Rc image allocation code amount
Xi, Xp, Xb Screen complexity of the current image
Xi-ave, Xp-ave, Xb-ave average screen complexity
Xi-p, Xp-p, Xb-p Measurement screen complexity of each frame
d0 Virtual buffer initial value of the first block
ppMq reference quantization scale
r 2. BitRate / PictureRate

Claims (10)

入力動画像を動き補償予測手段、直交変換手段、量子化手段、及び可変長符号化手段を有して符号化する動画像符号化装置において、
前記入力動画像の各画像の発生符号量を検出する手段と、
前記入力動画像の各画像の平均量子化スケールを検出する手段と、
前記入力動画像及び前記動き補償予測手段によって生成される動き補償予測画像のうち、少なくとも前記入力動画像の輝度値の分散、または、画素間差分値によりアクティビティを検出して前記入力動画像の符号化画像特性を得るための手段と、
前記符号化画像特性を得るための手段によって得た次に符号化する画像の符号化画像特性を前記次に符号化する画像の直前のIまたはPピクチャの符号化画像特性とBピクチャの符号化画像特性との平均値を基準符号化画像特性とし、この基準符号化画像特性で除算した値に、前記可変長符号化手段で予め定められた量子化スケールを乗算することにより前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定する手段と、
前記決定した次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値から、前記次に符号化する画像の各マクロブロックにおける量子化スケールを決定する手段と
を備えたことを特徴とする動画像符号化装置。
In a moving image encoding apparatus that encodes an input moving image by including motion compensation prediction means, orthogonal transform means, quantization means, and variable length encoding means,
Means for detecting a generated code amount of each image of the input moving image;
Means for detecting an average quantization scale of each image of the input moving image;
Chi sac motion compensated prediction image is generated by the input moving picture and the motion compensated prediction means, variance of luminance values of the input moving image even without low, or the input moving by detecting the activity by the difference value between pixels Means for obtaining an encoded image characteristic of the image;
The encoded image characteristic of the next image to be encoded obtained by the means for obtaining the encoded image characteristic is the encoded image characteristic of the I or P picture immediately before the image to be encoded next and the encoding of the B picture. The average value of the image characteristics is set as a reference encoded image characteristic, and the value obtained by dividing the reference encoded image characteristic by the quantization scale predetermined by the variable length encoding unit is then encoded. Means for determining an initial value of the quantization scale in the first macroblock of the image to be performed;
Characterized in that the initial value of the quantization scale in the first macro block of the image to be coded next with the determined, and means for determining a quantization scale for each macroblock of the image to be the next coded A video encoding device.
請求項1に記載された動画像符号化装置において、
前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定する手段は、
前記平均量子化スケールを検出する手段によって検出されたピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別に直前の画像における平均量子化スケールから、目標ビットレートが大きくなるに応じて量子化スケールが小さくなる関数によって基準量子化スケールを算出し、
前記符号化画像特性を得るための手段によって得られたピクチャタイプ別に直前の画像における符号化画像特性から、前記各ピクチャタイプの符号化画像特性を加算平均する関数によって基準符号化画像特性を算出し、
前記算出した基準量子化スケールと前記算出した基準符号化画像特性に対する前記現在の画像における符号化画像特性の比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数によって次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を算出し、
前記発生符号量を検出する手段によって検出された発生符号量と、目標ビットレートによる割当符号量と、の差に基づいて前記算出した量子化スケールの初期値と、過去の画像の符号化結果から得られる量子化スケールと、のいずれかを選択するようにしたことを特徴とする動画像符号化装置。
The moving picture encoding apparatus according to claim 1,
The means for determining the initial value of the quantization scale in the first macroblock of the next image to be encoded is:
For each picture type (I picture, P picture, B picture) detected by the means for detecting the average quantization scale, the quantization scale decreases as the target bit rate increases from the average quantization scale in the immediately preceding image. The reference quantization scale is calculated by the function
The reference encoded image characteristic is calculated from the encoded image characteristic of the immediately preceding image for each picture type obtained by the means for obtaining the encoded image characteristic by a function that averages the encoded image characteristics of each picture type. ,
A non-linear function whose factor is a ratio of the calculated reference quantization scale and the encoded image characteristic in the current image to the calculated reference encoded image characteristic, and whose output is a step-like value according to the input range of this factor To calculate the initial value of the quantization scale in the first macroblock of the next image to be encoded,
From the initial value of the quantization scale calculated based on the difference between the generated code amount detected by the means for detecting the generated code amount and the allocated code amount based on the target bit rate, and the past image encoding result One of the obtained quantization scales is selected, and a moving picture coding apparatus is characterized.
請求項1、請求項2のいずれかに記載された動画像符号化装置において、
前記次に符号化する画像の割当符号量を決定する手段は、
前記発生符号量を検出する手段によって検出された発生符号量、前記平均量子化スケールを検出する手段によって検出された平均量子化スケールから、過去の画像の実測画面複雑度を算出する手段と、
前記符号化画像特性を得るための手段によって得られた現在の画像の符号化画像特性と、それと同じピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)の直前の画像において検出された符号化画像特性との比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数を、前記直前の画像における前記過去の画像の実測画面複雑度に乗算することによって現在の画像の推定画面複雑度を算出する手段と、
前記実測画面複雑度を算出する手段によって算出された過去の画像の実測画面複雑度、もしくは前記現在の画像の推定画面複雑度を算出する手段によって算出された現在の画像の推定画面複雑度と、前記発生符号量を検出する手段によって検出された発生符号量、前記平均量子化スケールを検出する手段によって検出された平均量子化スケール、前記符号化画像特性を得るための手段によって得られた符号化画像特性から、次に符号化する画像の割当符号量を決定する手段と、
を備えたことを特徴とする動画像符号化装置。
In the moving image encoding device according to any one of claims 1 and 2,
The means for determining the allocated code amount of the next image to be encoded is:
Means for calculating the actual screen complexity of past images from the generated code amount detected by the means for detecting the generated code amount, the average quantization scale detected by the means for detecting the average quantization scale;
The encoded image characteristic of the current image obtained by the means for obtaining the encoded image characteristic, and the encoded image characteristic detected in the image immediately before the same picture type (I picture, P picture, B picture) The factor of the ratio and the non-linear function whose output is a step-like value according to the input range of this factor is multiplied by the measured screen complexity of the previous image in the previous image, Means for calculating estimated screen complexity,
The measured screen complexity of the past image calculated by the means for calculating the measured screen complexity, or the estimated screen complexity of the current image calculated by the means for calculating the estimated screen complexity of the current image; The generated code amount detected by the means for detecting the generated code amount, the average quantization scale detected by the means for detecting the average quantization scale, and the encoding obtained by the means for obtaining the encoded image characteristics Means for determining an assigned code amount of an image to be encoded next from image characteristics;
A moving picture encoding apparatus comprising:
請求項3に記載された動画像符号化装置において、
前記発生符号量と前記実測画面複雑度、もしくは前記推定画面複雑度から次に符号化する画像の割当符号量を決定する手段は、
前記実測画面複雑度の一定期間における平均値に対する前記推定画面複雑度の割合を、平均割当符号量に乗ずることによって前記割当符号量を決定することを特徴とする動画像符号化装置。
In the moving image encoding device according to claim 3,
Means for determining an assigned code amount of an image to be encoded next from the generated code amount and the measured screen complexity or the estimated screen complexity,
The moving picture coding apparatus, wherein the allocated code amount is determined by multiplying an average allocated code amount by a ratio of the estimated screen complexity to an average value of the measured screen complexity over a certain period.
請求項1乃至請求項4のいずれかに記載された動画像符号化装置において、
前記入力動画像または動き補償予測画像の符号化画像特性を得るための手段は、前記入力動画像の画像特性を検出する手段、動き補償予測画像の誤差画像の画像特性を検出する手段、及び動き補償予測における動きベクトル特性を検出する手段より構成され、
ピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別及び予測モード別の定数を、前記検出した入力動画像の画像特性、動き補償予測画像の誤差画像の画像特性、及び動き補償予測における動きベクトル特性の前記各特性値に対して乗じた上で加算することによって、前記符号化画像特性を得ることを特徴とする動画像符号化装置。
In the moving image encoding device according to any one of claims 1 to 4,
The means for obtaining the encoded image characteristic of the input moving image or the motion compensated prediction image is a means for detecting the image characteristic of the input moving image, a means for detecting the image characteristic of the error image of the motion compensated prediction image, and a motion Comprising means for detecting motion vector characteristics in compensated prediction;
Constants for each picture type (I-picture, P-picture, B-picture) and prediction mode are set as the image characteristics of the detected input moving image, the image characteristics of the error image of the motion compensation prediction image, and the motion vector characteristics in motion compensation prediction. The encoded image characteristic is obtained by multiplying each characteristic value and adding the characteristic value.
入力動画像を動き補償予測ステップ、直交変換ステップ、量子化ステップ、及び可変長符号化ステップを有して符号化する動画像符号化方法において、
前記入力動画像の各画像の発生符号量を検出するステップと、
前記入力動画像の各画像の平均量子化スケールを検出するステップと、
前記入力動画像及び前記動き補償予測ステップによって生成される動き補償予測画像のうち、少なくとも前記入力動画像の輝度値の分散、または、画素間差分値によりアクティビティを検出して前記入力動画像の符号化画像特性を得るためのステップと、
前記発生符号量を得るためのステップによって得た次に符号化する画像の符号化画像特性を前記次に符号化する画像の直前のIまたはPピクチャの符号化画像特性とBピクチャの符号化画像特性との平均値を基準符号化画像特性とし、この基準符号化画像特性で除算した値に、前記可変長符号化ステップで予め定められた量子化スケールを乗算することにより前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定するステップと、
前記決定した次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値から、前記次に符号化する画像の各マクロブロックにおける量子化スケールを決定するステップと、
を備えたことを特徴とする動画像符号化方法。
In a video encoding method for encoding an input video having a motion compensation prediction step, an orthogonal transform step, a quantization step, and a variable length encoding step,
Detecting a generated code amount of each image of the input moving image;
Detecting an average quantization scale of each image of the input moving image;
The motion produced by the input video and the motion compensated prediction step compensated prediction picture sac Chi, variance of luminance values of the input moving image even without low, or the input moving by detecting the activity by the difference value between pixels Steps for obtaining a coded image characteristic of the image;
The encoded image characteristic of the next image to be encoded obtained by the step for obtaining the generated code amount is the encoded image characteristic of the I or P picture immediately before the image to be encoded next and the encoded image of the B picture. The average value of the characteristic is used as a reference encoded image characteristic, and the value obtained by dividing the reference encoded image characteristic by the quantization scale predetermined in the variable length encoding step is then encoded. Determining an initial value for the quantization scale in the first macroblock of the image;
Determining a quantization scale in each macroblock of the next encoded image from an initial value of a quantization scale in the first macroblock of the determined next encoded image;
A moving picture encoding method comprising:
請求項6に記載された動画像符号化方法において、
前記次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を決定するステップは、
前記平均量子化スケールを検出するステップによって検出されたピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別に直前の画像における平均量子化スケールから、目標ビットレートが大きくなるに応じて量子化スケールが小さくなる関数によって基準量子化スケールを算出し、
前記符号化画像特性を得るためのステップによって得られたピクチャタイプ別に直前の画像における符号化画像特性から、前記各ピクチャタイプの符号化画像特性を加算平均する関数によって基準符号化画像特性を算出し、
前記算出した基準量子化スケールと前記算出した基準符号化画像特性に対する前記現在の画像における符号化画像特性の比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数によって次に符号化する画像の最初のマクロブロックにおける量子化スケールの初期値を算出し、
前記発生符号量を検出するステップによって検出された発生符号量と、目標ビットレートによる割当符号量と、の差に基づいて前記算出した量子化スケールの初期値と、過去の画像の符号化結果から得られる量子化スケールと、のいずれかを選択するようにしたことを特徴とする動画像符号化方法。
In the moving image encoding method according to claim 6,
Determining the initial value of the quantization scale in the first macroblock of the next encoded image;
For each picture type (I picture, P picture, B picture) detected by the step of detecting the average quantization scale, the quantization scale decreases as the target bit rate increases from the average quantization scale in the immediately preceding image. The reference quantization scale is calculated by the function
The reference encoded image characteristic is calculated from the encoded image characteristic of the previous image for each picture type obtained by the step for obtaining the encoded image characteristic by a function that averages the encoded image characteristics of each picture type. ,
A non-linear function whose factor is a ratio of the calculated reference quantization scale and the encoded image characteristic in the current image to the calculated reference encoded image characteristic, and whose output is a step-like value according to the input range of this factor To calculate the initial value of the quantization scale in the first macroblock of the next image to be encoded,
The initial value of the quantization scale calculated based on the difference between the generated code amount detected by the step of detecting the generated code amount and the allocated code amount based on the target bit rate, and the past image encoding result One of the obtained quantization scales is selected, and the moving picture coding method is characterized in that it is selected.
請求項6、請求項7のいずれかに記載された動画像符号化方法において、
前記次に符号化する画像の割当符号量を決定するステップは、
前記発生符号量を検出するステップによって検出された発生符号量、前記平均量子化スケールを検出するステップによって検出された平均量子化スケールから、過去の画像の実測画面複雑度を算出するステップと、
前記符号化画像特性を得るためのステップによって得られた現在の画像の符号化画像特性と、それと同じピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)の直前の画像において検出された符号化画像特性との比を因数とし、この因数の入力範囲に応じて出力がステップ状の値となる非線形関数を、前記直前の画像における前記過去の画像の実測画面複雑度に乗算することによって現在の画像の推定画面複雑度を算出するステップと、
前記実測画面複雑度を算出するステップによって算出された過去の画像の実測画面複雑度、もしくは前記現在の画像の推定画面複雑度を算出するステップによって算出された現在の画像の推定画面複雑度と、前記発生符号量を検出するステップによって検出された発生符号量、前記平均量子化スケールを検出するステップによって検出された平均量子化スケール、前記符号化画像特性を得るためのステップによって得られた符号化画像特性から、次に符号化する画像の割当符号量を決定するステップと、
を備えたことを特徴とする動画像符号化方法。
In the moving image encoding method according to any one of claims 6 and 7,
The step of determining the allocated code amount of the next image to be encoded includes:
A step of calculating a measured screen complexity of a past image from a generated code amount detected by the step of detecting the generated code amount, an average quantization scale detected by the step of detecting the average quantization scale;
The encoded image characteristics of the current image obtained by the step for obtaining the encoded image characteristics and the encoded image characteristics detected in the image immediately before the same picture type (I picture, P picture, B picture) The factor of the ratio and the non-linear function whose output is a step-like value according to the input range of this factor is multiplied by the measured screen complexity of the previous image in the previous image, Calculating an estimated screen complexity;
An actual screen complexity of the past image calculated by the step of calculating the actual screen complexity, or an estimated screen complexity of the current image calculated by the step of calculating the estimated screen complexity of the current image; The generated code amount detected by the step of detecting the generated code amount, the average quantization scale detected by the step of detecting the average quantization scale, and the encoding obtained by the step of obtaining the encoded image characteristics Determining an assigned code amount of an image to be encoded next from the image characteristics;
A moving picture encoding method comprising:
請求項8に記載された動画像符号化方法において、
前記発生符号量と前記実測画面複雑度、もしくは前記推定画面複雑度から次に符号化する画像の割当符号量を決定するステップは、
前記実測画面複雑度の一定期間における平均値に対する前記推定画面複雑度の割合を、平均割当符号量に乗ずることによって前記割当符号量を決定することを特徴とする動画像符号化方法。
In the moving image encoding method according to claim 8,
Determining an assigned code amount of an image to be encoded next from the generated code amount and the measured screen complexity or the estimated screen complexity,
A moving picture encoding method, wherein the allocated code amount is determined by multiplying an average allocated code amount by a ratio of the estimated screen complexity to an average value of the measured screen complexity for a certain period.
請求6乃至請求項9のいずれかに記載された動画像符号化方法において、
前記入力動画像または動き補償予測画像の符号化画像特性を得るためのステップは、前記入力動画像の画像特性を検出するステップ、動き補償予測画像の誤差画像の画像特性を検出するステップ、及び動き補償予測における動きベクトル特性を検出するステップより構成され、
ピクチャタイプ(Iピクチャ、Pピクチャ、Bピクチャ)別及び予測モード別の定数を、前記検出した入力動画像の画像特性、動き補償予測画像の誤差画像の画像特性、及び動き補償予測における動きベクトル特性の前記各特性値に対して乗じた上で加算することによって、前記符号化画像特性を得ることを特徴とする動画像符号化方法。
In the moving image encoding method according to any one of claims 6 to 9,
The step of obtaining the encoded image characteristic of the input moving image or the motion compensated prediction image includes the step of detecting the image characteristic of the input moving image, the step of detecting the image characteristic of the error image of the motion compensated prediction image, and the motion Comprising the step of detecting motion vector characteristics in compensated prediction;
Constants for each picture type (I-picture, P-picture, B-picture) and prediction mode are set as the image characteristics of the detected input moving image, the image characteristics of the error image of the motion compensation prediction image, and the motion vector characteristics in motion compensation prediction. The encoded image characteristic is obtained by multiplying each of the characteristic values and adding the characteristic value.
JP2000047245A 2000-02-24 2000-02-24 Video encoding apparatus and method Expired - Fee Related JP3812269B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000047245A JP3812269B2 (en) 2000-02-24 2000-02-24 Video encoding apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000047245A JP3812269B2 (en) 2000-02-24 2000-02-24 Video encoding apparatus and method

Publications (2)

Publication Number Publication Date
JP2001238217A JP2001238217A (en) 2001-08-31
JP3812269B2 true JP3812269B2 (en) 2006-08-23

Family

ID=18569528

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000047245A Expired - Fee Related JP3812269B2 (en) 2000-02-24 2000-02-24 Video encoding apparatus and method

Country Status (1)

Country Link
JP (1) JP3812269B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5342391B2 (en) * 2009-09-25 2013-11-13 株式会社メガチップス Image processing device
EP2355510A1 (en) * 2009-12-21 2011-08-10 Alcatel Lucent Method and arrangement for video coding
EP2355511A1 (en) * 2009-12-21 2011-08-10 Alcatel Lucent Method and arrangement for jointly encoding a plurality of video streams
JP5451487B2 (en) * 2010-03-31 2014-03-26 株式会社メガチップス Image encoding device
JP5635673B2 (en) * 2013-12-05 2014-12-03 株式会社メガチップス Image encoding device

Also Published As

Publication number Publication date
JP2001238217A (en) 2001-08-31

Similar Documents

Publication Publication Date Title
JP3954656B2 (en) Image coding apparatus and method
KR101518358B1 (en) A buffer-based rate control exploiting frame complexity buffer level and position of intra frames in video coding
EP1063851B1 (en) Apparatus and method of encoding moving picture signal
CN100463523C (en) Video encoding methods and systems with frame-layer rate control
US7903732B2 (en) Method and apparatus for encoding a moving-picture signal by calculating the complexity of the moving-picture signal
JPH10336663A (en) Pre-processor for mpeg2 coding
JPH11346362A (en) Real time single path variable bit rate control method, and encoder
JP2007089035A (en) Moving image encoding method, apparatus, and program
JP2001169281A (en) Device and method for encoding moving image
KR19980032089A (en) Image compression encoding apparatus and method
JPH0974565A (en) Controller for video signal coding system
JP3259702B2 (en) Moving picture variable bit rate coding apparatus and method
JP2001008215A (en) Dynamic image encoder and method therefor
JP4362795B2 (en) Video encoding apparatus and method
JPH09322176A (en) Encoding mode selecting method, moving image encoding device, encoding method, recording method and transmitting method
JP4295828B2 (en) Encoding with region information
JP3173369B2 (en) Image compression coding device
JP4362794B2 (en) Video encoding apparatus and method
JP3812269B2 (en) Video encoding apparatus and method
JP3812267B2 (en) Video encoding apparatus and method
JP3480067B2 (en) Image coding apparatus and method
JP3858520B2 (en) Video encoding apparatus and method
KR20040007818A (en) Method for controlling DCT computational quantity for encoding motion image and apparatus thereof
JP4362793B2 (en) Video encoding apparatus and method
JPH04329089A (en) Dynamic image coding device

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041124

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050405

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050606

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060522

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

Free format text: PAYMENT UNTIL: 20090609

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20100609

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110609

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120609

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120609

Year of fee payment: 6

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

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

Free format text: PAYMENT UNTIL: 20120609

Year of fee payment: 6

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20120609

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130609

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees