JP2014068247A - Code amount calculation device and program and moving image encoder and program - Google Patents

Code amount calculation device and program and moving image encoder and program Download PDF

Info

Publication number
JP2014068247A
JP2014068247A JP2012212926A JP2012212926A JP2014068247A JP 2014068247 A JP2014068247 A JP 2014068247A JP 2012212926 A JP2012212926 A JP 2012212926A JP 2012212926 A JP2012212926 A JP 2012212926A JP 2014068247 A JP2014068247 A JP 2014068247A
Authority
JP
Japan
Prior art keywords
binary code
code amount
code string
section width
width
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.)
Pending
Application number
JP2012212926A
Other languages
Japanese (ja)
Inventor
Satoshi Nakagawa
聰 中川
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP2012212926A priority Critical patent/JP2014068247A/en
Publication of JP2014068247A publication Critical patent/JP2014068247A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

PROBLEM TO BE SOLVED: To efficiently obtain a code amount when a moving image is encoded.SOLUTION: A moving image encoder includes a code amount calculation device which calculates a code amount of a code outputted from entropy encoding means on the basis of a series of a binary code string on a residual signal between a target image and a prediction image and encoding information such as prediction information and a series of a context variable on the encoding information. The code amount calculation device includes: means for storing initial section width when processing starts; means for holding section width updated with the initial section width as an initial value; means for controlling state transition of the section width which is held in accordance with the series of the binary code string and the series of the context variable; means for counting the number of bit-shifting times of the section width by normalization for each binary code string; and means for calculating the code amount outputted from the entropy encoding means on the basis of a code amount corresponding to a count value and the initial section width and a code amount corresponding to the section width held when the processing is terminated.

Description

本発明は、符号量計算装置及びプログラム、並びに、動画像符号化装置及びプログラムに関し、例えば、H.264/MPEG−4AVC等の動画像符号化技術による動画像圧縮符号の処理に適用できる。   The present invention relates to a code amount calculation device and program, and a moving image encoding device and program. The present invention can be applied to processing of a moving image compression code by a moving image encoding technique such as H.264 / MPEG-4AVC.

従来、H.264/MPEG−4AVC(以下、単に「H.264」と呼ぶ)等に代表される映像符号化技術による映像情報の圧縮符号化処理では、入力された画像を分割した処理単位毎に、動き補償予測等を行った予測画像と、入力された画像との差分である予測残差信号に、離散コサイン変換等の空間変換を施した変換係数を量子化し、さらに、これを算術符号等のエントロピー符号化することによって高効率の映像圧縮を実現している。   Conventionally, H.M. In video information compression encoding processing using video encoding technology represented by H.264 / MPEG-4AVC (hereinafter simply referred to as “H.264”), motion compensation is performed for each processing unit obtained by dividing an input image. The prediction residual signal that is the difference between the predicted image that has been predicted and the input image is quantized with a transform coefficient obtained by performing spatial transformation such as discrete cosine transformation, and this is further entropy code such as arithmetic code To achieve highly efficient video compression.

そして、従来の量子化処理により量子化雑音が発生した場合、復号側で再生される復号画像に歪が生じるが、量子化することによって、符号化すべき情報量が削減される。そして、従来の量子化処理では、量子化された係数情報等は算術符号等のエントロピー符号化により、情報の発生確率に応じた符号量となるように符号化される。例えば、H.264ではCABAC(Context−based Adaptive Binary Arithmetic Coding)と呼ばれるコンテキスト適応2値算術符号等が使用されている。   When quantization noise is generated by the conventional quantization process, distortion occurs in the decoded image reproduced on the decoding side, but the amount of information to be encoded is reduced by quantization. In the conventional quantization process, quantized coefficient information and the like are encoded by entropy encoding such as an arithmetic code so as to have a code amount corresponding to the occurrence probability of information. For example, H.M. In H.264, a context adaptive binary arithmetic code called CABAC (Context-based Adaptive Binary Arithmetic Coding) is used.

従来の映像符号化技術では、このような歪と符号量(レート)のトレードオフを評価し、符号化モード選択等に利用する技術としてレート歪最適化技術がある。レート歪最適化技術とは、複数の符号化モード等の選択肢について、その選択肢を選択した場合に得られる復号画像の対象画像に対する歪Dと、その選択肢で符号化したときに発生する符号量Rと、ラグランジュ乗数λで表されるRDコストJ(J=D+λR)を最小化するような選択をすることによって、レートと歪のトレードオフが最適な符号化をする方法である。   In the conventional video encoding technique, there is a rate distortion optimization technique as a technique for evaluating such a trade-off between distortion and code amount (rate) and using it for selecting an encoding mode. The rate distortion optimization technique refers to a distortion D with respect to a target image of a decoded image obtained when the option is selected, and a code amount R generated when the option is encoded. Thus, by selecting such that the RD cost J (J = D + λR) represented by the Lagrangian multiplier λ is minimized, the rate / distortion tradeoff is the optimum encoding method.

例えば、ある符号化単位(H.264ではマクロブロック等)で複数ある符号化モード候補(イントラモード、インターモード、スキップモード等〉からの選択を行う場合に、その選択肢で符号化したときに発生する符号量Rを計算する。この場合、従来技術では、実際に符号化してみることによって符号量を求める必要がある。また、その他にも、特許文献1の記載技術のように、コンテキスト変数が表す確率状態ごとに対応する符号量をテーブル引きにより求め、テーブル引きの結果を累積加算することで符号量を推定する方法がある。   For example, when selecting from a plurality of encoding mode candidates (intra mode, inter mode, skip mode, etc.) in a certain encoding unit (macroblock, etc. in H.264), it occurs when encoding with that option In this case, in the prior art, it is necessary to obtain the code amount by actually encoding.In addition, as in the technique described in Patent Document 1, the context variable may be There is a method of estimating a code amount by obtaining a code amount corresponding to each probability state to be represented by table lookup and cumulatively adding the table lookup results.

特開2008−11431号公報JP 2008-11431 A

しかしながら、従来の符号化技術のように実際に符号化を行ってみる方法では、出力されるビットパターンを求める処理等の演算量が多く処理の無駄が多い。さらに、従来技術では、符号量として整数精度のビット数しか得られず、算術符号がもつ整数符号長でない符号化が可能である特徴をモード選択等に有効に反映できない。   However, in the method of actually performing the encoding as in the conventional encoding technique, the amount of calculation such as processing for obtaining the output bit pattern is large, and the processing is wasted. Furthermore, in the prior art, only the number of bits with integer precision can be obtained as the code amount, and the feature that enables encoding that is not the integer code length of the arithmetic code cannot be effectively reflected in mode selection or the like.

また、特許文献1の記載技術のように、符号量テーブルを用いて加算していく方法では、算術符号の区間幅の分布に関する近似が用いられているために精度の高い符号量の推定ができず、より符号化効率の高い最適な選択がなされない場合があるという課題があった。   In addition, in the method of adding using a code amount table as in the technique described in Patent Document 1, since the approximation related to the distribution of the interval width of the arithmetic code is used, it is possible to estimate the code amount with high accuracy. Therefore, there has been a problem that optimal selection with higher encoding efficiency may not be made.

上述のような課題に鑑みて、動画像を符号化する際の符号量を効率的に求めることができる符号量計算装置及びプログラム、並びに、動画像符号化装置及びプログラムが望まれている。   In view of the above-described problems, a code amount calculation device and program, and a moving image encoding device and program capable of efficiently obtaining a code amount when encoding a moving image are desired.

第1の本発明は、動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列の系列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段を用いて、上記動画像の符号化を行う場合に、上記エントロピー符号化手段で出力する符号の符号量を計算する符号量計算装置において、(1)上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、(2)上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、(3)上記2値符号列の系列及び上記コンテキスト変数の系列に応じて、上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、(4)上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、(5)上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段とを有することを特徴とする。   The first aspect of the present invention relates to a sequence of binary code sequences related to encoding information such as a residual signal and prediction information between a target image constituting a moving image and a predicted image of the target image, and the encoding information. When encoding the moving image using entropy encoding means for performing entropy encoding of the encoded information based on a context variable sequence representing each probability state of the binary code string, In the code amount calculation device for calculating the code amount of the code output by the entropy encoding means, (1) an initial interval width storage means for storing an initial interval width at the start of processing related to the binary code string sequence; (2) section width holding means for setting the initial section width as an initial value and holding a section width updated in accordance with the binary code string sequence; and (3) the binary code string series and the context variable. Depending on the series A binary code string processing means for controlling the state transition of the section width of the section width holding means; and (4) the number of bit shifts for counting the number of times that the binary code string processing means has bit-shifted the section width by the normalization process. (5) a count value of the bit shift number counting means, a code amount corresponding to the initial interval width, and the interval at the end of processing of all binary code sequences related to the binary code sequence And calculating means for calculating the code amount output from the entropy encoding means based on the code amount corresponding to the section width held by the width holding means.

なお、上述の第1の本発明の符号量計算装置には、「動画像を構成する対象画像と上記対象画像の予測画像との誤差信号に係る2値符号列の系列と、上記誤差信号に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記誤差信号のエントロピー符号化を行うエントロピー符号化手段を用いて、上記動画像の符号化を行う場合に、上記エントロピー符号化手段で出力する符号の符号量を計算する符号量計算装置において、(1)上記2値符号列の系列に係る処理開始時での初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、(2)上記2値符号列の系列及び上記コンテキスト変数の系列に応じて、上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、(3)上記2値符号列ごとに、上記区間幅保持手段で更新される区間幅をビットシフトにより正規化する処理を行う正規化処理手段と、(4)上記正規化処理手段が、ビットシフトした回数をカウントするビットシフト回数カウント手段と、(5)上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段とを有することを特徴とする符号量計算装置。」が含まれる。   The code amount calculation apparatus according to the first aspect of the present invention includes: “a sequence of binary code sequences related to an error signal between a target image constituting a moving image and a predicted image of the target image; and the error signal. When encoding the moving image using entropy encoding means for performing entropy encoding of the error signal based on a sequence of context variables representing respective probability states of the binary code sequence, In the code amount calculation apparatus for calculating the code amount of the code output by the entropy encoding means, (1) an initial section width at the start of processing related to the binary code sequence is set as an initial value, and the binary code sequence (2) section width state transition of the section width holding means according to the binary code string series and the context variable series; Binary to control Sequence processing means; (3) normalization processing means for normalizing the section width updated by the section width holding means by bit shift for each of the binary code strings; and (4) the normalization. A bit shift number count unit for counting the number of times the bit shift is performed; (5) a count value of the bit shift number count unit; a code amount corresponding to the initial interval width; and a sequence of the binary code string Calculation means for calculating the code amount output from the entropy encoding means based on the code amount corresponding to the section width held by the section width holding means at the end of processing of all binary code strings according to The code amount calculation apparatus characterized by the above. "

第2の本発明は、動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段と、上記エントロピー符号化手段で、動画像の符号化を行う場合に、必要となる符号量を推定する符号量計算手段とを備え、上記エントロピー符号化手段は、上記符号量計算装置の推定結果に基づいて選択された符号化情報に係る符号を出力する動画像符号化装置において、上記符号量計算手段として第1の本発明の符号量計算装置を適用したことを特徴とする。   The second aspect of the present invention is a binary code sequence related to encoding information such as a residual signal or prediction information between a target image constituting a moving image and a predicted image of the target image, and a binary code related to the encoded information. When entropy coding means for performing entropy coding of the coded information based on a sequence of context variables representing each probability state of the code string, and when encoding a moving image by the entropy coding means, A code amount calculating means for estimating a required code amount, wherein the entropy encoding means outputs a code relating to encoding information selected based on the estimation result of the code amount calculating device. In the encoding apparatus, the code amount calculation apparatus according to the first aspect of the present invention is applied as the code amount calculation means.

第3の本発明は、動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段を用いて、上記動画像の符号化を行う場合に、上記エントロピー符号化手段で出力する符号の符号量を計算する符号量計算プログラムにおいて、コンピュータを、(1)上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、(2)上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、(3)上記2値符号列の系列及び上記コンテキスト変数の系列に応じて、上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、(4)上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、(5)上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段として機能させることを特徴とする。   The third aspect of the present invention is a binary code sequence related to encoding information such as a residual signal and prediction information between a target image constituting a moving image and a predicted image of the target image, and a binary code related to the encoded information. When encoding the moving image using entropy encoding means for performing entropy encoding of the encoded information based on a sequence of context variables representing each probability state of the code string, the entropy code In the code amount calculation program for calculating the code amount of the code output by the converting means, the computer includes (1) an initial interval width storage means for storing an initial interval width at the start of processing related to the binary code string sequence; (2) Section width holding means for setting the initial section width as an initial value and holding a section width updated in accordance with the binary code string sequence; and (3) the binary code string sequence and the context Variable A binary code string processing means for controlling the state transition of the section width of the section width holding means according to the sequence; and (4) the number of times that the binary code string processing means bit-shifts the section width by the normalization process. And (5) a count value of the bit shift number counting means, a code amount corresponding to the initial interval width, and all binary code strings related to the binary code string series It is made to function as calculation means for calculating the code amount output from the entropy encoding means based on the code amount corresponding to the interval width held by the interval width holding means at the end of the process.

第4の本発明の動画像符号化プログラムは、コンピュータを、(1)動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段と、(2)上記エントロピー符号化手段で、動画像の符号化を行う場合に、必要となる符号量を推定する符号量計算手段として機能させ、(3)上記エントロピー符号化手段は、上記符号量計算装置の推定結果に基づいて選択された符号化情報に係る符号を出力し、(4)上記符号量計算手段は、(4−1)上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、(4−2)上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、(4−3)上記2値符号列の系列及び上記コンテキスト変数の系列に応じて状態遷移を制御する2値符号列処理手段と、(4−4)上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、(4−5)上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段とを有することを特徴とする。
A moving picture coding program according to a fourth aspect of the present invention provides a computer, (1) a binary signal relating to coding information such as a residual signal and prediction information between a target image constituting a moving picture and a predicted picture of the target picture. Entropy coding means for performing entropy coding of the coded information based on the code string and a sequence of context variables representing respective probability states of the binary code string related to the coded information; (2) the above When the entropy encoding unit encodes a moving image, the entropy encoding unit functions as a code amount calculation unit that estimates a required code amount. (3) The entropy encoding unit performs the estimation result of the code amount calculation device. (4) The code amount calculation means stores (4-1) an initial interval width at the start of processing related to the binary code string sequence. Initial section width Storing means, (4-2) section width holding means for setting the initial section width as an initial value, and holding a section width updated in accordance with the sequence of the binary code string, and (4-3) the binary value. A binary code string processing means for controlling state transition in accordance with a code string series and the context variable series; and (4-4) the binary code string processing means has bit-shifted the section width by normalization processing. A bit shift number counting means for counting the number of times, (4-5) a count value of the bit shift number counting means, a code amount corresponding to the initial interval width, and all 2 relating to the binary code string series And calculating means for calculating a code amount output from the entropy encoding means based on a code amount corresponding to the section width held by the section width holding means at the end of the processing of the value code string. .

本発明によれば、動画像を符号化する際の符号量を効率的に求めることができる。   ADVANTAGE OF THE INVENTION According to this invention, the code amount at the time of encoding a moving image can be calculated | required efficiently.

第1の実施形態に係る符号量計算部の機能的構成について示したブロック図である。It is the block diagram shown about the functional structure of the code amount calculation part which concerns on 1st Embodiment. 第1の実施形態に係る動画像符号化装置の機能的構成について示したブロック図である。It is the block diagram shown about the functional structure of the moving image encoder which concerns on 1st Embodiment. 第1の実施形態に係るエントロピー符号化部の機能的構成について示したブロック図である。It is the block diagram shown about the functional structure of the entropy encoding part which concerns on 1st Embodiment. 第1の実施形態に係る符号量計算部の動作について示したフローチャートである。It is the flowchart shown about operation | movement of the code amount calculation part which concerns on 1st Embodiment. 第1の実施形態に係る符号量計算部で用いられる符号量テーブルTの構成例について示した説明図である。It is explanatory drawing shown about the structural example of the code amount table T used by the code amount calculation part which concerns on 1st Embodiment. 第2の実施形態に係る符号量計算部の機能的構成について示したブロック図である。It is the block diagram shown about the functional structure of the code amount calculation part which concerns on 2nd Embodiment. 第2の実施形態に係る符号量計算部の動作について示したフローチャートである。It is the flowchart shown about operation | movement of the code amount calculation part which concerns on 2nd Embodiment.

(A)第1の実施形態
以下、本発明による符号量計算装置及びプログラム、並びに、動画像符号化装置及びプログラムの第1の実施形態を、図面を参照しながら詳述する。なお、第1の実施形態では、本発明の符号量計算装置を、動画像符号化装置を構成する符号量計算部として構成した例について示している。
(A) First Embodiment A code amount calculation device and program, and a moving image encoding device and program according to a first embodiment of the present invention will be described in detail below with reference to the drawings. In the first embodiment, an example is shown in which the code amount calculation device of the present invention is configured as a code amount calculation unit that constitutes a moving image encoding device.

(A−1)第1の実施形態の構成
図2は、この実施形態の動画像符号化装置1の全体構成を示すブロック図である。なお、図2において、括弧内の符号は、後述する第2の実施形態でのみ用いられる符号である。
(A-1) Configuration of the First Embodiment FIG. 2 is a block diagram showing the overall configuration of the moving picture encoding apparatus 1 of this embodiment. In FIG. 2, the reference numerals in parentheses are used only in the second embodiment to be described later.

動画像符号化装置1は、画面分割部101、空間変換部102、量子化部103、エントロピー符号化部104、逆量子化部105、逆空間変換部106、ループ内フィルタ部107、参照画像バッファ108、インター予測部109、イントラ予測部110、符号化モード選択部111、符号量計算部112、予測残差信号生成部113、及び復号画像生成部114を有している。   The moving image encoding apparatus 1 includes a screen division unit 101, a space conversion unit 102, a quantization unit 103, an entropy encoding unit 104, an inverse quantization unit 105, an inverse space conversion unit 106, an in-loop filter unit 107, and a reference image buffer. 108, an inter prediction unit 109, an intra prediction unit 110, a coding mode selection unit 111, a code amount calculation unit 112, a prediction residual signal generation unit 113, and a decoded image generation unit 114.

動画像符号化装置1は、プロセッサ及びメモリ等を有するコンピュータ(1台に限定されず、複数台を分散処理し得るようにしたものであっても良い。)に、実施形態の動画像符号化プログラム(実施形態の符号量計算プログラムを含む)等をインストールすることにより構築しても良く、その場合でも、機能的には上述の図2のように示すことができる。なお、図2において、符号量計算部112以外の構成について限定されないものであり、例えば、H.264等に準拠した種々の動画像符号化装置と同様のものを適用することができるため、詳細については説明省略する。   The moving picture coding apparatus 1 is a moving picture coding according to the embodiment to a computer having a processor, a memory, and the like (not limited to one, but may be configured so that a plurality of pieces can be distributedly processed). It may be constructed by installing a program (including the code amount calculation program of the embodiment) or the like, and even in that case, it can be functionally shown as in FIG. 2, the configuration other than the code amount calculation unit 112 is not limited. Since the same devices as those of various video encoding devices conforming to H.264 or the like can be applied, the description is omitted for details.

画面分割部101は、対象画像(入力画像)を、マクロブロック等の処理単位領域ごとに画面分割して、予測残差信号生成部113に供給する。   The screen division unit 101 divides the target image (input image) into screens for each processing unit area such as a macroblock, and supplies the divided image to the prediction residual signal generation unit 113.

予測残差信号生成部113は、画面分割部101から供給される分割済の画像データとインター予測部109又はイントラ予測部110から供給される予測画像とから、予測残差信号を得て、空間変換部102に供給するものである。   The prediction residual signal generation unit 113 obtains a prediction residual signal from the divided image data supplied from the screen division unit 101 and the prediction image supplied from the inter prediction unit 109 or the intra prediction unit 110, and obtains a spatial This is supplied to the conversion unit 102.

空間変換部102は、予測残差信号を、DCT(離散コサイン変換)やその整数近似変換等によって空間変換して変換係数を得る。そして、量子化部103は、その変換係数を、所定の量子化幅で量子化した結果として、量子化された予測残差信号を得て、エントロピー符号化部104に供給する。   The spatial transform unit 102 spatially transforms the prediction residual signal by DCT (Discrete Cosine Transform) or its integer approximation transform to obtain transform coefficients. Then, the quantization unit 103 obtains a quantized prediction residual signal as a result of quantizing the transform coefficient with a predetermined quantization width, and supplies the quantized prediction residual signal to the entropy coding unit 104.

そして、エントロピー符号化手段としてのエントロピー符号化部104は、量子化された予測残差信号とモード情報等の符号化情報についてエントロピー符号化(例えば、算術符号化等)を行って、その他の符号化情報とともに符号化ストリームのデータを生成する。この符号化ストリームのデータが、動画像符号化装置1の出力となる。   Then, the entropy encoding unit 104 as the entropy encoding means performs entropy encoding (for example, arithmetic encoding) on the quantized prediction residual signal and encoding information such as mode information, and other codes. The encoded stream data is generated together with the encoding information. The data of this encoded stream becomes the output of the moving image encoding apparatus 1.

逆量子化部105は、量子化された予測残差信号を逆量子化する。そして、逆空間変換部106は、予測残差信号が逆量子化された結果に対して、逆空間変換(逆直交変換等)を行い、量子化誤差を伴う予測残差信号を得て、復号画像生成部114に供給する。   The inverse quantization unit 105 inversely quantizes the quantized prediction residual signal. Then, the inverse spatial transform unit 106 performs inverse spatial transform (such as inverse orthogonal transform) on the result of inverse quantization of the prediction residual signal, obtains a prediction residual signal with a quantization error, and performs decoding. This is supplied to the image generation unit 114.

復号画像生成部114は、量子化誤差を伴う予測残差信号(逆空間変換部106からの入力信号)と予測画像(インター予測部109又はイントラ予測部110からの予測画像)より復号画像を得る。復号画像生成部114は、復号画像をループ内フィルタ部107及びイントラ予測部110に供給する。   The decoded image generation unit 114 obtains a decoded image from a prediction residual signal (input signal from the inverse spatial transform unit 106) accompanied with a quantization error and a prediction image (a prediction image from the inter prediction unit 109 or the intra prediction unit 110). . The decoded image generation unit 114 supplies the decoded image to the in-loop filter unit 107 and the intra prediction unit 110.

ループ内フィルタ部107は、復号画像に対して、量子化によるブロック歪を軽減するデブロッキングフィルタ等として機能するものである。そして、ループ内フィルタ部107は、フィルタ処理した復号画像を参照画像バッファ108に供給する。   The in-loop filter unit 107 functions as a deblocking filter or the like that reduces block distortion due to quantization for the decoded image. Then, the in-loop filter unit 107 supplies the filtered decoded image to the reference image buffer 108.

参照画像バッファ108は、ループ内フィルタ部107からのフィルタ処理した復号画像を、後続の画像の符号化時のインター予測の動き補償のための参照画像として保持する。なお、H.264/AVC標準の場合、動き補償で参照する画像は、現在符号化を行おうとしている画像の直前画像に限定されず、複数の時刻の画像が参照画像となり得る。   The reference image buffer 108 holds the decoded image subjected to the filtering process from the in-loop filter unit 107 as a reference image for inter prediction motion compensation at the time of encoding the subsequent image. H. In the case of the H.264 / AVC standard, an image to be referred to in motion compensation is not limited to an image immediately before an image to be currently encoded, and images at a plurality of times can be reference images.

インター予測部109は、現在符号化を行おうとしている対象画像データと、参照画像バッファ108の参照画像から動き補償等の予測情報を得て予測画像データを生成するものである。イントラ予測部110は、対象画像の既に符号化され、局所復号された復号画像を用いて予測画像データを生成するものである。動画像符号化装置1では、符号化モード選択部111の制御に応じて、インター予測部109又はイントラ予測部110のいずれかを用いた予測画像データが、予測残差信号生成部113及び復号画像生成部114に供給される。   The inter prediction unit 109 generates prediction image data by obtaining prediction information such as motion compensation from the target image data to be currently encoded and the reference image in the reference image buffer 108. The intra prediction unit 110 generates predicted image data using a decoded image that has already been encoded and locally decoded. In the moving image encoding apparatus 1, predicted image data using either the inter prediction unit 109 or the intra prediction unit 110 is converted into a prediction residual signal generation unit 113 and a decoded image in accordance with control of the encoding mode selection unit 111. It is supplied to the generation unit 114.

符号化モード選択部111は、対象画像ごとにイントラ予測に基づく符号化モード(イントラ予測部110が出力する予測画像に基づく符号化)と、インター予測に基づく符号化モード(インター予測部109が出力する予測画像に基づく符号化)のいずれかを決定する。この実施形態の動画像符号化装置1では、上述の2つの符号化モードに対応しているものとして説明するが、動画像符号化装置1が対応する符号化モードの数や種類については限定されないものである。そして、符号化モード選択部111は、複数の符号化モードから、レート歪最適化によって、RDコストが最小となるような符号化モードを選択する。このとき、符号化モード選択部111は、それぞれの符号化モードで符号化を行った場合の発生符号量Rを符号量計算部112によって求め、RDコストの算出に用いるものとする。   The encoding mode selection unit 111 includes an encoding mode based on intra prediction (encoding based on a prediction image output from the intra prediction unit 110) and an encoding mode based on inter prediction (output from the inter prediction unit 109) for each target image. Or encoding based on the predicted image to be determined). In the moving image encoding apparatus 1 of this embodiment, although it demonstrates as what respond | corresponds to the above-mentioned two encoding modes, it does not limit about the number and kind of encoding mode which the moving image encoding apparatus 1 respond | corresponds. Is. Then, the coding mode selection unit 111 selects a coding mode that minimizes the RD cost by rate distortion optimization from a plurality of coding modes. At this time, the encoding mode selection unit 111 obtains the generated code amount R when encoding is performed in each encoding mode by the code amount calculation unit 112 and uses it for calculation of the RD cost.

次に、エントロピー符号化部104の内部構成について、図3を用いて説明する。   Next, the internal configuration of the entropy encoding unit 104 will be described with reference to FIG.

この実施形態のエントロピー符号化部104では、エントロピー符号化としてCABACのような算術符号によるエントロピー符号化を行うものとする。   In the entropy encoding unit 104 of this embodiment, entropy encoding using arithmetic codes such as CABAC is performed as entropy encoding.

図3に示すように、この実施形態のエントロピー符号化部104は、2値化部201、コンテキスト計算部202、コンテキスト変数テーブル204、及び算術符号化部203を有している。   As shown in FIG. 3, the entropy encoding unit 104 of this embodiment includes a binarization unit 201, a context calculation unit 202, a context variable table 204, and an arithmetic encoding unit 203.

エントロピー符号化部104では、量子化部103からの、量子化された予測残差信号である係数情報やモード情報等が、シンタックス要素として入力される。   In the entropy encoding unit 104, coefficient information, mode information, and the like, which are quantized prediction residual signals, are input from the quantization unit 103 as syntax elements.

そして、そのシンタックス要素は、2値化部201により、ビンと呼ばれる2値符号列の系列に変換される。そして、コンテキスト計算部202は、シンタックス要素や周囲の符号化済み情報等に応じたコンテキストごとにビンの生起確率に関する状態を保持するコンテキスト変数テーブル204へのインデックスを求める。   Then, the syntax element is converted by the binarization unit 201 into a sequence of binary code strings called bins. Then, the context calculation unit 202 obtains an index to the context variable table 204 that holds a state relating to the occurrence probability of the bin for each context according to the syntax element, surrounding encoded information, and the like.

そして、算術符号化部203は、2値化部201で生成されたビンごとに、対応するコンテキスト変数に応じた算術符号化を行い、符号化ビットストリームとして出力する。   Then, the arithmetic encoding unit 203 performs arithmetic encoding according to the corresponding context variable for each bin generated by the binarizing unit 201, and outputs the result as an encoded bit stream.

次に、符号量計算部112の内部構成について図1を用いて説明する。   Next, the internal configuration of the code amount calculation unit 112 will be described with reference to FIG.

図1に示すように、符号量計算部112は、初期区間幅記憶部301、区間幅保持部302、ビット数カウンタ303、2値符号列処理部304、及び符号量算出部305を有している。   As shown in FIG. 1, the code amount calculation unit 112 includes an initial interval width storage unit 301, an interval width holding unit 302, a bit number counter 303, a binary code string processing unit 304, and a code amount calculation unit 305. Yes.

図1に示すように、符号量計算部112には、符号量を推定する符号化単位のシンタックス要素に対して、エントロピー符号化部104で生成されるのと同様のビン(2値符号列)の系列と、各ビンに対応するコンテキスト変数の系列が入力されるものとして説明する。   As shown in FIG. 1, the code amount calculation unit 112 outputs the same bin (binary code string) as that generated by the entropy encoding unit 104 to the syntax element of the encoding unit for estimating the code amount. ) And the context variable series corresponding to each bin are input.

初期区間幅記憶部301は、符号量推定開始時の算術符号化部203の内部状態である区間幅情報を読み出して記憶するものである。   The initial section width storage unit 301 reads and stores section width information that is an internal state of the arithmetic coding unit 203 at the start of code amount estimation.

区間幅保持部302は、初期区間幅で初期化され、2値符号列処理部304により更新される区間幅を保持するものである。   The section width holding unit 302 holds the section width initialized by the initial section width and updated by the binary code string processing unit 304.

2値符号列処理部304は、入力されるビンと、コンテキスト変数に応じて、算術符号化を実際に行う場合と同様に、区間幅保持部302の区間幅の状態遷移を制御するものである。   The binary code string processing unit 304 controls state transition of the section width of the section width holding unit 302 in the same manner as when arithmetic coding is actually performed according to the input bin and the context variable. .

ビット数カウンタ303は、区間幅を正規化によってビットシフトした回数を保持するものである。   The bit number counter 303 holds the number of times the section width is bit shifted by normalization.

符号量算出部305は、計算対象となる符号化単位の2値符号列が処理されると、ビット数カウンタ303で保持される値と、2値符号列処理部304の処理終了時の区間幅に対応する符号量の和から、初期区間幅に対応する符号量を減算して、符号化対象の符号量として出力する。
(A−2)第1の実施形態の動作
次に、以上のような構成を有する第1の実施形態の動画像符号化装置1の動作について、を説明する。
When the binary code string of the encoding unit to be calculated is processed, the code amount calculation unit 305 determines the value held by the bit number counter 303 and the interval width at the end of the processing of the binary code string processing unit 304 The code amount corresponding to the initial section width is subtracted from the sum of the code amounts corresponding to, and output as the code amount to be encoded.
(A-2) Operation of the First Embodiment Next, the operation of the video encoding device 1 of the first embodiment having the above configuration will be described.

上述の通り、動画像符号化装置1では、符号量計算部112以外の処理については、種々の動画像符号化装置と同様のものを適用することができるため、符号量計算部112以外の動作説明については省略する。   As described above, in the video encoding device 1, the same processing as that of various video encoding devices can be applied to the processing other than the code amount calculation unit 112. The explanation is omitted.

以下では、符号量計算部112が、計算対象となる対象画像の符号化単位について符号量を計算するする動作の具体例について説明する。   Hereinafter, a specific example of the operation in which the code amount calculation unit 112 calculates the code amount for the encoding unit of the target image to be calculated will be described.

符号量計算部112では、符号量計算対象の符号化単位の2値符号列と、各ビンに対応するコンテキスト変数の系列が入力されると、まず、初期区間幅記憶部301に初期区間幅を記憶する。初期区間幅は、実際の算術符号化を行う算術符号化部203の内部状態を読み出したものであり、対象符号化単位までに符号化を行ったことによる算術符号化器(エントロピー符号化部104)の区間幅である。   In the code amount calculation unit 112, when a binary code string of a coding unit for code amount calculation and a sequence of context variables corresponding to each bin are input, first, an initial interval width is stored in the initial interval width storage unit 301. Remember. The initial interval width is obtained by reading the internal state of the arithmetic coding unit 203 that performs the actual arithmetic coding, and the arithmetic encoder (entropy coding unit 104) obtained by performing the coding up to the target coding unit. ).

また、このとき、区間幅保持部302は、この初期区間幅で初期化される。さらに、ビット数カウンタ303も0に初期化される。   At this time, the section width holding unit 302 is initialized with the initial section width. Further, the bit number counter 303 is also initialized to zero.

そして、2値符号列処理部304は、入力される2値符号列の各ビンと対応するコンテキスト変数を用いて、実際に算術符号化を行う場合と同様に区間幅の状態遷移を処理する。   Then, the binary code string processing unit 304 processes the state transition of the section width using the context variable corresponding to each bin of the input binary code string as in the case of actually performing arithmetic coding.

図4は、符号量計算部112(2値符号列処理部304)による各ビンの処理について示したフローチャートである。2値符号列処理部304は、各ビン(binVal)に対して、図4のフローチャートの処理を実行する。   FIG. 4 is a flowchart showing processing of each bin by the code amount calculation unit 112 (binary code string processing unit 304). The binary code string processing unit 304 executes the process of the flowchart of FIG. 4 for each bin (binVal).

まず、ビン(binVal)とコンテキスト変数(pStateIdx,valMPS)が入力されると、2値符号列処理部304は、区間幅保持部302に保持されている区間幅(codIRange)の分割幅を求める(S101)。   First, when a bin (binVal) and a context variable (pStateIdx, valMPS) are input, the binary code string processing unit 304 obtains a division width of the section width (codIRRange) held in the section width holding unit 302 ( S101).

なお、区間幅はLPS(least probable symbol)とMPS(most probable symbol)のための区間に分割されているため、2値符号列処理部304は、その分割された区間幅を求めることになる(codIRangeLPS,codIRangeMPS)。すなわち、ステップS101では、区間幅保持部302に保持されている区間幅(codlRange)を分割したLPSとMPSのための区間幅(codIRangeLPS,CcodIRangeMPS)を求める。また、CABACではpStateIdxとcodIRangeの上位ビットによるテーブル引きでcodIRangeLPSを求めている。   Since the section width is divided into sections for LPS (least probable symbol) and MPS (most probable symbol), the binary code string processing unit 304 obtains the divided section width ( codIRrangeLPS, codIRrangeMPS). That is, in step S101, section widths (codIRrangeLPS, CcodRangeMPS) for LPS and MPS obtained by dividing the section width (codrange) held in the section width holding unit 302 are obtained. In CABAC, codIRrangeLPS is obtained by table lookup using the upper bits of pStateIdx and codIRRange.

そして、2値符号列処理部304は、今回入力されたビン(binVal)がMPSである(valMPSと等しい)か否かを判定する(S102)。2値符号列処理部304は、ステップS102で、今回入力されたビンがMPSと判定された場合後述するステップS103から動作し、MPSと判定されなかった場合(LPSだった場合)には後述するステップS107から動作する。   Then, the binary code string processing unit 304 determines whether or not the bin (binVal) input this time is MPS (equal to valMPS) (S102). In step S102, the binary code string processing unit 304 operates from step S103 described later when the currently input bin is determined to be MPS, and will be described later if it is not determined to be MPS (if it is LPS). The operation starts from step S107.

上述のステップS102で、今回入力されたビンがMPSと判定された場合、2値符号列処理部304は、区間幅保持部302の区間幅をMPSの区間幅に更新(codIRange=codIRangeMPS)し(S103)、さらに、コンテキスト変数の更新を行う(S104)。   If it is determined in step S102 that the bin currently input is MPS, the binary code string processing unit 304 updates the section width of the section width holding unit 302 to the section width of MPS (codIRRange = codIRRangeMPS) ( Further, the context variable is updated (S104).

そして、2値符号列処理部304は、更新された区間幅が256(16進数で「0x100」)より小さくなっているか否かを確認する(S105)。   Then, the binary code string processing unit 304 confirms whether or not the updated section width is smaller than 256 (hexadecimal “0x100”) (S105).

そして、2値符号列処理部304は、更新された区間幅が256より小さくなっている場合には、正規化(ビットシフト)が1回必要であるので(MPSの場合は最大1回である)、ビット数カウンタ303の値(bitCount)を1増やし(bitCount=bitCount+1)、区間幅も1ビットシフトして正規化して(codIRange=codIRange<<1)(S106)、当該ビンの処理を終了する。なお、上述のステップS105で更新された区間幅が256以上と確認された場合には、2値符号列処理部304は、当該ビンの処理を終了する。   The binary code string processing unit 304 requires normalization (bit shift) once when the updated section width is smaller than 256 (maximum once in the case of MPS). ), The value (bitCount) of the bit number counter 303 is incremented by 1 (bitCount = bitCount + 1), the section width is also shifted by 1 bit and normalized (codIRRange = codIRRange << 1) (S106), and the processing of the bin ends. . When it is confirmed that the section width updated in step S105 described above is 256 or more, the binary code string processing unit 304 ends the bin processing.

一方、上述のステップS102で、今回入力されたビン(binVal)がLPSと判断された場合、2値符号列処理部304は、区間幅保持部302の区間幅をLPSの区間幅に更新(codIRange=codlRangeLPS)し(S107)、さらに、コンテキスト変数の更新を行う(S108)。   On the other hand, if it is determined in step S102 that the bin (binVal) input this time is LPS, the binary code string processing unit 304 updates the section width of the section width holding unit 302 to the section width of the LPS (codIRRange). = CodlRangeLPS) (S107), and the context variable is updated (S108).

そして、2値符号列処理部304は、区間幅が256(16進数で「0x100」)以上となるまで(正規化処理が完了するまで)、ビット数カウンタと区間幅の更新による正規化処理(上述のステップS106と同様のビットシフトの処理)を繰り返して、当該ビンに係る処理を終了する(S109、S110)。   Then, the binary code string processing unit 304 performs normalization processing by updating the bit number counter and the interval width until the interval width becomes 256 (hexadecimal “0x100”) or more (until the normalization processing is completed). The same bit shift processing as in step S106 described above is repeated, and the processing related to the bin ends (S109, S110).

なお、バイパス符号化(コンテキスト変数を伴わない確率1/2想定のビン)の場合は、2値符号列処理部304は、単純にビット数カウンタを1増やす(bitCount=bitCount+1)ように構成してもよい。また、バイパス符号化のビンが連続する場合は、2値符号列処理部304は、バイパス符号化ビン数mをビット数カウンタに加算(bitCount=bitCount+m)するよう構成しても良い。   In the case of bypass coding (a bin with a probability of 1/2 assuming no context variable), the binary code string processing unit 304 is configured to simply increase the bit number counter by 1 (bitCount = bitCount + 1). Also good. When the bypass encoding bins are continuous, the binary code string processing unit 304 may be configured to add the bypass encoding bin number m to the bit number counter (bitCount = bitCount + m).

以上の、図4のフローチャートの処理を入力されるビンの系列と、各ビンに対応するコンテキスト変数の系列に関して繰り返すことにより、区間幅保持部302の区間幅が、実際に算術符号化を行った場合と同様に状態遷移する。その結果、出力されるであろうビット数が、ビット数カウンタ303に保持されることになる。   The above processing of the flowchart of FIG. 4 is repeated for the input bin series and the context variable series corresponding to each bin, so that the section width of the section width holding unit 302 is actually subjected to arithmetic coding. The state transitions as in the case. As a result, the number of bits that will be output is held in the bit number counter 303.

符号量算出部305は、以上の処理によって求められたビット数カウンタ303の値(bitCount)と、初期区間幅記憶部301に記憶された初期区間幅(codIRangeS)と、対象系列処理後の区間幅保持部302の区間幅(codIRange)を用いて符号化対象に対する符号量を算出する。   The code amount calculation unit 305 includes the value (bitCount) of the bit number counter 303 obtained by the above processing, the initial interval width (codIRRangeS) stored in the initial interval width storage unit 301, and the interval width after the target sequence processing. The code amount for the encoding target is calculated using the section width (codIRRange) of the holding unit 302.

CABACでは、算術符号の区間幅は9ビット精度で表現されており以下の(1)式を満たすように正規化されている。すなわち、CABACでは算術符号の区間幅が小さいほど1ビット以下の情報がすでに符号量として発生していることに相当し、その符号量は以下の(2)式のように示すことができる。なお、(1)、(2)式で、「0x100」及び「0x200」は16進数の表現となっている。   In CABAC, the interval width of an arithmetic code is expressed with 9-bit precision and is normalized so as to satisfy the following expression (1). That is, in CABAC, as the interval width of the arithmetic code is smaller, it corresponds to the fact that information of 1 bit or less is already generated as the code amount, and the code amount can be expressed as the following equation (2). In the expressions (1) and (2), “0x100” and “0x200” are expressed in hexadecimal numbers.

0×100≦coIRange<0x200 …(1)
−log(codIRange/0x200) …(2)
そして、区間幅に対応する符号量を図5に示すように、例えば小数点以下16ビットの固定少数で表したテーブル(以下、「符号量テーブルT」と呼ぶ)として実現できる。
0 × 100 ≦ coIRRange <0x200 (1)
-Log 2 (codIRRange / 0x200) (2)
Then, as shown in FIG. 5, the code amount corresponding to the section width can be realized, for example, as a table (hereinafter referred to as “code amount table T”) expressed by a fixed decimal having 16 bits after the decimal point.

符号量算出部305は、例えば小数点以下16ビットの固定少数として符号量Rを算出する場合、「bitCount」と、「codIRangeSとcodIRange」と、上述の符号量テーブルTとを用いて、以下の(3)式により求めることができる。そして、符号量算出部305は、求めた符号量Rを出力する。   For example, when the code amount R is calculated as a fixed decimal with 16 bits after the decimal point, the code amount calculation unit 305 uses the following (a) (bitCount), “codIRRangeS and codIRRange”, and the above-described code amount table T ( 3) It can obtain | require by Formula. Then, the code amount calculation unit 305 outputs the obtained code amount R.

R=(bitCount<<16)+T[codIRange−0×100]
−T[codIRangeS−0×100] …(3)
(A−3)第1の実施形態の効果
第1の実施形態によれば、以下のような効果を奏することができる。
R = (bitCount << 16) + T [codIRrange-0 × 100]
-T [codIRRangeS-0 × 100] (3)
(A-3) Effects of First Embodiment According to the first embodiment, the following effects can be achieved.

動画像符号化装置1の符号量計算部112では、エントロピー符号化部104の算術符号化によって必要となる符号量を、実際に符号化することなく(出力ビットパターンを求める処理はせず)、整数精度より高精度に求めることができる。   The code amount calculation unit 112 of the moving image encoding device 1 does not actually encode the code amount required by the arithmetic encoding of the entropy encoding unit 104 (without processing for obtaining the output bit pattern). It can be obtained with higher precision than integer precision.

具体的には、符号化モード選択部111では、実際に符号化を行った場合と同様の算術符号の区間幅の遷移処理を行うので、特許文献1のテーブル引きによる処理のような近似ではない符号量が計算できる。さらに、符号化モード選択部111では、符号化開始時の初期状態、及び終了時の状態の区間幅から、整数精度より高精度な符号量を求めることができる。これにより、動画像符号化装置1では、符号化モード選択部111において、より最適な符号化モード選択が可能となり、符号化効率が向上する。   Specifically, since the encoding mode selection unit 111 performs the transition process of the section width of the arithmetic code similar to the case where the encoding is actually performed, it is not an approximation like the process by the table lookup of Patent Document 1. Code amount can be calculated. Furthermore, the encoding mode selection unit 111 can obtain a code amount with higher accuracy than integer accuracy from the section width of the initial state at the start of encoding and the state at the end. Thereby, in the moving image encoding device 1, the encoding mode selection unit 111 can select a more optimal encoding mode, and the encoding efficiency is improved.

(B)第2の実施形態
以下、本発明による符号量計算装置及びプログラム、並びに、動画像符号化装置及びプログラムの第2の実施形態を、図面を参照しながら詳述する。なお、第2の実施形態では、本発明の符号量計算装置を、動画像符号化装置を構成する符号量計算部として構成した例について示している。
(B) Second Embodiment Hereinafter, a second embodiment of a code amount calculation device and program, and a moving image coding device and program according to the present invention will be described in detail with reference to the drawings. In the second embodiment, an example is shown in which the code amount calculation device of the present invention is configured as a code amount calculation unit that constitutes a moving image encoding device.

(B−1)第2の実施形態の構成
第2の実施形態の動画像符号化装置1Aの全体構成も、上述の図2を用いて示すことができる。
(B-1) Configuration of Second Embodiment The overall configuration of the moving image encoding apparatus 1A of the second embodiment can also be shown using FIG.

そして、図6は、第2の実施形態の動画像符号化装置1Aに搭載される符号量計算部112Aの機能的構成について示したブロック図であり、上述の図1と同一又は対応する部分には同一又は対応する符号を付している。   FIG. 6 is a block diagram illustrating a functional configuration of the code amount calculation unit 112A mounted in the moving image encoding apparatus 1A according to the second embodiment, and the same or corresponding parts as those in FIG. Are given the same or corresponding symbols.

符号量計算部112Aでは、正規化回数テーブル306が追加されている点で第1の実施形態と異なっている。正規化回数テーブル306は、各ビンの区間幅に対応する正規化回数kを得ることを可能とするテーブルである。   The code amount calculation unit 112A is different from the first embodiment in that a normalization count table 306 is added. The normalization count table 306 is a table that makes it possible to obtain the normalization count k corresponding to the section width of each bin.

上述の通り、2値符号列処理部304が各ビンに対して処理を行う際、当該ビンがLPSの場合は正規化処理を複数回行う必要がある。第1の実施形態の2値符号列処理部304は、LPSのビンに対する正規化回数をループ処理(上述のステップS109、S110の処理)で管理していたが、第2の実施形態では、ビンごとに対応する正規化回数kを取得可能な正規化回数テーブル306を用いて管理する。   As described above, when the binary code string processing unit 304 performs processing on each bin, if the bin is LPS, it is necessary to perform normalization processing a plurality of times. The binary code string processing unit 304 of the first embodiment manages the number of times of normalization for LPS bins by loop processing (the processing of steps S109 and S110 described above). It manages using the normalization number table 306 which can acquire the normalization number k corresponding to every.

すなわち、2値符号列処理部304は、各ビンについて処理する際に、当該ビンがLPSの場合は、正規化回数テーブル306から当該ビンに対応する正規化回数kを取得する。そして、2値符号列処理部304は、取得した正規化回数kの回数分の正規化処理(上述のステップS110と同様の処理)を実行する。   That is, when processing each bin, if the bin is an LPS, the binary code string processing unit 304 acquires the normalization count k corresponding to the bin from the normalization count table 306. Then, the binary code string processing unit 304 executes normalization processing (the same processing as step S110 described above) for the acquired number of normalizations k.

LPSのビンについては、更新された区間幅はcodIRangeLPSのみに依存している。したがって、符号量計算部112Aにおいて、codIRangeLPSに基づいて、ビンごとに必要な正規化回数kをあらかじめ正規化回数テーブル306として用意しておくことが可能である。   For LPS bins, the updated interval width depends only on codIrangeLPS. Therefore, the code amount calculation unit 112A can prepare the normalization count k necessary for each bin as the normalization count table 306 in advance based on the codIRRangeLPS.

例えば、CABACではcodIRangeLPSが取りうる範囲に応じて限定したテーブルを用意しておくことが可能である。あるいは、codIRangeLPSを求めるテーブルに、対応する正規化回数も含めたテーブルとしておくことも可能である。   For example, in CABAC, it is possible to prepare a table limited according to the range that codIRangeLPS can take. Alternatively, the table for obtaining codIRangeLPS may be a table including the corresponding number of normalizations.

(B−2)第2の実施形態の動作
次に、以上のような構成を有する第2の実施形態の動画像符号化装置1A(符号量計算部112A)の動作について、第1の実施形態との差異を中心に説明する。
(B-2) Operation of Second Embodiment Next, the operation of the moving image coding apparatus 1A (code amount calculation unit 112A) of the second embodiment having the above-described configuration will be described in the first embodiment. The difference will be mainly explained.

図7は、符号量計算部112Aを構成する符号量計算部112A(2値符号列処理部304)による各ビンの処理について示したフローチャートである。第2の実施形態の2値符号列処理部304は、各ビン(binVal)に対して、図7のフローチャートの処理を実行する。   FIG. 7 is a flowchart showing processing of each bin by the code amount calculation unit 112A (binary code string processing unit 304) constituting the code amount calculation unit 112A. The binary code string processing unit 304 of the second embodiment executes the process of the flowchart of FIG. 7 for each bin (binVal).

図7に示すステップS201〜S208については、第1の実施形態のステップS101〜S108と同様であるので詳しい説明は省略する。   Since steps S201 to S208 shown in FIG. 7 are the same as steps S101 to S108 of the first embodiment, detailed description thereof will be omitted.

そして、第2の実施形態の符号量計算部112A(2値符号列処理部304)では、LPSのビンについて正規化する際に、第1の実施形態のようなループ処理(ステップS109、S110)ではなく、正規化回数テーブル306を用いた処理により複数回の正規化処理を実現している。   Then, the code amount calculation unit 112A (binary code string processing unit 304) of the second embodiment performs loop processing (steps S109 and S110) as in the first embodiment when normalizing the LPS bins. Instead, a plurality of normalization processes are realized by a process using the normalization number table 306.

具体的には、2値符号列処理部304は、上述のステップS202で、処理対象となるビンがLPSと判定された場合、正規化回数テーブル306から当該ビンに対応する正規化回数k(codIRangeLPSに対応する正規化回数k)を正規化回数テーブル306から求める(S209)。そして、2値符号列処理部304は、区間幅保持部302が保持する区間幅に対して正規化回数kの回数分の正規化処理(ビットシフトの処理)を行う(S210)。   Specifically, when the bin to be processed is determined to be LPS in step S202 described above, the binary code string processing unit 304 determines the normalization count k (codIRrangeLPS) corresponding to the bin from the normalization count table 306. The normalization count k) corresponding to is obtained from the normalization count table 306 (S209). Then, the binary code string processing unit 304 performs normalization processing (bit shift processing) for the number of times of normalization k for the section width held by the section width holding unit 302 (S210).

具体的にはステップS210において、2値符号列処理部304は、正規化回数kにしたがって、ビット数カウンタ303の値をkビット分増やし(bitCount=bitCount+k)、区間幅保持部302の区間幅もkビットシフトして正規化する(codIRange=codIRange<<k)。   Specifically, in step S210, the binary code string processing unit 304 increases the value of the bit number counter 303 by k bits according to the number of normalizations k (bitCount = bitCount + k), and the section width of the section width holding unit 302 is also increased. Shift by k bits and normalize (codIRrange = codIRrange << k).

以上の処理を入力されるビンの系列と、各ビンに対応するコンテキスト変数の系列に関して繰り返すことにより、符号量計算部112Aでは、区間幅保持部302の区間幅が、実際に算術符号化を行った場合と同様に状態遷移し、出力されるであろうビット数がビット数カウンタ303に求まる。   By repeating the above process for the input bin series and the context variable series corresponding to each bin, the code amount calculation unit 112A actually performs arithmetic coding on the section width of the section width holding unit 302. In the same way as in the case of the case, the number of bits to be output is obtained in the bit number counter 303.

そして、符号量算出部305は、以上の処理によって求められたビット数カウンタ303の値(bitCount)と、初期区間幅記憶部301に記憶された初期区間幅(codIRangeS)と、対象系列処理後の区間幅保持部302の区間幅(codlRange)を用いて計算対象系列に対する符号量Rを算出し出力する。   The code amount calculation unit 305 then obtains the value (bitCount) of the bit number counter 303 obtained by the above processing, the initial interval width (codIRRangeS) stored in the initial interval width storage unit 301, and the target sequence after processing The code amount R for the calculation target sequence is calculated and output using the section width (codrange) of the section width holding unit 302.

(B−3)第2の実施形態の効果
第2の実施形態によれば、第1の実施形態の効果に加えて以下のような効果を奏することができる。
(B-3) Effects of Second Embodiment According to the second embodiment, the following effects can be obtained in addition to the effects of the first embodiment.

第2の実施形態の符号量計算部112では、区間幅のビットシフトによる正規化処理を、第1の実施形態のようなループ処理ではなく、テーブル引き処理とすることで、第1の実施形態よりも符号量算出に必要な処理量を低減することができる。   In the code amount calculation unit 112 according to the second embodiment, the normalization process by the bit shift of the section width is not a loop process as in the first embodiment but a table lookup process, thereby enabling the first embodiment. As a result, it is possible to reduce the processing amount necessary for calculating the code amount.

(C)他の実施形態
本発明は、上記の各実施形態に限定されるものではなく、以下に例示するような変形実施形態も挙げることができる。
(C) Other Embodiments The present invention is not limited to the above-described embodiments, and may include modified embodiments as exemplified below.

(C−1)上記の各実施形態では、符号量計算部は動画像符号化装置の一部を構成するものとして説明したが、符号量計算部を独立した装置(符号量計算装置)として構築するようにしてもよい。その場合、本発明の符号量計算装置の機能的構成は、図1のように示すことができる。なお、本発明の符号量計算装置は、プロセッサ及びメモリ等を有するコンピュータ(1台に限定されず、複数台を分散処理し得るようにしたものであっても良い。)に、本発明の符号量計算プログラム等をインストールすることにより構築しても良く、その場合でも、機能的には上述の図1のように示すことができる。 (C-1) In each of the above embodiments, the code amount calculation unit has been described as constituting a part of the moving image encoding device. However, the code amount calculation unit is constructed as an independent device (code amount calculation device). You may make it do. In that case, the functional configuration of the code amount calculation apparatus of the present invention can be shown as shown in FIG. Note that the code amount calculation apparatus according to the present invention is applied to a computer (not limited to one, but may be configured to be capable of distributed processing of a plurality of units) having a processor and a memory. It may be constructed by installing a quantity calculation program or the like, and even in that case, it can be functionally shown as in FIG.

(C−2)上記の実施形態では、本発明の動画像符号化装置は、H.264に基づくエントロピー符号化(CABAC)を用いる例について説明したが、算術符号化を用いるその他の種々の符号化に対応する映像符号化処理を適用するようにしてもよい。 (C-2) In the above embodiment, the moving picture coding apparatus according to the present invention is an H.264 format. Although an example using entropy coding (CABAC) based on H.264 has been described, video coding processing corresponding to various other coding using arithmetic coding may be applied.

1…動画像符号化装置11…画面分割部、102…空間変換部、103…量子化部、104…エントロピー符号化部、105…逆量子化部、106…逆空間変換部、107…ループ内フィルタ部、108…参照画像バッファ、109…インター予測部、110…イントラ予測部、111…符号化モード選択部、112…符号量計算部、113…予測残差信号生成部、114…復号画像生成部、201…2値化部、202…コンテキスト計算部、203…算術符号化部、204…コンテキスト変数テーブル、301…初期区間幅記憶部、302…区間幅保持部、303…ビット数カウンタ、304…2値符号列処理部、305…符号量算出部。   DESCRIPTION OF SYMBOLS 1 ... Moving image encoder 11 ... Screen division part, 102 ... Spatial transformation part, 103 ... Quantization part, 104 ... Entropy coding part, 105 ... Inverse quantization part, 106 ... Inverse space transformation part, 107 ... In a loop Filter unit 108 Reference image buffer 109 Inter prediction unit 110 Intra prediction unit 111 Coding mode selection unit 112 Code amount calculation unit 113 Prediction residual signal generation unit 114 Decoded image generation , 201 ... binarization unit, 202 ... context calculation unit, 203 ... arithmetic coding unit, 204 ... context variable table, 301 ... initial interval width storage unit, 302 ... interval width holding unit, 303 ... bit number counter, 304 ... Binary code string processing unit, 305 ... Code amount calculation unit.

Claims (6)

動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列の系列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段を用いて、上記動画像の符号化を行う場合に、上記エントロピー符号化手段で出力する符号の符号量を計算する符号量計算装置において、
上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、
上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、
上記2値符号列の系列及び上記コンテキスト変数の系列に応じて、上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、
上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、
上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段と
を有することを特徴とする符号量計算装置。
A sequence of binary code sequences related to encoded information such as a residual signal and prediction information of a target image constituting a moving image and a predicted image of the target image, and a binary code sequence related to the encoded information When the moving image is encoded using the entropy encoding unit that performs entropy encoding of the encoding information based on the context variable sequence representing the probability state, the entropy encoding unit outputs the encoded moving image. In the code amount calculation device for calculating the code amount of the code,
Initial interval width storage means for storing an initial interval width at the start of processing related to the binary code string sequence;
Section width holding means for setting the initial section width as an initial value and holding a section width updated according to the sequence of the binary code string;
Binary code string processing means for controlling the state transition of the section width of the section width holding means in accordance with the binary code string series and the context variable series;
The binary code string processing means counts the number of times the section width is bit-shifted by normalization processing;
The count value of the bit shift number counting means, the code amount corresponding to the initial interval width, and the interval held by the interval width holding means at the end of processing of all binary code strings related to the binary code string sequence A code amount calculation apparatus comprising: a calculation unit that calculates a code amount output from the entropy encoding unit based on a code amount corresponding to a width.
上記2値符号列に係る区間幅ごとに対応する正規化回数を取得することが可能な情報を保持する正規化回数情報保持手段をさらに有し、
上記2値符号列処理手段は、上記2値符号列に係る区間幅ごとに、上記正規化回数情報保持手段で保持されている情報に基づいた回数分のビットシフトにより正規化処理を行い、
上記ビットシフト回数カウント手段は、上記2値符号列に係る区間幅ごとに、上記正規化回数保持手段で保持されている情報に基づいた回数をカウンタ値に加算する
ことを特徴とする請求項1に記載の符号量計算装置。
A normalization number information holding means for holding information capable of acquiring a normalization number corresponding to each interval width related to the binary code string;
The binary code string processing means performs a normalization process by a bit shift for the number of times based on information held in the normalization number information holding means for each interval width related to the binary code string,
The bit shift number counting means adds the number of times based on the information held in the normalized number holding means to the counter value for each section width related to the binary code string. The code amount calculation device described in 1.
上記2値符号列処理手段は、上記2値符号列の系列うち、バイパス符号化される2値符号列については、上記ビットシフト回数カウント手段のカウンタ値を加算する処理のみを行うことを特徴とする請求項2に記載の符号量計算装置。   The binary code string processing means performs only the process of adding the counter value of the bit shift number counting means for the binary code string to be bypass-coded among the binary code string series. The code amount calculation apparatus according to claim 2. 動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段と、上記エントロピー符号化手段で、動画像の符号化を行う場合に、必要となる符号量を推定する符号量計算手段とを備え、上記エントロピー符号化手段は、上記符号量計算装置の推定結果に基づいて選択された符号化情報に係る符号を出力する動画像符号化装置において、
上記符号量計算手段として請求項1〜3のいずれかの符号量計算装置を適用したことを特徴とする動画像符号化装置。
Probability states of a binary code string related to encoded information such as a residual signal and prediction information of a target image constituting the moving image and a predicted image of the target image, and a binary code string related to the encoded information The entropy coding means for performing entropy coding of the coding information based on the context variable sequence representing the coding information, and the amount of code required when the moving image is coded by the entropy coding means, A moving picture coding apparatus that outputs a code related to coding information selected based on an estimation result of the coding quantity calculation apparatus.
4. A moving picture coding apparatus, wherein the code quantity calculation apparatus according to claim 1 is applied as the code quantity calculation means.
動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段を用いて、上記動画像の符号化を行う場合に、上記エントロピー符号化手段で出力する符号の符号量を計算する符号量計算プログラムにおいて、
コンピュータを、
上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、
上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、
上記2値符号列の系列及び上記コンテキスト変数の系列に応じて、上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、
上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、
上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段と
して機能させることを特徴とする符号量計算プログラム。
Probability states of a binary code string related to encoded information such as a residual signal and prediction information of a target image constituting the moving image and a predicted image of the target image, and a binary code string related to the encoded information When encoding the moving image using the entropy encoding unit that performs entropy encoding of the encoding information based on the context variable sequence that represents the code of the code output by the entropy encoding unit In the code amount calculation program for calculating the code amount,
Computer
Initial interval width storage means for storing an initial interval width at the start of processing related to the binary code string sequence;
Section width holding means for setting the initial section width as an initial value and holding a section width updated according to the sequence of the binary code string;
Binary code string processing means for controlling the state transition of the section width of the section width holding means in accordance with the binary code string series and the context variable series;
The binary code string processing means counts the number of times the section width is bit-shifted by normalization processing;
The count value of the bit shift number counting means, the code amount corresponding to the initial interval width, and the interval held by the interval width holding means at the end of processing of all binary code strings related to the binary code string sequence A code amount calculation program that functions as a calculation unit that calculates a code amount output from the entropy encoding unit based on a code amount corresponding to a width.
コンピュータを、
動画像を構成する対象画像と上記対象画像の予測画像との残差信号や予測情報等の符号化情報に係る2値符号列と、上記符号化情報に係る2値符号列のそれぞれの確率状態を表すコンテキスト変数の系列とに基づいて、上記符号化情報のエントロピー符号化を行うエントロピー符号化手段と、
上記エントロピー符号化手段で、動画像の符号化を行う場合に、必要となる符号量を推定する符号量計算手段として機能させ、
上記エントロピー符号化手段は、上記符号量計算装置の推定結果に基づいて選択された符号化情報に係る符号を出力し、
上記符号量計算手段は、
上記2値符号列の系列に係る処理開始時での初期区間幅を記憶する初期区間幅記憶手段と、
上記初期区間幅を初期値とし、上記2値符号列の系列に応じて更新される区間幅を保持する区間幅保持手段と、
上記2値符号列の系列及び上記コンテキスト変数の系列に応じて上記区間幅保持手段の区間幅の状態遷移を制御する2値符号列処理手段と、
上記2値符号列処理手段が、正規化処理によって区間幅をビットシフトした回数をカウントするビットシフト回数カウント手段と、
上記ビットシフト回数カウント手段のカウント値と、上記初期区間幅に対応する符号量と、上記2値符号列の系列に係るすべての2値符号列の処理終了時に上記区間幅保持手段が保持する区間幅に対応する符号量とに基づいて、上記エントロピー符号化手段から出力する符号量を計算する計算手段とを有する
ことを特徴とする動画像符号化プログラム。
Computer
Probability states of a binary code string related to encoded information such as a residual signal and prediction information of a target image constituting the moving image and a predicted image of the target image, and a binary code string related to the encoded information Entropy encoding means for performing entropy encoding of the encoded information based on a sequence of context variables representing
When encoding the moving image with the entropy encoding unit, the entropy encoding unit functions as a code amount calculation unit that estimates a required code amount,
The entropy encoding means outputs a code related to encoding information selected based on the estimation result of the code amount calculation device,
The code amount calculation means includes:
Initial interval width storage means for storing an initial interval width at the start of processing related to the binary code string sequence;
Section width holding means for setting the initial section width as an initial value and holding a section width updated according to the sequence of the binary code string;
Binary code string processing means for controlling state transition of the section width of the section width holding means in accordance with the binary code string series and the context variable series;
The binary code string processing means counts the number of times the section width is bit-shifted by normalization processing;
The count value of the bit shift number counting means, the code amount corresponding to the initial interval width, and the interval held by the interval width holding means at the end of processing of all binary code strings related to the binary code string sequence A moving picture encoding program comprising: a calculation unit that calculates a code amount output from the entropy encoding unit based on a code amount corresponding to a width.
JP2012212926A 2012-09-26 2012-09-26 Code amount calculation device and program and moving image encoder and program Pending JP2014068247A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012212926A JP2014068247A (en) 2012-09-26 2012-09-26 Code amount calculation device and program and moving image encoder and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012212926A JP2014068247A (en) 2012-09-26 2012-09-26 Code amount calculation device and program and moving image encoder and program

Publications (1)

Publication Number Publication Date
JP2014068247A true JP2014068247A (en) 2014-04-17

Family

ID=50744231

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012212926A Pending JP2014068247A (en) 2012-09-26 2012-09-26 Code amount calculation device and program and moving image encoder and program

Country Status (1)

Country Link
JP (1) JP2014068247A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017123513A (en) * 2016-01-05 2017-07-13 日本電信電話株式会社 Image coding method, image encoder and image coding program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017123513A (en) * 2016-01-05 2017-07-13 日本電信電話株式会社 Image coding method, image encoder and image coding program

Similar Documents

Publication Publication Date Title
TWI685245B (en) Data encoding and decoding
JP4354520B2 (en) Encoder
JP6730187B2 (en) Data encoding and decoding
JP6400092B2 (en) Data encoding and decoding
JP5492206B2 (en) Image encoding method and image decoding method, and image encoding device and image decoding device
JP5139542B2 (en) Two-pass quantization for CABAC coders
JP2023052667A (en) dependent quantization
JP4949462B2 (en) Code amount estimation method, apparatus, program thereof, and recording medium
JP2017118549A (en) Data encoding and decoding
KR102020101B1 (en) Method and apparatus for syntax element encoding in a video codec
JP4819940B2 (en) Video encoding device
JP2018056685A (en) Image encoder, image encoding method and image encoding program, and image decoder, image decoding method and image decoding program
US20140286417A1 (en) Data encoding and decoding
TWI650012B (en) Apparatus, method, and storage medium for data encoding and decoding
JP6476900B2 (en) Moving picture coding apparatus, moving picture coding method, and computer program for moving picture coding
JP5231243B2 (en) Encoding apparatus and encoding method
US20080144721A1 (en) Video coding apparatus
KR101652183B1 (en) Coding syntax elements using vlc codewords
JP2009021775A (en) Coder and coding method
JP2011176483A (en) Quantization device, program and method, and moving image encoding apparatus
JP6708211B2 (en) Moving picture coding apparatus, moving picture coding method, and recording medium storing moving picture coding program
JP2007074337A (en) Coding device and method therefor
JP2014068247A (en) Code amount calculation device and program and moving image encoder and program
JP6402520B2 (en) Encoding apparatus, method, program, and apparatus
JP6497100B2 (en) Video encoding apparatus, method and program