JP2004357079A - In-frame rate control method in dynamic image coding, in-frame rate control system, dynamic image coding device, and in-frame rate control program - Google Patents

In-frame rate control method in dynamic image coding, in-frame rate control system, dynamic image coding device, and in-frame rate control program Download PDF

Info

Publication number
JP2004357079A
JP2004357079A JP2003153689A JP2003153689A JP2004357079A JP 2004357079 A JP2004357079 A JP 2004357079A JP 2003153689 A JP2003153689 A JP 2003153689A JP 2003153689 A JP2003153689 A JP 2003153689A JP 2004357079 A JP2004357079 A JP 2004357079A
Authority
JP
Japan
Prior art keywords
quantization parameter
code amount
control unit
target
picture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2003153689A
Other languages
Japanese (ja)
Other versions
JP4142497B2 (en
Inventor
Takeshi Nakamura
健 中村
Takeshi Yoshitome
健 吉留
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2003153689A priority Critical patent/JP4142497B2/en
Publication of JP2004357079A publication Critical patent/JP2004357079A/en
Application granted granted Critical
Publication of JP4142497B2 publication Critical patent/JP4142497B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide in-frame rate control with accuracy and stability in dynamic image coding. <P>SOLUTION: A target code amount computing unit 102 calculates a target generating code amount of a succeeding control unit for each control unit in a picture on the basis of a differential between a target value of an accumulated generated code amount and an actual value of the accumulated generated code amount in the picture till then. A quantization parameter computing unit 103 calculates an estimation value of a quantization parameter for generating the target generating code amount from a past encoding result. A quantization parameter smoothing unit 104 calculates a weighted mean value between the estimation value of the quantization parameter and the quantization parameter for each control unit which has been coded until then and uses it as a succeeding quantization parameter for each control unit. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は,動画像符号化におけるフレーム内レート制御技術に関し,特に,従来より正確で安定したレート制御を行なう方法,装置およびプログラムに関する。
【0002】
【従来の技術】
動画像符号化においては,符号化ビットレートを所望のビットレートに保つために,レート制御が行なわれるのが一般的である。一般にレート制御は,各ピクチャに目標符号量を割り当てるフレーム間レート制御と,与えられた目標符号量に合わせてピクチャの発生符号量を制御するフレーム内レート制御に分けることができる。
【0003】
通常,動画像は複数のフレームから構成され,特にインタレース映像の場合には,各フレームは2つのフィールドから構成される。動画像符号化においては,フレーム単位で符号化するものと,フィールド単位で符号化するものがあるが,これらの符号化単位をまとめて以下,ピクチャという。
【0004】
ここで,本来制御の単位の名称からして,フレーム間レート制御,フレーム内レート制御は,ピクチャ間レート制御,ピクチャ内レート制御と呼ぶべきであるが慣習としてフレーム間レート制御,フレーム内レート制御という呼び方が一般的であるため,こちらの呼び方も同一の意味として使用する。すなわち,本明細書におけるフレーム間レート制御,フレーム内レート制御は,フィールド単位の符号化の制御を排除するものではない。
【0005】
フレーム内(ピクチャ内)レート制御では,ピクチャ内の各符号化単位の量子化パラメータの制御を行ないながら符号化を行なうのが一般的である。
【0006】
MPEG−2のテストモデル5(以下,TM5という)に示されるピクチャ内レート制御手法においては,与えられたピクチャ目標符号量にピクチャの発生符号量を一致させるために,毎マクロブロックごとに量子化パラメータを決定する(非特許文献1参照)。
【0007】
毎マクロブロック符号化ごとに,それまでのピクチャ内累積発生符号量の実際値から目標値を引いた差分値を求める。ピクチャ内累積発生符号量の目標値とは,ピクチャ目標符号量を全マクロブロックに平均に分配した場合の各マクロブロック目標符号量の累積値である。各マクロブロックの量子化パラメータは,その差分値に初期値を足した値に比例した値とする。これにより,差分値が大きい場合には,量子化パラメータが大きくなり,発生符号量が減り,差分値が小さい場合には,量子化パラメータが小さくなり,発生符号量が増えることにより,レート制御が実現される。
【0008】
これを式で表すと下記のようになる。
【0009】
=d・31/r ……(1)
=d+(Bj−1 −(j−1)・T/N) ……(2)
jは処理対象のマクロブロック番号,Nは総マクロブロック数,Bj−1 はマクロブロック番号j−1までの累積発生符号量,Tはピクチャ目標符号量,r は制御の応答の強弱を決めるパラメータである。また,dは変数dの初期値であり,その値は直前同種ピクチャの最後のマクロブロックのdが用いられる。
【0010】
このdの値によってピクチャの最初のマクロブロックの量子化パラメータが決まるため,その量子化パラメータの値を以下において,量子化パラメータの初期値Qと呼ぶことにする。すなわち,Q=d・31/rとする。
【0011】
実際の制御では,量子化パラメータは,上記Qにマクロブロックごとの特性に応じた係数Nact を乗じて,2倍したのち,規格上取りうる値(2〜62,または1〜112)にクリッピングした値mquantが用いられるが,ここでは簡単のためにQを量子化パラメータと呼ぶことにする。
【0012】
mquant=clip(2.0・Q・Nact ) ……(3)
以上述べた方法は比較的計算量も少なく,制御の特性が良く知られているために,この制御手法を基にする制御方法は広く用いられている。
【0013】
マクロブロック単位での制御の例を説明したが,それ以外の単位で同様の符号化制御をすることも考えられる。例えば,TM5では制御の単位がマクロブロック単位であったが,実装上の観点から見ると,より制御の単位が大きいほうが計算量が少なく有利な場合がある。そのため,制御の単位を水平に連続するマクロブロックの集合であるスライス単位とし,スライスに一度だけ,上記式を計算しスライスの量子化パラメータを決定する方法などがありうる。この場合,制御の応答はやや遅くなるが,量子化パラメータ決定のための計算量を削減できる利点がある。
【0014】
図5は,上記TM5に示されるピクチャ内レート制御手法を用いた従来の符号化装置の構成例を示す図である。図5において,2は符号化装置,11は入力画像信号から動き探索・補償部18からの信号を減じて予測誤差を求める減算部,12は予測誤差をDCT変換するDCT部,13はDCT部12で得られた変換係数を量子化する量子化部,14は量子化部13で得られた量子化変換係数を逆量子化する逆量子化部である。
【0015】
15は逆量子化した係数を逆DCT変換する逆DCT部,16は逆DCT部15で得られた差分画像に動き探索・補償部18からの信号を加算する加算部,17は復号画像が格納されるフレームメモリ,18はフレームメモリ17に格納された復号画像を参照フレームとして動き探索,動き補償を行う動き探索・補償部,19は量子化部13で得られた量子化変換係数を可変長符号化する可変長符号化部である。
【0016】
また,20はピクチャの発生符号量を制御する符号化制御部,60はフレーム内(ピクチャ内)の量子化パラメータを制御するフレーム内量子化制御部,100はピクチャ内の発生符号量を累算する累積符号量累算部,101は現時点までのピクチャ内の累積発生符号量の目標値を算出する目標累積符号量計算部である。
【0017】
105は目標累積符号量計算部101により算出された累積発生符号量の目標値から累積符号量累算部100に記録された累積発生符号量の値を減じる減算部,106は減算部105による減算結果に基づいて量子化パラメータを算出する量子化パラメータ計算部である。
【0018】
まず,DCT部12が,減算部11で得られた予測誤差をDCT変換し,量子化部13が,符号化制御部20が決定した量子化パラメータQに従って,変換係数を量子化する。量子化後の変換係数に対して,逆量子化部14,逆DCT部15が,それぞれ逆量子化,逆DCT変換を行い,その結果に加算部16が動き探索・補償部18からの信号を加算する。その結果得られた復号画像をフレームメモリ17に格納する。
【0019】
一方,可変長符号化部19は,量子化部13による量子化後の変換係数を可変長符号化するとともに,発生符号量Rの情報をフレーム内量子化制御部60内の累積符号量累算部100に送信する。累積符号量累算部100は,送信されたそれまでの発生符号量Rを累算して記録する。
【0020】
そして,減算部105が,目標累積符号量計算部101により算出された累積発生符号量の目標値から累積符号量累算部100に記録された実際の累積発生符号量の値を減じる。量子化パラメータ計算部106は,減算部105による減算結果に基づいて次の制御単位の量子化パラメータQを算出し,算出された量子化パラメータQの情報を量子化部13に送信する。
【0021】
【非特許文献1】
MPEG−2 Test Model 5, Document ISO/IEC JTC1 SC29 WG11/93−400, Test Model Editing Committee, April 1993.
【0022】
【発明が解決しようとする課題】
しかし,上記従来技術の方法では以下のような問題がある。一つは制御の安定性に関する問題である。一般に量子化パラメータQと発生符号量Rとは,反比例に近い関係にあるため,図6に示すように量子化パラメータが大きい場合の符号量変化より量子化パラメータが小さい場合の符号量変化の方が大きい。
【0023】
TM5では,ピクチャ内累積発生符号量の実際値と目標値の差分値に比例して量子化パラメータの値を変化させているために,この差分値が負の値をとり,量子化パラメータが小さい時に特に応答が敏感になる。そのため,制御単位がマクロブロック単位でなくスライス単位などであり,フィードバックが遅い系においては,制御の過程で量子化パラメータが必要以上に小さくなった後に符号量が爆発的に増えて制御が振動的になる問題がある。
【0024】
もう一つは,制御の正確性に関する問題である。TM5においては,制御の過程でピクチャ内累積発生符号量の実際値と目標値が一致した場合は,d=dとなり,量子化パラメータは初期値Qとなる。しかし,Qがそのピクチャの絵柄および目標符号量に適切な値でない場合には,発生符号量が再びピクチャ内累積発生符号量の実際値と目標値が乖離する方向に働く。
【0025】
例えば,初期値Qが適切な値より小さい場合には,符号量が出過ぎて,ピクチャ内累積発生符号量の実際値と目標値の差分値が再び増えていく。このため,Qの値が適切な値でない場合,発生符号量と目標符号量との偏差が必ず残ってしまう。
【0026】
別の見方をすれば,制御の過程においてある量子化パラメータで発生符号量がT/Nとなる状態が続くと,ピクチャ内累積発生符号量の実際値と目標値の差分値が変化しないために量子化パラメータも変化せず,それ以上目標符号量に近づかない定常状態に陥ってしまう問題がある。このために,ピクチャに与えられた目標符号量を正確に実現することができないという問題がある。
【0027】
本発明は,上記従来技術の問題点を解決し,正確で安定したレート制御を可能とするフレーム内レート制御を実現することを目的とする。
【0028】
【課題を解決するための手段】
上記課題を解決するため,本発明は,ピクチャ内の制御単位ごとに,次の制御単位の目標符号量を決定し,それまでに符号化した制御単位の発生符号量と量子化パラメータとの積をその発生符号量の目標値で割るなどして,次の制御単位の目標符号量を発生させる量子化パラメータを推定する。または,目標符号量の逆数に比例した値を量子化パラメータとする。
【0029】
そして,そのようにして求めた量子化パラメータとそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとすることによってレート制御を行なう。このような制御を行なうことにより,前述の制御の安定性に関する問題と正確性に関する問題を解決することができる。
【0030】
本発明の作用は,以下のとおりである。本発明では,次の制御単位の目標符号量を決定し,その符号量を発生させる量子化パラメータを推定したり,または,その目標発生符号量の逆数に比例した値を量子化パラメータとしたりすることにより,符号量が異常に出過ぎたり,出なかったりすることによる制御の不安定化を防ぐことができる。ここで,目標符号量を発生させる量子化パラメータの推定は,例えば,それまでに符号化した制御単位の発生符号量と量子化パラメータとの積を,次の制御単位の発生符号量の目標値で割った値などを推定値とすることなどにより行う。
【0031】
上述した従来法(TM5)と本発明によるレート制御方法との違いを,図7に示す従来のレート制御概念図と,図1に示す本発明によるレート制御概念図とを用いて説明する。従来法では,図7に示すように,目標値(j・T/N)と累積発生符号量(B)との差分をとり,差分値に基づいて量子化パラメータQの計算を行い,算出された量子化パラメータQに基づいて符号化を行い,発生符号量Rを積分器(図5の累積符号量累算部100)により累算する方法を採っていた。しかし,従来法では,制御対象が直線的な特性を持っておらず,その特性を補正することを行なっていなかったため,制御全体も安定しにくかった。
【0032】
一方,本発明においては,図1のレート制御概念図に示すように,目標値(j・T/N)と累積発生符号量(B)との差分値に基づいて量子化パラメータQの計算を行うにあたり,差分値から目標符号量R’ を算出し,算出された目標符号量R’を発生させる量子化パラメータQ’を推定し,その推定した量子化パラメータQ’を平滑化して,量子化パラメータQを決定する。
【0033】
本発明においては,量子化パラメータの計算において,制御対象の特性と逆の特性をもつ変換,すなわち,目標発生符号量の逆数に比例した値(仮の量子化パラメータ)を求めたり,目標符号量を発生させる量子化パラメータを推定する操作を行なうために,累積発生符号量と目標値との差分値と符号化による発生符号量の関係が直線的になり,制御系全体の安定性が増す。
【0034】
また,制御単位ごとの目標符号量を適切に決定することにより,ピクチャに与えられた目標符号量を正確に実現することができるようになる。例えば,ピクチャ目標符号量Tをピクチャ内の制御単位の数Nで割った値から,それまでに出過ぎた符号量を一定率Kずつ返す分を差し引いて,次の制御単位の目標符号量などに設定する。すなわち,次の制御単位の目標符号量を,
目標符号量=T/N−K・(Bj−1 −(j−1)・T/N)
などとすることにより,ピクチャに与えられた目標符号量を従来よりも正確に実現することができるようになる。
【0035】
一方,ピクチャ内の制御単位ごとの発生符号量と量子化パラメータの関係は通常大きく異なるために,上記のように毎制御単位ごとの発生符号量が比較的一定値に近くなるように量子化パラメータを決定すると,制御単位ごとの量子化パラメータの変動が大きくなってしまう。そこで,求めた量子化パラメータとそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値をとることによりその変動を抑制する。
【0036】
例えば,直前に符号化した制御単位の量子化パラメータと今回求めた量子化パラメータとの間で7対1の重み付き平均をとり,この値を量子化パラメータとする。これにより,制御の正確性は若干落ちるもののピクチャ内の制御単位ごとの量子化パラメータの変動を滑らかにすることができ,視覚的にもすぐれた制御を実現することができる。また,制御の安定性と正確性に関しても従来より優れた性能を得ることができる。
【0037】
すなわち,本発明は,ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定し,過去の符号化結果からその目標発生符号量を発生させる量子化パラメータを推定し,その値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとすることを特徴とする。
【0038】
また,本発明は,ピクチャ内の制御単位ごとに,それまでのピクチャ内累積発生符号量の目標値と実際値との差分に基づいて,次の制御単位の目標発生符号量を決定し,それまでに符号化した制御単位の発生符号量と量子化パラメータとの積を次の制御単位の発生符号量の目標値で割って量子化パラメータを決定し,その値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を次の制御単位の量子化パラメータとすることを特徴とする。
【0039】
また,本発明は,ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定し,その逆数に比例して量子化パラメータを決定し,その決定した値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとすることを特徴とする。
【0040】
【発明の実施の形態】
以下に,図を用いて,本発明の実施の形態について説明する。
【0041】
〔装置の構成例〕
図2は,本発明のピクチャ内レート制御方法を用いた符号化装置の構成例を示す図である。1は符号化装置,10はピクチャの発生符号量を制御する符号化制御部,50はフレーム内(ピクチャ内)の量子化パラメータを制御するフレーム内量子化制御部である。符号化装置1の符号化制御部10を除いた部分は,図5で説明した従来の符号化装置2の符号化制御部20を除いた部分の構成と同様である。
【0042】
図2において,100はピクチャ内のそれまでの発生符号量を累算する累積符号量累算部,101はピクチャ内の現時点での累積発生符号量の目標値を算出する目標累積符号量計算部,102は減算部105による減算結果に基づいて次の制御単位の目標符号量R’を算出する目標符号量計算部である。
【0043】
103は目標符号量計算部102が算出した目標符号量R’に対応する量子化パラメータQ’を算出する量子化パラメータ計算部,104は量子化パラメータ計算部103が算出した量子化パラメータQ’を平滑化して,次の制御単位の量子化パラメータQを算出する量子化パラメータ平滑化部である。
【0044】
符号化装置1の動作は,以下のとおりである。まず,DCT部12が,減算部11で得られた予測誤差をDCT変換し,量子化部13が,符号化制御部10が決定した量子化パラメータQに従って,変換係数を量子化する。量子化後の変換係数に対して,逆量子化部14,逆DCT部15が,それぞれ逆量子化,逆DCT変換を行い,その結果に加算部16が動き探索・補償部18からの信号を加算する。その結果得られた復号画像をフレームメモリ17に格納する。
【0045】
一方,可変長符号化部19は,量子化部13による量子化後の変換係数を可変長符号化し,発生符号量Rの情報をフレーム内量子化制御部50内の累積符号量累算部100に送信する。
【0046】
累積符号量累算部100は,送信されたそれまでの発生符号量Rを累算して記録する。そして,減算部105が,目標累積符号量計算部101により算出された累積発生符号量の目標値から累積符号量累算部100に記録された実際の累積発生符号量の値を減じる。目標符号量計算部102は,減算部105による減算結果に基づいて,次の制御単位の発生符号量の目標値である目標符号量R’を算出し,算出された目標符号量R’の情報を量子化パラメータ計算部103に送信する。量子化パラメータ計算部103は,目標符号量計算部102から送信された目標符号量R’に基づいて,目標符号量R’を発生させるための量子化パラメータQ’を算出する。
【0047】
ここで,後述するように,目標符号量R’を発生させるための量子化パラメータQ’は,例えばそれまでに符号化した制御単位の発生符号量Rと量子化パラメータとの積を目標符号量R’で割るなどして,または,目標符号量R’の逆数に比例した値として算出する。
【0048】
量子化パラメータ平滑化部104は,量子化パラメータが急激に変化しないように,量子化パラメータ計算部103が算出した量子化パラメータQ’を平滑化し,平滑化の結果得られる量子化パラメータQの情報を量子化部13に送信する。ここで,量子化パラメータ平滑化部104が行う平滑化処理は,例えば,量子化パラメータQ’とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータQとすることにより行う。
【0049】
〔第1の実施の形態〕
図3は,本発明の第1の実施の形態に係るレート制御処理フローを示す図である。本発明の第1の実施の形態では,ピクチャ内レート制御をスライス単位で符号化制御を行なうものとする。ピクチャ内のスライス数はNであるものとする。
【0050】
始めに,ピクチャ間レート制御アルゴリズムにより,これから符号化するピクチャの目標符号量Tを決定する(ステップS1)。このアルゴリズムは本発明の範囲ではないが,例えば,TM5には過去の符号化結果(発生符号量および量子化パラメータ)および残りGOP符号量などからピクチャ目標符号量を計算する手法が紹介されている。
【0051】
ピクチャの符号化の始めに,最初の1スライス(スライス0)の量子化パラメータの値Qを決定する。これから符号化するピクチャと同じピクチャタイプを持つ過去のピクチャが存在しない場合には(ステップS2),I,PピクチャではQ=10,BピクチャではQ=14とする(ステップS3)。存在する場合には,同種ピクチャの最も近い過去のピクチャ(直前同種ピクチャ)の最後のスライスの量子化パラメータを1スライス目の量子化パラメータQとする(ステップS4)。
【0052】
この量子化パラメータQを用いて,1スライス目(スライス0)を符号化する(ステップS5)。実際には,量子化パラメータQにマクロブロックごとの特性に応じた係数Nact を乗じて,2倍したのち,規格上取りうる値(2〜62,または1〜112)にクリッピングした値mquantを用い,スライス0内の各マクロブロックの符号化を行なう。スライス0の符号化が終了したら,スライス0の発生符号量Rを集計し,次のスライス1の量子化パラメータQを以下のように決定する。
【0053】
ここでより一般的に,スライスjの量子化パラメータQを決定する方法を記述する。ただし,jは1以上N−1以下である。スライスj−1の符号化が終了したら,スライスの発生符号量Rj−1 を集計し(ステップS6),スライスj−1の発生符号量Rj−1 と量子化パラメータQj−1 との積により,スライスj−1の複雑さ指標Xj−1 を求める(ステップS7)。
【0054】
j−1 =Qj−1 ・Rj−1 ……(4)
次に,スライスj−1の発生符号量Rj−1 から,スライスj−1までのピクチャ内の累積発生符号量Bj−1 を求める(ステップS8)。j=1の場合,B=Rであり,j≧2の場合,下記のとおりである。
【0055】
j−1 =Rj−1 +Bj−2 ……(5)
次にスライスjの目標符号量R’ を決定する(ステップS9)。目標符号量R’ は,「(1スライスあたりの平均目標符号量)−(返済符号量)」で決定する。1スライスあたりの平均目標符号量は,1ピクチャ目標符号量Tをピクチャ内のスライス数Nで割った値であり,返済符号量は,その時点の累積発生符号量の実際値と目標値の差分値に定率K(例えば0.1)を掛けた量とする。
【0056】
R’ =T/N−0.1・(Bj−1 −(j−1)・T/N) …(6)
このスライスjの目標符号量R’ を発生させるための量子化パラメータQ’をスライスj−1の複雑さ指標Xj−1 を用いて求める。すなわち,下記のように,スライスj−1の複雑さ指標Xj−1 を,スライスjの目標符号量R’ で割って量子化パラメータQ’を求める(ステップS10)。
【0057】
Q’=Xj−1 /R’ ……(7)
これは,量子化パラメータと発生符号量が反比例するという近似と,直前のスライスの複雑さ指標と,これから符号化するスライスの複雑さ指標とがあまり変わらないという近似に基づいている。
【0058】
今回求めた値Q’と前のスライスで決定された値Qj−1 との間で,a:(1−a)(aは例えば1/8など)の比率で重み付き平均をとって,スライスjの量子化パラメータQを決定する(ステップS11)。
【0059】
=1/8・Q’+7/8・Qj−1 ……(8)
これは,量子化パラメータはスライス毎に急激に変化すると画質や安定性の面で望ましくないので,量子化パラメータを平滑化する効果がある。
【0060】
実際には,量子化パラメータQにマクロブロックごとの特性に応じた係数Nact を乗じて,2倍したのち,規格上取りうる値(2〜62,または1〜112)にクリッピングした値mquantを用い,スライスj内の各マクロブロックの符号化を行なう(ステップS12)。
【0061】
ステップS6〜S12をピクチャ内の全てのスライスについて繰り返し(ステップS13),ピクチャ符号化終了時には,最終スライスの量子化パラメータQを,後の同種ピクチャの初期値のために記憶しておく(ステップS14)。
【0062】
これをすべてのピクチャ符号化について繰り返す(ステップS15)。このようにすることによって,従来より正確で安定したレート制御を行なうことができる。
【0063】
〔第2の実施の形態〕
図4は,本発明の第2の実施の形態に係るレート制御処理フローを示す図である。本発明の第2の実施の形態では,ピクチャ内レート制御をM個のマクロブロックを一つの制御単位(以下,MBグループという)として符号化制御を行なうものとする。ピクチャ内のMBグループの数はNであるものとする。
【0064】
始めに,ピクチャ間レート制御アルゴリズムにより,これから符号化するピクチャの目標符号量Tを決定する(ステップS21)。このアルゴリズムは,本発明の範囲ではない。ピクチャの符号化の始めに,最初の制御単位(MBグループ0)の量子化パラメータの値Qを決定する。これから符号化するピクチャと同じピクチャタイプを持つ過去のピクチャが存在しない場合には(ステップS22),I,PピクチャではQ=10,BピクチャではQ=14とする(ステップS23)。存在する場合には,同種ピクチャの最も近い過去のピクチャ(直前同種ピクチャ)の最後のMBグループの量子化パラメータをQとする(ステップS24)。
【0065】
この量子化パラメータQを用いて,MBグループ0を符号化する(ステップS25)。実際には,量子化パラメータQにマクロブロックごとの特性に応じた係数Nact を乗じて,2倍したのち,規格上取りうる値(2〜62,または1〜112)にクリッピングした値mquantを用いMBグループ0内の各マクロブロックの符号化を行なう。
【0066】
MBグループ0の符号化が終了したら,MBグループの発生符号量Rを集計し,MBグループjの量子化パラメータQを以下のように決定する。ここでより一般的に,MBグループjの量子化パラメータQを決定する方法を記述する。ただし,jは1以上N−1以下である。
【0067】
MBグループj−1の符号化が終了したら,MBグループの発生符号量Rj−1 を集計する(ステップS26)。次に,MBグループの複雑さ指標Xj−1 (Xj−1 =Rj−1 ・Qj−1 )を計算し記憶する(ステップS27)。そして,MBグループj−1の発生符号量Rj−1 から,MBグループj−1までのピクチャ内の累積発生符号量Bj−1 を求める(ステップS28)。j=1の場合,B=Rであり,j≧2の場合,下記のとおりである。
【0068】
j−1 =Rj−1 +Bj−2 ……(9)
次に,MBグループjの目標符号量R’を決定する(ステップS29)。目標符号量R’は,「(1MBグループあたりの平均目標符号量)−(返済符号量)」で決定する。1MBグループあたりの平均目標符号量は,1ピクチャ目標符号量Tをピクチャ内のMBグループ数Nで割った値であり,返済符号量は,その時点の累積発生符号量の実際値と目標値との差分値を,残り制御単位数N−jで割った値とする。
【0069】
R’=T/N−(Bj−1 −(j−1)・T/N)/(N−j)…(10)
このMBグループjの目標符号量R’の逆数に比例した値を仮の量子化パラメータQ’ として求める(ステップS30)。
【0070】
Q’ =X/R’ ……(11)
このとき用いる比例定数Xは,直前同種ピクチャの全MBグループの複雑さ指標の平均値,すなわちMBグループの発生符号量と平均量子化パラメータとの積の平均値とし,ピクチャ内の各MBグループについて同じ値を用いる。このようにすることによって,MBグループjの符号化時に実際に発生する符号量はMBグループjの目標符号量R’とは必ずしも一致しないが,仮の量子化パラメータQ’は変動が少なくなり視覚的に望ましいというメリットがある。
【0071】
そして,今回求めた仮の量子化パラメータQ’と前の2つのMBグループの仮の量子化パラメータQ’j−1 との間で1:1:1の比率で重み付き平均(移動平均)をとって,以下のようにMBグループjの量子化パラメータQを決定する(ステップS31)。
【0072】
=(Q’+Q’j−1 +Q’j−2 )/3 ……(12)
実際には,量子化パラメータQにマクロブロックごとの特性に応じた係数Nact を乗じて,2倍したのち,規格上取りうる値(2〜62,または1〜112)にクリッピングした値mquantを用いMBグループj内の各マクロブロックの符号化を行なう(ステップS32)。ステップS26〜S32をピクチャ内の全てのMBグループについて繰り返し(ステップS33),ピクチャ符号化終了時には,最終MBグループの量子化パラメータQを,後の同種ピクチャの初期値のために記憶しておく(ステップS34)。また,MBグループの複雑さ指標の平均値Xを記憶しておく(ステップS35)。
【0073】
これをすべてのピクチャ符号化について繰り返す(ステップS36)。このようにすることによって,従来より正確で安定したレート制御を行なうことができる。
【0074】
以上説明した各実施の形態の処理は,ハードウェアや符号化処理専用のプロセッサによって実現することができ,また,汎用のコンピュータとソフトウェアプログラムとによって実現することもできる。そのソフトウェアプログラムは,コンピュータ読み取り可能な記録媒体に記録して提供することも,ネットワークを通して提供することも可能である。
【0075】
【発明の効果】
本発明によれば,次の制御単位の目標符号量を決定し,その符号量を発生させる量子化パラメータを推定したり,または,その目標発生符号量の逆数に比例した値を量子化パラメータとしたりすることにより,符号量が異常に出過ぎたり,出なかったりすることによる制御の不安定化を防ぐことができる。
【0076】
また,本発明によれば,例えば,ピクチャ目標符号量Tをピクチャ内の制御単位の数Nで割った値から,それまでに出過ぎた符号量を一定率Kずつ返す分を差し引いて次の制御単位の目標符号量に設定するなど,制御単位ごとの目標符号量を適切に決定することにより,ピクチャに与えられた目標符号量を正確に実現することができるようになる。
【図面の簡単な説明】
【図1】本発明によるレート制御概念図である。
【図2】本発明のピクチャ内レート制御方法を用いた符号化装置の構成例を示す図である。
【図3】本発明の第1の実施の形態に係るレート制御処理フローを示す図である。
【図4】本発明の第2の実施の形態に係るレート制御処理フローを示す図である。
【図5】従来の符号化装置の構成例を示す図である。
【図6】量子化パラメータと発生符号量との関係を示す図である。
【図7】従来のレート制御概念図である。
【符号の説明】
1,2 符号化装置
10,20 符号化制御部
11 減算部
12 DCT部
13 量子化部
14 逆量子化部
15 逆DCT部
16 加算部
17 フレームメモリ
18 動き探索・補償部
19 可変長符号化部
50,60 フレーム内量子化制御部
100 累積符号量累算部
101 目標累積符号量計算部
102 目標符号量計算部
103,106 量子化パラメータ計算部
104 量子化パラメータ平滑化部
105 減算部
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an intra-frame rate control technique in video coding, and more particularly to a method, apparatus, and program for performing more accurate and stable rate control than before.
[0002]
[Prior art]
In video coding, rate control is generally performed to maintain the coding bit rate at a desired bit rate. In general, rate control can be divided into inter-frame rate control in which a target code amount is assigned to each picture, and intra-frame rate control in which a generated code amount of a picture is controlled in accordance with a given target code amount.
[0003]
Generally, a moving image is composed of a plurality of frames, and particularly in the case of interlaced video, each frame is composed of two fields. In moving image coding, there are a method of coding in units of frames and a method of coding in units of fields. These coding units are collectively referred to as a picture.
[0004]
Here, from the name of the control unit, the inter-frame rate control and the intra-frame rate control should be called inter-picture rate control and intra-picture rate control. Is generally used, so this name is used interchangeably. That is, the inter-frame rate control and the intra-frame rate control in this specification do not exclude the control of the coding in the field unit.
[0005]
In the intra-frame (in-picture) rate control, encoding is generally performed while controlling the quantization parameter of each encoding unit in the picture.
[0006]
In the intra-picture rate control method shown in MPEG-2 test model 5 (hereinafter referred to as TM5), in order to make the generated code amount of a picture equal to a given picture target code amount, quantization is performed for each macroblock. The parameters are determined (see Non-Patent Document 1).
[0007]
For each macroblock coding, a difference value is calculated by subtracting the target value from the actual value of the accumulated code amount in the picture up to that time. The target value of the cumulative code amount in a picture is the cumulative value of the target code amount of each macroblock when the target code amount of the picture is distributed to all macroblocks on average. The quantization parameter of each macroblock is a value proportional to a value obtained by adding an initial value to the difference value. As a result, when the difference value is large, the quantization parameter becomes large, and the generated code amount decreases. When the difference value is small, the quantization parameter becomes small, and the generated code amount increases. Is achieved.
[0008]
This is represented by the following equation.
[0009]
Q j = D j ・ 31 / r …… (1)
d j = D 0 + (B j-1 − (J−1) · T / N) (2)
j is the macroblock number to be processed, N is the total number of macroblocks, B j-1 Is a cumulative generated code amount up to the macroblock number j-1, T is a picture target code amount, and r is a parameter for determining the strength of control response. Also, d 0 Is the variable d j Of the last macroblock of the immediately preceding picture of the same type. j Is used.
[0010]
This d 0 Determines the quantization parameter of the first macroblock of the picture, the value of the quantization parameter is defined below as the initial value Q of the quantization parameter. 0 I will call it. That is, Q 0 = D 0 ・ Set to 31 / r.
[0011]
In actual control, the quantization parameter is Q j To the coefficient N according to the characteristics of each macroblock act Multiplied by 2 and then the value mquant which is clipped to a value (2-62 or 1-112) that can be taken in the standard j Is used, but here Q j Is referred to as a quantization parameter.
[0012]
mquant j = Clip (2.0 · Q j ・ N act ) …… (3)
Since the above-described method has a relatively small amount of calculation and well-known control characteristics, a control method based on this control method is widely used.
[0013]
Although an example of control in units of macro blocks has been described, similar coding control may be performed in other units. For example, in TM5, the control unit is a macroblock unit, but from the viewpoint of mounting, a larger control unit may be advantageous because the calculation amount is smaller. Therefore, there is a method in which the control unit is a slice unit which is a set of horizontally continuous macroblocks, and the above expression is calculated only once for each slice to determine the quantization parameter of the slice. In this case, although the response of the control is slightly delayed, there is an advantage that the amount of calculation for determining the quantization parameter can be reduced.
[0014]
FIG. 5 is a diagram showing a configuration example of a conventional encoding device using the intra-picture rate control method shown in the TM5. In FIG. 5, reference numeral 2 denotes an encoding device; 11, a subtraction unit for subtracting a signal from the motion search / compensation unit 18 from an input image signal to obtain a prediction error; 12, a DCT unit for performing DCT conversion of the prediction error; A quantizing unit that quantizes the transform coefficient obtained in 12 is an inverse quantizing unit that inversely quantizes the quantized transform coefficient obtained in the quantizing unit 13.
[0015]
Reference numeral 15 denotes an inverse DCT unit for performing an inverse DCT transform of the inversely quantized coefficient, 16 an addition unit for adding a signal from the motion search / compensation unit 18 to the difference image obtained by the inverse DCT unit 15, and 17 a decoded image. A frame memory 18, a motion search / compensation unit for performing motion search and motion compensation using the decoded image stored in the frame memory 17 as a reference frame, and 19 a variable-length quantization transform coefficient obtained by the quantization unit 13. This is a variable length coding unit to be coded.
[0016]
Reference numeral 20 denotes an encoding control unit for controlling the generated code amount of a picture; 60, an intra-frame quantization control unit for controlling a quantization parameter in a frame (in a picture); The accumulated code amount accumulating unit 101 is a target accumulated code amount calculating unit that calculates a target value of the accumulated code amount in the picture up to the present time.
[0017]
A subtraction unit 105 subtracts the value of the accumulated code amount recorded in the accumulated code amount accumulation unit 100 from the target value of the accumulated code amount calculated by the target accumulated code amount calculation unit 101, and a subtraction unit 106 subtracts 106. A quantization parameter calculation unit that calculates a quantization parameter based on a result.
[0018]
First, the DCT unit 12 performs DCT on the prediction error obtained by the subtraction unit 11, and the quantization unit 13 quantizes the transform coefficient according to the quantization parameter Q determined by the coding control unit 20. The inverse quantization unit 14 and the inverse DCT unit 15 respectively perform inverse quantization and inverse DCT transform on the quantized transform coefficient, and the addition unit 16 adds the signal from the motion search / compensation unit 18 to the result. to add. The decoded image obtained as a result is stored in the frame memory 17.
[0019]
On the other hand, the variable length coding unit 19 performs variable length coding on the transform coefficient after quantization by the quantization unit 13 and accumulates information on the generated code amount R in the intra-frame quantization control unit 60. Transmit to the unit 100. The accumulated code amount accumulating unit 100 accumulates and records the transmitted generated code amount R up to that time.
[0020]
Then, the subtraction unit 105 subtracts the value of the actual accumulated code amount recorded in the accumulated code amount accumulation unit 100 from the target value of the accumulated code amount calculated by the target accumulated code amount calculation unit 101. The quantization parameter calculation unit 106 calculates the quantization parameter Q of the next control unit based on the result of the subtraction by the subtraction unit 105, and transmits information on the calculated quantization parameter Q to the quantization unit 13.
[0021]
[Non-patent document 1]
MPEG-2 Test Model 5, Document ISO / IEC JTC1 SC29 WG11 / 93-400, Test Model Editing Committee, April 1993.
[0022]
[Problems to be solved by the invention]
However, the above-mentioned prior art method has the following problems. One is the problem of control stability. Generally, since the quantization parameter Q and the generated code amount R have a relationship close to inverse proportion, as shown in FIG. 6, the change in the code amount when the quantization parameter is small is smaller than the change in the code amount when the quantization parameter is large. Is big.
[0023]
In TM5, since the value of the quantization parameter is changed in proportion to the difference between the actual value of the accumulated code amount in the picture and the target value, the difference takes a negative value and the quantization parameter is small. Sometimes the response is particularly sensitive. Therefore, in systems where the control unit is not a macroblock unit but a slice unit, and the feedback is slow, the code amount explosively increases after the quantization parameter becomes unnecessarily small in the control process and the control becomes oscillatory. Problem.
[0024]
The other is the problem of control accuracy. In TM5, if the actual value of the accumulated code amount in the picture and the target value match during the control process, d j = D 0 And the quantization parameter is the initial value Q 0 It becomes. But Q 0 Is not an appropriate value for the picture of the picture and the target code amount, the generated code amount acts again in a direction in which the actual value of the intra-picture accumulated generated code amount deviates from the target value.
[0025]
For example, the initial value Q 0 Is smaller than an appropriate value, the code amount is too large, and the difference value between the actual value of the accumulated code amount in the picture and the target value increases again. For this reason, Q 0 Is not an appropriate value, a deviation between the generated code amount and the target code amount always remains.
[0026]
From another viewpoint, if the generated code amount continues to be T / N with a certain quantization parameter in the control process, the difference between the actual value and the target value of the accumulated code amount in the picture does not change. There is a problem that the quantization parameter does not change, and the system falls into a steady state where it does not approach the target code amount any more. For this reason, there is a problem that the target code amount given to the picture cannot be accurately realized.
[0027]
SUMMARY OF THE INVENTION It is an object of the present invention to solve the above-mentioned problems of the prior art and realize an intra-frame rate control that enables accurate and stable rate control.
[0028]
[Means for Solving the Problems]
In order to solve the above problem, the present invention determines a target code amount of the next control unit for each control unit in a picture, and multiplies the generated code amount of the control unit encoded up to that by the quantization parameter. Is divided by the target value of the generated code amount to estimate the quantization parameter for generating the target code amount of the next control unit. Alternatively, a value proportional to the reciprocal of the target code amount is set as the quantization parameter.
[0029]
Then, rate control is performed by using the weighted average value of the quantization parameter thus obtained and the quantization parameter of the control unit coded so far as the quantization parameter of the next control unit. By performing such control, it is possible to solve the above-mentioned problems relating to the stability and accuracy of the control.
[0030]
The operation of the present invention is as follows. In the present invention, the target code amount of the next control unit is determined, and a quantization parameter for generating the code amount is estimated, or a value proportional to the reciprocal of the target generated code amount is used as the quantization parameter. This makes it possible to prevent the control amount from becoming unstable due to an abnormally large or non-existent code amount. Here, the estimation of the quantization parameter for generating the target code amount is performed, for example, by multiplying the product of the generated code amount of the control unit encoded so far and the quantization parameter by the target value of the generated code amount of the next control unit. This is performed by, for example, using a value obtained by dividing by an estimated value.
[0031]
The difference between the above-described conventional method (TM5) and the rate control method according to the present invention will be described with reference to the conventional rate control conceptual diagram shown in FIG. 7 and the rate control conceptual diagram according to the present invention shown in FIG. In the conventional method, as shown in FIG. 7, the target value (jT / N) and the accumulated code amount (B j ), A quantization parameter Q is calculated based on the difference value, coding is performed based on the calculated quantization parameter Q, and a generated code amount R is calculated by an integrator (accumulated code amount in FIG. 5). The accumulating unit 100) employs a method of accumulating. However, in the conventional method, since the control target does not have a linear characteristic and the characteristic is not corrected, the whole control is difficult to stabilize.
[0032]
On the other hand, in the present invention, the target value (jT / N) and the accumulated code amount (B j In calculating the quantization parameter Q on the basis of the difference value from the above, a target code amount R ′ is calculated from the difference value, and the quantization parameter Q ′ for generating the calculated target code amount R ′ is estimated. The quantized parameter Q ′ is smoothed to determine the quantized parameter Q.
[0033]
In the present invention, in the calculation of the quantization parameter, a conversion having a characteristic opposite to the characteristic of the control target, that is, a value (temporary quantization parameter) proportional to the reciprocal of the target generated code amount is obtained or the target code amount is calculated. In order to perform the operation of estimating the quantization parameter for generating the error, the relationship between the difference value between the accumulated code amount and the target value and the code amount generated by the coding becomes linear, and the stability of the entire control system increases.
[0034]
By appropriately determining the target code amount for each control unit, the target code amount given to the picture can be accurately realized. For example, from the value obtained by dividing the target code amount T of the picture by the number N of control units in the picture, the amount by which the code amount that has passed so far is returned by a constant rate K is subtracted to obtain the target code amount of the next control unit. Set. That is, the target code amount of the next control unit is
Target code amount = T / NK- (B j-1 − (J−1) · T / N)
By doing so, the target code amount given to the picture can be realized more accurately than in the past.
[0035]
On the other hand, since the relationship between the generated code amount and the quantization parameter for each control unit in a picture is usually greatly different, the quantization parameter is set such that the generated code amount for each control unit is relatively close to a constant value as described above. Is determined, the fluctuation of the quantization parameter for each control unit becomes large. Therefore, the variation is suppressed by taking a weighted average value of the obtained quantization parameter and the quantization parameter of the control unit coded so far.
[0036]
For example, a 7: 1 weighted average is calculated between the quantization parameter of the control unit encoded immediately before and the quantization parameter obtained this time, and this value is used as the quantization parameter. As a result, although the accuracy of the control is slightly lowered, the fluctuation of the quantization parameter for each control unit in the picture can be smoothed, and visually excellent control can be realized. In addition, it is possible to obtain superior performance with respect to control stability and accuracy.
[0037]
That is, the present invention determines a target generated code amount of the next control unit for each control unit in a picture, estimates a quantization parameter for generating the target generated code amount from past coding results, A weighted average value of the quantization parameter of the control unit and the quantization parameter of the control unit encoded up to that time is used as the quantization parameter of the next control unit.
[0038]
Further, the present invention determines a target generated code amount of the next control unit for each control unit in a picture based on a difference between a target value and an actual value of the accumulated generated code amount in the picture up to that time. The product of the generated code amount of the control unit coded up to and the quantization parameter is divided by the target value of the generated code amount of the next control unit to determine the quantization parameter, and the value and the control coded so far are determined. It is characterized in that a weighted average value with a unit quantization parameter is used as a quantization parameter of the next control unit.
[0039]
Also, the present invention determines a target generated code amount of the next control unit for each control unit in a picture, determines a quantization parameter in proportion to the reciprocal thereof, and determines the determined value and the coding value up to that. The weighted average value of the obtained control unit and the quantization parameter is used as the quantization parameter of the next control unit.
[0040]
BEST MODE FOR CARRYING OUT THE INVENTION
An embodiment of the present invention will be described below with reference to the drawings.
[0041]
[Example of device configuration]
FIG. 2 is a diagram showing a configuration example of an encoding device using the intra-picture rate control method of the present invention. 1 is an encoding device, 10 is an encoding control unit for controlling the amount of generated code of a picture, and 50 is an intra-frame quantization control unit for controlling a quantization parameter in a frame (in a picture). The configuration of the encoding apparatus 1 excluding the encoding control unit 10 is the same as the configuration of the conventional encoding apparatus 2 except for the encoding control unit 20 described with reference to FIG.
[0042]
In FIG. 2, reference numeral 100 denotes a cumulative code amount accumulating unit that accumulates the generated code amount up to that point in the picture, and 101 denotes a target cumulative code amount calculating unit that calculates a target value of the current cumulative generated code amount in the picture. , 102 are target code amount calculation units for calculating the target code amount R ′ of the next control unit based on the result of the subtraction by the subtraction unit 105.
[0043]
Reference numeral 103 denotes a quantization parameter calculation unit that calculates a quantization parameter Q ′ corresponding to the target code amount R ′ calculated by the target code amount calculation unit 102, and 104 denotes a quantization parameter Q ′ calculated by the quantization parameter calculation unit 103. This is a quantization parameter smoothing unit that performs smoothing and calculates a quantization parameter Q of the next control unit.
[0044]
The operation of the encoding device 1 is as follows. First, the DCT unit 12 performs DCT on the prediction error obtained by the subtraction unit 11, and the quantization unit 13 quantizes the transform coefficient according to the quantization parameter Q determined by the coding control unit 10. The inverse quantization unit 14 and the inverse DCT unit 15 respectively perform inverse quantization and inverse DCT transform on the quantized transform coefficient, and the addition unit 16 adds the signal from the motion search / compensation unit 18 to the result. to add. The decoded image obtained as a result is stored in the frame memory 17.
[0045]
On the other hand, the variable-length coding unit 19 performs variable-length coding on the transform coefficient after quantization by the quantization unit 13, and stores information on the generated code amount R in the cumulative code amount accumulating unit 100 in the intra-frame quantization control unit 50. Send to
[0046]
The accumulated code amount accumulating unit 100 accumulates and records the transmitted generated code amount R up to that time. Then, the subtraction unit 105 subtracts the value of the actual accumulated code amount recorded in the accumulated code amount accumulation unit 100 from the target value of the accumulated code amount calculated by the target accumulated code amount calculation unit 101. The target code amount calculation unit 102 calculates a target code amount R ′, which is a target value of the generated code amount of the next control unit, based on the result of the subtraction by the subtraction unit 105, and information on the calculated target code amount R ′. Is transmitted to the quantization parameter calculation unit 103. The quantization parameter calculator 103 calculates a quantization parameter Q ′ for generating the target code amount R ′ based on the target code amount R ′ transmitted from the target code amount calculator 102.
[0047]
Here, as will be described later, the quantization parameter Q ′ for generating the target code amount R ′ is, for example, a product of the generated code amount R of the control unit encoded so far and the quantization parameter, It is calculated by dividing by R ′ or as a value proportional to the reciprocal of the target code amount R ′.
[0048]
The quantization parameter smoothing unit 104 smoothes the quantization parameter Q ′ calculated by the quantization parameter calculation unit 103 so that the quantization parameter does not change rapidly, and information of the quantization parameter Q obtained as a result of the smoothing. Is transmitted to the quantization unit 13. Here, in the smoothing process performed by the quantization parameter smoothing unit 104, for example, the weighted average value of the quantization parameter Q ′ and the quantization parameter of the control unit encoded up to that point is calculated by using the weighted average value of the next control unit. This is performed by setting the quantization parameter Q.
[0049]
[First Embodiment]
FIG. 3 is a diagram showing a flow of the rate control process according to the first embodiment of the present invention. In the first embodiment of the present invention, it is assumed that the intra-picture rate control is performed on a slice-by-slice basis. It is assumed that the number of slices in a picture is N.
[0050]
First, a target code amount T of a picture to be encoded is determined by an inter-picture rate control algorithm (step S1). Although this algorithm is not within the scope of the present invention, for example, TM5 introduces a method of calculating a picture target code amount from past coding results (generated code amounts and quantization parameters) and remaining GOP code amounts. .
[0051]
At the beginning of picture coding, the quantization parameter value Q of the first slice (slice 0) 0 To determine. If there is no past picture having the same picture type as the picture to be encoded (step S2), the I and P pictures have Q 0 = 10, Q for B picture 0 = 14 (step S3). If there is, the quantization parameter of the last slice of the closest past picture of the same picture (the immediately preceding same picture) is set to the quantization parameter Q of the first slice. 0 (Step S4).
[0052]
This quantization parameter Q 0 Is used to encode the first slice (slice 0) (step S5). In practice, the quantization parameter Q 0 To the coefficient N according to the characteristics of each macroblock act Multiplied by 2 and then the value mquant which is clipped to a value (2-62 or 1-112) that can be taken in the standard j , Each macro block in slice 0 is encoded. When the encoding of slice 0 is completed, the generated code amount R of slice 0 0 And the quantization parameter Q of the next slice 1 1 Is determined as follows.
[0053]
Here, more generally, the quantization parameter Q of slice j j Describes how to determine Here, j is 1 or more and N-1 or less. When the encoding of the slice j-1 is completed, the generated code amount R of the slice j-1 (Step S6), and the generated code amount R of slice j-1 j-1 And the quantization parameter Q j-1 And the complexity index X of slice j-1 j-1 Is obtained (step S7).
[0054]
X j-1 = Q j-1 ・ R j-1 …… (4)
Next, the generated code amount R of slice j-1 j-1 , The accumulated code amount B in the picture up to slice j-1 j-1 Is obtained (step S8). If j = 1, B 0 = R 0 And when j ≧ 2, it is as follows.
[0055]
B j-1 = R j-1 + B j-2 …… (5)
Next, the target code amount R ′ of slice j j Is determined (step S9). Target code amount R ' j Is determined by “(average target code amount per slice) − (repayment code amount)”. The average target code amount per slice is a value obtained by dividing the target code amount T for one picture by the number of slices N in a picture, and the repayment code amount is the difference between the actual value of the accumulated code amount at that time and the target value. The value is multiplied by a constant rate K (for example, 0.1).
[0056]
R ' j = T / N-0.1 · (B j-1 − (J−1) · T / N) (6)
The target code amount R ′ of this slice j j The quantization parameter Q ′ for generating j To the complexity index X of slice j-1 j-1 Is determined using That is, as shown below, the complexity index X of slice j-1 j-1 With the target code amount R ′ of slice j j Divided by the quantization parameter Q j 'Is obtained (step S10).
[0057]
Q ' j = X j-1 / R ' j ...... (7)
This is based on the approximation that the quantization parameter and the generated code amount are inversely proportional, and the approximation that the complexity index of the immediately preceding slice and the complexity index of the slice to be encoded do not change much.
[0058]
The value Q 'found this time j And the value Q determined in the previous slice j-1 And a: (1-a) (a is, for example, 1/8), a weighted average is taken, and the quantization parameter Q of the slice j is calculated. j Is determined (step S11).
[0059]
Q j = 1/8 Q ' j + 7/8 · Q j-1 …… (8)
This has the effect of smoothing the quantization parameter, because if the quantization parameter changes abruptly for each slice, it is undesirable in terms of image quality and stability.
[0060]
In practice, the quantization parameter Q j To the coefficient N according to the characteristics of each macroblock act Multiplied by 2 and then the value mquant which is clipped to a value (2-62 or 1-112) that can be taken in the standard j Is used to encode each macroblock in slice j (step S12).
[0061]
Steps S6 to S12 are repeated for all slices in the picture (step S13), and when the picture encoding is completed, the quantization parameter Q j Is stored for the subsequent initial value of the same kind of picture (step S14).
[0062]
This is repeated for all picture encodings (step S15). By doing so, more accurate and stable rate control than before can be performed.
[0063]
[Second embodiment]
FIG. 4 is a diagram showing a rate control processing flow according to the second embodiment of the present invention. In the second embodiment of the present invention, it is assumed that in-picture rate control is performed by using M macroblocks as one control unit (hereinafter referred to as MB group). It is assumed that the number of MB groups in a picture is N.
[0064]
First, a target code amount T of a picture to be encoded is determined by an inter-picture rate control algorithm (step S21). This algorithm is not within the scope of the present invention. At the beginning of picture coding, the quantization parameter value Q of the first control unit (MB group 0) 0 To determine. If there is no past picture having the same picture type as the picture to be encoded (step S22), Q 0 = 10, Q for B picture 0 = 14 (step S23). If there is, the quantization parameter of the last MB group of the closest past picture of the same picture (the immediately preceding same picture) is Q 0 (Step S24).
[0065]
This quantization parameter Q 0 Is used to encode MB group 0 (step S25). In practice, the quantization parameter Q 0 To the coefficient N according to the characteristics of each macroblock act Multiplied by 2 and then the value mquant which is clipped to a value (2-62 or 1-112) that can be taken in the standard j Is used to encode each macroblock in MB group 0.
[0066]
When the encoding of the MB group 0 is completed, the generated code amount R of the MB group 0 And quantize parameter Q of MB group j j Is determined as follows. Here, more generally, the quantization parameter Q of MB group j j Describes how to determine Here, j is 1 or more and N-1 or less.
[0067]
When the encoding of the MB group j-1 is completed, the generated code amount R of the MB group j-1 Are counted (step S26). Next, the complexity index X of the MB group j-1 (X j-1 = R j-1 ・ Q j-1 ) Is calculated and stored (step S27). Then, the generated code amount R of the MB group j-1 j-1 , The accumulated code amount B in the picture up to the MB group j−1 j-1 Is obtained (step S28). If j = 1, B 0 = R 0 And when j ≧ 2, it is as follows.
[0068]
B j-1 = R j-1 + B j-2 …… (9)
Next, the target code amount R ′ of the MB group j j Is determined (step S29). Target code amount R ' j Is determined by “(average target code amount per 1 MB group) − (repayment code amount)”. The average target code amount per MB group is a value obtained by dividing the target code amount T for one picture by the number N of MB groups in a picture, and the repayment code amount is the actual value and the target value of the accumulated code amount at that time. Is divided by the number of remaining control units N-j.
[0069]
R ' j = T / N- (B j-1 − (J−1) · T / N) / (N−j) (10)
The target code amount R ′ of this MB group j j The value proportional to the reciprocal of j (Step S30).
[0070]
Q ' j = X / R ' j …… (11)
The proportionality constant X used at this time is the average value of the complexity index of all MB groups of the immediately preceding same picture, that is, the average value of the product of the generated code amount of the MB group and the average quantization parameter. Use the same value. By doing so, the code amount actually generated when encoding the MB group j is equal to the target code amount R ′ of the MB group j. j Is not necessarily the same as the temporary quantization parameter Q ′ j Has the advantage that the fluctuation is reduced and it is visually desirable.
[0071]
Then, the temporary quantization parameter Q ′ obtained this time j And the tentative quantization parameters Q ′ of the previous two MB groups j-1 And a weighted average (moving average) at a ratio of 1: 1: 1 to obtain the quantization parameter Q of the MB group j as follows: j Is determined (step S31).
[0072]
Q j = (Q ' j + Q ' j-1 + Q ' j-2 ) / 3 ... (12)
In practice, the quantization parameter Q j To the coefficient N according to the characteristics of each macroblock act Multiplied by 2 and then the value mquant which is clipped to a value (2-62 or 1-112) that can be taken in the standard j Is used to encode each macroblock in MB group j (step S32). Steps S26 to S32 are repeated for all the MB groups in the picture (step S33), and when the picture encoding is completed, the quantization parameter Q of the last MB group is j Is stored for the subsequent initial value of the same type of picture (step S34). Further, the average value X of the complexity index of the MB group is stored (step S35).
[0073]
This is repeated for all picture encodings (step S36). By doing so, more accurate and stable rate control than before can be performed.
[0074]
The processing of each of the embodiments described above can be realized by hardware or a processor dedicated to encoding processing, and can also be realized by a general-purpose computer and a software program. The software program can be provided by being recorded on a computer-readable recording medium or can be provided through a network.
[0075]
【The invention's effect】
According to the present invention, the target code amount of the next control unit is determined, and a quantization parameter for generating the code amount is estimated, or a value proportional to the reciprocal of the target generated code amount is set as the quantization parameter. By doing so, it is possible to prevent the control amount from becoming unstable due to abnormal or excessive output of the code amount.
[0076]
Further, according to the present invention, for example, a value obtained by dividing a target code amount T of a picture by the number N of control units in a picture and subtracting an amount of the code amount that has been passed so far by a constant rate K is subtracted from the next control value. By appropriately determining the target code amount for each control unit, for example, by setting the target code amount in units, the target code amount given to the picture can be accurately realized.
[Brief description of the drawings]
FIG. 1 is a conceptual diagram of rate control according to the present invention.
FIG. 2 is a diagram illustrating a configuration example of an encoding device using the intra-picture rate control method of the present invention.
FIG. 3 is a diagram showing a flow of a rate control process according to the first embodiment of the present invention.
FIG. 4 is a diagram showing a rate control processing flow according to a second embodiment of the present invention.
FIG. 5 is a diagram illustrating a configuration example of a conventional encoding device.
FIG. 6 is a diagram illustrating a relationship between a quantization parameter and a generated code amount.
FIG. 7 is a conceptual diagram of a conventional rate control.
[Explanation of symbols]
1,2 coding device
10,20 encoding control unit
11 Subtraction unit
12 DCT section
13 Quantization unit
14 Inverse quantization unit
15 Inverse DCT section
16 Addition unit
17 Frame memory
18 Motion search / compensation unit
19 Variable length coding unit
50,60 In-frame quantization controller
100 Cumulative code amount accumulator
101 Target cumulative code amount calculation unit
102 Target code amount calculation unit
103, 106 Quantization parameter calculator
104 Quantization parameter smoothing unit
105 Subtraction unit

Claims (8)

動画像符号化におけるフレーム内レート制御方法において,
ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定するステップと,
過去の符号化結果から前記目標発生符号量を発生させる量子化パラメータを推定するステップと,
前記量子化パラメータの推定値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとするステップとを有する
ことを特徴とする動画像符号化におけるフレーム内レート制御方法。
In an intra-frame rate control method in video coding,
Determining, for each control unit in the picture, a target generated code amount for the next control unit;
Estimating a quantization parameter for generating the target generated code amount from a past coding result;
Moving the weighted average value between the estimated value of the quantization parameter and the quantization parameter of the control unit coded so far as the quantization parameter of the next control unit. In-frame rate control method in multiplexing.
動画像符号化におけるフレーム内レート制御方法において,
ピクチャ内の制御単位ごとに,それまでのピクチャ内累積発生符号量の目標値と実際の累積発生符号量との差分に基づいて,次の制御単位の目標発生符号量を決定するステップと,
それまでに符号化した制御単位の発生符号量と量子化パラメータとの積を,次の制御単位の発生符号量の目標値で割って量子化パラメータを決定するステップと,
その決定した値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとするステップとを有する
ことを特徴とする動画像符号化におけるフレーム内レート制御方法。
In an intra-frame rate control method in video coding,
Determining, for each control unit in the picture, a target generated code amount of the next control unit based on a difference between the target value of the accumulated generated code amount in the picture and the actual accumulated generated code amount;
Deciding a quantization parameter by dividing a product of the generated code amount of the control unit encoded up to then and the quantization parameter by a target value of the generated code amount of the next control unit;
A step of using a weighted average value of the determined value and the quantization parameter of the control unit encoded so far as the quantization parameter of the next control unit. Internal rate control method.
動画像符号化におけるフレーム内レート制御方法において,
ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定するステップと,
決定した目標発生符号量の逆数に比例する量子化パラメータを決定するステップと,
その決定した値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとするステップとを有する
ことを特徴とする動画像符号化におけるフレーム内レート制御方法。
In an intra-frame rate control method in video coding,
Determining, for each control unit in the picture, a target generated code amount for the next control unit;
Determining a quantization parameter proportional to the reciprocal of the determined target generated code amount;
A step of using a weighted average value of the determined value and the quantization parameter of the control unit encoded so far as the quantization parameter of the next control unit. Internal rate control method.
動画像符号化におけるフレーム内レート制御装置において,
ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定する目標符号量計算部と,
過去の符号化結果から前記目標発生符号量を発生させる量子化パラメータを推定する量子化パラメータ計算部と,
前記量子化パラメータの推定値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとする量子化パラメータ平滑化部とを備える
ことを特徴とする動画像符号化におけるフレーム内レート制御装置。
In the intra-frame rate control device in video coding,
A target code amount calculation unit for determining a target generated code amount of the next control unit for each control unit in the picture;
A quantization parameter calculator for estimating a quantization parameter for generating the target generated code amount from a past coding result;
A quantization parameter smoothing unit that uses a weighted average value of the estimated value of the quantization parameter and the quantization parameter of the control unit encoded so far as a quantization parameter of the next control unit. Intra-frame rate control device in video coding.
動画像符号化におけるフレーム内レート制御装置において,
ピクチャ内の制御単位ごとに,それまでのピクチャ内累積発生符号量の目標値と実際の累積発生符号量との差分に基づいて,次の制御単位の目標発生符号量を決定する目標符号量計算部と,
それまでに符号化した制御単位の発生符号量と量子化パラメータとの積を,次の制御単位の発生符号量の目標値で割って量子化パラメータを決定する量子化パラメータ計算部と,
その決定した値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとする量子化パラメータ平滑化部とを備える
ことを特徴とする動画像符号化におけるフレーム内レート制御装置。
In the intra-frame rate control device in video coding,
Target code amount calculation for determining the target generated code amount of the next control unit for each control unit in the picture based on the difference between the target value of the cumulative generated code amount in the picture up to that point and the actual accumulated generated code amount Department and
A quantization parameter calculator for dividing a product of the generated code amount of the control unit encoded up to that and the quantization parameter by a target value of the generated code amount of the next control unit to determine a quantization parameter;
A moving image, comprising: a quantization parameter smoothing unit that uses a weighted average value of the determined value and the quantization parameter of the control unit encoded so far as a quantization parameter of the next control unit. An intra-frame rate control device in image coding.
動画像符号化におけるフレーム内レート制御装置において,
ピクチャ内の制御単位ごとに,次の制御単位の目標発生符号量を決定する目標符号量計算部と,
決定した目標発生符号量の逆数に比例する量子化パラメータを決定する量子化パラメータ計算部と,
その決定した値とそれまでに符号化した制御単位の量子化パラメータとの重み付き平均値を,次の制御単位の量子化パラメータとする量子化パラメータ平滑化部とを備える
ことを特徴とする動画像符号化におけるフレーム内レート制御装置。
In the intra-frame rate control device in video coding,
A target code amount calculation unit for determining a target generated code amount of the next control unit for each control unit in the picture;
A quantization parameter calculator for determining a quantization parameter proportional to a reciprocal of the determined target generated code amount;
A moving image, comprising: a quantization parameter smoothing unit that uses a weighted average value of the determined value and the quantization parameter of the control unit encoded so far as a quantization parameter of the next control unit. An intra-frame rate control device in image coding.
請求項4から請求項6までのいずれか1項に記載の動画像符号化におけるフレーム内レート制御装置と,
該動画像符号化におけるフレーム内レート制御装置がピクチャ内の制御単位ごとに決定した量子化パラメータを用いて,動画像を可変長符号化する手段とを備える
ことを特徴とする動画像符号化装置。
An intra-frame rate control device in video coding according to any one of claims 4 to 6,
Means for performing variable-length coding of a moving image using a quantization parameter determined for each control unit in a picture by the intra-frame rate control device in the moving image coding. .
請求項1から請求項3までのいずれか1項に記載の動画像符号化におけるフレーム内レート制御方法を,コンピュータに実行させるための動画像符号化におけるフレーム内レート制御プログラム。4. An intra-frame rate control program in video encoding for causing a computer to execute the intra-frame rate control method in video encoding according to any one of claims 1 to 3.
JP2003153689A 2003-05-30 2003-05-30 Intra-frame rate control method, intra-frame rate control apparatus, moving picture encoding apparatus, and intra-frame rate control program in moving picture coding Expired - Fee Related JP4142497B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003153689A JP4142497B2 (en) 2003-05-30 2003-05-30 Intra-frame rate control method, intra-frame rate control apparatus, moving picture encoding apparatus, and intra-frame rate control program in moving picture coding

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003153689A JP4142497B2 (en) 2003-05-30 2003-05-30 Intra-frame rate control method, intra-frame rate control apparatus, moving picture encoding apparatus, and intra-frame rate control program in moving picture coding

Publications (2)

Publication Number Publication Date
JP2004357079A true JP2004357079A (en) 2004-12-16
JP4142497B2 JP4142497B2 (en) 2008-09-03

Family

ID=34048542

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003153689A Expired - Fee Related JP4142497B2 (en) 2003-05-30 2003-05-30 Intra-frame rate control method, intra-frame rate control apparatus, moving picture encoding apparatus, and intra-frame rate control program in moving picture coding

Country Status (1)

Country Link
JP (1) JP4142497B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100456835C (en) * 2005-07-07 2009-01-28 联发科技股份有限公司 Methods and systems for rate control in video encoder
WO2011086779A1 (en) * 2010-01-14 2011-07-21 株式会社メガチップス Image processing device
WO2011096173A1 (en) * 2010-02-08 2011-08-11 パナソニック株式会社 Video signal encoding device and video signal encoding method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100456835C (en) * 2005-07-07 2009-01-28 联发科技股份有限公司 Methods and systems for rate control in video encoder
WO2011086779A1 (en) * 2010-01-14 2011-07-21 株式会社メガチップス Image processing device
US9661333B2 (en) 2010-01-14 2017-05-23 Megachips Corporation Image processor for code amount control
WO2011096173A1 (en) * 2010-02-08 2011-08-11 パナソニック株式会社 Video signal encoding device and video signal encoding method
JP2011166370A (en) * 2010-02-08 2011-08-25 Panasonic Corp Video signal encoding device and video signal encoding method
US9066103B2 (en) 2010-02-08 2015-06-23 Panasonic Intellectual Property Management Co., Ltd. Video signal coding apparatus and video signal coding method

Also Published As

Publication number Publication date
JP4142497B2 (en) 2008-09-03

Similar Documents

Publication Publication Date Title
JP5008718B2 (en) Encoding bit rate control method and apparatus, program thereof, and recording medium recording program
US7593462B2 (en) Moving picture encoding system
EP1063851B1 (en) Apparatus and method of encoding moving picture signal
US7903732B2 (en) Method and apparatus for encoding a moving-picture signal by calculating the complexity of the moving-picture signal
JP2002010259A (en) Image encoding apparatus and its method and recording medium recording image encoding program
KR100846769B1 (en) Method for encoding motion image having fixed computational complexity and apparatus thereof
TW200931983A (en) Image coding apparatus and image coding method
WO2007143876A1 (en) Method and apparatus for adaptively determining a bit budget for encoding video pictures
JP2000152237A (en) Constant bit rate control in video coder by preceding analysis of picture slice
CN101779468A (en) Image processing device and image processing method
JP4221655B2 (en) Encoding apparatus, encoding method, program, and recording medium
JPH08102938A (en) Image coder
JP2006295535A (en) Dynamic image coding apparatus, and method
US6865224B1 (en) Bit rate control for video data compression
JP2001028753A (en) Dynamic image coder and its method
JP4142497B2 (en) Intra-frame rate control method, intra-frame rate control apparatus, moving picture encoding apparatus, and intra-frame rate control program in moving picture coding
JP3812267B2 (en) Video encoding apparatus and method
JP3812269B2 (en) Video encoding apparatus and method
JP3858520B2 (en) Video encoding apparatus and method
JP2008252225A (en) Motion picture encoding device and method
KR100336497B1 (en) Rate Control Apparatus and Method Using Spatial Prediction Error Model for Moving Picture Coding
CN102202220B (en) Encoding apparatus and control method for encoding apparatus
JPH07264579A (en) Video encoding device
JP2008078978A (en) Moving image encoder
KR20040028332A (en) Apparatus and method for prediction of bit rate in real-time H.263 video coding rate control

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050719

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070601

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070612

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070808

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20070808

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

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

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

Free format text: PAYMENT UNTIL: 20110620

Year of fee payment: 3

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20110620

Year of fee payment: 3

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: R3D02

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

Free format text: PAYMENT UNTIL: 20120620

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130620

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees