JP4362793B2 - Video encoding apparatus and method - Google Patents
Video encoding apparatus and method Download PDFInfo
- Publication number
- JP4362793B2 JP4362793B2 JP19014399A JP19014399A JP4362793B2 JP 4362793 B2 JP4362793 B2 JP 4362793B2 JP 19014399 A JP19014399 A JP 19014399A JP 19014399 A JP19014399 A JP 19014399A JP 4362793 B2 JP4362793 B2 JP 4362793B2
- Authority
- JP
- Japan
- Prior art keywords
- image
- code amount
- value
- average
- quantization scale
- 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 - Lifetime
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の動画像符号化装置の一構成例を図7に示す。
また、符号化ピクチャ構造の一例を図6に示す。
動き補償予測では、図6に示した符号化ピクチャ構造のように、 Iピクチャ(フレーム内符号化)、Pピクチャ(順方向予測符号化)、Bピクチャ(双方向予測符号化)と呼ばれる、予測方法の異なる3種類のピクチャの組合せによって構成される。
図7に示されるように、変換符号化では、Iピクチャでは符号化画像そのものに対し、P,Bピクチャでは動き補償器77による動き補償予測の誤差信号である減算器71の出力に対して、DCTがDCT器72で施される。
【0004】
DCT器72で得られたDCT係数に対して量子化が、符号量制御部90の出力により制御して量子化器73によってなされた後に、動きベクトル等のその他の付帯情報と共に可変長符号化が可変長符号化器75でなされ、符号列が「ビットストリーム」としてバッファ76に記憶された後に出力される。
この際、バッファ76の充足度に応じて符号量制御部90で量子化スケールが制御される。
一方、量子化器73の出力係数は、逆量子化器77、IDCT器78に供給さて、局部復号されてブロック毎にフレームメモリ81に貯えられる。
【0005】
MPEG2は可変長符号化であるため、単位時間当りの発生符号量(ビットレート)は一定ではない。
そこで、量子化器73での量子化の際の量子化スケールをマクロブロック単位に適宜変更することにより、所要のビットレートに制御することが可能になっている。
MPEG2 Test Model 5では、GOP単位で発生符号量を一定にする固定ビットレート制御方法が提案されている。
【0006】
このTest Model 5における固定ビットレート制御方法は、一定の転送レートが要求される用途に対しては有効な方法である。
しかし、動画像シーケンスのどの部分に対してもほぼ同じ符号量が割り当てられるため、情報量を多く含む複雑なシーンに対しては十分な符号量が与えられずに画質劣化が生じてしまう。これに対して、情報量が少ない単純なシーンの場合には符号量が余剰になって無駄が生じ、DVD-Videoのように可変転送レートが可能な用途に対しては、適切なレート制御方法とは言えなかった。
【0007】
以上のような問題を解決するレート制御方法が可変ビットレート制御方法である。特開平6−141298号公報には、可変ビットレート制御による符号化装置が開示されている。
この装置では、最初に、入力動画像に対して固定量子化スケールによって仮符号化を行い、単位時間毎に発生符号量がカウントされる。つぎに、入力動画像全体の発生符号量が所要値になるように、仮符号化時の発生符号量に基づいて各部分の目標転送レートを設定する。そしてこの目標転送レートに合致するように制御を行いながら、入力動画像に対して2回目の符号化、言い換えると実符号化が行われる。
【0008】
しかし、上記従来例では、出力ビットストリームを得るためには少なくとも2回の符号化を行わなければならず、リアルタイム性を要求されるような用途ではこの装置のような2パス方式の可変ビットレート制御は使用出来ない。
【0009】
これに対し、動画像をほぼリアルタイムで符号化するための可変ビットレート制御方法、すなわち1パス方式の可変ビットレート制御方法も存在する。特開平10−302396号公報には、1パス方式の可変ビットレート制御方法による符号化装置が開示されている。
【0010】
この装置では、動画像を符号化する際に単位時間毎の符号化難易度を測定し、それを予め標準化された符号化難易度と割当符号量の関係から単位時間毎の割当符号量の参考値を求める。
【0011】
割当符号量の参考値から実際の割当符号量へ変更する方法は、記録媒体に所定の時間長記録する動画像の発生符号量の総和が記録媒体に記録可能な実容量以下になるように、記録媒体の実容量から定まる一定の割当符号量bavで符号化した場合の割当符号量Bavと現在までの実際の発生符号量の総和Bgenを比較し、Bav−Bgenが正の時にbav以上の割当符号量を許可することにより、所定の時間長の動画像が一定の記録容量の記録媒体に記録出来ることを保証する1パス方式の可変ビットレート制御を実現している。
【0012】
【発明が解決しようとする課題】
しかしながら1パス方式の可変ビットレート制御では2パス方式とは異なり、入力される動画像シーケンスがどのような画面複雑度の時間変化で構成されているかは予めわからない状態でビットレート制御を行わなければならない。
上記従来発明では実際の発生符号量が、記録媒体の実容量から定まる一定の割当符号量bavより下回った分だけ、それ以降の符号化でbavを上回る符号量割当が可能になる。
そのため、動画像シーケンスの前半で比較的符号化が易しく、後半が難しい場合は、前半の余剰ビットが後半の難しい部分に回せて、シーケンス全体の主観画質の改善が可能になるが、逆に前半が難しく、後半が易しい場合は前半の難しい部分の主観画質の改善は不可能である上に、符号化の終了した時点では後半の易しい部分で符号量が余剰になり、記録媒体の容量の無駄が生じてしまう。
本発明は以上の問題を解決して、割当符号量に時間的に変化するマージンを付加することによって、動画像シーケンスの初めの部分でも一定の割当符号量を上回る符号量割当を可能にし、シーケンス全体の符号量割当を適正にし、かつ全般的な画質向上を図ることを目的とする。
【0013】
【課題を解決するための手段】
そこで、本発明は、上記課題を解決するために以下の装置及び方法を提供するものである。
(1)入力動画像を、動き補償予測手段、直交変換手段、量子化手段、及び可変長符号化手段を有して符号化を行う動画像符号化装置において、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の発生符号量を検出するとともに、前記入力動画像の先頭の画像から現在までに符号化した画像までの総発生符号量を検出する手段と、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の平均量子化スケールを検出する手段と、
符号化された前記入力動画像を記録する記録媒体の記録可能容量と、前記入力動画像の記録時間とから平均目標ビットレートを決定する手段と、
前記平均目標ビットレートに基づいて最小量子化スケールを設定する手段と、
前記発生符号量の余裕分であるマ−ジンの値を、前記入力動画像の符号化開始時点では最大値に設定するとともに、時間経過に伴って前記マージンの値を前記最大値から漸次小さくした値を予め設定される第1の所定期間毎に設定する手段と、
前記入力動画像の符号化開始時点から現在までの区間を前記平均目標ビットレートで符号化した場合に発生すると想定される想定発生符号量と、前記現在までの総発生符号量との差分値を算出し、この差分値の一定割合分を前記マージンの値に加算することで、前記所定期間毎に設定するマージンの値を補正する手段と、
前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、符号化単位である第2の所定期間内における各画像の目標割当符号量を算出する手段と、
前記目標割当符号量と各マクロブロックの発生符号量とから、既知の方法により、各マクロブロックの量子化スケールを決定するとともに、この決定された量子化スケールが前記最小量子化スケールよりも小さい場合は、前記決定された量子化スケールを前記最小量子化スケールと置き換える手段とを備えたことを特徴とする動画像符号化装置。
(2)上記(1)に記載された動画像符号化装置において、
前記発生符号量のマージンの値を設定する手段は、
符号化動画像の記録済み時間または残り記録時間によって前記マージンの値を決定することを特徴とする動画像符号化装置。
(3)上記(1)に記載された動画像符号化装置において、
前記発生符号量のマージンの値を設定する手段は、
観測時刻における符号化動画像の記録済み時間、残り記録時間、記録済みの発生符号量、記録媒体に対する残り容量、目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数により、前記マージンの値を決定することを特徴とする動画像符号化装置。
(4)上記(1)乃至(3)のいずれかに記載された動画像符号化装置において、
前記各画像毎の発生符号量と前記各画像毎の平均量子化スケールとを乗算した後に所定の変換を施して、前記各画像毎の画面複雑度を検出する手段と、
前記画面複雑度の一定期間における平均値である平均画面複雑度を求める手段と、
を有し、
前記目標割当符号量を算出する手段は、
前記平均画面複雑度と、前記各画像毎の画面複雑度と、前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、前記所定期間内における各画像の目標割当符号量を算出することを特徴とする動画像符号化装置。
(5)入力動画像を、動き補償予測ステップ、直交変換ステップ、量子化ステップ、及び可変長符号化ステップを有して符号化を行う動画像符号化方法において、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の発生符号量を検出するとともに、前記入力動画像の先頭の画像から現在までに符号化した画像までの総発生符号量を検出するステップと、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の平均量子化スケールを検出するステップと、
符号化された前記入力動画像を記録する記録媒体の記録可能容量と、前記入力動画像の記録時間とから平均目標ビットレートを決定するステップと、
前記平均目標ビットレートに基づいて最小量子化スケールを設定するステップと、
前記発生符号量の余裕分であるマ−ジンの値を、前記入力動画像の符号化開始時点では最大値に設定するとともに、時間経過に伴って前記マージンの値を前記最大値から漸次小さくした値を予め設定される第1の所定期間毎に設定するステップと、
前記入力動画像の符号化開始時点から現在までの区間を前記平均目標ビットレートで符号化した場合に発生すると想定される想定発生符号量と、前記現在までの総発生符号量との差分値を算出し、この差分値の一定割合分を前記マージンの値に加算することで、前記所定期間毎に設定するマージンの値を補正するステップと、
前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、符号化単位である第2の所定期間内における各画像の目標割当符号量を算出するステップと、
前記目標割当符号量と各マクロブロックの発生符号量とから、既知の方法により、各マクロブロックの量子化スケールを決定するとともに、この決定された量子化スケールが前記最小量子化スケールよりも小さい場合は、前記決定された量子化スケールを前記最小量子化スケールと置き換えるステップとを備えたことを特徴とする動画像符号化方法。
(6)上記(5)に記載された動画像符号化方法において、
前記発生符号量のマージンの値を設定するステップは、
符号化動画像の記録済み時間または残り記録時間によって前記マージンの値を決定することを特徴とする動画像符号化方法。
(7)上記(5)に記載された動画像符号化方法において、
前記発生符号量のマージンの値を設定するステップは、
観測時刻における符号化動画像の記録済み時間、残り記録時間、記録済みの発生符号量、記録媒体に対する残り容量、目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数により、前記マージンの値を決定することを特徴とする動画像符号化方法。
(8)上記(5)乃至(7)のいずれかに記載された動画像符号化方法において、
前記各画像毎の発生符号量と前記各画像毎の平均量子化スケールとを乗算した後に所定の変換を施して、前記各画像毎の画面複雑度を検出するステップと、
前記画面複雑度の一定期間における平均値である平均画面複雑度を求めるステップと、
を有し、
前記目標割当符号量を算出するステップは、
前記平均画面複雑度と、前記各画像毎の画面複雑度と、前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、前記所定期間内における各画像の目標割当符号量を算出することを特徴とする動画像符号化方法。
【0019】
【発明の実施の形態】
本発明の動画像符号化装置及びその方法の第1の実施例について、以下に図1と共に説明する。
図1に示したように、本発明の動画像符号化装置及びその方法の第1の実施例は、減算器11、DCT器12、量子化器13、符号量制御器14、可変長符号化器15、バッファ16、逆量子化器17、IDCT器18、動き補償予測器19、加算器20、フレームメモリ21、平均量子化スケール検出器22、発生符号量検出器23、画像特性検出器25、記録時間検出器31、マージン設定器32、平均レート設定器33、及び最小量子化スケール設定器34より構成されている。
【0020】
原画像は図示されていない画像ブロック分割器によって、予めマクロブロック単位に分割されているものとする。
分割された原画像は、Iピクチャについては動き補償予測が行われず、原画像ブロックそのものがDCT器12に送られ、DCTされた後に量子化器13で符号量制御器14から送られる量子化スケールによって量子化される。
【0021】
量子化器13の出力は可変長符号化器15で符号に変換されてバッファ16で調整された後に符号が出力される。
一方、量子化器13の出力係数は逆量子化器17、IDCT器18で局部復号されてブロック毎にフレームメモリ21に貯えられる。
【0022】
P及びBピクチャについては分割された原画像とフレームメモリに貯えられた所定の局部復号画像ブロックが動き補償予測器19に供給され、ここで動きベクトル検出及び動き補償が行われて、予測画像ブロックが減算器11で原画像ブロックとの間で画素間差分が取られ、差分値である誤差画像ブロックがDCT器12に送られる。
【0023】
この後はIピクチャと同様にDCTされ、量子化器13で符号量制御器14から送られる量子化スケールによって量子化された後に可変長符号化器15で符号に変換されてバッファ16で調整された後に符号が出力される。
【0024】
一方、量子化器13の出力係数は逆量子化器17、IDCT器18で局部復号された後に前記予測画像ブロックが加算器20によって画素毎に加算され、ブロック毎にフレームメモリ21に貯えられる。
【0025】
各ピクチャについて、マクロブロック毎の量子化スケールが平均量子化スケール検出器22に送られ、そこで1フレーム毎に量子化スケールが加算され、1フレームの平均量子化スケールが算出される。一方、バッファ16において発生符号量が監視され、値が発生符号量検出器23に送られる。
ここにおいて、発生符号量がフレーム単位に加算され、1フレームの発生符号量が検出される。
【0026】
これと共に、発生符号量検出器23で、各フレームの発生符号量が順次加算されて、動画像シーケンスの先頭から現在までに符号化した画像の実際の総発生符号量が計算される。
各フレームの平均量子化スケール、発生符号量、及び現在までの総発生符号量は符号量制御器14に送られる。
【0027】
平均レート設定器33では、平均目標ビットレートRaveが設定され、符号量制御器14に送られる。
平均目標ビットレートRaveの設定値は、例えば記録媒体35の場合、動画像データが記録可能な容量と、それに記録する動画像シーケンスの記録時間から決定される。すなわち、固定ビットレート制御で符号化した場合の平均ビットレートに相当する。
【0028】
最小量子化スケール設定器34では、平均レート設定器33で設定した平均レートに応じて、量子化スケールの最小値を設定する。一般的に量子化スケールは、ある一定値以上になると復号画像の画質に劣化が知覚する。
【0029】
逆に言うと、ある一定値よりも量子化スケールを下げても復号画像の画質はほとんど変わらないので、量子化スケールを一定値でリミッタをかけてそれ以上は量子化スケールが下がらないようにすることにより、リミッタのかかった部分で発生符号量を平均レートより少なくして、復号画像の画質を保持しつつ、発生符号量の削減を図るものである。
平均レートに応じて最小量子化スケールを変更することにより、平均レートに見合った画質を選択することが出来る。
【0030】
マージン設定器32では、符号量の余裕分であるマージンの値が所定の周期毎に設定される。
マージンの設定方法には、(1) ビットレートに対するマージンと(2) 一定区間内の発生符号量の総量に対するマージンとの2つの方法がある。
記録時間や記録媒体35の容量といったパラメータの設定等によって適宜適切な方を選択して、マージンの設定を行う。
【0031】
(1) ビットレートに対するマージンについて(図2)
図2にマージンの配分方法と符号量推移の一実施例を示す。
マージンは、平均目標ビットレートRaveに対して与えられ、例えばRaveが4Mbpsの時、10%のマージンを与えるとき、マージンを10%または0.4Mbpsと表す。
【0032】
動画像シーケンスの総記録時間が設定されている場合、記録時間検出器31で検出される記録経過時間より残り記録時間が得られるので、符号化の開始時点ではマージンが最大で、符号化の終了時点でマージンが0になるよう、残り記録時間に比例したマージンの量を決定する関数を設定する。
前記所定の周期毎に、記録時間検出器31で得られる残り記録時間から前記関数により符号量マージンが決定される。
【0033】
但し、これだけではシーケンスが後ろになるにつれてマージンが少なくなってしまうので、現在までに符号化した画像の実際の総発生符号量と、この区間を平均目標ビットレートRaveで符号化した場合の発生符号量の差を計算し、この差の一定割合を前記マージンに加算することにより、シーケンスの後半でも十分なマージンが確保される。
【0034】
(2) 一定区間内の発生符号量の総量に対するマージンについて(図3)
図3にマージンの配分方法と符号量推移の他の実施例を示す。
これは記録媒体35における形式的な記録容量の表示が実際の最大容量より小さく設定される場合で、例えば記録媒体35の容量表示が1.0 Gbitで、実際の最大容量が1.2Gbitの時、マージンは20%または0.2Gbitと表す。
【0035】
動画像シーケンスの総記録時間、あるいは記録媒体の目安の記録時間が表示されている場合は、その目安の記録時間を所定の区間長に分割する。
なお、分割される各区間の長さは等間隔でもよいし、そうでなくてもよい。
【0036】
分割された各区間に対し、前記記録媒体35の容量のマージンを所定の方法によって配分する。
マージンの配分方法は、例えば分割各区間の長さに比例して、すなわち各区間が等間隔ならば配分するマージンも等しく配分してもよいが、シーケンスの最初の方は相対的に多く、後半になるにつれて次第に少なく設定し、前半で余ったマージンは順次後半に繰り越すことにより、無駄の少ないマージンの割当を実現している。
【0037】
なお、分割各区間に配分するマージンの量は、記録媒体35の実際の最大容量と表示記録容量の差を限度としてもよいし、それを若干越えたマージンの量を設定してもよい。
【0038】
容量の差を限度とした場合は、実際の総発生符号量が記録媒体35の実際の最大容量以下になることが保証され、容量の差を若干越えた量を設定した場合は、実際の総発生符号量が記録媒体35の実際の最大容量以下になる保証はなくなるが、その分符号化の難しい部分における画質改善の幅がより大きくなる。
なお、マージンの値を符号量制御器14に送る場合は、(1)の場合と同様に平均目標ビットレートRaveに対するマージンに換算する。
【0039】
符号量制御器14では、平均量子化スケール検出器22から送られてきた各フレームの平均量子化スケール、発生符号量検出器から送られてきた発生符号量と現在までの総発生符号量、平均レート設定器33から送られてきた平均目標ビットレート、最小量子化スケール設定器34から送られてきた最小量子化スケール、及びマージン設定器32から送られてきたマージンから、MPEG2 Test Model 5または別の符号量配分の方法(各画像に対する符号量割当方法)を用いて符号量制御が行われ、各画像の目標割当符号量が決定される。
【0040】
一実施例としてMPEG2 Test Model 5を用いた目標割当符号量の決定方法を以下に説明する。
固定ビットレート制御におけるビットレートをBitRate、1秒当りのフレーム数をPictureRate、1つの符号化単位である1GOP(通常はIピクチャの間隔)のフレーム数をNとすると、1GOPの平均割当符号量Raveは次式(1)で与えられる。
【0041】
【0042】
符号量制御器14において割当てられる1GOPの割当符号量Rcは、Raveと1GOP当りのマージンmarginを用いて、次式(2)で設定される。
【0043】
【0044】
すなわち、Rcの値は固定ビットレート制御の場合よりもマージン分だけ高いビットレートで制御することになる。そうするとマージン分だけ符号量が不足することになるが、後述するように、最小量子化スケールによる量子化スケールのリミッタがかかるため、リミッタのかかった部分における発生符号量の削減をマージンによる符号量増加に充当して、所定の平均目標ビットレートに収めることが可能である。
【0045】
割当符号量Rcを1GOPの各ピクチャに適切に割り振ることにより、これから符号化する各画像の目標符号量を算出する。
1GOPに含まれるP、Bピクチャのフレーム数をNp、Nb、Iピクチャに対するP、Bピクチャの量子化スケールの設定比率をKp、Kb、直前に符号化した同じピクチャタイプのピクチャの画面複雑度(発生符号量と平均量子化スケールとの積)をXi, Xp, Xbとする。
この時、各ピクチャタイプの目標割当符号量Ti, Tp, Tbは次式(3) (4) (5)で与えられる。
なお、MAX[A, B]はAとBのいずれか大きい方を選択する動作を示す。
【0046】
(Iピクチャ)
【0047】
(Pピクチャ)
【0048】
(Bピクチャ)
【0049】
さらに、決定した各画像の目標割当符号量とバッファ16で検出される各マクロブロックの発生符号量をもとに、MPEG2 Test Model 5または別の符号量配分の方法(各マクロブロックに対する符号量割当方法)を用いて各マクロブロックの量子化スケールを決定する。
【0050】
なお、画像特性検出器25において各マクロブロックの原画像アクティビティが検出され、この値が符号量制御器14へ送られる。
このアクティビティの値はMPEG2 Test Model 5における各マクロブロックの量子化スケールを変更する適応量子化制御に使用されるが、この適応量子化制御は行わなくてもよい。または別の方法により適応量子化制御を行ってもよい。
【0051】
このようにして決定した各マクロブロックの量子化スケールに対し、最小量子化スケール設定器34によって設定される最小量子化スケールによるリミッタがかけられる。すなわち、各マクロブロックの量子化スケールが最小量子化スケールよりも小さい場合は最小量子化スケールに置き換えて、それ以外の場合は前記決定した値をそのまま各マクロブロックの量子化スケールとして最終的に決定し、この値が符号量制御器14から出力される。
【0052】
符号量制御器14から出力される各マクロブロックの量子化スケールが量子化器13に送られ、現在の画像(DCT後の分割された原画像または動き補償予測の誤差画像ブロック)がこの量子化スケールで量子化される。
更に量子化器13の出力は、可変長符号化器15で可変長符号化されて、バッファ16で調整された後に符号が出力される。
【0053】
マクロブロック毎の量子化スケール、バッファ16で監視される発生符号量がそれぞれ、平均量子化スケール検出器22、発生符号量検出器23に送られ、次のピクチャの符号量制御に使用される。
なお、発生符号量検出器23では現在までに符号化した画像について発生符号量を加算して、実際の総符号量を求め、この値をマージン設定器32に送っている。
【0054】
また、符号量制御器14では、記録時間と平均目標ビットレートRaveから求まる、固定のRaveで符号化した場合の目標発生符号量(前記マージンの設定方法(2)では現在までに割当てられたマージンの総量も含む。)と、発生符号量検出器23で求めた実際の総発生符号量との差を計算し、この発生符号量の目標と実際の差に対して一定比率を乗算して、これをマージン設定器32で設定したマージンに加算することにより、初期設定において、シーケンスの後半ではマージンが小さくなるように設定した場合でも、後半部分のマージンを十分に確保することが可能になる。
【0055】
本発明の動画像符号化装置及びその方法の第2の実施例について、以下に図4と共に説明する。
第2の実施例では第1の実施例に比べ、レート比較器37と残量検出器36が追加され、マージン設定器32Aの動作が変更になっているが、それ以外の部分は第1の実施例と同一なので、変更になった部分についてのみ説明する。
【0056】
レート比較器37では、発生符号量検出器23で検出された各画像の発生符号量を所定期間について加算して、この期間の実転送レートを計算した値と、平均レート設定器33から出力される目標転送レート、最大転送レートとをマージン設定器32に送る。
【0057】
残量検出器36では、記録媒体35に予め設定された最大容量と記録媒体35に内蔵された符号量カウンタで検出された記録済み符号量の差、もしくは記録済み領域の位置情報を検出して、それを残り記録容量に変換することにより、記録媒体35の残り容量を検出し、それをマージン設定器32Aに送る。
【0058 】
マージン設定器32Aでは、記録時間検出器31から送られた動画像シーケンスの記録済み時間または残り記録時間、発生符号量検出器23から送られた記録済みの発生符号量、残量検出器36から送られた記録媒体35に対する残り容量、レート比較器37から送られた目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数を設定し、この関数によってマージンの設定を行うことにより、一層適切な符号量制御を行うことが可能になる。
【0059】
本発明の動画像符号化装置及びその方法の第3の実施例について、以下に図5と共に説明する。
第3の実施例では第2の実施例に比べ、画面複雑度算出器24が追加され、符号量制御器14の動作が変更になっているが、それ以外の部分は第2の実施例と同一なので、変更になった部分についてのみ説明する。
【0060】
画面複雑度算出器24へは、平均量子化スケール検出器22から1フレームの平均量子化スケールが、発生符号量検出器23からは1フレームの発生符号量が各画像毎に入力され、平均量子化スケールと発生符号量とが乗算された後に乗算結果に所定の変換が施されて、各フレームの画面複雑度として求められる。
【0061】
画面複雑度算出器24で求められる画面複雑度は符号化ピクチャタイプ別に一定期間内の値が加算された後にその期間内の同じピクチャタイプのフレーム数で除算されて、各ピクチャタイプの平均画面複雑度 Xi-ave, Xp-ave, Xb-ave が算出される。
各ピクチャタイプの平均画面複雑度 Xi-ave, Xp-ave, Xb-aveと、直前に符号化した同じピクチャタイプの画像の画面複雑度 Xi, Xp, Xb は符号量制御器14に送られる。
【0062】
この画面複雑度算出器24から送られてきた各ピクチャタイプの平均画面複雑度 Xi-ave, Xp-ave, Xb-aveと直前に符号化した同じピクチャタイプの画像の画面複雑度 Xi, Xp, Xb、平均量子化スケール検出器22から送られてきた各フレームの平均量子化スケール、発生符号量検出器23から送られてきた発生符号量と現在までの総発生符号量、平均レート設定器33から送られてきた平均目標ビットレート、最小量子化スケール設定器34から送られてきた最小量子化スケール、マージン設定器32Aから送られてきたマージンから、MPEG2 Test Model 5、または別の符号量配分の方法(各画像に対する符号量割当方法)を用いて、符号量制御器14において符号量制御が行われる。
【0063】
MPEG2 Test Model 5を用いて目標割当符号量を決定する場合、第1の実施例における式(1)のRcを求める式が次の(6)のように変わるが、その他の部分は第1の実施例と同じである。
【0064】
【0065】
第2の実施例と同様に、MPEG2 Test Model 5等において設定するビットレートの値を、平均目標ビットレートにマージンを加えることにより、固定ビットレート制御の場合よりもマージン分だけ高いビットレートで制御して各画像の目標割当符号量が決定した後、当該ピクチャタイプについて、直前に符号化した画像の画面複雑度を平均画面複雑度で割った値を、得られた各画像の目標割当符号量に乗算することにより、画面複雑度を考慮した符号量割当が行われる。
【0066】
そして決定した各画像の目標割当符号量とバッファ16で検出される各マクロブロッの発生符号量をもとに、第1、第2の実施例と同様にして、各マクロブロックの量子化スケールを決定する。
【0067】
なお、以上の第3の実施例では、第2の実施例で得られる各画像の目標割当符号量に対し画面複雑度を考慮した符号量割当を行っているが、これを第1の実施例に適用してもよい。
【0068】
【発明の効果】
以上のように本発明によると、可変ビットレート制御で動画像を符号化する際に、各画像の発生符号量、量子化スケールと、目標平均符号量、符号量のマージンから前記一定区間の割当符号量を決定し、それを所定の方法で一定区間内の各画像に配分する。符号量のマージンの設定値は、例えば動画像シーケンスの記録済み時間または残り記録時間で変化させ、シーケンスの最初では最大で、時間の経過と共に一定の割合で減少させ、シーケンスの最後では0となるように設定することにより、記録媒体の実容量を超えることなく、途中の区間では一定のビットレートを超える符号量割当が可能になる。
【0069】
あるいは、記録媒体の実容量に対しマージンを設ける場合は、記録媒体の容量のマージンを動画像シーケンスの所定の区間長に区切った各区間に配分する。マージンの配分をシーケンスの最初では多目に、後半になるにつれて次第に少な目に設定し、前半で余ったマージンは順次後半に繰り越すことにより、無駄の少ないマージンの割当が可能となる。
【0070】
また、動画像シーケンスの記録済み時間、残り記録時間、記録済みの発生符号量、記録媒体に対する残り容量、目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数によってマージンを設定することにより、一層適正な符号量制御を行うことが可能になる。
【0071】
また、以上のような方法で配分された各画像の割当符号量に対し、各フレームの平均量子化スケールと発生符号量を乗算して所定の変換を施して、各フレームの画面複雑度を求め、この値を一定期間内のピクチャタイプ別平均画面複雑度で割った値を前記各画像の割当符号量に乗算することにより、画面複雑度を考慮した符号量割当を行って、1パス方式の可変ビットレート制御による動画像符号化においても、より画像の特性に応じた符号量制御が可能になる。
【図面の簡単な説明】
【図1】本発明の動画像符号化装置及びその方法の第1の実施例を示したブロック構成図である。
【図2】本発明の動画像符号化装置及びその方法の符号量推移の一実施例を示した図である。
【図3】本発明の動画像符号化装置及びその方法の符号量推移の他の実施例を示した図である。
【図4】本発明の動画像符号化装置及びその方法の第2の実施例を示したブロック構成図である。
【図5】本発明の動画像符号化装置及びその方法の第3の実施例を示したブロック構成図である。
【図6】符号化ピクチャ構造の一例を示した図である。
【図7】従来の一般的な動画像符号化装置の一構成例を示した図である。
【符号の説明】
11 減算器
12 DCT器
13 量子化器
14 符号量制御器
15 可変長符号化器
16 バッファ
17 逆量子化器
18 IDCT器
19 動き補償予測器
20 加算器
21 フレームメモリ
22 平均量子化スケール検出器
23 発生符号量検出器
24 画面複雑度算出器
25 画像特性検出器
31 記録時間検出器
32,32A マージン設定器
33 平均レート設定器
34 最小量子化スケール設定器
36 残量検出器
37 レート比較器
Xi, Xp, Xb 現在の画像の画面複雑度
Xi-ave, Xp-ave, Xb-ave 平均画面複雑度[0001]
BACKGROUND OF THE INVENTION
The present invention relates to high-efficiency encoding of moving images, and more particularly to a code amount control apparatus and method suitable for performing variable bit rate encoding in real time.
[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 that constitutes a moving image into blocks of 16x16 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 In contrast, 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 MPEG2 moving image encoding apparatus is shown in FIG.
An example of the coded picture structure is shown in FIG.
In motion-compensated prediction, as in the coded picture structure shown in FIG. 6, prediction called I picture (intraframe coding), P picture (forward prediction coding), and B picture (bidirectional prediction coding) It consists of a combination of three types of pictures with different methods.
As shown in FIG. 7, in transform coding, with respect to the output of the
[0004]
After the quantization is performed on the DCT coefficient obtained by the
At this time, the quantization scale is controlled by the code
On the other hand, the output coefficient of the
[0005]
Since MPEG2 is variable length coding, the generated code amount (bit rate) per unit time is not constant.
Therefore, the required bit rate can be controlled by appropriately changing the quantization scale at the time of quantization in the
MPEG2 Test Model 5 proposes a fixed bit rate control method that makes the generated code amount constant in GOP units.
[0006]
The constant bit rate control method in Test Model 5 is an effective method for applications requiring a constant transfer rate.
However, since almost the same code amount is assigned to any part of the moving image sequence, a sufficient amount of code is not given to a complicated scene including a large amount of information, resulting in image quality degradation. On the other hand, in the case of a simple scene with a small amount of information, the code amount becomes excessive, resulting in waste, and an appropriate rate control method for applications capable of variable transfer rates such as DVD-Video. I couldn't say that.
[0007]
A rate control method that solves the above problems is a variable bit rate control method. Japanese Patent Laid-Open No. 6-141298 discloses an encoding apparatus based on variable bit rate control.
In this apparatus, first, provisional encoding is performed on an input moving image using a fixed quantization scale, and a generated code amount is counted every unit time. Next, the target transfer rate of each part is set based on the generated code amount at the time of temporary encoding so that the generated code amount of the entire input moving image becomes a required value. Then, the second encoding, that is, the actual encoding is performed on the input moving image while performing control so as to match the target transfer rate.
[0008]
However, in the above conventional example, in order to obtain an output bit stream, encoding must be performed at least twice, and in applications where real-time performance is required, the variable bit rate of the two-pass method such as this device is used. Control cannot be used.
[0009]
On the other hand, there is a variable bit rate control method for encoding a moving image in almost real time, that is, a one-pass variable bit rate control method. Japanese Patent Laid-Open No. 10-302396 discloses an encoding apparatus using a one-pass variable bit rate control method.
[0010]
In this apparatus, when encoding a moving image, the degree of encoding difficulty per unit time is measured, and this is pre-standardized based on the relationship between the encoding difficulty level and the allocated code amount, and the reference of the allocated code amount per unit time. Find the value.
[0011]
The method of changing from the reference value of the allocated code amount to the actual allocated code amount is such that the sum of the generated code amounts of moving images recorded on the recording medium for a predetermined time length is less than or equal to the actual capacity that can be recorded on the recording medium. Compare the allocated code amount Bav when encoding with a constant allocated code amount bav determined from the actual capacity of the recording medium and the total Bgen of the actual generated code amount up to the present, and when Bav-Bgen is positive, the allocation is greater than bav By permitting the code amount, a variable bit rate control of a one-pass method that guarantees that a moving image having a predetermined time length can be recorded on a recording medium having a fixed recording capacity is realized.
[0012]
[Problems to be solved by the invention]
However, unlike the two-pass method, the variable bit rate control of the one-pass method must be performed without performing the bit rate control without knowing in advance what kind of time complexity of the input video sequence is composed. Don't be.
In the above-described conventional invention, code amount allocation exceeding bav becomes possible in subsequent encoding by the amount that the actual generated code amount falls below a certain allocated code amount bav determined from the actual capacity of the recording medium.
Therefore, if the first half of the video sequence is relatively easy to encode and the second half is difficult, the surplus bits in the first half can be turned to the difficult part in the second half, and the subjective image quality of the entire sequence can be improved. However, when the second half is easy, it is impossible to improve the subjective image quality of the difficult part of the first half, and at the end of the encoding, the code amount is excessive at the easy part of the second half and the capacity of the recording medium is wasted Will occur.
The present invention solves the above-described problem and adds a time-varying margin to the allocated code amount, thereby enabling code amount allocation exceeding a certain allocated code amount even at the beginning of the moving image sequence. It is an object to optimize the overall code amount allocation and improve the overall image quality.
[0013]
[Means for Solving the Problems]
Accordingly, the present invention provides the following apparatus and method in order to solve the above problems.
(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,
At the time of encoding each image constituting the input moving image, the generated code amount for each image is detected, and the total generated code amount from the head image of the input moving image to the image encoded so far Means for detecting
Means for detecting an average quantization scale for each image at the time of encoding each image constituting the input moving image;
The encoded input Movement Means for determining an average target bit rate from a recordable capacity of a recording medium for recording an image and a recording time of the input moving image;
Means for setting a minimum quantization scale based on the average target bit rate;
The margin value, which is a margin of the generated code amount, is set to the maximum value at the start of encoding of the input moving image. When In both cases, a value obtained by gradually decreasing the margin value from the maximum value with time is preset. First Means for setting every predetermined period;
A difference value between an assumed generated code amount that is assumed to be generated when a section from the encoding start time of the input moving image to the present is encoded at the average target bit rate, and the total generated code amount up to the present time. Means for calculating and correcting a margin value set for each predetermined period by adding a certain percentage of the difference value to the margin value;
The corrected margin value, the average quantization scale for each image, and the generated code amount for each image ,in front Average target bit rate And Using known methods, The second encoding unit Means for calculating a target allocation code amount of each image within a predetermined period;
The target allocation code amount and For each macroblock From the generated code amount, by a known method, Each macroblock The quantization scale of And if the determined quantization scale is smaller than the minimum quantization scale, replace the determined quantization scale with the minimum quantization scale. And a video encoding device.
(2) In the video encoding device described in (1) above,
Means for setting a margin value of the generated code amount,
A moving picture coding apparatus, wherein the margin value is determined based on a recorded time of a coded moving picture or a remaining recording time.
(3) In the video encoding device described in (1) above,
Means for setting a margin value of the generated code amount,
Factor some of the recorded time of the encoded video at the observation time, the remaining recording time, the amount of recorded code generated, the remaining capacity for the recording medium, the target transfer rate, the maximum transfer rate, and the actual transfer rate at a given time. A moving picture coding apparatus, wherein the margin value is determined by a function as follows.
(4) In the video encoding device described in any of (1) to (3) above,
Means for performing a predetermined conversion after multiplying the generated code amount for each image by the average quantization scale for each image, and detecting the screen complexity for each image;
The screen complexity Constant Means for determining the average screen complexity, which is the average value over a period,
Have
The means for calculating the target allocation code amount includes:
The average screen complexity, the screen complexity for each image, the corrected margin value, the average quantization scale for each image, and the generated code amount for each image ,in front Average target bit rate And And a moving image coding apparatus that calculates a target allocated code amount of each image within the predetermined period using a known method.
(5) A motion compensation prediction step, an orthogonal transformation step, a quantization step, and a variable length coding of the input moving image Step In a video encoding method for performing encoding with
At the time of encoding each image constituting the input moving image, the generated code amount for each image is detected, and the total generated code amount from the head image of the input moving image to the image encoded so far Detecting steps,
A step of detecting an average quantization scale for each image at the time of encoding each image constituting the input moving image;
The encoded input Movement Determining an average target bit rate from a recordable capacity of a recording medium for recording an image and a recording time of the input moving image;
Setting a minimum quantization scale based on the average target bit rate;
The margin value, which is a margin of the generated code amount, is set to the maximum value at the start of encoding of the input moving image. When In both cases, a value obtained by gradually decreasing the margin value from the maximum value with time is preset. First A step for setting every predetermined period;
A difference value between an assumed generated code amount that is assumed to be generated when a section from the encoding start time of the input moving image to the present is encoded at the average target bit rate, and the total generated code amount up to the present time. Calculating and correcting a margin value set for each predetermined period by adding a certain percentage of the difference value to the margin value;
The corrected margin value, the average quantization scale for each image, and the generated code amount for each image ,in front Average target bit rate And Using known methods, The second encoding unit Calculating a target allocation code amount of each image within a predetermined period;
The target allocation code amount and For each macroblock From the generated code amount, by a known method, Each macroblock The quantization scale of And if the determined quantization scale is smaller than the minimum quantization scale, replace the determined quantization scale with the minimum quantization scale. And a video encoding method comprising: a step.
(6) In the video encoding method described in (5) above,
The step of setting a margin value of the generated code amount includes:
A moving picture encoding method, wherein the margin value is determined according to a recorded time or a remaining recording time of an encoded moving picture.
(7) In the video encoding method described in (5) above,
The step of setting a margin value of the generated code amount includes:
Factor some of the recorded time of the encoded video at the observation time, the remaining recording time, the amount of recorded code generated, the remaining capacity for the recording medium, the target transfer rate, the maximum transfer rate, and the actual transfer rate at a given time. A moving picture coding method, wherein the margin value is determined by a function
(8) In the video encoding method described in any of (5) to (7) above,
Performing a predetermined transformation after multiplying the generated code amount for each image by the average quantization scale for each image to detect the screen complexity for each image;
The screen complexity Constant Obtaining an average screen complexity, which is an average value over a period,
Have
The step of calculating the target allocation code amount includes:
The average screen complexity, the screen complexity for each image, the corrected margin value, the average quantization scale for each image, and the generated code amount for each image ,in front Average target bit rate And A moving picture coding method characterized in that a target allocation code amount of each picture in the predetermined period is calculated by a known method.
[0019]
DETAILED DESCRIPTION OF THE INVENTION
A first embodiment of the moving picture coding apparatus and method according to the present invention will be described below with reference to FIG.
As shown in FIG. 1, the first embodiment of the moving picture coding apparatus and method according to the present invention includes a
[0020]
It is assumed that the original image is divided into macroblock units in advance by an image block divider (not shown).
The divided original image is not subjected to motion compensation prediction for the I picture, the original image block itself is sent to the
[0021]
The output of the
On the other hand, the output coefficient of the
[0022]
For P and B pictures, the divided original image and a predetermined locally decoded image block stored in the frame memory are supplied to the motion compensated
[0023]
After this, DCT is performed in the same manner as for the I picture, quantized by the
[0024]
On the other hand, after the output coefficient of the
[0025]
For each picture, the quantization scale for each macroblock is sent to the average
Here, the generated code amount is added in units of frames, and the generated code amount of one frame is detected.
[0026]
At the same time, the generated
The average quantization scale of each frame, the generated code amount, and the total generated code amount up to the present time are sent to the
[0027]
The average
For example, in the case of the recording medium 35, the set value of the average target bit rate Rave is determined from the capacity capable of recording moving image data and the recording time of the moving image sequence to be recorded thereon. That is, it corresponds to the average bit rate when encoding is performed with fixed bit rate control.
[0028]
The minimum quantization
[0029]
In other words, even if the quantization scale is lowered below a certain value, the quality of the decoded image will hardly change, so limit the quantization scale to a certain value so that the quantization scale does not decrease further. As a result, the amount of generated code is reduced in the portion where the limiter is applied, and the generated code amount is reduced while maintaining the image quality of the decoded image.
By changing the minimum quantization scale according to the average rate, it is possible to select an image quality suitable for the average rate.
[0030]
In the
There are two methods for setting the margin: (1) a margin for the bit rate and (2) a margin for the total amount of generated code within a certain interval.
A margin is set by selecting an appropriate one according to parameter settings such as the recording time and the capacity of the recording medium 35.
[0031]
(1) About margin for bit rate (Figure 2)
FIG. 2 shows an embodiment of a margin distribution method and code amount transition.
The margin is given with respect to the average target bit rate Rave. For example, when Rave is 4 Mbps, when a 10% margin is given, the margin is expressed as 10% or 0.4 Mbps.
[0032]
If the total recording time of the moving image sequence is set, the remaining recording time can be obtained from the recording elapsed time detected by the
For each predetermined period, the code amount margin is determined by the function from the remaining recording time obtained by the
[0033]
However, since the margin will decrease as the sequence goes backward with this alone, the actual total generated code amount of the image encoded up to now and the generated code when this interval is encoded with the average target bit rate Rave By calculating the amount difference and adding a certain percentage of this difference to the margin, a sufficient margin is ensured even in the second half of the sequence.
[0034]
(2) About the margin for the total amount of generated code within a certain interval (Fig. 3)
FIG. 3 shows another embodiment of the margin distribution method and code amount transition.
This is a case where the display of the formal recording capacity in the recording medium 35 is set smaller than the actual maximum capacity. For example, when the capacity display of the recording medium 35 is 1.0 Gbit and the actual maximum capacity is 1.2 Gbit, the margin is Expressed as 20% or 0.2 Gbit.
[0035]
When the total recording time of the moving image sequence or the approximate recording time of the recording medium is displayed, the approximate recording time is divided into a predetermined section length.
In addition, the length of each section divided | segmented may be equal intervals, and may not be so.
[0036]
For each of the divided sections, the capacity margin of the recording medium 35 is distributed by a predetermined method.
The margin allocation method is, for example, proportional to the length of each divided section, that is, if each section is equally spaced, the allocated margin may be equally distributed. As it becomes, the margin is gradually reduced, and the margin remaining in the first half is sequentially carried over to the second half, thereby realizing a margin allocation with less waste.
[0037]
It should be noted that the margin amount allocated to each divided section may be limited to the difference between the actual maximum capacity of the recording medium 35 and the display recording capacity, or a margin amount slightly exceeding that may be set.
[0038]
If the difference in capacity is limited, it is guaranteed that the actual total generated code amount will be less than or equal to the actual maximum capacity of the recording medium 35. If an amount slightly exceeding the capacity difference is set, the actual total code amount will be Although there is no guarantee that the amount of generated code will be less than or equal to the actual maximum capacity of the recording medium 35, the range of image quality improvement in the portion where encoding is difficult is increased accordingly.
When the margin value is sent to the
[0039]
In the
[0040]
As one embodiment, a method for determining a target allocation code amount using MPEG2 Test Model 5 will be described below.
If the bit rate in the fixed bit rate control 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 average allocated code amount Rave of 1 GOP Is given by the following equation (1).
[0041]
[0042]
The allocated code amount Rc of 1 GOP allocated in the
[0043]
[0044]
That is, the value of Rc is controlled at a bit rate that is higher than the fixed bit rate control by a margin. In this case, the amount of code will be insufficient by the margin, but as will be described later, since the quantization scale is limited by the minimum quantization scale, the amount of code generated by the margin is reduced by reducing the amount of code generated in the limited portion. It is possible to fall within a predetermined average target bit rate.
[0045]
By appropriately allocating the assigned code amount Rc to each picture of 1 GOP, the target code amount of each image to be encoded is calculated.
The number of frames of P and B pictures included in one GOP is Np, Nb, and the setting ratio of the quantization scale of P and B pictures to N pictures is Kp, Kb. Let Xi, Xp, and Xb be the product of the generated code amount and the average quantization scale.
At this time, the target allocation code amounts Ti, Tp, and Tb of each picture type are given by the following equations (3), (4), and (5).
Note that MAX [A, B] indicates the operation of selecting the larger of A and B.
[0046]
(I picture)
[0047]
(P picture)
[0048]
(B picture)
[0049]
Furthermore, based on the determined target allocation code amount of each image and the generated code amount of each macroblock detected by the
[0050]
The image
The value of this activity is used for adaptive quantization control for changing the quantization scale of each macroblock in MPEG2 Test Model 5, but this adaptive quantization control need not be performed. Alternatively, adaptive quantization control may be performed by another method.
[0051]
A limiter based on the minimum quantization scale set by the minimum quantization
[0052]
The quantization scale of each macroblock output from the
Further, the output of the
[0053]
The quantization scale for each macroblock and the generated code amount monitored by the
The generated
[0054]
Further, the
[0055]
A second embodiment of the moving picture coding apparatus and method according to the present invention will be described below with reference to FIG.
In the second embodiment, a
[0056]
In the
[0057]
The remaining
[0058]
In the
[0059]
A third embodiment of the moving picture coding apparatus and method according to the present invention will be described below with reference to FIG.
In the third embodiment, a
[0060]
An average quantization scale of one frame is input from the average
[0061]
The screen complexity obtained by the
The average screen complexity Xi-ave, Xp-ave, Xb-ave of each picture type and the screen complexity Xi, Xp, Xb of the picture of the same picture type encoded immediately before are sent to the
[0062]
The average screen complexity Xi-ave, Xp-ave, Xb-ave of each picture type sent from the
[0063]
When the target allocation code amount is determined using MPEG2 Test Model 5, the equation for calculating Rc in equation (1) in the first embodiment changes as shown in the following (6), but the other parts are the first The same as the embodiment.
[0064]
[0065]
As in the second embodiment, the bit rate value set in MPEG2 Test Model 5 etc. is controlled at a bit rate higher than the fixed bit rate control by adding a margin to the average target bit rate. Then, after the target allocation code amount of each image is determined, for the picture type, a value obtained by dividing the screen complexity of the image encoded immediately before by the average screen complexity is obtained as the target allocation code amount of each image obtained. Is multiplied by the code amount allocation in consideration of the screen complexity.
[0066]
Based on the determined target allocation code amount of each image and the generated code amount of each macro block detected by the
[0067]
In the third embodiment described above, the code amount allocation considering the screen complexity is performed on the target allocation code amount of each image obtained in the second embodiment. This is the same as the first embodiment. You may apply to.
[0068]
【The invention's effect】
As described above, according to the present invention, when a moving image is encoded by variable bit rate control, the allocation of the fixed interval is performed based on the generated code amount, quantization scale, target average code amount, and code amount margin of each image. The code amount is determined, and is distributed to each image within a certain section by a predetermined method. For example, the code amount margin setting value is changed according to the recorded time or the remaining recording time of the moving image sequence, is maximum at the beginning of the sequence, is decreased at a constant rate as time elapses, and becomes 0 at the end of the sequence. By setting in this way, it is possible to allocate a code amount exceeding a certain bit rate in an intermediate section without exceeding the actual capacity of the recording medium.
[0069]
Alternatively, when a margin is provided for the actual capacity of the recording medium, the capacity margin of the recording medium is allocated to each section divided into predetermined section lengths of the moving image sequence. Margin allocation is set to a large number at the beginning of the sequence, and gradually set to a smaller number as it becomes the second half.
[0070]
Also, some of the recorded time of the video sequence, the remaining recording time, the recorded generated code amount, the remaining capacity for the recording medium, the target transfer rate, the maximum transfer rate, and the actual transfer rate at a predetermined time are factors. By setting a margin with a function, it is possible to perform more appropriate code amount control.
[0071]
In addition, the assigned code amount of each image distributed by the above method is multiplied by the average quantization scale of each frame and the generated code amount to perform a predetermined conversion to obtain the screen complexity of each frame. Then, by multiplying the allocated code amount of each image by a value obtained by dividing this value by the average screen complexity for each picture type within a certain period, code amount allocation considering the screen complexity is performed, and Also in the moving picture coding by the variable bit rate control, the code amount control according to the characteristics of the image can be performed.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a first embodiment of a moving picture coding apparatus and method according to the present invention.
FIG. 2 is a diagram showing an example of code amount transition of the moving picture coding apparatus and method according to the present invention.
FIG. 3 is a diagram showing another embodiment of code amount transition of the moving picture coding apparatus and method according to the present invention.
FIG. 4 is a block diagram showing a second embodiment of the moving picture coding apparatus and method according to the present invention.
FIG. 5 is a block diagram showing a third embodiment of the moving picture coding apparatus and method according to the present invention.
FIG. 6 is a diagram illustrating an example of a coded picture structure.
FIG. 7 is a diagram illustrating a configuration example of a conventional general moving image encoding device.
[Explanation of symbols]
11 Subtractor
12 DCT device
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
31 Recording time detector
32,32A Margin setting device
33 Average rate setting device
34 Minimum quantization scale setting device
36 Remaining amount detector
37 Rate comparator
Xi, Xp, Xb Screen complexity of the current image
Xi-ave, Xp-ave, Xb-ave average screen complexity
Claims (8)
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の発生符号量を検出するとともに、前記入力動画像の先頭の画像から現在までに符号化した画像までの総発生符号量を検出する手段と、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の平均量子化スケールを検出する手段と、
符号化された前記入力動画像を記録する記録媒体の記録可能容量と、前記入力動画像の記録時間とから平均目標ビットレートを決定する手段と、
前記平均目標ビットレートに基づいて最小量子化スケールを設定する手段と、
前記発生符号量の余裕分であるマ−ジンの値を、前記入力動画像の符号化開始時点では最大値に設定するとともに、時間経過に伴って前記マージンの値を前記最大値から漸次小さくした値を予め設定される第1の所定期間毎に設定する手段と、
前記入力動画像の符号化開始時点から現在までの区間を前記平均目標ビットレートで符号化した場合に発生すると想定される想定発生符号量と、前記現在までの総発生符号量との差分値を算出し、この差分値の一定割合分を前記マージンの値に加算することで、前記所定期間毎に設定するマージンの値を補正する手段と、
前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、符号化単位である第2の所定期間内における各画像の目標割当符号量を算出する手段と、
前記目標割当符号量と各マクロブロックの発生符号量とから、既知の方法により、各マクロブロックの量子化スケールを決定するとともに、この決定された量子化スケールが前記最小量子化スケールよりも小さい場合は、前記決定された量子化スケールを前記最小量子化スケールと置き換える手段とを備えたことを特徴とする動画像符号化装置。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,
At the time of encoding each image constituting the input moving image, the generated code amount for each image is detected, and the total generated code amount from the head image of the input moving image to the image encoded so far Means for detecting
Means for detecting an average quantization scale for each image at the time of encoding each image constituting the input moving image;
A recordable capacity of the recording medium for recording the input moving images encoded, means for determining the average target bit rate from the recording time of the input video,
Means for setting a minimum quantization scale based on the average target bit rate;
The generated code amount of an allowance Ma - the value of Gin, both set to the maximum value in the encoding start time of the input moving image, gradually decreasing the value of the margin from the maximum value over time Means for setting the obtained value for each predetermined first predetermined period;
A difference value between an assumed generated code amount that is assumed to be generated when a section from the encoding start time of the input moving image to the present is encoded at the average target bit rate, and the total generated code amount up to the present time. Means for calculating and correcting a margin value set for each predetermined period by adding a certain percentage of the difference value to the margin value;
Using the value of margin in the correction, the average quantization scale for each picture, the a generated code amount of each image, and a pre-Symbol average target bit rate, by known methods, is coding unit Means for calculating a target assigned code amount of each image within a second predetermined period;
When the quantization scale of each macroblock is determined by a known method from the target allocation code amount and the generated code amount of each macroblock, and the determined quantization scale is smaller than the minimum quantization scale Comprises a means for replacing the determined quantization scale with the minimum quantization scale .
前記発生符号量のマージンの値を設定する手段は、
符号化動画像の記録済み時間または残り記録時間によって前記マージンの値を決定することを特徴とする動画像符号化装置。The moving picture encoding apparatus according to claim 1,
Means for setting a margin value of the generated code amount,
A moving picture coding apparatus, wherein the margin value is determined based on a recorded time of a coded moving picture or a remaining recording time.
前記発生符号量のマージンの値を設定する手段は、
観測時刻における符号化動画像の記録済み時間、残り記録時間、記録済みの発生符号量、記録媒体に対する残り容量、目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数により、前記マージンの値を決定することを特徴とする動画像符号化装置。 The moving picture encoding apparatus according to claim 1,
Means for setting a margin value of the generated code amount,
Factor some of the recorded time of the encoded video at the observation time, the remaining recording time, the amount of recorded code generated, the remaining capacity for the recording medium, the target transfer rate, the maximum transfer rate, and the actual transfer rate at a given time. A moving picture coding apparatus, wherein the margin value is determined by a function as follows .
前記各画像毎の発生符号量と前記各画像毎の平均量子化スケールとを乗算した後に所定の変換を施して、前記各画像毎の画面複雑度を検出する手段と、
前記画面複雑度の一定期間における平均値である平均画面複雑度を求める手段と、
を有し、
前記目標割当符号量を算出する手段は、
前記平均画面複雑度と、前記各画像毎の画面複雑度と、前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、前記所定期間内における各画像の目標割当符号量を算出することを特徴とする動画像符号化装置。In the moving image encoder according to any one of claims 1 to 3,
Means for performing a predetermined conversion after multiplying the generated code amount for each image by the average quantization scale for each image, and detecting the screen complexity for each image;
Means for obtaining an average screen complexity that is an average value of the screen complexity for a certain period;
Have
The means for calculating the target allocation code amount includes:
And said average picture complexity, the a screen complexity of each image, the value of the margin in the correction, the average quantization scale for each picture, and the generated code amount of said each image, before Symbol average target using the bit rate, in a known manner, the moving picture coding apparatus and calculates the target allocated code amount of each image within the predetermined period.
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の発生符号量を検出するとともに、前記入力動画像の先頭の画像から現在までに符号化した画像までの総発生符号量を検出するステップと、
前記入力動画像を構成する各画像の符号化時において、前記各画像毎の平均量子化スケールを検出するステップと、
符号化された前記入力動画像を記録する記録媒体の記録可能容量と、前記入力動画像の記録時間とから平均目標ビットレートを決定するステップと、
前記平均目標ビットレートに基づいて最小量子化スケールを設定するステップと、
前記発生符号量の余裕分であるマ−ジンの値を、前記入力動画像の符号化開始時点では最大値に設定するとともに、時間経過に伴って前記マージンの値を前記最大値から漸次小さくした値を予め設定される第1の所定期間毎に設定するステップと、
前記入力動画像の符号化開始時点から現在までの区間を前記平均目標ビットレートで符号化した場合に発生すると想定される想定発生符号量と、前記現在までの総発生符号量との差分値を算出し、この差分値の一定割合分を前記マージンの値に加算することで、前記所定期間毎に設定するマージンの値を補正するステップと、
前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、符号化単位である第2の所定期間内における各画像の目標割当符号量を算出するステップと、
前記目標割当符号量と各マクロブロックの発生符号量とから、既知の方法により、各マクロブロックの量子化スケールを決定するとともに、この決定された量子化スケールが前記最小量子化スケールよりも小さい場合は、前記決定された量子化スケールを前記最小量子化スケールと置き換えるステップとを備えたことを特徴とする動画像符号化方法。In a moving image encoding method for encoding an input moving image, including a motion compensation prediction step, an orthogonal transform step, a quantization step, and a variable length encoding step ,
At the time of encoding each image constituting the input moving image, the generated code amount for each image is detected, and the total generated code amount from the head image of the input moving image to the image encoded so far Detecting steps,
A step of detecting an average quantization scale for each image at the time of encoding each image constituting the input moving image;
A recordable capacity of the recording medium for recording the input moving image is encoded, and determining the average target bit rate from the recording time of the input video,
Setting a minimum quantization scale based on the average target bit rate;
The generated code amount of an allowance Ma - the value of Gin, both set to the maximum value in the encoding start time of the input moving image, gradually decreasing the value of the margin from the maximum value over time Setting the obtained value for each predetermined first predetermined period;
A difference value between an assumed generated code amount that is assumed to be generated when a section from the encoding start time of the input moving image to the present is encoded at the average target bit rate, and the total generated code amount up to the present time. Calculating and correcting a margin value set for each predetermined period by adding a certain percentage of the difference value to the margin value;
Using the value of margin in the correction, the average quantization scale for each picture, the a generated code amount of each image, and a pre-Symbol average target bit rate, by known methods, is coding unit Calculating a target allocation code amount of each image within a second predetermined period;
When the quantization scale of each macroblock is determined by a known method from the target allocation code amount and the generated code amount of each macroblock, and the determined quantization scale is smaller than the minimum quantization scale Comprises a step of replacing the determined quantization scale with the minimum quantization scale .
前記発生符号量のマージンの値を設定するステップは、
符号化動画像の記録済み時間または残り記録時間によって前記マージンの値を決定することを特徴とする動画像符号化方法。In the moving image encoding method according to claim 5,
The step of setting a margin value of the generated code amount includes:
A moving picture encoding method, wherein the margin value is determined according to a recorded time or a remaining recording time of an encoded moving picture.
前記発生符号量のマージンの値を設定するステップは、
観測時刻における符号化動画像の記録済み時間、残り記録時間、記録済みの発生符号量、記録媒体に対する残り容量、目標転送レート、最大転送レート及び所定時間における実転送レートのうちのいくつかを因数とする関数により、前記マージンの値を決定することを特徴とする動画像符号化方法。In the moving image encoding method according to claim 5,
The step of setting a margin value of the generated code amount includes:
Factor some of the recorded time of the encoded video at the observation time, the remaining recording time, the amount of recorded code generated, the remaining capacity for the recording medium, the target transfer rate, the maximum transfer rate, and the actual transfer rate at a given time. A moving picture coding method, wherein the margin value is determined by a function
前記各画像毎の発生符号量と前記各画像毎の平均量子化スケールとを乗算した後に所定の変換を施して、前記各画像毎の画面複雑度を検出するステップと、
前記画面複雑度の一定期間における平均値である平均画面複雑度を求めるステップと、
を有し、
前記目標割当符号量を算出するステップは、
前記平均画面複雑度と、前記各画像毎の画面複雑度と、前記補正したマージンの値と、前記各画像毎の平均量子化スケールと、前記各画像毎の発生符号量と、前記平均目標ビットレートとを用いて、既知の方法により、前記所定期間内における各画像の目標割当符号量を算出することを特徴とする動画像符号化方法。In the moving image encoding method according to any one of claims 5 to 7,
Performing a predetermined transformation after multiplying the generated code amount for each image by the average quantization scale for each image to detect the screen complexity for each image;
Obtaining an average screen complexity that is an average value of the screen complexity for a certain period;
Have
The step of calculating the target allocation code amount includes:
And said average picture complexity, the a screen complexity of each image, the value of the margin in the correction, the average quantization scale for each picture, and the generated code amount of said each image, before Symbol average target using the bit rate, in a known manner, the moving picture coding method and calculates the target allocated code amount of each image within the predetermined period.
Priority Applications (6)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP19014399A JP4362793B2 (en) | 1999-07-05 | 1999-07-05 | Video encoding apparatus and method |
EP00305070A EP1063851B1 (en) | 1999-06-22 | 2000-06-15 | Apparatus and method of encoding moving picture signal |
CNB001096087A CN1159916C (en) | 1999-06-22 | 2000-06-15 | Moving image coding apparatus and method thereof |
DE60035740T DE60035740T2 (en) | 1999-06-22 | 2000-06-15 | Apparatus and method for encoding motion picture signals |
US09/597,485 US6600783B1 (en) | 1999-06-22 | 2000-06-19 | Apparatus and method of encoding moving picture signal |
US10/454,677 US6922442B2 (en) | 1999-06-22 | 2003-06-05 | Apparatus and method of encoding moving picture signal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP19014399A JP4362793B2 (en) | 1999-07-05 | 1999-07-05 | Video encoding apparatus and method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2001025015A JP2001025015A (en) | 2001-01-26 |
JP4362793B2 true JP4362793B2 (en) | 2009-11-11 |
Family
ID=16253129
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP19014399A Expired - Lifetime JP4362793B2 (en) | 1999-06-22 | 1999-07-05 | Video encoding apparatus and method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4362793B2 (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4203707B2 (en) * | 2001-01-31 | 2009-01-07 | 日本電気株式会社 | A moving picture coding apparatus, a moving picture coding method, and a program using the prior analysis. |
US7151856B2 (en) | 2002-04-25 | 2006-12-19 | Matsushita Electric Industrial Co., Ltd. | Picture coding apparatus and picture coding method |
JP4510696B2 (en) * | 2005-05-17 | 2010-07-28 | キヤノン株式会社 | Image processing apparatus and image processing method |
US8363717B2 (en) | 2005-05-17 | 2013-01-29 | Canon Kabushiki Kaisha | Image processing apparatus |
JP4556844B2 (en) * | 2005-11-04 | 2010-10-06 | パナソニック株式会社 | Code amount control method and code amount control apparatus |
JP4994698B2 (en) * | 2006-04-13 | 2012-08-08 | キヤノン株式会社 | Information transmission apparatus and information transmission method |
JP4878052B2 (en) * | 2008-12-04 | 2012-02-15 | 日本電信電話株式会社 | Video code amount control method, video encoding device, video code amount control program, and recording medium therefor |
-
1999
- 1999-07-05 JP JP19014399A patent/JP4362793B2/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
JP2001025015A (en) | 2001-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4256574B2 (en) | Image signal encoding method and image signal encoding apparatus | |
US6141380A (en) | Frame-level rate control for video compression | |
JP3866538B2 (en) | Video coding method and apparatus | |
JPH11346362A (en) | Real time single path variable bit rate control method, and encoder | |
JP2001169281A (en) | Device and method for encoding moving image | |
JP2002058029A (en) | Device and method for encoding moving picture and medium recording program | |
JP2001169284A (en) | Quantization step setting method in moving image encoder and moving image encoder using the method | |
JP3259702B2 (en) | Moving picture variable bit rate coding apparatus and method | |
JP4221655B2 (en) | Encoding apparatus, encoding method, program, and recording medium | |
JP3907875B2 (en) | Coding rate control device and information coding device | |
JP2001008215A (en) | Dynamic image encoder and method therefor | |
JP4362795B2 (en) | Video encoding apparatus and method | |
JP4257655B2 (en) | Video encoding device | |
JPH10164577A (en) | Dynamic image encoder | |
JP4362793B2 (en) | Video encoding apparatus and method | |
JP3982615B2 (en) | System for converting encoded video data | |
JP4362794B2 (en) | Video encoding apparatus and method | |
JP4179917B2 (en) | Video encoding apparatus and method | |
JP3812267B2 (en) | Video encoding apparatus and method | |
JPH0998427A (en) | Dynamic image encoding device | |
JP3812269B2 (en) | Video encoding apparatus and method | |
JP3858520B2 (en) | Video encoding apparatus and method | |
JP2004040811A (en) | Method and apparatus for controlling amount of dct computation performed to encode motion image | |
JP3480067B2 (en) | Image coding apparatus and method | |
JP2000261799A (en) | Variable rate video coding device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20060331 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20071225 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20080229 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080424 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090501 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090625 |
|
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: 20090724 |
|
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: 20090806 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120828 Year of fee payment: 3 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 4362793 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120828 Year of fee payment: 3 |
|
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: 20120828 Year of fee payment: 3 |
|
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: 20120828 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130828 Year of fee payment: 4 |
|
EXPY | Cancellation because of completion of term |