JP2003204554A - Image signal encoding apparatus and encoding method - Google Patents
Image signal encoding apparatus and encoding methodInfo
- Publication number
- JP2003204554A JP2003204554A JP2002285573A JP2002285573A JP2003204554A JP 2003204554 A JP2003204554 A JP 2003204554A JP 2002285573 A JP2002285573 A JP 2002285573A JP 2002285573 A JP2002285573 A JP 2002285573A JP 2003204554 A JP2003204554 A JP 2003204554A
- Authority
- JP
- Japan
- Prior art keywords
- code amount
- information
- quantization
- quantized
- activity
- 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
Links
Landscapes
- Television Signal Processing For Recording (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
(57)【要約】
【課題】 処理ブロック毎のアクティビティに応じて量
子化ステップを制御する処理を良好に行う。
【解決手段】 S1で現在のmin qqに対してアクティビ
ティの順番を求め、S2で順番を示す変数iが0に初期
化され、S3で変数にi番目のアクティビティを代入す
る。S4でq-scaIeを求める。S5でq-scaIeを一ステッ
プ下げた時の総符号量を求める。S6で総符号量と目標
符号量とを比較する。総符号量が目標符号量以下であれ
ば、量子化ステップを下げることができるので、S7で
アクティビティの順番を示す変数iを進め、S8でtota
lを更新し、S3に戻る。S6において、発生符号量が
目標符号量より大と判定されれば、処理がマクロブロッ
ク単位の処理に移る。総符号量が目標符号量以下のmin
actが設定される。各マクロブロックのアクティビティ
の順番とmin actとの比較結果に応じて量子化ステップ
を下げるか否かが制御される。
(57) [Summary] PROBLEM TO BE SOLVED: To satisfactorily perform a process of controlling a quantization step according to an activity of each processing block. SOLUTION: The current min is set in S1. The order of activities is obtained for qq, a variable i indicating the order is initialized to 0 in S2, and the i-th activity is substituted for the variable in S3. In step S4, q-scaIe is obtained. In S5, the total code amount when q-scaIe is lowered by one step is obtained. In S6, the total code amount is compared with the target code amount. If the total code amount is equal to or less than the target code amount, the quantization step can be reduced. Therefore, the variable i indicating the order of the activity is advanced in S7, and the total
Update l and return to S3. If it is determined in S6 that the generated code amount is larger than the target code amount, the processing shifts to processing in units of macro blocks. Min whose total code amount is less than or equal to the target code amount
act is set. Activity order and min for each macroblock Whether to reduce the quantization step is controlled according to the result of comparison with act.
Description
【0001】[0001]
【発明の属する技術分野】この発明は、例えば動き補償
とDCT(Discrete Cosine Transform)を用いた符号化
に対して適用できる画像信号の符号化装置および符号化
方法に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image signal encoding apparatus and an encoding method applicable to, for example, motion compensation and encoding using DCT (Discrete Cosine Transform).
【0002】[0002]
【従来の技術】MPEG(Moving Pictures Expert Grou
p)規格に代表されるDCTを用いた画像圧縮方式では、
伝送路に送出されるビットストリームが所望のレートに
なるように、符号量制御を行なっている。例えば量子化
ステップを表す量子化インデックスを制御することによ
って、符号量制御がなされる。MPEG2でTM5とし
て提案されている符号量制御では、仮想バッファの残量
と、以前エンコードした際の量子化インデックスと発生
符号量の関係を用いて量子化ステップをフィードバック
制御している。2. Description of the Related Art MPEG (Moving Pictures Expert Grou)
p) In the image compression method using DCT represented by the standard,
The code amount is controlled so that the bit stream sent to the transmission path has a desired rate. For example, the code amount is controlled by controlling the quantization index representing the quantization step. In the code amount control proposed as TM5 in MPEG2, the quantization step is feedback controlled by using the relationship between the remaining amount of the virtual buffer, the quantization index and the generated code amount at the time of previous encoding.
【0003】図1は、MPEGのレイヤー構造を示すも
のである。シーケンス層、GOP(Group Of Picture)
層、ピクチャ層、スライス層、マクロブロック層からな
る階層構造が規定されている。より具体的には、図1に
示すように、スライス層や、マクロブロック層に含まれ
るデータ(Qスケールと呼ぶ)で量子化ステップを変化
させることによって、1フレーム等の所定期間で発生す
る符号量を調節している。例えば(4:2:0)のフォ
ーマットでは、4個の輝度信号のブロックと、色信号U
の1個のブロックと、色信号Vの1個のブロックとによ
って、マクロブロックが構成されている。FIG. 1 shows the layer structure of MPEG. Sequence layer, GOP (Group Of Picture)
A hierarchical structure including layers, picture layers, slice layers, and macroblock layers is defined. More specifically, as shown in FIG. 1, a code generated in a predetermined period such as one frame by changing the quantization step in the data (called Q scale) included in the slice layer or macroblock layer. Adjusting the amount. For example, in the format of (4: 2: 0), four luminance signal blocks and color signal U
, And one block of the color signal V constitute a macro block.
【0004】一例として、Qスケールの値q scaleとし
て、Q1〜Q31の31種類が用意されている。Qスケ
ールの番号が大きくなるにしたがって、量子化ステップ
が大きい値となるようにされている。図2に示すよう
に、量子化と合計符号長(適宜総符号量とも言う)の関
係は、量子化ステップを大きくすると、量子化が粗くな
り合計符号長が少なくなる。逆に、量子化ステップを小
さくすると、量子化は細かくなり合計符号長が多くな
る。また、量子化は離散値しかとれないため、合計符号
長も離散的になる。As an example, the value q on the Q scale As scales, 31 kinds of Q1 to Q31 are prepared. The larger the Q scale number, the larger the quantization step. As shown in FIG. 2, regarding the relationship between the quantization and the total code length (also appropriately referred to as the total code amount), when the quantization step is increased, the quantization becomes coarse and the total code length decreases. On the contrary, when the quantization step is reduced, the quantization becomes finer and the total code length increases. Moreover, since the quantization can take only discrete values, the total code length is also discrete.
【0005】通信等のアプリケーションでは、以前の量
子化ステップと総符号量の関係を用いて、現在の平均レ
ートに対してフィードバックをかける方式が一般的であ
る。すなわち、現在の平均レートが目標レートよりも高
めならば量子化ステップを若干粗めにして総符号量を下
げ、現在の平均レートが低めならば量子化ステップを若
干細かくして総符号量を増やす。このようにして平均的
に目標レートを実現するように制御を行う。すなわち、
細かい時間で見ると総符号量は増減するものの、長いス
パンで見ると平均的に総符号量を目標値とするものであ
る。In applications such as communication, it is general to apply feedback to the current average rate using the relationship between the previous quantization step and the total code amount. That is, if the current average rate is higher than the target rate, the quantization step is slightly coarsened to reduce the total code amount, and if the current average rate is low, the quantization step is slightly fined to increase the total code amount. . In this way, control is performed so that the target rate is realized on average. That is,
Although the total code amount increases / decreases when viewed in a fine time, the total code amount becomes an average value when viewed in a long span.
【0006】しかしながら、編集等を前提としたVTR
のようアプリケーションでは、前述のような平均レート
だけで制御すると不具合がおきてしまう。このようなア
プリケーションでは、例えばフレーム毎での編集といっ
た操作があるため、編集単位毎にその総符号量が一定量
を絶対に超えないような制御が必要となる。以下、この
ような制御を固定長符号量制御と呼ぶことにする。However, a VTR based on the premise of editing, etc.
In an application like this, a problem will occur if control is performed only with the average rate as described above. In such an application, since there is an operation such as editing for each frame, it is necessary to control such that the total code amount does not exceed a certain amount for each editing unit. Hereinafter, such control will be referred to as fixed length code amount control.
【0007】[0007]
【発明が解決しようとする課題】前述のフィードバック
制御ではこの様な制御が困難なため、再生画像の破綻を
来したり、あるいは符号量が超えないようにマージンを
見込み過ぎて画質が劣化してしまうことがあった。そこ
で、予め異なる量子化ステップの固定量子化器を複数用
いて量子化を行ない、そのときの総符号量に基づいて、
量子化制御を行なうという技術が知られている。例え
ば、国際公開公報WO96/28937には、フィード
フォワード方式の符号量制御が開示されている。Since such control is difficult in the above-mentioned feedback control, the reproduced image may be broken, or the margin is too large so that the code amount does not exceed and the image quality deteriorates. There was something that happened. Therefore, quantization is performed using a plurality of fixed quantizers having different quantization steps in advance, and based on the total code amount at that time,
A technique of performing quantization control is known. For example, WO96 / 28937 discloses a feedforward type code amount control.
【0008】具体的には、図2に示される31種類のQ
スケールをそれぞれ持つ量子化器を設け、各量子化器で
量子化された量子化DCT係数の1フレーム期間の総符
号量をそれぞれを求め、総符号量が目標符号量(図2に
おけるターゲットビットレングス)を超えず、且つ目標
符号量に対する差が小さいQスケールを決定する。図2
の例では、Q4がそのようなQスケールに該当する。Specifically, there are 31 kinds of Q shown in FIG.
Quantizers each having a scale are provided, and the total code amount of the quantized DCT coefficient quantized by each quantizer in one frame period is obtained, and the total code amount is the target code amount (target bit length in FIG. 2). ) Is not exceeded and the difference with respect to the target code amount is small, the Q scale is determined. Figure 2
In the above example, Q4 corresponds to such a Q scale.
【0009】しかしながら、この求められた例えば31
種類の量子化の時の総符号量をもとに、どのように量子
化ステップを決めるのかが問題となる。Qスケールは、
離散的なものであるので、ビットレートも離散的な値し
かとれず細かな制御ができず、目標符号量との差が充分
に小さくならない問題があった。However, the calculated value of, for example, 31
The problem is how to determine the quantization step based on the total code amount at the time of the type of quantization. Q scale is
Since it is discrete, there is a problem that the bit rate can take only discrete values and fine control cannot be performed, and the difference from the target code amount cannot be sufficiently small.
【0010】したがって、この発明の目的は、フィード
フォワード方式の符号量制御において、アクティビティ
に応じて、目標符号量を超えないで、且つ目標符号量と
総符号量との差をより小さくすることが可能な画像信号
の符号化装置および符号化方法を提供することにある。Therefore, an object of the present invention is to reduce the difference between the target code amount and the total code amount in the feedforward type code amount control without exceeding the target code amount depending on the activity. An object is to provide a possible image signal encoding device and encoding method.
【0011】[0011]
【課題を解決するための手段】請求項1の発明は、複数
のブロックによって構成される等長化単位毎に、目標符
号量内で画像信号を量子化する画像信号の符号化装置に
おいて、予測部を設け、予測部は、複数の量子化情報で
差分をそれぞれ量子化し、各量子化情報で量子化したと
きに、等長化単位で発生する総符号量を求める手段と、
等長化単位で発生する総符号量が目標符号量を超えない
で、総符号量と目標符号量との差が最小の第1の量子化
情報を決定する手段と、画像の処理ブロック毎の局所的
情報を検出し、局所的情報を出力する手段と、第1の量
子化情報を局所的情報により変化させて最終的な第2の
量子化情報を決定する決定手段とからなり、決定手段
は、第1の量子化情報毎に、局所的情報を考慮した量子
化情報とその量子化情報を一段階小さくしたものとの差
が小さい順に、順番を求め、順番の早いものから開始し
て局所的情報毎に符号量を集計し、集計された符号量か
ら目標符号量を満足する局所的情報を設定する第1の設
定手段と、第1の設定手段によって設定された局所的情
報に基づいて、無条件に量子化情報を一つ減じることが
できる処理ブロックと、量子化情報を減じることが不可
能な処理ブロックと、量子化情報を減じることが可能か
否かの検証を行う処理ブロックとの何れであるかを決定
することによって第2の量子化情報を決定し、量子化情
報を減じることが可能か否かの検証を行う場合には、一
つ減じた量子化情報による総符号量と目標符号量とを比
較する第2の設定手段とからなる画像信号の符号化装置
である。According to a first aspect of the present invention, there is provided an image signal encoding apparatus for quantizing an image signal within a target code amount for each equal-length unit composed of a plurality of blocks, in which prediction is performed. And a predicting unit that quantizes the difference with each of a plurality of pieces of quantization information and, when quantized with each piece of quantization information, obtains a total code amount generated in equal length units,
A unit for determining the first quantization information having the minimum difference between the total code amount and the target code amount without the total code amount generated in the equal length unit exceeding the target code amount, and for each processing block of the image. The determining means comprises means for detecting local information and outputting the local information, and determining means for changing the first quantized information by the local information to determine the final second quantized information. For each of the first quantized information, the order is calculated in ascending order of the difference between the quantized information in which the local information is considered and the quantized information obtained by reducing the quantized information by one step. Based on the local information set by the first setting unit that aggregates the code amount for each local information and sets the local information that satisfies the target code amount from the aggregated code amount Processing block that can unconditionally reduce one quantization information , The second quantization information is determined by determining whether it is a processing block in which the quantization information cannot be reduced or a processing block in which it is verified whether or not the quantization information can be reduced. When determining and verifying whether or not it is possible to reduce the quantized information, an image including second setting means for comparing the total code amount and the target code amount by the quantized information that is reduced by one It is a signal encoding device.
【0012】請求項3の発明は、複数のブロックによっ
て構成される等長化単位毎に、目標符号量内で画像信号
を量子化する画像信号の符号化方法において、複数の量
子化情報で差分をそれぞれ量子化し、各量子化情報で量
子化したときに、等長化単位で発生する総符号量を求め
るステップと、等長化単位で発生する総符号量が目標符
号量を超えないで、総符号量と目標符号量との差が最小
の第1の量子化情報を決定するステップと、画像の処理
ブロック毎のアクティビティを検出し、局所的情報を出
力するステップと、第1の量子化情報を局所的情報によ
り変化させて最終的な第2の量子化情報を決定する決定
ステップとからなり、決定ステップは、第1の量子化情
報毎に、局所的情報を考慮した量子化情報とその量子化
情報を一段階小さくしたものとの差が小さい順に、順番
を求め、順番の早いものから開始して局所的情報毎に符
号量を集計し、集計された符号量から目標符号量を満足
する局所的情報を設定する第1の設定ステップと、第1
の設定ステップによって設定された局所的情報に基づい
て、無条件に量子化情報を一つ減じることができる処理
ブロックと、量子化情報を減じることが不可能な処理ブ
ロックと、量子化情報を減じることが可能か否かの検証
を行う処理ブロックとの何れであるかを決定することに
よって第2の量子化情報を決定し、量子化情報を減じる
ことが可能か否かの検証を行う場合には、一つ減じた量
子化情報による総符号量と目標符号量とを比較する第2
の設定ステップとからなる画像信号の符号化方法であ
る。According to a third aspect of the present invention, in an image signal encoding method for quantizing an image signal within a target code amount for each equal-length unit composed of a plurality of blocks, a difference is obtained between a plurality of pieces of quantization information. Respectively, when quantized by each quantization information, the step of obtaining the total code amount generated in the equal length unit, and the total code amount generated in the equal length unit does not exceed the target code amount, A step of determining first quantization information having a minimum difference between the total code amount and the target code amount, a step of detecting activity for each processing block of an image and outputting local information, and a first quantization A decision step of changing the information according to the local information to decide the final second quantized information, wherein the decision step includes, for each of the first quantized information, quantized information considering the local information. The quantization information is one step smaller The order is calculated in ascending order of the difference from the above, the code amount is aggregated for each local information starting from the earliest sequence, and the local information satisfying the target code amount is set from the aggregated code amount. The first setting step and the first
Based on the local information set by the setting step, the processing block that can unconditionally reduce one quantization information, the processing block that cannot reduce the quantization information, and the quantization information are reduced. When determining whether the second quantization information is determined by determining which is the processing block for performing the verification of whether the quantization information can be reduced or not, Is a second comparing the total code amount by the quantized information reduced by one and the target code amount.
And an image signal encoding method including the setting step.
【0013】アクティビティを考慮した量子化情報は、
離散的な値であるので、目標符号量と総符号量との間に
差が存在する。これを小さくするために、例えば各マク
ロブロックの量子化ステップを一つずつ小にする。その
場合に、量子化ステップ毎に局所的情報に関して順番を
求め、順番の早いものから順に総符号量が目標符号量を
超えない局所的情報を設定する。次に、処理ブロック単
位で量子化ステップを制御する。その場合に、設定され
た局所的情報より順番が早い処理ブロックは、無条件に
量子化ステップを一つ減じ、設定された局所的情報と同
じ順番の処理ブロックは、量子化ステップを一つ減じる
ことが可能かどうかが検証される。The quantized information considering the activity is
Since they are discrete values, there is a difference between the target code amount and the total code amount. In order to reduce this, for example, the quantization step of each macroblock is reduced by one. In that case, the order is obtained for the local information for each quantization step, and the local information whose total code amount does not exceed the target code amount is set in order from the earliest one. Next, the quantization step is controlled in processing block units. In that case, a processing block whose order is earlier than the set local information unconditionally reduces one quantization step, and a processing block whose order is the same as the set local information reduces one quantization step. It is verified whether it is possible.
【0014】[0014]
【発明の実施の形態】以下、この発明の一実施形態につ
いて図面を参照して説明する。図3は、この発明が適用
されたエンコーダの全体的構成を示す。一例として、1
フレーム、すなわち、1画面単位で合計符号長が固定長
になるように制御する。図3において、参照符号1が走
査変換部を示す。走査変換部1において、入力画像信号
がマクロブロックに分割される。入力画像がプログレッ
シブ走査の場合では、そのままマクロブロックに分割さ
れ、インターレース走査の場合は、フィールド−フレー
ム変換してマクロブロックに分割される。MPEGで
は、輝度信号に関して、4個のDCTブロックから構成
される(16×16)のサイズのブロックが構成され
る。色差信号Cr、Cbに関して、(4:2:0)の場
合、それぞれが(8×8)のブロックが構成される。こ
れらの合計6個のDCTブロックをまとめて一つのマク
ロブロックが構成される。BEST MODE FOR CARRYING OUT THE INVENTION An embodiment of the present invention will be described below with reference to the drawings. FIG. 3 shows the overall configuration of an encoder to which the present invention is applied. As an example, 1
Control is performed so that the total code length becomes a fixed length for each frame, that is, for each screen. In FIG. 3, reference numeral 1 indicates a scan conversion unit. In the scan conversion unit 1, the input image signal is divided into macroblocks. When the input image is progressive scan, it is divided into macroblocks as it is, and when interlaced scan is performed, it is divided into macroblocks by field-frame conversion. In MPEG, a block of size (16 × 16), which is composed of four DCT blocks, is configured for the luminance signal. When the color difference signals Cr and Cb are (4: 2: 0), blocks of (8 × 8) are formed. These six DCT blocks in total are combined to form one macroblock.
【0015】走査変換部1においてマクロブロック化さ
れたデータが本線系2および予測系3にそれぞれ入力さ
れる。本線系2は、参照符号4が付されたFIFO、参
照符号5が付されたDCT処理部、参照符号6が付され
た量子化部、参照符号7が付されたVLC(Variable Le
ngth Coding) 、参照符号8が付されたバッファとから
なる。The data converted into macroblocks in the scan conversion unit 1 are input to the main line system 2 and the prediction system 3, respectively. The main line system 2 includes a FIFO denoted by reference numeral 4, a DCT processing unit denoted by reference numeral 5, a quantization unit denoted by reference numeral 6, and a VLC (Variable Lease) denoted by reference numeral 7.
ngth Coding) and a buffer with reference numeral 8.
【0016】DCT処理部5では、イントラ符号化が行
われ、入力画素値そのものがDCTされる。なお、前フ
レームのローカル復号値を動き補償することによって形
成された予測値と入力画素値とのフレーム間差分を求
め、フレーム間差分をDCTするようにしても良い。量
子化部6には、予測系3においてマクロブロックmb毎に
決定された量子化ステップQ final[mb]が供給され、こ
の量子化ステップQ final[mb]でDCT係数が量子化さ
れる。FIFO4は、予測系3において、量子化ステッ
プQ finalが決定されるまでの時間を補償するための遅
延素子である。In the DCT processing section 5, intra coding is performed and the input pixel value itself is DCT processed. The interframe difference between the predicted value formed by motion compensation of the local decoded value of the previous frame and the input pixel value may be obtained, and the interframe difference may be DCT. The quantization unit 6 includes a quantization step Q determined for each macroblock mb in the prediction system 3. final [mb] is supplied, this quantization step Q DCT coefficients are quantized by final [mb]. The FIFO 4 uses the quantization step Q in the prediction system 3. It is a delay element to compensate for the time until final is determined.
【0017】量子化部6からの量子化DCT係数がVL
C部7において可変長符号化される。VLC部7の出力
がバッファ8に供給される。バッファ8によって平滑化
がなされ、ビットストリームが出力される。The quantized DCT coefficient from the quantizer 6 is VL.
Variable length coding is performed in the C unit 7. The output of the VLC unit 7 is supplied to the buffer 8. Smoothing is performed by the buffer 8 and the bit stream is output.
【0018】予測系3は、参照符号9で示すDCT処理
部と、参照符号10−1,10−2,・・・,10−n
で示すn個の量子化器と、参照符号11−1,11−
2,・・・,11−nで示すn個の符号量検出器と、参
照符号12で示すメモリと、参照符号13で示す量子化
ステップ決定部と、参照符号14で示す作業用のメモリ
と、アクティビティ算出回路15とからなる。量子化ス
テップ決定部13からの量子化ステップが上述した本線
系2の量子化部6に供給される。The prediction system 3 includes a DCT processing unit indicated by reference numeral 9 and reference numerals 10-1, 10-2, ..., 10-n.
N quantizers and reference symbols 11-1, 11-
2, ..., 11-n code amount detectors, a memory indicated by reference numeral 12, a quantization step determination unit indicated by reference numeral 13, and a working memory indicated by reference numeral 14. , Activity calculation circuit 15. The quantization step from the quantization step determination unit 13 is supplied to the quantization unit 6 of the main line system 2 described above.
【0019】n個の量子化器10−1,10−2,・・
・,10−nは、それぞれ異なる量子化ステップで量子
化する。各量子化器で発生した量子化DCT係数が符号
量検出器11−1,11−2,・・・,11−nに供給
され、各マクロブロックの符号量が符号量検出器11−
1,11−2,・・・,11−nからそれぞれ発生す
る。符号量検出器11−1,11−2,・・・,11−
nは、量子化DCT係数をVLC部7と同様に可変長符
号化し、可変長符号をマクロブロックについて集計する
構成とされている。このようにして求められた各マクロ
ブロックについての各量子化の符号量をバッファメモリ
12に保存する。The n quantizers 10-1, 10-2, ...
., 10-n are quantized at different quantization steps. The quantized DCT coefficient generated by each quantizer is supplied to the code amount detectors 11-1, 11-2, ..., 11-n, and the code amount of each macroblock is detected by the code amount detector 11-.
, 11-2, ..., 11-n. Code amount detectors 11-1, 11-2, ..., 11-
n has a configuration in which the quantized DCT coefficient is variable-length coded similarly to the VLC unit 7, and the variable-length code is aggregated for macroblocks. The code amount of each quantization for each macro block obtained in this way is stored in the buffer memory 12.
【0020】メモリ12上では、マクロブロックmbに対
して、q scaIeで量子化した符号量をLength[mb,q sca1
e]といった二次元配列の形で保存する。例えば1画面内
のマクロブロック数が1350個で、量子化ステップの
種類が31個であれば、縦および横方向のアドレスの一
方が(mb=1)から(mb=1350)までとされ、
縦および横方向のアドレスの他方が(q scaIe=1)か
ら(q scaIe=31)までとされ、両者で指定されるメ
モリ上のアドレスに各マクロブロックの符号量のデータ
が格納される。On the memory 12, for macroblock mb, q The code amount quantized by scaIe is Length [mb, q sca1
Save as a two-dimensional array such as e]. For example, if the number of macroblocks in one screen is 1350 and the type of quantization step is 31, one of the vertical and horizontal addresses is from (mb = 1) to (mb = 1350),
The other of the vertical and horizontal addresses is (q From scaIe = 1) to (q up to scaIe = 31), and the data of the code amount of each macroblock is stored at the address on the memory designated by both.
【0021】メモリ12に格納された符号量を用いて、
マクロブロック毎に1つの量子化ステップを選択しなが
ら、1画面分を総和した時の符号量が目標符号量GEN
TGT(図2参照)を上回らずに最も近くなる様な量
子化ステップの組合せを探す。この量子化ステップの組
合せを求める方法がこの発明に係わるものである。実際
のアプリケーションでは、各マクロブロックの量子化ス
テップを同じにするのではなく、マクロブロック毎にそ
の性質を加味して変化させるようになされる。このため
に、アクティビティ算出回路15が設けられ、各マクロ
ブロックの局所的情報Act(mb)が算出される。アクティ
ビティAct(mb)がバッファメモリ12に供給される。Using the code amount stored in the memory 12,
The code amount when summing up one screen while selecting one quantization step for each macroblock is the target code amount GEN.
Look for the closest combination of quantization steps that does not exceed TGT (see FIG. 2). The method for obtaining the combination of the quantization steps is related to the present invention. In an actual application, the quantization step of each macroblock is not made the same, but is changed in consideration of its property for each macroblock. For this purpose, an activity calculation circuit 15 is provided, and local information Act (mb) of each macroblock is calculated. The activity Act (mb) is supplied to the buffer memory 12.
【0022】量子化ステップ決定部13は、メモリ12
の内容を使用して目標符号量を超えないで、且つ目標符
号量との差が最小となる参照量子化min qqを求め、ま
た、メモリ12の内容を使用して、後述するように、最
終的なものである、Q finalを決定するものである。The quantization step determining unit 13 is provided in the memory 12
The reference quantization min that does not exceed the target code amount by using the content of Using the contents of memory 12 to determine qq, which is the final one, as described below, Q It determines the final.
【0023】量子化ステップ決定部13には、各マクロ
ブロックmbに対応して決定された量子化ステップがQ f
inal[mb]という配列の形で格納される。この情報は本線
系2に伝送される。本線系2の量子化部6では、各マク
ロブロックmb no毎に検出された量子化ステップQ fina
l[mb]によってそのマクロブロックのDCT係数が量子
化される。The quantization step determination unit 13 determines the quantization step determined for each macroblock mb as Q. f
It is stored in the form of an array called inal [mb]. This information is transmitted to the main line system 2. In the quantization unit 6 of the main line system 2, each macro block mb Quantization step Q detected for each no fina
The DCT coefficient of the macroblock is quantized by l [mb].
【0024】このような処理により、等長化単位例えば
1画面単位の合計符号長を所望の量以下にする、固定長
符号量制御が実現できる。この制御において、目標符号
量GEN TGTを上回らず、これに最も近くなるよう
な量子化ステップの組合せを見つける方法が重要であ
る。図2の例では、Q3では、合計符号長が目標符号量
GEN TGTを上回り、Q4が合計符号長が目標符号
量GEN TGTを超えない範囲で、最も近いものであ
る。そうであっても、Q4を適用した場合、合計符号長
と目標符号量GEN TGTとの間の差が存在する。こ
の差ができる限り小さいことが望ましい。By such processing, fixed length code amount control can be realized in which the total code length of the equal length unit, for example, one screen unit, is made equal to or smaller than a desired amount. In this control, the target code amount GEN It is important to find a combination of quantization steps that does not exceed TGT and is closest to TGT. In the example of FIG. 2, in Q3, the total code length is the target code amount GEN. It exceeds TGT, and the total code length of Q4 is the target code amount GEN. It is the closest one within a range not exceeding TGT. Even so, when Q4 is applied, the total code length and the target code amount GEN There is a difference between TGT. It is desirable that this difference be as small as possible.
【0025】ここで、この差を小さくするために、マク
ロブロックのアクティビティ情報を用いて量子化ステッ
プを変化させることが効果的である。アクティビティと
は、画面内の局所的な画像の性質を表すものである。コ
ンポーネント信号の場合では、輝度信号を使用してアク
ティビティが算出される。Here, in order to reduce this difference, it is effective to change the quantization step using the activity information of the macroblock. An activity represents a local image property on the screen. In the case of component signals, the luminance signal is used to calculate activity.
【0026】マクロブロックのアクティビティとして
は、従来から知られているように、差の絶対値の合計等
いくつかのものが使用できるが、例えばアクティビティ
として、下記の式1で示すようなマクロブロックを構成
する複数の画素値の分散を使用できる。式1でNは、マ
クロブロックを構成する画素の数であり、xが画素値で
あり、ΣがN画素についての集計を表し、x^がマクロ
ブロックの画素値の平均値である。As the activity of the macroblock, several things such as the sum of the absolute values of the differences can be used as conventionally known. For example, as the activity, a macroblock as shown in the following formula 1 is used. A variance of the constituent pixel values can be used. In Expression 1, N is the number of pixels forming the macroblock, x is the pixel value, Σ is the total for N pixels, and x ^ is the average value of the pixel values of the macroblock.
【0027】 Act(mb) =1/N・Σ(x−x^)2 (1) (x^=1/N・Σx)Act (mb) = 1 / N · Σ (x−x ^) 2 (1) (x ^ = 1 / N · Σx)
【0028】図4は、アクティビティ算出回路15の構
成を示す。参照符号101がマクロブロックの平均値算
出回路であり、参照符号102が時間合わせ用の遅延素
子としてのFIFOであり、参照符号103で示す減算
器によって平均値に対する各画素値の差が演算される。
差が参照符号104で示す二乗器で二乗され、さらに積
算器105で積算され、積算値が106で示す割算回路
で割り算される。割算回路106から式1で表されるア
クティビティ情報Act(mb)が発生する。FIG. 4 shows the configuration of the activity calculation circuit 15. Reference numeral 101 is a macroblock average value calculation circuit, reference numeral 102 is a FIFO as a delay element for time adjustment, and a subtracter indicated by reference numeral 103 calculates the difference between each pixel value and the average value. .
The difference is squared by a squarer indicated by reference numeral 104, further integrated by an integrator 105, and the integrated value is divided by a division circuit indicated by 106. The division circuit 106 generates activity information Act (mb) represented by Expression 1.
【0029】予測系3の量子化器10−1,10−2,
・・・1・10−nでは、アクティビティを考慮した量
子化を行なっていない。各量子化器では、Qスケールで
1画面全体に渡ってDCT係数を量子化する。なお、図
3におけるアクティビティ算出回路15は、上述した図
4の構成を有するものである。Quantizers 10-1, 10-2 of the prediction system 3,
・ ・ ・ 1-10-n does not perform quantization considering activity. Each quantizer quantizes the DCT coefficient over the entire screen on the Q scale. The activity calculation circuit 15 in FIG. 3 has the configuration of FIG. 4 described above.
【0030】そして、1画面全部に対して適用される一
定値Qref に対して、各マクロブロックに適用するアク
ティビティを考慮した量子化ステップQact (mb)が得ら
れる。この量子化ステップで量子化した時のそのマクロ
ブロックの符号量Length[mb,Qact (mb)]を使用して1
画面の総符号量が求まる。次にQref を変えていった時
の総符号量のうちで、目標符号量GEN TGTを超え
ないで、且つ目標符号量との差を最小とする総符号量を
生じさせるQref が参照量子化min qqが量子化ステップ
決定部13によって求められる。Then, for the constant value Q ref applied to the entire one screen, the quantization step Q act (mb) considering the activity applied to each macroblock is obtained. 1 using the code amount Length [mb, Q act (mb)] of the macroblock when quantized in this quantization step
The total code amount of the screen is obtained. Next, of the total code amount when Q ref is changed, the target code amount GEN Not exceed TGT, and the difference between the target code amount causes a total code amount for minimizing Q ref is the reference quantization min qq is obtained by the quantization step determination unit 13.
【0031】かかる参照量子化min_qqを求める方法につ
いて説明する。予測系3では、上述したように、31種
類のQスケールによって量子化を行ないそのときの総符
号量Length[mb,q scaIe]をメモリ12上に保存してい
る。ここでは、アクティビティが考慮されていない。こ
の時の量子化ステップq scaIe がある参照量子化ステッ
プQref に対して、当該マクロブロックのアクティビテ
ィを考慮した場合のものQact の場合、求められた符号
量を、Qref をインデックスとして1画面に渡り累算す
る。この結果、1画面分の予測系の処理が終った時に
は、各参照量子化Q ref に対して、アクティビティを考
慮した画面総和の符号量が得られることになる。A method for obtaining the reference quantization min_qq will be described.
And explain. In the prediction system 3, as described above, 31 types
Quantization according to the Q scale of the class
Volume Length [mb, q scaIe] is stored in memory 12.
It Activities are not considered here. This
Quantization step q Reference quantization step with scaIe
QrefThe macro block's activity
Considering QactIf, the sign obtained
Quantity, QrefAccumulate over 1 screen as index
It As a result, when the processing of the prediction system for one screen is completed,
Is each reference quantization Q refConsider the activity against
The code amount of the screen sum considered is obtained.
【0032】レートコントロールにおいては、Qref を
離散的に変化させて、目標符号量GEN TGTを超え
ないで目標符号量GEN TGTとの差が最小になるよ
うな参照量子化を見つける。このようにしてmin qqが求
められる。この処理は、Qre f の総数に等しい回数の比
較で済む。In the rate control, Q ref is changed discretely to obtain the target code amount GEN. Target code amount GEN without exceeding TGT Find the reference quantization that minimizes the difference from the TGT. In this way min qq is required. This process requires the comparison of number of times equal to the total number of Q re f.
【0033】以上の処理を実現するために、予測系3に
は、量子化ステップ決定部13が設けられている。量子
化ステップ決定部13の一例の構成を図5に示す。入力
として与えられるデータは、そのマクロブロック(mb番
目のマクロブロック)のアクティビティ情報Act(mb)
と、Qスケールと、Qスケールで量子化した時の符号量
Length(mb)である。量子化ステップ決定部13は、メモ
リ12に対してアドレスを出力してアドレスに対応する
Length(mb)を受け取るので、Qスケールの値が分かる。
各マクロブロックごとにAct(mb)が一つ決定され、Qス
ケールは、量子化器10−1,・・・,10−nによっ
て、各マクロブロック内で異なる値を並列に適用し、各
々に対するLength(mb)が計算される。アクティビティ情
報Act(mb)は、アクティビティ算出回路15から供給さ
れる。符号量Length(mb)は、メモリ12から読み出され
たものである。量子化ステップ決定部13に対する入力
としては、n個のQスケールに対応する符号量Length(m
b)が1画面の最初のマクロブロックに関するものからそ
の最後のマクロブロックに関するものまで順に供給され
る。In order to realize the above processing, the prediction system 3 is provided with a quantization step determining unit 13. FIG. 5 shows an example of the configuration of the quantization step determining unit 13. The data given as input is the activity information Act (mb) of the macroblock (mbth macroblock).
, Q scale, and code amount when quantized by Q scale
Length (mb). The quantization step determination unit 13 outputs the address to the memory 12 and corresponds to the address.
Since Length (mb) is received, the value of the Q scale is known.
One Act (mb) is determined for each macroblock, and the Q scale applies different values in each macroblock in parallel by the quantizers 10-1, ..., 10-n, and Length (mb) is calculated. The activity information Act (mb) is supplied from the activity calculation circuit 15. The code amount Length (mb) is read from the memory 12. As an input to the quantization step determination unit 13, the code amount Length (m
b) is supplied in order from the first macroblock of the screen to the last macroblock.
【0034】参照符号301で示すマッピング部に対し
て、Act(mb)およびQスケールが供給される。マッピン
グ部301は、一例として下記の式2と逆の関係でもっ
て入力されたQスケール(Qact )をQref に変換する
ものである。すなわち、Qスケールをアクティビティを
考慮したものと仮定し、アクティビティを考慮しない値
Qrefをマッピング部301が出力する。Act (mb) and Q scale are supplied to the mapping unit indicated by reference numeral 301. The mapping unit 301 converts the Q scale (Q act ) input in the inverse relationship of the following Expression 2 into Q ref , for example. That is, assuming that the Q scale considers the activity, the mapping unit 301 outputs a value Q ref that does not consider the activity.
【0035】アクティビティが大きい箇所は比較的画質
の劣化が目立ちにくく、量子化ステップを相対的に粗く
することが可能であり、また、アクティビティが小さい
箇所は比較的画質の劣化が目立ちやすいため、量子化ス
テップを相対的に細かくする必要がある。アクティビテ
ィと量子化ステップを関連づける方法を以下に説明す
る。The deterioration of the image quality is relatively inconspicuous in the areas where the activity is large, and the quantization step can be made relatively coarse, and the deterioration in the image quality is relatively conspicuous in the areas where the activity is small. The conversion step needs to be relatively fine. A method of associating an activity with a quantization step will be described below.
【0036】参照量子化ステップQref に対して、アク
ティビティを考慮した場合の量子化ステップ(実際に使
用される量子化ステップ)をQact (mb)とすると、次の
式2でQact (mb)が決定される。この場合、総符号量を
目標符号量以下に制御することは無視されている。な
お、参照量子化ステップQref とは、アクティビティを
考慮しないで、1画面全体を量子化する量子化ステップ
を意味する。この一実施形態は、画面の局所的情報とし
てのアクティビティを考慮するものであるので、仮想的
なQrefを導入し、Qrefをアクティビティに応じて変更
するものである。変更する割合は、Qrefの値と無関係
にアクティビティに応じて一定である。[0036] with respect to the reference quantization step Q ref, the quantization step in the case of considering the activity of the (quantization step actually used) When Q act (mb), Q act (mb by the following formula 2 ) Is determined. In this case, controlling the total code amount to be equal to or less than the target code amount is ignored. The reference quantization step Q ref means a quantization step of quantizing the entire one screen without considering the activity. Since this one embodiment considers the activity as the local information of the screen, a virtual Q ref is introduced and the Q ref is changed according to the activity. The rate of change is constant depending on the activity, regardless of the value of Q ref .
【0037】 Qact (mb)=fmap (Qref (mb),act(mb)) (2)Q act (mb) = f map (Q ref (mb), act (mb)) (2)
【0038】ここで、関数fmap() は、act(mb) とQ
ref からQact (mb)を計算するためのものである。例え
ばMPEGのTM(Test Model)5で使用されているもの
を次の式3で示す。Here, the function f map () is the same as act (mb) and Q
It is for calculating Q act (mb) from ref . For example, the one used in TM (Test Model) 5 of MPEG is shown by the following Expression 3.
【0039】 fmap TM(Qref (mb),act(mb)) =[(2.0×act(mb)+N act)/(act(mb)+2.0×N act)]×Qref (mb) (3)F map TM (Q ref (mb), act (mb)) = [(2.0 × act (mb) + N act) / (act (mb) + 2.0 × N act)] × Q ref (mb) (3)
【0040】ここで、N act は、act(mb)の1画面の平
均であるが、システムデイレイを考慮して、前画面の値
を用いることもある。式3において、act(mb)=N act
であれば、Qref に対して乗じられる係数kが1とな
る。act(mb)=0であれば、Qr efに対して乗じられる係
数kが0.5となる。係数kは、0.5から2までの範囲
の値をとりうる。このような関数fmap() を用いて、Q
act (mb)を算出する。本来、アクティビティ情報Act(m
b)は、連続値(小数点以下の値を有する値)であるが、
適当に丸めた代表値、例えば16ステップの代表値であ
っても画質的には十分である。Where N Although act is the average of one screen of act (mb), the value of the previous screen may be used in consideration of the system delay. In Expression 3, act (mb) = N act
Then, the coefficient k by which Q ref is multiplied becomes 1. If act (mb) = 0, the coefficient k to be multiplied with respect to Q r ef is 0.5. The coefficient k can take values in the range 0.5 to 2. Using such a function f map (), Q
Calculate act (mb). Originally, activity information Act (m
b) is a continuous value (value with a value after the decimal point),
A properly rounded representative value, for example, a representative value of 16 steps is sufficient for image quality.
【0041】簡単な例として、1画面内に4個のマクロ
ブロックが存在し、各マクロブロックのアクティビティ
情報Act(mb)を考慮した量子化の操作が(×0.5,×1.0,×
0.5,×2.0) であったとする。参照量子化Qref が例え
ば10の場合では、各マクロブロックに対するアクティ
ビティを考慮した量子化Qact は、Qref に対してAct
(mb)を考慮した操作を行うことで、(5,10,5,20)とな
る。例えばマッピング部301に対してAct(mb)=0.5
でQact =10が供給されるときには、Qref が20で
あることが分かる。As a simple example, there are four macroblocks in one screen, and the quantization operation considering the activity information Act (mb) of each macroblock is (× 0.5, × 1.0, ×).
0.5, × 2.0). In the case the reference quantization Q ref is for example 10, the quantization Q act in consideration of activity for each macroblock, Act against Q ref
By performing the operation considering (mb), it becomes (5,10,5,20). For example, Act (mb) = 0.5 for the mapping unit 301
It can be seen that Q ref is 20 when Q act = 10 is supplied.
【0042】マッピング部301からの参照量子化Q
ref がアドレス生成部302に供給される。アドレス生
成部302は、Qref からメモリ303のアドレスを発
生する。メモリ303は、予めフレームの先頭でクリア
される。Qref として31通りのものが用意されている
時には、Qref と対応して31個のメモリ303のアド
レスが存在する。1画面内のマクロブロック毎に31種
類のQスケールと各Qスケールに対応したLengthが量子
化ステップ決定部13へ入力される。Reference quantization Q from mapping section 301
The ref is supplied to the address generator 302. The address generator 302 generates the address of the memory 303 from Q ref . The memory 303 is cleared at the beginning of the frame in advance. When 31 kinds of Q ref are prepared, there are 31 addresses of the memory 303 corresponding to Q ref . 31 types of Q scales and Lengths corresponding to the respective Q scales are input to the quantization step determination unit 13 for each macroblock in one screen.
【0043】あるアドレスがメモリ303に与えられる
と、そのアドレスに既に書かれているデータ量がメモリ
303から読み出され、加算器304にフィードバック
される。そして、加算器304にて入力Lengthと加算さ
れたものがメモリ303の同じアドレスに書き込まれ、
積算動作がなされる。したがって、1画面の全てのマク
ロブロックの処理が終了すると、Qref のそれぞれにつ
いての総符号量がメモリ303上に格納される。When an address is given to the memory 303, the amount of data already written at that address is read from the memory 303 and fed back to the adder 304. Then, the sum added with the input Length in the adder 304 is written in the same address of the memory 303,
Accumulation operation is performed. Therefore, when the processing of all macroblocks in one screen is completed, the total code amount for each Q ref is stored in the memory 303.
【0044】次に、参照符号305で示すカウンタのカ
ウント値がアドレス生成部302およびレジスタ309
に供給される。このカウント値は、Qref の31通りの
値に対応して例えば30,29,・・・,0とデクリメ
ントするものである。Qrefがデクリメントされるにし
たがって総符号量が増大する。アドレス生成部302
は、カウント値に応じてリードアドレス(すなわち、Q
ref )をメモリ303に与える。メモリ303からその
アドレスの総符号量が読み出され、減算器306に総符
号量が供給される。Next, the count value of the counter indicated by reference numeral 305 is the address generation unit 302 and the register 309.
Is supplied to. The count value is decremented, for example, 30, 29, ..., 0, corresponding to 31 values of Q ref . The total code amount increases as Q ref is decremented. Address generator 302
Read address (that is, Q
ref ) is given to the memory 303. The total code amount of the address is read from the memory 303, and the total code amount is supplied to the subtractor 306.
【0045】減算器306には、目標符号量GEN T
GTが供給され、メモリ303から読み出された総符号
量が目標符号量GEN TGTから減算される。減算器
306の出力が比較器307およびレジスタ308に供
給される。比較器307の出力がレジスタ308および
309に対してイネーブルとして供給される。比較器3
07の他方の入力としてレジスタ308の出力が供給さ
れる。The subtractor 306 has a target code amount GEN. T
When the GT is supplied and the total code amount read from the memory 303 is the target code amount GEN Subtracted from TGT. The output of the subtractor 306 is supplied to the comparator 307 and the register 308. The output of comparator 307 is provided as an enable to registers 308 and 309. Comparator 3
The output of register 308 is provided as the other input of 07.
【0046】比較器307は、減算器306の減算出力
とレジスタ308に蓄えられているレジスタデータとを
比較し、減算出力がレジスタデータより小さい場合に、
レジスタ308および309が入力を取り込むイネーブ
ルとしての比較出力を発生する。減算出力が負の場合で
は、比較器307がイネーブルを発生しない。したがっ
て、Qref の全てに対応するリードアドレスを発生し終
えた時点では、レジスタ308には、最小の減算出力が
格納され、レジスタ309には、最小減算出力を発生し
たQref に対応するカウント値が格納されている。この
カウント値がmin qqとして出力される。なお、減算出力
が負となった時点で、カウンタ305のカウントを停止
しても良い。The comparator 307 compares the subtraction output of the subtractor 306 with the register data stored in the register 308, and when the subtraction output is smaller than the register data,
Registers 308 and 309 generate the compare output as an enable to capture the inputs. If the subtraction output is negative, the comparator 307 does not generate an enable. Therefore, at the time when the generation of the read addresses corresponding to all of Q ref is completed, the minimum subtraction output is stored in the register 308, and the count value corresponding to Q ref that generated the minimum subtraction output is stored in the register 309. Is stored. This count value is min Output as qq. The count of the counter 305 may be stopped when the subtraction output becomes negative.
【0047】量子化ステップ決定部13の処理につい
て、図6を参照してより具体的に説明する。簡単のため
に、量子化ステップ(q scale)の種類が1,2,4,
8,16であり、アクティビティを考慮した量子化の操
作(係数k)が0.5,1.0,2.0 であるとする。この場合で
は、Qref とQact とは、図6Aに示すような関係とな
る。例えばQref =2の例では、アクティビティを考慮
した量子化ステップQactがQact =1,Qact =2,
Qact =4となる。The process of the quantization step determining unit 13 will be described more specifically with reference to FIG. For simplicity, the quantization step (q (scale) types are 1, 2, 4,
8 and 16, and the quantization operation (coefficient k) considering the activity is 0.5, 1.0, and 2.0. In this case, Q ref and Q act have the relationship shown in FIG. 6A. For example, in the case of Q ref = 2, the quantization step Q act considering the activity is Q act = 1 and Q act = 2.
Q act = 4.
【0048】今、4つのマクロブロックmb0,mb1,mb2,mb
3からなる1画面を考える。それぞれのアクティビティ
情報(係数k)を(2.0,0.5,2.0,1.0)とする。画面内の
Qref を2,4,8とした場合、各マクロブロックmbn
のアクティビティを考慮した量子化ステップは、図6B
に示すものとなる。Qref =1およびQref =16の場
合には、操作後の値が規定の範囲からはみ出してしまう
ために除外している。すなわち、該当なしとして処理す
る。Now, four macro blocks mb0, mb1, mb2, mb
Consider a screen consisting of three. Each activity
The information (coefficient k) is (2.0,0.5,2.0,1.0). In the screen
Qref , 2, 4, 8 each macroblock mbn
The quantization step considering the activity of FIG.
It will be as shown in. Qref= 1 and Qref= 16
The value after operation will fall outside the specified range.
To exclude for. That is, it is treated as not applicable.
It
【0049】したがって、Qref に対する1画面の総符
号量total length(Qref )は、下記に示すものとなる。Therefore, the total code amount of one screen for Q ref total The length (Q ref ) is as shown below.
【0050】total length(2)=Length[mb0,4]+Length
[mb1,1]+Length[mb2,4]+Length[mb3,2]
total length(4)=Length[mb0,8]+Length[mb1,2]+Len
gth[mb2,8]+Length[mb3,4]
total length(8)=Length[mb0,16]+Length[mb1,4]+Le
ngth[mb2,16]+Length[mb3,8]Total length (2) = Length [mb0,4] + Length
[mb1,1] + Length [mb2,4] + Length [mb3,2] total length (4) = Length [mb0,8] + Length [mb1,2] + Len
gth [mb2,8] + Length [mb3,4] total length (8) = Length [mb0,16] + Length [mb1,4] + Le
ngth [mb2,16] + Length [mb3,8]
【0051】図3おける予測系3では、各マクロブロッ
クに対して全ての量子化ステップ1,2,4,8,16
によってそれぞれ量子化を行う。まず、total length
(2)、total length(4)、total length(8)が0に初期化
される。最初のマクロブロックmb0について、Length[mb
0,1],Length[mb0,2],Length[mb0,4],Length[mb0,
8],Length[mb0,16]が得られる。mb0 のアクティビティ
を考慮した量子化ステップの操作(係数k)が2である
ので、図6Aを参照してQact からQrefの関係を求め
ることにより下記のように各Qrefに対する符号量が分
かる。In the prediction system 3 in FIG. 3, all the quantization steps 1, 2, 4, 8 and 16 are performed for each macroblock.
Quantize each by. First, total length
(2), total length (4), total length (8) is initialized to 0. For the first macroblock mb0, Length [mb
0,1], Length [mb0,2], Length [mb0,4], Length [mb0,
8], Length [mb0,16] are obtained. Since the operation (coefficient k) of the quantization step considering the activity of mb0 is 2, the code amount for each Q ref can be found as follows by obtaining the relationship of Q ref from Q act with reference to FIG. 6A. .
【0052】Length[mb0,1]・・・・該当無し(Qact
が1になるようなQrefが存在しないという意味であ
る。)
Length[mb0,2]・・・・Qref =1でアクティビティを
考慮した符号量
Length[mb0,4]・・・・Qref =2でアクティビティを
考慮した符号量
Length[mb0,8]・・・・Qref =4でアクティビティを
考慮した符号量
Length[mb0,16]・・・・Qref =8でアクティビティを
考慮した符号量Length [mb0,1] ... Not applicable (Q act
It means that there is no Q ref such that 1 becomes 1. ) Length [mb0,2] ··· Code quantity considering activity with Q ref = 1 Length [mb0,4] ··· Code quantity considering activity with Q ref = 2 Length [mb0,8] ··· Q code amount considering the activity in ref = 4 Length [mb0,16] code amount in consideration of the activity in ···· Q ref = 8
【0053】図6Aに示す表を参照するのがマッピング
部301(図5参照)である。マッピング部301から
のQref に応じてメモリ303のアドレスを変化させて
積算する。それによってマクロブロックmb0 だけでのto
tal lengthは,下記のものとなる。The mapping unit 301 (see FIG. 5) refers to the table shown in FIG. 6A. The address of the memory 303 is changed according to Q ref from the mapping unit 301, and integration is performed. This allows to in macroblock mb0 only
tal The length is as follows.
【0054】total length(2)=Length[mb0,4] total length(4)=Length[mb0,8] total length(8)=Length[mb0,16]Total length (2) = Length [mb0,4] total length (4) = Length [mb0,8] total length (8) = Length [mb0,16]
【0055】マクロブロックmb1 については、アクティ
ビティを考慮した量子化ステップの操作(係数k)が0.
5 であるので、図6Aを参照して同様に符号量が分か
る。For the macroblock mb1, the operation of the quantization step (coefficient k) considering the activity is 0.
Since it is 5, the code amount can be similarly known with reference to FIG. 6A.
【0056】Length[mb1,1]・・・・Qref =2でアク
ティビティを考慮した符号量
Length[mb1,2]・・・・Qref =4でアクティビティを
考慮した符号量
Length[mb1,4]・・・・Qref =8でアクティビティを
考慮した符号量
Length[mb1,8]・・・・Qref =16でアクティビティ
を考慮した符号量
Length[mb1,16]・・・・該当無しLength [mb1,1] ... Code amount considering the activity when Q ref = 2 Length [mb1,2] ... Code amount considering the activity when Q ref = 4 Length [mb1,4] ] ・ ・ ・ ・ Code amount Length [mb1,8] considering activity with Q ref = 8 ・ ・ ・ ・ Code amount Length [mb1,16] considering activity with Q ref = 16 ・ ・ ・ ・ ・ ・ Not applicable
【0057】これによりマクロブロックmb1 までのtota
l lengthは,下記のものとなる。By this, tota up to macroblock mb1
l The length is as follows.
【0058】 total length(2)=Length[mb0,4]+Length(mb1,1] total length(4)=Length[mb0,8]+Length(mb1,2] total length(8)=Length[mb0,16]+Length(mb1,4]Total length (2) = Length [mb0,4] + Length (mb1,1] total length (4) = Length [mb0,8] + Length (mb1,2] total length (8) = Length [mb0,16] + Length (mb1,4]
【0059】マクロブロックmb2 については、アクティ
ビティを考慮した量子化ステップの操作(係数k)が2.
0 であるので、図6Aを参照して同様に符号量が分か
る。For the macroblock mb2, the quantization step operation (coefficient k) considering the activity is 2.
Since it is 0, the code amount can be similarly known with reference to FIG. 6A.
【0060】Length[mb2,1]・・・・該当無し
Length[mb2,2]・・・・Qref =1でアクティビティを
考慮した符号量
Length[mb2,4]・・・・Qref =2でアクティビティを
考慮した符号量
Length[mb2,8]・・・・Qref =4でアクティビティを
考慮した符号量
Length[mb2,16] ・・・・Qref =8でアクティビティ
を考慮した符号量[0060] Length [mb2,1] ···· applicable without Length [mb2,2] ···· Q ref = amount of code in consideration of the activity in 1 Length [mb2,4] ···· Q ref = 2 , Code amount considering the activity in Length [mb2,8] ··· Code amount considering the activity in Q ref = 4 Length [mb2,16] ··· Code amount considering the activity in Q ref = 8
【0061】これによりマクロブロックmb2 までのtota
l lengthは,下記のものとなる。As a result, tota up to macroblock mb2
l The length is as follows.
【0062】total length(2)=Length[mb0,4]+Length
[mb1,1]+Length[mb2,4]
total length(4)=Length[mb0,8]+Length[mb1,2]+Len
gth[mb2,8]
total length(8)=Length[mb0,16]+Length[mb1,4]+Le
ngth[mb2,16]
となる。Total length (2) = Length [mb0,4] + Length
[mb1,1] + Length [mb2,4] total length (4) = Length [mb0,8] + Length [mb1,2] + Len
gth [mb2,8] total length (8) = Length [mb0,16] + Length [mb1,4] + Le
It will be ngth [mb2,16].
【0063】マクロブロックmb3 については、アクティ
ビティを考慮した量子化ステップの操作(係数k)が1.
0 であるので、図6Aを参照して同様に符号量が分か
る。For the macroblock mb3, the operation (coefficient k) of the quantization step considering the activity is 1.
Since it is 0, the code amount can be similarly known with reference to FIG. 6A.
【0064】Length[mb3,1]・・・・Qref =1でアク
ティビティを考慮した符号量
Length[mb3,2]・・・・Qref =2でアクティビティを
考慮した符号量
Length[mb3,4]・・・・Qref =4でアクティビティを
考慮した符号量
Length[mb3,8]・・・・Qref =8でアクティビティを
考慮した符号量
Length[mb3,16] ・・・Qref =16でアクティビティ
を考慮した符号量Length [mb3,1] ... Code amount considering the activity with Q ref = 1 Length [mb3,2] ... Code amount considering the activity with Q ref = 2 Length [mb3,4 ] ··· Code amount Length [mb3,8] considering activity with Q ref = 4 ··· Code amount Length [mb3,16] considering activity with Q ref = 8 ··· Q ref = 16 Code amount considering activity in
【0065】これによりマクロブロックmb3 まで(すな
わち、1画面)のtotal lengthは,下記のものとなる。As a result, the total of up to macroblock mb3 (that is, one screen) The length is as follows.
【0066】total length(2)=Length[mb0,4]+Length
[mb1,1]+Length[mb2,4]+Length[mb3,2]
total length(4)=Length[mb0,8]+Length[mb1,2]+Len
gth[mb2,8]+Length[mb3,4]
total length(8)=Length[mb0,16]+Length[mb1,4]+Le
ngth[mb2,16]+Length[mb3,8]
となる。以上のようにして、2,4,8のQref に対す
る1画面の総符号量が求められる。Total length (2) = Length [mb0,4] + Length
[mb1,1] + Length [mb2,4] + Length [mb3,2] total length (4) = Length [mb0,8] + Length [mb1,2] + Len
gth [mb2,8] + Length [mb3,4] total length (8) = Length [mb0,16] + Length [mb1,4] + Le
It becomes ngth [mb2,16] + Length [mb3,8]. As described above, the total code amount of one screen for the Q refs of 2, 4, and 8 is obtained.
【0067】以上の処理によって、目標符号量GEN
TGTを超えないで、目標符号量GEN TGTとの差
が最小の参照量子化Qref がmin qqとして求められる。
しかしながら、Qref を離散的に操作しているので、ビ
ットレートも離散的な値しかとれず細かな制御ができな
いため、目標符号量GEN TGTとの差が充分に小さ
くならない可能性がある。そこで、この発明は、量子化
ステップが飛び飛びの離散値しか選ぶことができず、実
際に使用できるQact (mb)が丸め等の処理によって近い
値にマッピングをしていることを利用して、目標符号量
GEN TGTとの差をより小さくするものである。丸
め処理を利用して細かくビットレートを調整する。By the above processing, the target code amount GEN
The target code amount GEN is not exceeded without exceeding TGT. The reference quantization Q ref with the smallest difference from the TGT is min It is calculated as qq.
However, since Q ref is operated discretely, the bit rate can take only discrete values and fine control cannot be performed. Therefore, the target code amount GEN The difference from TGT may not be sufficiently small. Therefore, the present invention takes advantage of the fact that the quantization step can only select discrete discrete values, and the actually usable Q act (mb) is mapped to a close value by processing such as rounding. Target code amount GEN The difference from the TGT is made smaller. The bit rate is finely adjusted by using the rounding process.
【0068】すなわち、ビットレートを若干下げたい場
合には、いくつかのマクロブロックに対してQスケール
を大きくして総符号量を少なくすれば良い。このとき、
アクティビティを考慮した際の丸め処理によって切り捨
てられた量が大きいもの、すなわち、切り上げても弊害
が少なそうなものから順に切り上げるようにする。逆
に、ビットレートを若干上げたい場合には、いくつかの
マクロブロックに対してQスケールを小さくして総符号
量を大きくすれば良い。このとき、丸め処理によって切
り上げられた量が大きいものから順に切り捨てるように
する。それによって、アクティビティを考慮してQスケ
ールを変化させた時に、本来のQスケールに対して誤差
が少ないようにする。That is, when it is desired to slightly reduce the bit rate, the Q scale may be increased for some macroblocks to reduce the total code amount. At this time,
Round up the rounded down rounding when considering the activities, that is, the rounded down rounds that seem to cause less harm. On the other hand, when it is desired to increase the bit rate slightly, the Q scale may be reduced for some macroblocks to increase the total code amount. At this time, the rounding-up process is performed in order from the largest amount rounded up. Thereby, when the Q scale is changed in consideration of the activity, the error is small with respect to the original Q scale.
【0069】次に例を示す。簡単のため、1画面が4個
のマクロブロックによって構成されているとする。所望
のビットレートを得るため各マクロブロックに対するア
クティビティを考慮して連続値(小数点以下まで求めら
れる値)の量子化ステップは、(3.2、5.9、4.1、10.5)
とする。これを四捨五入で丸めをすると、(3、6、
4、11)となる。若し、この組み合わせにより得られ
るビットレートが所望のものよりも高く、ビットレート
を下げたい場合には、下記の順にQスケールを変化させ
る。()内の値は、元の連続値に対する差を示す。An example is shown below. For simplicity, it is assumed that one screen is composed of four macro blocks. The quantization step of continuous values (values obtained to the right of the decimal point) considering the activity for each macroblock to obtain the desired bit rate is (3.2, 5.9, 4.1, 10.5).
And If you round this off, you get (3, 6,
4 and 11). If the bit rate obtained by this combination is higher than the desired one and the bit rate is desired to be lowered, the Q scale is changed in the following order. The value in () shows the difference from the original continuous value.
【0070】3→4(0.8)、4→5(0.9)、6→7(1.
1)、11→12(1.5)3 → 4 (0.8), 4 → 5 (0.9), 6 → 7 (1.
1), 11 → 12 (1.5)
【0071】逆にビットレートが所望のものよりも低
く、ビットレートを上げたい場合には、下記の順にす
る。()内の値は、元の連続値に対する差を示す。On the contrary, when the bit rate is lower than the desired one and it is desired to increase the bit rate, the following order is applied. The value in () shows the difference from the original continuous value.
【0072】11→10(0.5)、6→5(0.9)、4→3
(1.1)、3→2(1.2)11 → 10 (0.5), 6 → 5 (0.9), 4 → 3
(1.1), 3 → 2 (1.2)
【0073】前述したmin qqは、目標符号量を超えない
ように設定されており、目標符号量までは、未だ余裕が
あるので、この余裕を利用してビットレートを上げよう
とするので、この場合は、ビットレートが所望のものよ
りも低く、ビットレートを上げたい場合に該当し、Qス
ケールを小さくする処理が必要である。しかしながら、
処理の順序例えば画面の上の左端から順に下の右端に向
かってQスケールを小さくした時には、処理の最初の部
分のQスケールのみが制御され、後半の部分では、Qス
ケールが制御されず、画質の改善にとってそれほど有効
ではない不都合が生じる。このような不都合を生じない
で、アクティビティ情報に応じて量子化ステップを制御
することが必要である。そのような処理を実現する方法
(アクティビティ部分和法と称する)について以下に説
明する。The above-mentioned min qq is set so that it does not exceed the target code amount, and there is still a margin up to the target code amount, so we try to increase the bit rate by using this margin, so in this case, the bit rate is This is lower than what is desired, and corresponds to the case where it is desired to increase the bit rate, and a process for reducing the Q scale is necessary. However,
Processing order For example, when the Q scale is decreased from the upper left end of the screen toward the lower right end, only the Q scale of the first part of the process is controlled, and the Q scale is not controlled in the latter part of the screen. There is an inconvenience that is not so effective for improving It is necessary to control the quantization step according to the activity information without causing such an inconvenience. A method for realizing such processing (called an activity partial sum method) will be described below.
【0074】アクティビティ部分和法は、予測系3で参
照量子化min qqを求めるために符号量の集計をとると同
時に、各アクティビティ毎の符号量の和を求めるように
する。すなわち、アクティビティAct(mb)とq scaIeの二
変数でインデックスされる配列データact sub ttl[acti
vity,q scaIe]を生成する。このデータをアクティビテ
ィ部分和と呼ぶことにする。アクティビティに離散値を
用いれば、q scaIeも離散値であるので、このデータを
格納するための容量は、実現可能なものである。The activity partial sum method uses the reference quantization min in the prediction system 3. In order to obtain qq, the code amount is totaled, and at the same time, the sum of the code amount for each activity is obtained. That is, the activities Act (mb) and q Array data indexed by two variables of scaI act sub ttl [acti
vity, q scaIe] is generated. This data will be called activity partial sum. If you use discrete values for the activity, q Since scaIe is also a discrete value, the capacity for storing this data is feasible.
【0075】図7は、アクティビティ部分和算出回路の
一例の構成を示す。前述した図5の構成と同様のもので
ある。すなわち、量子化ステップ決定部13には、図5
の構成と共に、図7のアクティビティ部分和算出回路も
設けられている。図5の構成では、1画面の全てのマク
ロブロックの処理が終了すると、Qref のそれぞれにつ
いての総符号量がメモリ上に格納される。一方、図7の
構成では、1画面の全てのマクロブロックの処理が終了
すると、アクティビティとq scaIeの二変数でインデッ
クスされる積算符号量がメモリ上に格納される。FIG. 7 shows an example of the structure of the activity partial sum calculation circuit. The configuration is similar to that of FIG. 5 described above. That is, the quantization step determination unit 13 is
In addition to the above configuration, the activity partial sum calculation circuit of FIG. 7 is also provided. In the configuration of FIG. 5, when the processing of all macroblocks of one screen is completed, the total code amount for each Q ref is stored in the memory. On the other hand, in the configuration of FIG. 7, when processing of all macroblocks on one screen is completed, the activity and q The accumulated code amount indexed by the two variables of scaIe is stored in the memory.
【0076】図7において、参照符号401がアドレス
生成回路を示し、参照符号402がメモリを示す。アド
レス生成回路401では、メモリ402に対する書き込
みアドレスおよび読み出しアドレスを生成する。書き込
みアドレスは、アクティビティAct(mb)とq scaIe(mb)と
の両者で決定される。読み出しアドレスとしては、任意
のアドレスが与えられる。同じ書き込みアドレスが指定
されると、メモリ402からの読み出しデータと入力デ
ータ(Length)とが加算器403が加算され、加算出力
がメモリ402の同一アドレスに対して書き込まれる。
メモリ402が1フレーム毎にクリアされる。したがっ
て、メモリ402上には、アクティビティとq scaIeの
二変数でインデックスされる1画面の積算符号量が格納
される。各符号量がアクティビティ部分和である。In FIG. 7, reference numeral 401 indicates an address generation circuit, and reference numeral 402 indicates a memory. The address generation circuit 401 generates a write address and a read address for the memory 402. The write address is activity Act (mb) and q Determined by both scaIe (mb). An arbitrary address is given as the read address. When the same write address is designated, the read data from the memory 402 and the input data (Length) are added by the adder 403, and the addition output is written to the same address of the memory 402.
The memory 402 is cleared every frame. Therefore, the activity and q The accumulated code amount of one screen indexed by two variables of scaIe is stored. Each code amount is a partial activity sum.
【0077】min qqを求めた後、参照量子化min qqに対
して、「アクティビティを考慮した丸めない量子化ステ
ップQact(mb)」と「その量子化ステップを一段階小
さくしたもの」との差が小さくなるアクティビティの順
番を求める。これは、アクティビティおよびq scaIeが
離散値であるので、あらかじめ計算でき、全てのq scaI
eのそれぞれについて、アクティビティの順番をテーブ
ルにしておくことで、容易に順番を求めることができ
る。Min After obtaining qq, the reference quantization min For qq, the order of activities in which the difference between the “non-rounding quantization step Q act (mb) considering the activity” and the “quantization step reduced by one step” is calculated. This is the activity and q Since scaIe is a discrete value, it can be calculated in advance and all q scaI
For each of the e, the order of the activities can be easily obtained by making a table of the order of the activities.
【0078】このアクティビティの順番に基づいて、ア
クティビティ部分和を用いて量子化ステップを一段階ず
らしてその符号量の増加を調べる。すなわち、順番が早
いものから順に量子化ステップを一つ下げる。総符号量
が目標符号量GEN TGTを超えることなく、GEN
TGTとの差が最小となるアクティビティを見つけ
る。これをmin actとする。この処理は、アクティビテ
ィの総数に等しい回数によってなされる。Based on the order of the activities, the quantization step is shifted by one step using the activity partial sum and the increase in the code amount is examined. That is, the quantization step is lowered by one from the earliest order. The total code amount is the target code amount GEN GEN without exceeding TGT
Find the activity with the smallest difference from the TGT. This is min Act. This process is done a number of times equal to the total number of activities.
【0079】次に、マクロブロック単位で調べる。すな
わち、アクティビティの順番がmin actよりも早いマクロ
ブロックについては、無条件に量子化ステップを一段階
下げる。アクティビティの順番がmin actと同じマクロ
ブロックについては、量子化ステップを一段階下げるこ
とが可能か否かを調べる。アクティビティの順番がmin
actより一つ遅いマクロブロックについては量子化ステ
ップを一段階下げることが不可能とする。この処理は、
マクロブロックの総数に等しい回数、行なわれる。Next, the macro block is examined. sand
Wow, the order of activities is min Macro faster than act
For blocks, unconditionally one quantization step
Lower. The order of activities is min same macro as act
For blocks, lower the quantization step by one.
Check if and are possible. The order of activities is min
For macroblocks one slower than act, the quantization step
It is impossible to lower the level by one step. This process
This is done a number of times equal to the total number of macroblocks.
【0080】図8および図9は、上述したアクティビテ
ィ部分和法を説明するためのフローチャートである。図
3の構成では、量子化ステップ決定部13においてフロ
ーチャートで示す処理がなされる。これらの図は、一連
の処理を示すものであるが、作図スペースの制約から二
つの図に分けたものである。最初のステップS1では、
テーブルを参照して現在のmin qqに対してアクティビテ
ィの順番act queue[ ]を求める。この順番は、最も早い
順が0で、以下、1,2,・・・と遅くなる。最も遅い
順位は、アクティビティの総数から1を減じたものであ
る。8 and 9 are flow charts for explaining the above-mentioned activity partial sum method. In the configuration of FIG. 3, the quantization step determination unit 13 performs the process shown in the flowchart. These figures show a series of processes, but are divided into two figures due to the restriction of the drawing space. In the first step S1,
Current min with reference to table The order of activities act for qq ask for queue []. In this order, the earliest order is 0, and the order is 1, 2, ... The slowest ranking is the total number of activities minus one.
【0081】ステップS2では、アクティビティの順番
を示す変数iが0に初期化される。ステップS3では、
変数actにi番目のアクティビティを代入する。In step S2, a variable i indicating the order of activities is initialized to 0. In step S3,
Assign the i-th activity to the variable act.
【0082】ステップS4では、actとmin qqによってq
scaIeを求める。ステップS5では、q scaIeを一ステ
ップ下げた時の総符号量を求める。総符号量をtmpと表
記する。At step S4, act and min qq by q
Find scaIe. In step S5, q Calculate the total code amount when scaIe is lowered by one step. The total code amount is written as tmp.
【0083】q scaIeを下げたことにより発生符号量の
総和が増加するので、ステップS6では、総符号量tmp
と目標符号量GEN TGTとを比較する。総符号量が
GEN TGT以下であれば、量子化ステップを下げる
ことができるので、処理が次のステップS7に進む。ス
テップS7では、アクティビティの順番を示す変数iを
進め、ステップS8でtotalを更新し、ステップS3に
戻る。次のアクティビティの順番に関して上述と同様の
処理がなされる。Q Since the sum of the generated code amount increases due to the decrease of scaIe, the total code amount tmp is set in step S6.
And the target code amount GEN Compare with TGT. Total code amount is GEN If it is less than or equal to TGT, the quantization step can be lowered, so that the process proceeds to the next step S7. In step S7, the variable i indicating the order of activities is advanced, total is updated in step S8, and the process returns to step S3. The same processing as described above is performed regarding the order of the next activity.
【0084】ステップS6において、発生符号量が目標
符号量GEN TGTより大と判定されれば、処理がス
テップS9に進む。ステップS9以降のフローが図9に
示されている。図9のフローは、マクロブロック単位の
処理である。ステップS9では、アクティビティの順番
を示す変数iが一つ減じられる。この減じた結果のアク
ティビティの順番は、総符号量tmpが目標符号量GEN
TGTを超えないものである。In step S6, the generated code amount is the target code amount GEN. If it is determined that it is larger than TGT, the process proceeds to step S9. The flow after step S9 is shown in FIG. The flow in FIG. 9 is processing in units of macroblocks. At step S9, one variable i indicating the order of activities is subtracted. The order of the activities resulting from this subtraction is that the total code amount tmp is the target code amount GEN.
It does not exceed TGT.
【0085】ステップS10では、マクロブロックのイ
ンデックスである変数mbがゼロに初期化される。ステッ
プS11では、変数mbが総マクロブロック数MB NUMであ
るか否かが判定される。そうであれば、全マクロブロッ
クの処理が終了したことになるので、処理が終了する。
変数mbが総マクロブロック数MB NUMに達していないなら
ば、ステップS12に処理が移る。In step S10, the variable mb, which is the index of the macroblock, is initialized to zero. In step S11, the variable mb is the total number of macroblocks MB. It is determined whether it is NUM. If so, it means that the processing of all macroblocks has been completed, so the processing is completed.
Variable mb is the total number of macroblocks MB If it has not reached NUM, the process proceeds to step S12.
【0086】ステップS12では、mbで示されるマクロ
ブロックのアクティビティの順番とステップS9のmin
actとを比較する。順番がmin actより小の場合では、量
子化ステップを無条件に下げることができるので、ステ
ップS17にジャンプし、そのマクロブロックmbの量子
化ステップが一つ減じられる。順番がmin actより大の
場合では、量子化ステップを下げることができないの
で、ステップS18にジャンプし、量子化ステップを下
げることなく、マクロブロックmbが進められる。順番が
min actと等しい場合では、量子化ステップを下げられ
る可能性があるので、検証のために次のステップS13
に進む。In step S12, the order of activity of the macroblock indicated by mb and min in step S9.
Compare with act. Order is min If it is smaller than act, the quantization step can be unconditionally lowered, so that the step jumps to step S17 and the quantization step of the macro block mb is reduced by one. Order is min If it is larger than act, the quantization step cannot be lowered, so the process jumps to step S18, and the macroblock mb is advanced without lowering the quantization step. The order is
min If it is equal to act, the quantization step may be lowered, so for verification, the next step S13
Proceed to.
【0087】ステップS13では、actとmin qqによっ
てq scaIeが求められる。ステップS14では、マクロ
ブロックmbのq scaIeを一つ減じた時の総符号量tmpが求
められる。すなわち、q scaIeを一つ減じたことによる
符号量の増加分が元の総符号量に加算された結果が総符
号量tmpに代入される。In step S13, act and min qq by q scaIe is required. In step S14, q of the macro block mb The total code amount tmp when scaIe is subtracted by 1 is obtained. That is, q The result obtained by adding the increment of the code amount by subtracting scaIe to the original total code amount is substituted for the total code amount tmp.
【0088】ステップS15では、総符号量tmpと目標
符号量GEN TGTとを比較する。総符号量tmpがG
EN TGT以下であれば、量子化ステップを下げるこ
とができるので、処理が次のステップS16に進む。そ
うでなければ、ステップS18(mbを進める処理)にジ
ャンプする。In step S15, the total code amount tmp and the target code amount GEN Compare with TGT. Total code amount tmp is G
EN If it is equal to or lower than TGT, the quantization step can be lowered, so that the process proceeds to the next step S16. If not, the process jumps to step S18 (process for advancing mb).
【0089】ステップS16では、総符号量を実際に更
新する。そして、ステップS17において、マクロブロ
ックmbの量子化ステップを一つ減じる。ステップS18
において、mbを一つ進めて、ステップS11(mbと総マ
クロブロック数MB NUMの比較)に戻る。In step S16, the total code amount is actually updated. Then, in step S17, the quantization step of the macro block mb is reduced by one. Step S18
In step S11, advance mb to step S11 (mb and total number of macroblocks MB. NUM comparison).
【0090】図10は、アクティビティの順番を求める
処理を説明するものである。各参照量子化Qref および
各アクティビティ毎に、q scaleを変化させる順番の一
例が示されている。ここで、kは、アクティビティ情報
に応じて量子化ステップを操作するための係数、すなわ
ち、式(3)において、Qref (mb)に乗じられる係数部
分を表している。前述したように、アクティビティが大
きいマクロブロックは、量子化ステップを粗くし、アク
ティビティが小さいマクロブロックは、量子化ステップ
を細かくする必要がある。すなわち、アクティビティが
小さい場合では、係数が小さくされ、量子化ステップが
細かくされ、逆に、アクティビティが大きい場合では、
係数が大きくされ、量子化ステップが粗くされる。した
がって、この係数kをアクティビティとして扱うことが
できる。図10では、簡単のため、アクティビティkが
5種類の離散的な値(0.5,0.75,1.0,1.5,2.0) をとりう
るものとしている。FIG. 10 explains the processing for obtaining the order of activities. For each reference quantization Q ref and each activity, q An example of the order in which the scale is changed is shown. Here, k represents a coefficient for operating the quantization step according to the activity information, that is, a coefficient portion to be multiplied by Q ref (mb) in the equation (3). As described above, macroblocks with high activity require coarse quantization steps, and macroblocks with low activity require fine quantization steps. That is, when the activity is small, the coefficient is made small, and the quantization step is finely divided. On the contrary, when the activity is large,
Coefficients are increased and quantization steps are coarser. Therefore, this coefficient k can be treated as an activity. In FIG. 10, for the sake of simplicity, the activity k can take five discrete values (0.5, 0.75, 1.0, 1.5, 2.0).
【0091】この「アクティビティを考慮した丸めない
量子化ステップQact(mb)(5,7.5,10,15,20)」と「丸
めた量子化ステップを一段階小さくしたもの(4,7,9,14,
19)」との差が小さい順、すなわち、本来連続値でとる
べき値との差が小さい順に順位が付けられる。This “quantization step without rounding considering activity Q act (mb) (5,7.5,10,15,20)” and “the rounded quantization step reduced by one step (4,7,9 ,14,
19) ”is the smallest in the difference, that is, the order in which the difference with the value that should be taken as a continuous value is the smallest is ranked.
【0092】例えばQref =10の場合では、アクティ
ビティkを乗じた値が(5,7.5,10,15,20)となり、四捨五
入で丸めた値が (5,8,10,15,20) となる。ビットレート
を上げるために、丸め後の量子化から1を減算し、(4,
7,9,14,19) を得る。差が小さい順に順番付けがなされ
る。この場合では、アクティビティが0.75が最も早い順
位となる。Qref =11の場合でも、同様に順位が求め
られる。例えば図2に示されるQ1〜Q31の他のQ
ref についても同様にアクティビティの順番が求められ
る。この図10に示すテーブルは、予め求めることがで
きる。図8におけるステップS1では、テーブルを参照
してアクティビティの順番を求めることができる。For example, when Q ref = 10, the value obtained by multiplying the activity k is (5,7.5,10,15,20), and the rounded value is (5,8,10,15,20). Become. To increase the bit rate, subtract 1 from the rounded quantization, (4,
7,9,14,19). Ordering is done in ascending order of difference. In this case, 0.75 is the fastest activity. Even in the case of Q ref = 11, the ranking is similarly obtained. For example, another Q of Q1 to Q31 shown in FIG.
The order of activities is also required for refs . The table shown in FIG. 10 can be obtained in advance. In step S1 in FIG. 8, the order of activities can be obtained by referring to the table.
【0093】なお、この発明においては、量子化の対象
の信号が画像信号または画像信号と予測画像信号の差分
の何れであっても良い。また、以上の説明では、変換符
号化としてDCTを用いたが、DCTに限られず、ウェ
ーブレット変換、Haar変換、K−L変換等に対しても、
この発明を適用することができる。In the present invention, the signal to be quantized may be either the image signal or the difference between the image signal and the predicted image signal. Further, in the above description, DCT is used as transform coding, but not limited to DCT, wavelet transform, Haar transform, KL transform, etc.
This invention can be applied.
【0094】また、この発明は、圧縮符号化されたデー
タを磁気テープに記録したり、ハードディスク、光磁気
ディスクに記録する場合に対して適用できる。The present invention can also be applied to the case of recording compression-coded data on a magnetic tape or a hard disk or a magneto-optical disk.
【0095】さらに、マクロブロックの構造としては、
(4:2:0)に限らず、(4:2:2)、(4:4:
4)、(4:1:1)等の構造であっても良い。マクロ
ブロック内に含まれるDCTブロックの個数も限定され
るものではない。よりさらに、符号量を制御する等長化
単位としては、1フレームに限らず、より短い期間を設
定しても良い。Further, as the structure of the macroblock,
Not only (4: 2: 0), but also (4: 2: 2) and (4: 4:
The structure may be 4), (4: 1: 1) or the like. The number of DCT blocks included in the macro block is not limited. Furthermore, the equal length unit for controlling the code amount is not limited to one frame, and a shorter period may be set.
【0096】[0096]
【発明の効果】この発明は、フィードフォワード制御で
あるので、フィードバック制御における問題を回避する
ことができる。すなわち、シーンチェンジ時のデータ量
の急変による再生画像の破綻を来すことなく、ある決め
られた枚数のフレームをある決められたビットレートに
押さえ込むように制御することができる。Since the present invention is feedforward control, it is possible to avoid problems in feedback control. That is, it is possible to control so that a certain number of frames can be suppressed to a certain bit rate without causing a breakdown of a reproduced image due to a sudden change in the data amount at the time of a scene change.
【0097】また、この発明は、量子化ステップが画像
の局所的性質により可変されるので、復号画像の画質を
向上することができる。この場合、アクティビティ情報
を離散値とし、アクティビティ情報の順番を求め、目標
符号量を超えない範囲で、目標符号量との差が最も小さ
いアクティビティを設定する。次に、マクロブロック単
位の処理を行う場合に、設定アクティビティと各マクロ
ブロックのアクティビティ情報を比較することによっ
て、量子化ステップを制御する必要のあるマクロブロッ
クを限定することができるので、比較的簡単な処理で量
子化ステップを決定できる。Further, according to the present invention, since the quantization step is changed depending on the local property of the image, the quality of the decoded image can be improved. In this case, the activity information is set to a discrete value, the order of the activity information is obtained, and the activity having the smallest difference from the target code amount is set within a range not exceeding the target code amount. Next, when performing processing in units of macroblocks, by comparing the activity information of each macroblock with the set activity, it is possible to limit the macroblocks for which the quantization step needs to be controlled. The quantization step can be determined by various processes.
【図1】量子化ステップのデータを伝送する方法の一例
を示す略線図である。FIG. 1 is a schematic diagram showing an example of a method of transmitting data of a quantization step.
【図2】量子化ステップに対する1フレームで発生する
合計符号長の変化の一例を示す略線図である。FIG. 2 is a schematic diagram showing an example of a change in total code length generated in one frame with respect to a quantization step.
【図3】この発明の一実施例の全体的構成を示すブロッ
ク図である。FIG. 3 is a block diagram showing the overall configuration of an embodiment of the present invention.
【図4】アクティビティ算出回路の一例のブロック図で
ある。FIG. 4 is a block diagram of an example of an activity calculation circuit.
【図5】この発明の一実施形態における量子化ステップ
決定部の一例のブロック図である。FIG. 5 is a block diagram of an example of a quantization step determining unit according to an embodiment of the present invention.
【図6】この発明の一実施形態における量子化ステップ
のQref およびQact の関係を説明するための略線図で
ある。FIG. 6 is a schematic diagram for explaining the relationship between Q ref and Q act in the quantization step in the embodiment of the present invention.
【図7】この発明の一実施形態におけるアクティビティ
部分和算出回路の一例のブロック図である。FIG. 7 is a block diagram of an example of an activity partial sum calculation circuit according to an embodiment of the present invention.
【図8】この発明の一実施形態における量子化ステップ
の制御の方法を説明するためのフローチャートである。FIG. 8 is a flowchart illustrating a method of controlling a quantization step according to an embodiment of the present invention.
【図9】この発明の一実施形態における量子化ステップ
の制御の方法を説明するためのフローチャートである。FIG. 9 is a flowchart illustrating a method of controlling a quantization step according to an embodiment of the present invention.
【図10】この発明の一実施形態においてアクティビテ
ィ情報に応じて量子化ステップを制御する方法を説明す
るための略線図である。FIG. 10 is a schematic diagram for explaining a method of controlling a quantization step according to activity information according to an embodiment of the present invention.
2・・・本線系、3・・・予測系、6・・・量子化部、
10−1〜10−n・・・量子化器、13・・・量子化
ステップ決定部、15・・・アクティビティ算出部2 ... Main line system, 3 ... Prediction system, 6 ... Quantization unit,
10-1 to 10-n ... Quantizer, 13 ... Quantization step determination unit, 15 ... Activity calculation unit
───────────────────────────────────────────────────── フロントページの続き Fターム(参考) 5C053 FA14 FA21 GA11 GB22 GB26 GB28 GB34 GB38 5C059 KK22 KK30 KK36 MA00 MA23 MC11 MC38 ME01 PP16 SS11 TA47 TB04 TC06 TC10 TC19 TC38 TD04 UA02 UA33 5J064 AA01 AA02 BA16 BB03 BC01 BC04 BC16 BC21 BC26 BD01 ─────────────────────────────────────────────────── ─── Continued front page F-term (reference) 5C053 FA14 FA21 GA11 GB22 GB26 GB28 GB34 GB38 5C059 KK22 KK30 KK36 MA00 MA23 MC11 MC38 ME01 PP16 SS11 TA47 TB04 TC06 TC10 TC19 TC38 TD04 UA02 UA33 5J064 AA01 AA02 BA16 BB03 BC01 BC04 BC16 BC21 BC26 BD01
Claims (4)
化単位毎に、目標符号量内で画像信号を量子化する画像
信号の符号化装置において、 予測部を設け、 上記予測部は、複数の量子化情報で差分をそれぞれ量子
化し、各量子化情報で量子化したときに、上記等長化単
位で発生する総符号量を求める手段と、上記等長化単位
で発生する総符号量が目標符号量を超えないで、上記総
符号量と上記目標符号量との差が最小の第1の量子化情
報を決定する手段と、画像の処理ブロック毎の局所的情
報を検出し、局所的情報を出力する手段と、上記第1の
量子化情報を上記局所的情報により変化させて最終的な
第2の量子化情報を決定する決定手段とからなり、 上記決定手段は、上記第1の量子化情報毎に、上記局所
的情報を考慮した量子化情報とその量子化情報を一段階
小さくしたものとの差が小さい順に、順番を求め、上記
順番の早いものから開始して上記局所的情報毎に符号量
を集計し、集計された上記符号量から目標符号量を満足
する局所的情報を設定する第1の設定手段と、 上記第1の設定手段によって設定された局所的情報に基
づいて、無条件に量子化情報を一つ減じることができる
処理ブロックと、量子化情報を減じることが不可能な処
理ブロックと、量子化情報を減じることが可能か否かの
検証を行う処理ブロックとの何れであるかを決定するこ
とによって上記第2の量子化情報を決定し、上記量子化
情報を減じることが可能か否かの検証を行う場合には、
一つ減じた量子化情報による総符号量と上記目標符号量
とを比較する第2の設定手段とからなる画像信号の符号
化装置。1. An image signal coding apparatus for quantizing an image signal within a target code amount for each equal-length unit composed of a plurality of blocks, wherein a prediction unit is provided, and the prediction unit is a plurality of units. A means for determining the total code amount generated in the equal length unit when the difference is quantized by the quantized information and quantized by each quantized information, and the total code amount generated in the equal length unit is the target. Means for determining first quantized information having a minimum difference between the total code amount and the target code amount without exceeding the code amount, and detecting local information for each processing block of an image to obtain local information. And a deciding means for deciding the final second quantized information by changing the first quantized information by the local information, and the deciding means comprises the first quantized information. For each piece of quantized information, the quantization information and its Of the quantized information, the order is calculated in ascending order of the difference from the quantized information, and the code amount is aggregated for each of the local information starting from the earlier sequence, and the target is calculated from the aggregated code amount. First setting means for setting local information satisfying the code amount, and a processing block capable of unconditionally subtracting one piece of quantization information based on the local information set by the first setting means. And the processing block in which the quantization information cannot be reduced, and the processing block in which it is verified whether or not the quantization information can be reduced are determined. When determining information and verifying whether it is possible to subtract the quantized information,
An image signal encoding apparatus comprising second setting means for comparing the total code amount based on the subtracted quantized information with the target code amount.
順番の情報をルックアップテーブルとして持つようにし
た画像信号の符号化装置。2. The image signal encoding device according to claim 1, wherein the prediction unit further has information of the order of each of the first quantization information as a lookup table.
化単位毎に、目標符号量内で画像信号を量子化する画像
信号の符号化方法において、 複数の量子化情報で差分をそれぞれ量子化し、各量子化
情報で量子化したときに、上記等長化単位で発生する総
符号量を求めるステップと、 上記等長化単位で発生する総符号量が目標符号量を超え
ないで、上記総符号量と上記目標符号量との差が最小の
第1の量子化情報を決定するステップと、 画像の処理ブロック毎のアクティビティを検出し、局所
的情報を出力するステップと、 上記第1の量子化情報を上記局所的情報により変化させ
て最終的な第2の量子化情報を決定する決定ステップと
からなり、 上記決定ステップは、上記第1の量子化情報毎に、上記
局所的情報を考慮した量子化情報とその量子化情報を一
段階小さくしたものとの差が小さい順に、順番を求め、
上記順番の早いものから開始して上記局所的情報毎に符
号量を集計し、集計された上記符号量から目標符号量を
満足する局所的情報を設定する第1の設定ステップと、 上記第1の設定ステップによって設定された局所的情報
に基づいて、無条件に量子化情報を一つ減じることがで
きる処理ブロックと、量子化情報を減じることが不可能
な処理ブロックと、量子化情報を減じることが可能か否
かの検証を行う処理ブロックとの何れであるかを決定す
ることによって上記第2の量子化情報を決定し、上記量
子化情報を減じることが可能か否かの検証を行う場合に
は、一つ減じた量子化情報による総符号量と上記目標符
号量とを比較する第2の設定ステップとからなる画像信
号の符号化方法。3. An image signal encoding method for quantizing an image signal within a target code amount for each equal-length unit made up of a plurality of blocks, wherein each difference is quantized by a plurality of pieces of quantization information, A step of obtaining a total code amount generated in the equal length unit when quantized by each quantization information, and a total code amount generated in the equal length unit not exceeding a target code amount, Determining the first quantization information with the smallest difference between the amount and the target code amount, detecting the activity for each processing block of the image, and outputting the local information, the first quantization A decision step of deciding the final second quantized information by changing the information according to the local information, wherein the decision step considers the local information for each of the first quantized information. Quantization information and its Coca information in order difference is small and those one step smaller, determined order,
A first setting step of starting from the earliest one in order, totalizing the code amount for each of the local information, and setting local information satisfying the target code amount from the totalized code amount; Based on the local information set by the setting step, the processing block that can unconditionally reduce one quantization information, the processing block that cannot reduce the quantization information, and the quantization information are reduced. The second quantized information is determined by deciding which of the processing blocks is to verify whether or not the quantized information can be reduced. In this case, the image signal encoding method comprises a second setting step of comparing the total code amount obtained by subtracting the quantized information with the target code amount.
ックアップテーブルとして持つようにした画像信号の符
号化方法。4. The image signal encoding method according to claim 3, further comprising the information of the order for each of the first quantized information as a lookup table.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002285573A JP4127006B2 (en) | 2001-10-24 | 2002-09-30 | Image signal encoding apparatus and encoding method |
Applications Claiming Priority (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2001-326614 | 2001-10-24 | ||
| JP2001326614 | 2001-10-24 | ||
| JP2002285573A JP4127006B2 (en) | 2001-10-24 | 2002-09-30 | Image signal encoding apparatus and encoding method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2003204554A true JP2003204554A (en) | 2003-07-18 |
| JP4127006B2 JP4127006B2 (en) | 2008-07-30 |
Family
ID=27666455
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002285573A Expired - Fee Related JP4127006B2 (en) | 2001-10-24 | 2002-09-30 | Image signal encoding apparatus and encoding method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP4127006B2 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2006060343A (en) * | 2004-08-18 | 2006-03-02 | Fuji Xerox Co Ltd | Parameter determining apparatus, coding device, method of determining parameter and its program |
| US12041234B2 (en) | 2007-09-28 | 2024-07-16 | Dolby Laboratories Licensing Corporation | Video compression and transmission techniques |
-
2002
- 2002-09-30 JP JP2002285573A patent/JP4127006B2/en not_active Expired - Fee Related
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2006060343A (en) * | 2004-08-18 | 2006-03-02 | Fuji Xerox Co Ltd | Parameter determining apparatus, coding device, method of determining parameter and its program |
| US12041234B2 (en) | 2007-09-28 | 2024-07-16 | Dolby Laboratories Licensing Corporation | Video compression and transmission techniques |
| US12355965B2 (en) | 2007-09-28 | 2025-07-08 | Dolby Laboratories Licensing Corporation | Video compression and transmission techniques |
Also Published As
| Publication number | Publication date |
|---|---|
| JP4127006B2 (en) | 2008-07-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP2963416B2 (en) | Video encoding method and apparatus for controlling bit generation amount using quantization activity | |
| JP2001510311A (en) | Object-based rate control apparatus and method in coding scheme | |
| JP3960451B2 (en) | Scene characteristic detection type moving picture coding apparatus | |
| JP4221655B2 (en) | Encoding apparatus, encoding method, program, and recording medium | |
| JPH0723422A (en) | Video signal band compression device for digital VTR | |
| KR20010021879A (en) | Apparatus and method for macroblock based rate control in a coding system | |
| JPWO1996028937A1 (en) | Image signal encoding method and device | |
| KR20060036934A (en) | Video data encoding apparatus and video data encoding method | |
| JP3846424B2 (en) | Image signal quantization apparatus and method | |
| JP3872849B2 (en) | Video encoding device | |
| JPH10108184A (en) | Image data processing apparatus and method | |
| JP3511893B2 (en) | Video signal encoding method and apparatus | |
| JPH05227520A (en) | Image compression coding device | |
| JP2003204554A (en) | Image signal encoding apparatus and encoding method | |
| JP2847569B2 (en) | Video coding control method | |
| JP3149673B2 (en) | Video encoding device, video encoding method, video reproducing device, and optical disc | |
| JP3200518B2 (en) | Image signal encoding device | |
| US8111748B2 (en) | Method and apparatus for video coding | |
| JPH07236137A (en) | Picture encoding control system | |
| JPH10108197A (en) | Image encoding device, image encoding control method, and medium recording image encoding control program | |
| JP4857243B2 (en) | Image encoding apparatus, control method therefor, and computer program | |
| JP4007398B2 (en) | Quantization control apparatus and method | |
| JP2003204553A (en) | Image signal encoding apparatus and encoding method | |
| JP3918208B2 (en) | Video data compression apparatus and method | |
| JP2891250B2 (en) | Moving picture coding method and apparatus |
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: 20070608 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070619 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070820 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070918 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20071114 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20071211 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080212 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080324 |
|
| A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20080328 |
|
| 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: 20080422 |
|
| 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: 20080505 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110523 Year of fee payment: 3 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110523 Year of fee payment: 3 |
|
| LAPS | Cancellation because of no payment of annual fees |