JP4767992B2 - Variable length encoding method and variable length decoding method - Google Patents

Variable length encoding method and variable length decoding method Download PDF

Info

Publication number
JP4767992B2
JP4767992B2 JP2008119337A JP2008119337A JP4767992B2 JP 4767992 B2 JP4767992 B2 JP 4767992B2 JP 2008119337 A JP2008119337 A JP 2008119337A JP 2008119337 A JP2008119337 A JP 2008119337A JP 4767992 B2 JP4767992 B2 JP 4767992B2
Authority
JP
Japan
Prior art keywords
block
blocks
significant coefficients
peripheral
variable length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP2008119337A
Other languages
Japanese (ja)
Other versions
JP2008259224A (en
Inventor
敏志 近藤
眞也 角野
誠 羽飼
清史 安倍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial 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 Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP2008119337A priority Critical patent/JP4767992B2/en
Publication of JP2008259224A publication Critical patent/JP2008259224A/en
Application granted granted Critical
Publication of JP4767992B2 publication Critical patent/JP4767992B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Description

本発明は、画像信号を圧縮伸張する際の、可変長符号化方法および可変長復号化方法に関する。   The present invention relates to a variable-length encoding method and a variable-length decoding method when compressing and expanding an image signal.

現在標準化作業が行われているH.264符号化方式では、可変長符号化方法として、コンテキスト適応型可変長符号化(以下CAVLC)方式とコンテキスト適応型2値算術符号化(以下CABAC)方式の2つの方法が定義されている。   Standardization work is currently underway. In the H.264 coding method, two methods, a context adaptive variable length coding (hereinafter referred to as CAVLC) method and a context adaptive binary arithmetic coding (hereinafter referred to as CABAC) method, are defined as variable length coding methods.

CAVLC方式においては、周辺ブロックの情報等(コンテキスト)を用いてVLCテーブルを適応的に切り替えることにより、符号化効率を向上させている。また、CABAC方式においては、確率テーブルをコンテキストに応じて切り替えることにより、符号化効率を向上させている。   In the CAVLC method, encoding efficiency is improved by adaptively switching the VLC table using information (context) of neighboring blocks. In the CABAC system, the coding efficiency is improved by switching the probability table according to the context.

CAVLC方式において、ブロック内の有意係数の個数を符号化または復号化する方法について説明する。ここで有意係数とは、係数値が0でない係数のことである。図5において、ブロックCが可変長符号化を施そうとしているブロックであり、ブロックA、BはそれぞれブロックCの左および上に位置するブロックであるとする。ここで例えば、H.264方式では各ブロックは動き補償の大きさに関わらず水平4画素、垂直4画素の大きさで周波数変換されており、有意係数の個数の最大値は16となる。この場合、ブロックA、Bが両者とも画面内にあり、かつ同じスライス内であるとすると、ブロックA、Bの有意係数の個数に対して2つの平均値を求め、その値によって用いるVLCテーブルを変更する。例えば、平均値が0または1の場合は図4のVLC0を、平均値が2または3の場合は図4のVLC1を、平均値が5以上の場合は図4のVLC2を、というように用いる。   A method for encoding or decoding the number of significant coefficients in a block in the CAVLC scheme will be described. Here, the significant coefficient is a coefficient whose coefficient value is not 0. In FIG. 5, it is assumed that block C is a block to be subjected to variable length coding, and blocks A and B are blocks located on the left and above block C, respectively. Here, for example, H.M. In the H.264 system, each block is frequency-converted with the size of 4 horizontal pixels and 4 vertical pixels regardless of the magnitude of motion compensation, and the maximum number of significant coefficients is 16. In this case, if the blocks A and B are both in the screen and are in the same slice, two average values are obtained for the number of significant coefficients of the blocks A and B, and the VLC table used according to the average value is calculated. change. For example, when the average value is 0 or 1, VLC0 in FIG. 4 is used, when the average value is 2 or 3, VLC1 in FIG. 4 is used, and when the average value is 5 or more, VLC2 in FIG. 4 is used. .

次に、CABAC方式において、各ブロックが有意係数を有するか否かを示すビット(CBPビット)を符号化または復号化する方法について説明する。図5において、ブロックCが可変長符号化を施そうとしているブロックであり、ブロックA、BはそれぞれブロックCの左および上に位置するブロックであるとする。この場合、ブロックA、Bが両者とも画面内にあり、かつ同じスライス内であり、ブロックCと同じ種類のブロック(例えばA、B、Cがすべて輝度信号ブロック)であるとすると、ブロックA、Bが有意係数を有するか否かの4通りの組合せ中の、いずれのパターンであるかを求める。そして、そのパターンによって、CBPビットを算術符号化する際に用いる確率テーブルを4つの中から選択する。   Next, a method for encoding or decoding a bit (CBP bit) indicating whether each block has a significant coefficient in the CABAC system will be described. In FIG. 5, it is assumed that block C is a block to be subjected to variable length coding, and blocks A and B are blocks located on the left and above block C, respectively. In this case, if the blocks A and B are both in the screen, are in the same slice, and are the same type of blocks as the block C (for example, A, B, and C are all luminance signal blocks), Which of the four combinations of whether or not B has a significant coefficient is determined. Then, the probability table used when arithmetically coding the CBP bits is selected from the four patterns according to the pattern.

次に、CABAC方式において、ブロック内の各係数が有意係数であるか否かを示すビットを符号化または復号化する方法について説明する。図6は、ブロック内の係数を所定の走査順序で並べ替えたものを示している。ここでH.264方式では、低周波数成分から高周波数成分に対してジグザグ順に走査する方法が用いられる。この際、各係数が有意係数であるか否かは、SIGビットおよびLASTビットと呼ばれるビットにより表現し、これらのビットを算術符号化する。ここでSIGビットは、有意係数の場合には1、係数値が0である場合には0となる。また、LASTビットは、有意係数に対してのみ割り振られ、その有意係数がブロック内の最後の係数である場合には1、そうでない場合には0となる。ここでSIGビットおよびLASTビットを算術符号化する際の確率テーブルは、ブロックの種類別(例えば画面内予測輝度信号ブロック、ピクチャ間予測輝度信号ブロック、画面内予測色差信号ブロック、ピクチャ間予測色差信号ブロック、等)に用意され、さらに各ブロックの種類に対して、各係数位置(走査順での位置)毎に用意される。したがって例えば、あるブロックの種類が最大16係数を有する場合、SIGビット、LASTビットのそれぞれに対して確率テーブルが15個ずつ用いられる。これは16番目に有意係数が存在する場合、最終係数は符号化する必要がないためである。   Next, a method for encoding or decoding a bit indicating whether or not each coefficient in a block is a significant coefficient in the CABAC system will be described. FIG. 6 shows the coefficients in the block rearranged in a predetermined scanning order. Here H. In the H.264 system, a method of scanning in a zigzag order from a low frequency component to a high frequency component is used. At this time, whether each coefficient is a significant coefficient is expressed by bits called SIG bit and LAST bit, and these bits are arithmetically encoded. Here, the SIG bit is 1 when the coefficient is significant, and is 0 when the coefficient value is 0. The LAST bit is assigned only to the significant coefficient, and is 1 when the significant coefficient is the last coefficient in the block, and 0 otherwise. Here, the probability table when arithmetically encoding the SIG bit and the LAST bit is different depending on the type of block (for example, intra-screen prediction luminance signal block, inter-picture prediction luminance signal block, intra-screen prediction color difference signal block, inter-picture prediction color difference signal). Are prepared for each coefficient position (position in scanning order) for each block type. Thus, for example, if a block type has a maximum of 16 coefficients, 15 probability tables are used for each SIG bit and LAST bit. This is because if the 16th significant coefficient exists, the final coefficient does not need to be encoded.

なお、CABAC方式では、確率テーブルを選択する要因となるコンテキストとして、上述のCBP、SIGビット、LASTビットの他に、例えば、イントラマクロブロックであるか、スキップマクロブロックであるか、ダイレクトモードマクロブロックであるか、参照ピクチャ番号が0であるか、差分QPが0であるか否か、等の項目がある。そして、これらのコンテキストに関して、算術符号化の対象となるブロックの左及び上に位置するブロックの値を使って対象ブロックのコンテキスト値を決定し、その値に対応する確率テーブルを用いて可変長符号化を行っている。可変長符号化を施されたビット列は図24に示すように符号列中に記述される。図24において、各情報の下に示されているのは確率テーブルである。例えば、マクロブロックの符号化モードであるMB_typeを可変長符号化する場合には、コンテキスト値に応じて4つの確率テーブル(MB0〜MB3)を用いることを示している。   In the CABAC method, as a context that causes the probability table to be selected, in addition to the above-described CBP, SIG bit, and LAST bit, for example, an intra macroblock, a skip macroblock, a direct mode macroblock, or the like , Whether the reference picture number is 0, and whether the difference QP is 0. Then, with respect to these contexts, the context value of the target block is determined using the values of the blocks located to the left and above the block that is the target of arithmetic coding, and the variable length code using the probability table corresponding to the value Is going on. The bit string subjected to variable length coding is described in the code string as shown in FIG. In FIG. 24, a probability table is shown below each information. For example, when MB_type, which is a macroblock encoding mode, is variable length encoded, four probability tables (MB0 to MB3) are used according to the context value.

しかしながら、上記従来のCAVLC方式及びCABAC方式においては、周波数変換ブロック(以下、単に変換ブロックと呼ぶ)の大きさが同一の大きさを有しているという前提に基づいてVLCテーブルや確率テーブルの選択方法が定められているために、変換ブロックの大きさが一定でない場合には、これらの方法を用いることができないという問題を有している。   However, in the conventional CAVLC method and CABAC method, selection of the VLC table and the probability table is based on the assumption that the frequency conversion blocks (hereinafter simply referred to as conversion blocks) have the same size. Since the methods are determined, there is a problem that these methods cannot be used when the size of the transform block is not constant.

また、上記従来のCAVLC方式及びCABAC方式は、画像信号がインタレース信号の場合に対応していないという問題もある。つまり、インタレース信号に対しては、ブロック毎にフレーム又はフィールド構造で符号化・復号化が行われることになるので、符号化/復号化対象のブロックと左又は上に位置するブロックとが異なる構造で符号化/復号化されている場合が発生するが、従来のCAVLC方式及びCABAC方式では、このようなインタレース信号の場合における可変長符号化の決定方法が定義されていない。   In addition, the conventional CAVLC method and CABAC method have a problem that they do not support the case where the image signal is an interlaced signal. In other words, since the interlaced signal is encoded / decoded in a frame or field structure for each block, the block to be encoded / decoded is different from the block located on the left or above. In some cases, coding / decoding is performed with a structure, but the conventional CAVLC scheme and CABAC scheme do not define a variable length coding decision method in the case of such an interlaced signal.

そこで、本発明は上記問題点を解決するものであり、変換ブロックの大きさが一定でない場合に、可変長符号化方法としてCAVLC方式やCABAC方式を用いる際に、符号化効率が向上するVLCテーブルや確率テーブルの選択方法を実現する可変長符号化方法および可変長復号化方法を提供することを目的とする。   Therefore, the present invention solves the above-described problem. When the size of the transform block is not constant, the VLC table improves the coding efficiency when the CAVLC method or the CABAC method is used as the variable length coding method. Another object of the present invention is to provide a variable-length encoding method and a variable-length decoding method that realize a method for selecting a probability table.

また、本発明は、画像信号がインタレース信号である場合に、可変長符号化方法としてCAVLC方式やCABAC方式を用いる際に、符号化効率が向上するVLCテーブルや確率テーブルの選択方法を実現する可変長符号化方法および可変長復号化方法を提供することをも目的とする。   In addition, the present invention realizes a method for selecting a VLC table or a probability table that improves coding efficiency when the CAVLC method or the CABAC method is used as the variable length coding method when the image signal is an interlace signal. It is another object of the present invention to provide a variable length encoding method and a variable length decoding method.

上記目的を達成するために、本発明の可変長符号化方法は、画像を複数のブロックに分割し、前記ブロックを単位として符号化を行う際に用いる可変長符号化方法であって、符号化対象ブロックの情報を符号化する際に用いる可変長符号化テーブルを、前記符号化対象ブロックの周辺ブロックの情報に応じて決定し、前記符号化対象ブロックと前記周辺ブロックとの大きさが異なる際には、前記周辺ブロックの情報を前記符号化対象ブロックの大きさに変換して使用することを特徴として有している。   In order to achieve the above object, a variable length coding method of the present invention is a variable length coding method used when an image is divided into a plurality of blocks and coding is performed in units of the blocks. When the variable length coding table used when coding the information of the target block is determined according to the information of the neighboring blocks of the coding target block, and the sizes of the coding target block and the neighboring blocks are different Is characterized in that the information on the peripheral blocks is used after being converted into the size of the block to be encoded.

また、本発明に係る可変長符号化方法の前記情報はブロックの有意係数の個数であることを特徴とする。   The variable length coding method according to the present invention is characterized in that the information is the number of significant coefficients of the block.

なお、本発明は、上記可変長符号化方法及び可変長復号化方法として実現することができるだけでなく、それら方法に含まれる特長的な手順を手段として備える可変長符号化装置及び可変長復号化装置として実現したり、それらの手順をコンピュータに実行させるプログラムとして実現することもできる。そして、そのようなプログラムは、CD−ROM等の記録媒体やインターネット等の伝送媒体を介して流通させることができるのは言うまでもない。   The present invention can be realized not only as the variable length coding method and variable length decoding method described above but also as a variable length coding apparatus and variable length decoding provided with characteristic procedures included in the methods. It can also be realized as a device or as a program for causing a computer to execute these procedures. Needless to say, such a program can be distributed via a recording medium such as a CD-ROM or a transmission medium such as the Internet.

以上のように、本発明の可変長符号化方法および可変長復号化方法は、CAVLC方式によって、各ブロックの有意係数の個数を符号化する場合、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合には、周辺ブロックの有意係数の個数を、符号化対象ブロックと周辺ブロックとの大きさの比に基づいて変換し、この変換された値を可変長符号化テーブルの決定に用いる。   As described above, the variable length coding method and the variable length decoding method of the present invention encode the number of significant coefficients of each block by the CAVLC method, and the size of the encoding target block and the size of the surrounding blocks. Are different from each other, the number of significant coefficients of the surrounding blocks is converted based on the ratio of the size of the encoding target block to the surrounding blocks, and the converted value is used to determine the variable length coding table. .

以上のような動作により、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合であっても、符号化対象ブロックの大きさに応じた可変長テーブルの決定を行うことができ、符号化効率の向上を図ることが出来る。   With the operation as described above, even when the size of the encoding target block is different from the size of the surrounding blocks, the variable length table can be determined according to the size of the encoding target block. It is possible to improve the conversion efficiency.

また、本発明の可変長符号化方法は、CABAC方式によって、各ブロックが有意係数を有するか否かを示すビット(CBPビット)を符号化する場合、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合には、周辺ブロックの有意係数の有無を、符号化対象ブロックと周辺ブロックとの大きさの比に基づいて変換し、この変換された値をCABAC方式において用いる確率テーブルの決定に用いる。   Also, the variable length coding method of the present invention uses the CABAC method to encode a bit (CBP bit) indicating whether each block has a significant coefficient or not. If the size is different, the presence / absence of a significant coefficient in the surrounding block is converted based on the ratio of the size of the encoding target block to the surrounding block, and the probability table used in the CABAC method is determined. Used for.

以上のような動作により、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合であっても、符号化対象ブロックの大きさに応じた確率テーブルの決定を行うことができ、符号化効率の向上を図ることが出来る。   With the operation as described above, even when the size of the encoding target block and the size of the surrounding blocks are different, the probability table can be determined according to the size of the encoding target block, Efficiency can be improved.

また、本発明の可変長符号化方法は、CABAC方式によって、ブロック内の各係数が有意係数であるか否かを示すビットの符号化方法する場合、符号化対象ブロックの大きさ別に確率テーブルを用意し、ブロックサイズ毎に異なる組の確率テーブルを用意する。または、符号化対象ブロックの最大ブロックサイズに合わせて確率テーブルを用意し、ブロックの大きさの違いに関わらず同じ確率テーブルの組を用いる。   The variable length coding method of the present invention uses a CABAC method to encode a bit indicating whether or not each coefficient in a block is a significant coefficient. Prepare a different set of probability tables for each block size. Alternatively, a probability table is prepared in accordance with the maximum block size of the encoding target block, and the same set of probability tables is used regardless of the difference in block size.

以上のような動作により、ブロックが複数の大きさを有する場合であっても、ブロックの大きさ別に確率テーブルの組を持つことにより、符号化効率の向上を図ることができる。また、ブロックの大きさの最大値に合わせて確率テーブルを用意し、ブロックの大きさの違いに関わらず同じ確率テーブルの組を用いることにより、確率テーブルの数を減らすことができ、メモリサイズを小さくすることができる。   By the operation as described above, even if a block has a plurality of sizes, it is possible to improve the coding efficiency by having a set of probability tables for each block size. In addition, by preparing a probability table according to the maximum block size and using the same set of probability tables regardless of the difference in block size, the number of probability tables can be reduced, and the memory size can be reduced. Can be small.

また、本発明は、画像信号がインタレースである場合に、可変長符号化・復号化方法としてCAVLC方式やCABAC方式を用いる際に、対象ブロックと周辺ブロックとがフレーム構造で符号化されているかフィールド構造で符号化されているかの符号化構造の一致及び相違に基づいて、可変長符号化テーブル及び確率テーブルを決定している。これによって、フレーム構造とフィールド構造のブロックが混在する場合であっても、VLCテーブル及び確率テーブルが一義的に決定され、符号化効率が向上される。   Also, according to the present invention, when the image signal is interlaced, whether the target block and the peripheral block are encoded in the frame structure when the CAVLC method or the CABAC method is used as the variable length encoding / decoding method. The variable length coding table and the probability table are determined based on the coincidence and difference between the coding structures that are encoded in the field structure. Thus, even when a frame structure and a field structure block coexist, the VLC table and the probability table are uniquely determined, and the coding efficiency is improved.

本発明の実施の形態について、図面を参照して説明する。   Embodiments of the present invention will be described with reference to the drawings.

(実施の形態1)
まず、動画像符号化装置の全体的な動作について図1を用いて説明する。図1は、フレームメモリ101、差分演算部102、予測誤差符号化部103、符号列生成部104、予測誤差復号化部105、加算演算部106、フレームメモリ107、動きベクトル検出部108、モード選択部109、符号化制御部110、スイッチ111〜115から構成される動画像符号化装置のブロック図である。
(Embodiment 1)
First, the overall operation of the video encoding apparatus will be described with reference to FIG. 1 shows a frame memory 101, a difference calculation unit 102, a prediction error encoding unit 103, a code string generation unit 104, a prediction error decoding unit 105, an addition calculation unit 106, a frame memory 107, a motion vector detection unit 108, and a mode selection. 1 is a block diagram of a video encoding apparatus including a unit 109, an encoding control unit 110, and switches 111 to 115. FIG.

フレームメモリ101で並び替えが行われた各ピクチャは、マクロブロックの単位で読み出されるとする。ここでは、マクロブロックは水平16×垂直16画素の大きさであるとする。また、動き補償は16×16、16×8、8×16、8×8、8×4、4×8、4×4のブロック単位で行うものとする。ここで例えば16×8とは、水平16画素、垂直8画素の大きさを有するブロックを示すとする。またここでは、前方参照予測符号化ピクチャ(Pピクチャ)の符号化を例として説明する。   Assume that each picture rearranged in the frame memory 101 is read in units of macroblocks. Here, it is assumed that the macroblock has a size of horizontal 16 × vertical 16 pixels. Motion compensation is performed in units of 16 × 16, 16 × 8, 8 × 16, 8 × 8, 8 × 4, 4 × 8, and 4 × 4 blocks. Here, for example, 16 × 8 indicates a block having a size of 16 horizontal pixels and 8 vertical pixels. Here, the encoding of a forward reference predictive encoded picture (P picture) will be described as an example.

Pピクチャの符号化においては、符号化制御部110は、スイッチ113をオンにする。また、Pピクチャが他のピクチャの参照ピクチャとして用いられる場合には、スイッチ114、115がオンになるように各スイッチを制御する。他のピクチャの参照ピクチャとして用いられない場合には、スイッチ114、115はオフになるように各スイッチを制御する。したがって、フレームメモリ101から読み出されたPピクチャのマクロブロックは、まず動きベクトル検出部108、モード選択部109、差分演算部102に入力される。   In encoding a P picture, the encoding control unit 110 turns on the switch 113. When the P picture is used as a reference picture for other pictures, each switch is controlled so that the switches 114 and 115 are turned on. When not used as a reference picture for other pictures, the switches 114 and 115 are controlled to be turned off. Therefore, the macroblock of the P picture read from the frame memory 101 is first input to the motion vector detection unit 108, the mode selection unit 109, and the difference calculation unit 102.

動きベクトル検出部108では、フレームメモリ107に蓄積された参照ピクチャの復号化画像データを前方参照ピクチャとして用いることにより、マクロブロックに含まれる各ブロックの前方動きベクトルの検出を行う。   The motion vector detection unit 108 detects the forward motion vector of each block included in the macroblock by using the decoded picture data of the reference picture stored in the frame memory 107 as the forward reference picture.

モード選択部109では、動きベクトル検出部108で検出した動きベクトルを用いて、マクロブロックの符号化モードを決定する。ここで、Pピクチャの符号化モードは、例えば、ピクチャ内符号化、前方参照によるピクチャ間予測符号化から選択することができるとする。また、前方参照によるピクチャ間予測符号化を用いた場合には、マクロブロックをどのようなブロックに分割して動き補償するかという情報も符号化モードに含む。   The mode selection unit 109 determines the macroblock coding mode using the motion vector detected by the motion vector detection unit 108. Here, it is assumed that the coding mode of the P picture can be selected from, for example, intra-picture coding and inter-picture prediction coding by forward reference. In addition, when inter-picture predictive coding based on forward reference is used, the coding mode also includes information on what block a macroblock is divided to perform motion compensation.

モード選択部109で決定された符号化モードは符号列生成部104に対して出力される。また、モード選択部109で決定された符号化モードに基づいた参照画像が差分演算部102と加算演算部106に出力される。ただし、ピクチャ内符号化が選択された場合には、参照画像は出力されない。また、モード選択部109でピクチャ内符号化が選択された場合には、スイッチ111はaに、スイッチ112はcに接続するように制御し、ピクチャ間予測符号化が選択された場合には、スイッチ111はbに、スイッチ112はdに接続するように制御する。以下では、モード選択部109でピクチャ間予測符号化が選択された場合について説明する。   The encoding mode determined by the mode selection unit 109 is output to the code string generation unit 104. Further, a reference image based on the encoding mode determined by the mode selection unit 109 is output to the difference calculation unit 102 and the addition calculation unit 106. However, when intra-picture encoding is selected, the reference image is not output. Further, when intra-picture coding is selected by the mode selection unit 109, the switch 111 is controlled to be connected to a and the switch 112 is connected to c. When inter-picture predictive coding is selected, The switch 111 is controlled to be connected to b, and the switch 112 is connected to d. Hereinafter, a case where inter-picture prediction coding is selected by the mode selection unit 109 will be described.

差分演算部102には、モード選択部109から参照画像が入力される。差分演算部102では、Pピクチャのマクロブロックと参照画像との差分を演算し、予測誤差画像を生成し出力する。   A reference image is input from the mode selection unit 109 to the difference calculation unit 102. The difference calculation unit 102 calculates the difference between the macroblock of the P picture and the reference image, and generates and outputs a prediction error image.

予測誤差画像は予測誤差符号化部103に入力される。予測誤差符号化部103では、入力された予測誤差画像に対して周波数変換や量子化等の符号化処理を施すことにより、符号化データを生成して出力する。ここで、予測誤差画像に対する周波数変換は、モード選択部109において決定された動き補償の大きさに基づいて行うものとする。例えば8×8以上の大きさで動き補償された場合には、8×8の大きさで周波数変換し、8×8未満の大きさで動き補償された場合には、動き補償と同じ大きさで周波数変換するものとする。予測誤差符号化部103から出力された符号化データは、符号列生成部104に入力される。   The prediction error image is input to the prediction error encoding unit 103. The prediction error encoding unit 103 generates and outputs encoded data by performing encoding processing such as frequency conversion and quantization on the input prediction error image. Here, it is assumed that the frequency conversion for the prediction error image is performed based on the magnitude of motion compensation determined by the mode selection unit 109. For example, when motion compensation is performed with a size of 8 × 8 or more, frequency conversion is performed with a size of 8 × 8, and when motion compensation is performed with a size of less than 8 × 8, the same size as motion compensation is used. The frequency is converted by The encoded data output from the prediction error encoding unit 103 is input to the code string generation unit 104.

符号列生成部104では、入力された符号化データに対して、可変長符号化等を施し、モード選択部109から入力された符号化モード、ヘッダ情報、等の情報を付加することにより符号列を生成し出力する。   The code string generation unit 104 performs variable length coding or the like on the input encoded data, and adds the information such as the encoding mode and header information input from the mode selection unit 109 to generate the code string. Is generated and output.

次に、動画像復号化装置の全体的な動作について、図3を用いて説明する。図3は、符号列解析部301、予測誤差復号化部302、モード復号部303、動き補償復号部305、動きベクトル記憶部306、フレームメモリ307、加算演算部308、スイッチ309、310、可変長復号化部311から構成される動画像復号化装置のブロック図である。   Next, the overall operation of the moving picture decoding apparatus will be described with reference to FIG. FIG. 3 shows a code string analysis unit 301, a prediction error decoding unit 302, a mode decoding unit 303, a motion compensation decoding unit 305, a motion vector storage unit 306, a frame memory 307, an addition operation unit 308, switches 309 and 310, variable length FIG. 10 is a block diagram of a video decoding device configured by a decoding unit 311.

以下では、前方予測参照符号化ピクチャ(Pピクチャ)の復号化処理について説明する。   Hereinafter, the decoding process of the forward prediction reference coded picture (P picture) will be described.

符号列は符号列解析部301に入力される。符号列解析部301では、入力された符号列から、各種データの抽出を行う。ここで各種データとは、モード選択の情報や動きベクトル情報等である。抽出されたモード選択の情報は、モード復号部303に対して出力される。また、抽出された動きベクトル情報は、動き補償復号部305に対して出力される。さらに、予測誤差符号化データは可変長復号部311に対して出力される。   The code string is input to the code string analysis unit 301. The code string analysis unit 301 extracts various data from the input code string. Here, the various data are mode selection information, motion vector information, and the like. The extracted mode selection information is output to mode decoding section 303. The extracted motion vector information is output to the motion compensation decoding unit 305. Further, the prediction error encoded data is output to the variable length decoding unit 311.

モード復号部303では、符号列から抽出されたモード選択の情報を参照し、スイッチ309と710の制御を行う。モード選択がピクチャ内符号化である場合には、スイッチ309はaに、スイッチ710はcに接続するように制御する。また、モード選択がピクチャ間予測符号化である場合には、スイッチ309はbに、スイッチ710はdに接続するように制御する。   The mode decoding unit 303 controls the switches 309 and 710 with reference to the mode selection information extracted from the code string. When the mode selection is intra-picture coding, the switch 309 is controlled to be connected to a, and the switch 710 is controlled to be connected to c. When the mode selection is inter picture predictive coding, control is performed so that the switch 309 is connected to b and the switch 710 is connected to d.

またモード復号部303では、モード選択の情報を動き補償部に対しても出力する。以下では、モード選択がピクチャ間予測符号化である場合について説明する。   The mode decoding unit 303 also outputs mode selection information to the motion compensation unit. Hereinafter, a case where the mode selection is inter-picture predictive coding will be described.

可変長復号部311では、入力された予測誤差符号化データに対して可変長復号を施す。可変長復号を施されたデータは、予測誤差復号化部302に対して出力される。   The variable length decoding unit 311 performs variable length decoding on the input prediction error encoded data. The data subjected to the variable length decoding is output to the prediction error decoding unit 302.

予測誤差復号化部302では、入力されたデータに対して、逆量子化処理や、逆周波数変換を施すことにより、予測誤差画像を生成する。ここで、逆周波数変換は、モード選択部109において決定された動き補償の大きさに基づいて行うものとする。例えば8×8以上の大きさで動き補償された場合には、8×8の大きさで周波数変換し、8×8未満の大きさで動き補償された場合には、動き補償と同じ大きさで周波数変換するものとする。生成された予測誤差画像はスイッチ309に対して出力される。ここでは、スイッチ309はbに接続されているので、予測誤差画像は加算演算部308に対して出力される。   The prediction error decoding unit 302 generates a prediction error image by performing inverse quantization processing or inverse frequency transform on the input data. Here, it is assumed that the inverse frequency conversion is performed based on the magnitude of motion compensation determined by the mode selection unit 109. For example, when motion compensation is performed with a size of 8 × 8 or more, frequency conversion is performed with a size of 8 × 8, and when motion compensation is performed with a size of less than 8 × 8, the same size as motion compensation is used. The frequency is converted by The generated prediction error image is output to the switch 309. Here, since the switch 309 is connected to b, the prediction error image is output to the addition operation unit 308.

動き補償復号部305は、可変長復号化部311から入力された、符号化された動きベクトルに対して、復号化処理を行う。そして、復号化された動きベクトルに基づいて、フレームメモリ307から動き補償画像を取得する。このようにして生成された動き補償画像は加算演算部308に対して出力される。   The motion compensation decoding unit 305 performs a decoding process on the encoded motion vector input from the variable length decoding unit 311. Then, a motion compensated image is acquired from the frame memory 307 based on the decoded motion vector. The motion compensated image generated in this way is output to the addition operation unit 308.

加算演算部308では、入力された予測誤差画像と動き補償画像とを加算し、復号化画像を生成する。生成された復号化画像はスイッチ310を介してフレームメモリ307に対して出力される。   The addition operation unit 308 adds the input prediction error image and the motion compensated image to generate a decoded image. The generated decoded image is output to the frame memory 307 via the switch 310.

さて、上記で説明した動画像符号化装置における符号列生成部104、および動画像復号化装置における可変長復号化部311の動作について、詳細を以下で説明する。   Now, details of the operations of the code string generation unit 104 in the video encoding device described above and the variable length decoding unit 311 in the video decoding device will be described below.

まず、符号列生成部104または可変長復号化部311において、CAVLC方式によって、各ブロックの有意係数の個数を符号化または復号化する方法について説明する。   First, a method for encoding or decoding the number of significant coefficients of each block by the CAVLC method in the code string generation unit 104 or the variable length decoding unit 311 will be described.

各ブロックの有意係数の個数を符号化または復号化する場合には、周辺ブロックの有意係数の個数を参照する。ここでは、周辺ブロックとして、対象ブロックの上および左に位置するブロックを用いる場合について説明する。周辺ブロックがすべて画面内にあり、かつ同じスライス内であるとすると、対象ブロックの有意係数の個数を符号化または復号化する際には、周辺ブロックの有意係数の個数を用いて可変長符号化(復号化)テーブルを決定する。ここで、対象ブロックの有意係数の最大個数と、周辺ブロックの有意係数の最大個数が異なる場合、対象ブロックと周辺ブロックの有意係数の最大個数を一致させるように、周辺ブロックの有意係数の個数を求める。ここで、対象ブロックの有意係数の個数の最大値をNとすると(例えば対象ブロックの大きさが8×8である場合、Nは64となる)、周辺ブロックを参照して得られる有意係数の個数がN/8未満であれば図4のVLC0、N/8以上N/4未満であれば図4のVLC1、N/4以上であれば図4のVLC2を用いる、といったように可変長符号化(復号化)テーブルを決定する。ここで図4においては、有意係数の個数が16の場合までしか可変長符号化(復号化)テーブルを示していないが、これらのテーブルは有意係数の個数が17以上まで拡張したものを用いるとする。以下では図2を用いて説明するが、図2においてブロックCが可変長符号化または可変長復号化を施そうとしているブロックであるとする。   When encoding or decoding the number of significant coefficients of each block, the number of significant coefficients of the neighboring blocks is referred to. Here, a case will be described in which blocks located above and to the left of the target block are used as peripheral blocks. Assuming that all the peripheral blocks are in the screen and are in the same slice, when encoding or decoding the number of significant coefficients of the target block, variable length encoding is performed using the number of significant coefficients of the peripheral blocks. Determine the (decryption) table. Here, if the maximum number of significant coefficients of the target block is different from the maximum number of significant coefficients of the surrounding blocks, the number of significant coefficients of the surrounding blocks is set so that the maximum number of significant coefficients of the target block and the surrounding blocks match. Ask. Here, when the maximum value of the number of significant coefficients of the target block is N (for example, when the size of the target block is 8 × 8, N is 64), the significant coefficient obtained by referring to the surrounding blocks If the number is less than N / 8, a variable length code such as VLC0 in FIG. 4, VLC1 in FIG. 4 if N / 8 or more and less than N / 4, and VLC2 in FIG. 4 is used if N / 4 or more is used. The encryption (decryption) table is determined. Here, in FIG. 4, the variable length coding (decoding) table is shown only up to the case where the number of significant coefficients is 16. However, when these tables are used, the number of significant coefficients is expanded to 17 or more. To do. In the following, description will be made with reference to FIG. 2. In FIG. 2, it is assumed that block C is a block to be subjected to variable length coding or variable length decoding.

第1の例を図2(a)を用いて説明する。図2(a)において、また、ブロックA1、A2、B1、B2がブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは8×8の大きさを有し、周辺ブロックは、8×4の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックA1とA2との有意係数の個数の和を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックB1とB2との有意係数の個数の和を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックA1、A2の有意係数の個数の和と、ブロックB1、B2の有意係数の個数の和との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。ここで、ブロックB1とB2との有意係数の個数の和を用いる代わりに、ブロックCに隣接するブロックB1の有意係数の個数を2倍して用いても良い。   A first example will be described with reference to FIG. In FIG. 2A, the blocks A1, A2, B1, and B2 are peripheral blocks located on the left and above the block C. Here, the block C has a size of 8 × 8, and the peripheral block has a size of 8 × 4. In this case, the sum of the number of significant coefficients of the blocks A1 and A2 is used as the number of significant coefficients of the block located on the left of the block C, and the number of significant coefficients of the block located on the block C is represented by the block B1. And the sum of the number of significant coefficients of B2. Then, the average value of the number of significant coefficients of the blocks located on the left and the top of the block C, that is, here, the sum of the number of significant coefficients of the blocks A1 and A2, and the sum of the number of significant coefficients of the blocks B1 and B2 The variable length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value. Here, instead of using the sum of the number of significant coefficients of the blocks B1 and B2, the number of significant coefficients of the block B1 adjacent to the block C may be doubled.

第2の例を図2(b)を用いて説明する。図2(b)において、ブロックA1、A2、A3、A4、B1、B2、B3、B4がブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは8×8の大きさを有し、ブロックA1、A2、A3、A4、B1、B2、B3、B4は、4×4の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックA1、A2、A3、A4の有意係数の個数の和を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックB1、B2、B3、B4の有意係数の個数の和を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックA1、A2、A3、A4の有意係数の個数の和と、ブロックB1、B2、B3、B4の有意係数の個数の和との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。ここで、A1、A2、A3、A4の有意係数の個数の和を用いる代わりに、ブロックCに隣接するブロックA2、A4の有意係数の個数の和の2倍の値や、ブロックB1、B2、B3、B4の有意係数の個数の和を用いる代わりに、ブロックCに隣接するブロックB3、B4の有意係数の個数の和の2倍の値、等を用いても良い。   A second example will be described with reference to FIG. In FIG. 2B, blocks A1, A2, A3, A4, B1, B2, B3, and B4 are peripheral blocks located on the left and top of block C. Here, the block C has a size of 8 × 8, and the blocks A1, A2, A3, A4, B1, B2, B3, and B4 have a size of 4 × 4. In this case, as the number of significant coefficients of the block located on the left of the block C, the sum of the number of significant coefficients of the blocks A1, A2, A3, and A4 is used, and the number of significant coefficients of the block located on the block C is obtained. , The sum of the number of significant coefficients of the blocks B1, B2, B3, B4 is used. Then, the average value of the number of significant coefficients of the blocks located on the left and top of the block C, that is, here, the sum of the number of significant coefficients of the blocks A1, A2, A3, and A4 and the blocks B1, B2, B3, and B4 An average value with the sum of the number of significant coefficients is determined, and a variable-length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value. Here, instead of using the sum of the number of significant coefficients of A1, A2, A3, A4, a value that is twice the sum of the number of significant coefficients of the blocks A2, A4 adjacent to the block C, or the blocks B1, B2, Instead of using the sum of the number of significant coefficients of B3 and B4, a value twice the sum of the number of significant coefficients of the blocks B3 and B4 adjacent to the block C may be used.

第3の例を図2(c)を用いて説明する。図2(c)において、ブロックA、BがブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは8×4の大きさを有し、ブロックA、Bは、8×8の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックAの有意係数の個数の1/2の値を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックBの有意係数の個数の1/2の値を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックAの有意係数の個数の1/2の値と、ブロックBの有意係数の個数の1/2の値との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。   A third example will be described with reference to FIG. In FIG. 2C, blocks A and B are peripheral blocks located on the left and top of block C. Here, the block C has a size of 8 × 4, and the blocks A and B have a size of 8 × 8. In this case, as the number of significant coefficients of the block located on the left of the block C, a value that is ½ of the number of significant coefficients of the block A is used, and as the number of significant coefficients of the block located on the block C, the block A value that is 1/2 of the number of significant coefficients of B is used. Then, the average value of the number of significant coefficients of the blocks located on the left and the upper side of the block C, that is, here, the value of 1/2 of the number of significant coefficients of the block A and 1 / number of the number of significant coefficients of the block B. An average value with the value of 2 is obtained, and a variable-length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value.

第4の例を図2(d)を用いて説明する。図2(d)において、ブロックA1、A2、B1、B2がブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは8×4の大きさを有し、ブロックA1、A2、B1、B2は、4×8の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックA1、A2の有意係数の個数の和の1/2の値を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックB1、B2の有意係数の個数の和の1/2の値を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックA1、A2の有意係数の個数の和の1/2の値と、ブロックB1、B2の有意係数の個数の和の1/2の値との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。ここで、A1、A2の有意係数の個数の和を用いる代わりに、ブロックA1、A2のいずれかの有意係数の個数や、ブロックB1、B2の有意係数の個数の和を用いる代わりに、ブロックB1、B2のいずれかの有意係数の個数、等を用いても良い。   A fourth example will be described with reference to FIG. In FIG. 2D, blocks A1, A2, B1, and B2 are peripheral blocks positioned on the left and top of block C. Here, the block C has a size of 8 × 4, and the blocks A1, A2, B1, and B2 have a size of 4 × 8. In this case, as the number of significant coefficients of the block located on the left of the block C, a value that is ½ of the sum of the number of significant coefficients of the blocks A1 and A2 is used. As the number, a value half the sum of the number of significant coefficients of the blocks B1 and B2 is used. Then, the average value of the number of significant coefficients of the blocks located on the left and the top of the block C, that is, here, the value of ½ of the sum of the number of significant coefficients of the blocks A1 and A2, and the significance of the blocks B1 and B2 A variable length coding (decoding) table is obtained when an average value of the sum of the number of coefficients and a half value is obtained and the number of significant coefficients of the block C is encoded (decoded) by the average value. decide. Here, instead of using the sum of the number of significant coefficients of A1 and A2, instead of using the number of significant coefficients of one of the blocks A1 and A2 or the sum of the number of significant coefficients of the blocks B1 and B2, the block B1 , B2 may be used as the number of significant coefficients.

第5の例を図2(e)を用いて説明する。図2(e)において、ブロックA1、A2、A3、A4、B1、B2、B3、B4がブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは8×4の大きさを有し、ブロックA1、A2、A3、A4、B1、B2、B3、B4は、4×4の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックA1、A2の有意係数の個数の和を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックB3、B4の有意係数の個数の和を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックA1、A2の有意係数の個数の和と、ブロックB3、B4の有意係数の個数の和との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。ここで、A1、A2の有意係数の個数の和を用いる代わりに、ブロックA1、A2、A3、A4の有意係数の個数の和の1/2の値や、ブロックB3、B4の有意係数の個数の和を用いる代わりに、ブロックB1、B2、B3、B4の有意係数の個数の和の1/2の値、等を用いても良い。   A fifth example will be described with reference to FIG. In FIG. 2E, blocks A1, A2, A3, A4, B1, B2, B3, and B4 are peripheral blocks located on the left and top of block C. Here, the block C has a size of 8 × 4, and the blocks A1, A2, A3, A4, B1, B2, B3, and B4 have a size of 4 × 4. In this case, the sum of the number of significant coefficients of the blocks A1 and A2 is used as the number of significant coefficients of the block located on the left side of the block C, and the number of significant coefficients of the block located on the block C is represented by the block B3, The sum of the number of significant coefficients of B4 is used. Then, the average value of the number of significant coefficients of the blocks located on the left and top of the block C, that is, here, the sum of the number of significant coefficients of the blocks A1 and A2, and the sum of the number of significant coefficients of the blocks B3 and B4, The variable length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value. Here, instead of using the sum of the number of significant coefficients of A1 and A2, the value of 1/2 of the number of significant coefficients of the blocks A1, A2, A3 and A4 and the number of significant coefficients of the blocks B3 and B4 are used. Instead of using the sum of the values, a value that is half the sum of the number of significant coefficients of the blocks B1, B2, B3, and B4 may be used.

第6の例を図2(f)を用いて説明する。図2(f)において、ブロックA、BがブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは4×4の大きさを有し、ブロックA、Bは、8×8の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックAの有意係数の個数の1/4の値を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックBの有意係数の個数の1/4の値を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックAの有意係数の個数の1/4の値と、ブロックBの有意係数の個数の1/4の値との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。   A sixth example will be described with reference to FIG. In FIG. 2F, blocks A and B are peripheral blocks located on the left and top of block C. Here, it is assumed that the block C has a size of 4 × 4, and the blocks A and B have a size of 8 × 8. In this case, the value of 1/4 of the number of significant coefficients of the block A is used as the number of significant coefficients of the block located on the left of the block C, and the number of significant coefficients of the block located on the block C is A value that is 1/4 of the number of significant coefficients of B is used. Then, the average value of the number of significant coefficients of the blocks located on the left and top of the block C, that is, here, the value of 1/4 of the number of significant coefficients of the block A and 1 / number of the number of significant coefficients of the block B An average value with the value of 4 is obtained, and a variable-length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value.

第7の例を図2(g)を用いて説明する。図2(g)において、ブロックA1、A2、B1、B2がブロックCの左および上に位置する周辺ブロックとなる。ここでブロックCは4×4の大きさを有し、ブロックA1、A2、B1、B2、4×8の大きさを有するとする。この場合、ブロックCの左に位置するブロックの有意係数の個数として、ブロックA2の有意係数の個数の1/2の値を用い、ブロックCの上に位置するブロックの有意係数の個数として、ブロックB1の有意係数の個数の1/2の値を用いる。そして、ブロックCの左および上に位置するブロックの有意係数の個数の平均値、すなわちここでは、ブロックA2の有意係数の個数の1/2の値と、ブロックB1の有意係数の個数の1/2の値との平均値を求め、この平均値により、ブロックCの有意係数の個数を符号化(復号化)する際の可変長符号化(復号化)テーブルを決定する。ここで、A2の有意係数の個数の1/2の値を用いる代わりに、ブロックA1、A2の有意係数の個数の和の1/4の値や、ブロックB1の有意係数の個数の1/2の値を用いる代わりに、ブロックB1、B2の有意係数の個数の和の1/4の値、等を用いても良い。   A seventh example will be described with reference to FIG. In FIG. 2G, blocks A1, A2, B1, and B2 are peripheral blocks located on the left and top of block C. Here, the block C has a size of 4 × 4, and has a size of the blocks A1, A2, B1, B2, 4 × 8. In this case, as the number of significant coefficients of the block located on the left of the block C, a value that is ½ of the number of significant coefficients of the block A2 is used, and as the number of significant coefficients of the block located above the block C, the block A value that is 1/2 of the number of significant coefficients of B1 is used. Then, the average value of the number of significant coefficients of the blocks located on the left and the top of the block C, that is, here, the value of 1/2 of the number of significant coefficients of the block A2, and 1 / number of the number of significant coefficients of the block B1. An average value with the value of 2 is obtained, and a variable-length encoding (decoding) table for encoding (decoding) the number of significant coefficients of the block C is determined based on the average value. Here, instead of using a value that is 1/2 of the number of significant coefficients of A2, a value that is 1/4 of the sum of the number of significant coefficients of blocks A1 and A2 or 1/2 of the number of significant coefficients of block B1 is used. Instead of using the value of, a value of ¼ of the sum of the number of significant coefficients of the blocks B1 and B2 may be used.

次に、符号列生成部104または可変長復号化部311において、CABAC方式によって、各ブロックが有意係数を有するか否かを示すビット(CBPビット)を符号化または復号化する方法について説明する。   Next, a method of encoding or decoding a bit (CBP bit) indicating whether each block has a significant coefficient by the CABAC method in the code string generation unit 104 or the variable length decoding unit 311 will be described.

各ブロックのCBPビットを符号化または復号化する場合、周辺ブロックのCBPビットを参照する。ここでは、周辺ブロックとして、対象ブロックの上および左に位置するブロックを用いる場合について説明する。周辺ブロックがすべて画面内にあり、かつ同じスライス内であり、符号化(復号化)対象ブロックと同じ種類であるとすると、対象ブロックのCBPビットを符号化または復号化する際には、周辺ブロックの有意係数の有無によって可変長符号化(復号化)の際の確率テーブルを決定する。この場合には、対象ブロックの左に位置するブロックの有意係数の個数の合計値が0であるか否か、および対象ブロックの上に位置するブロックの有意係数の個数の合計値が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、対象ブロックのCBPビットを算術符号化する際に用いる確率テーブルを4通りの中から選択する。ここで、対象ブロックの有意係数の最大個数と、周辺ブロックの有意係数の最大個数が異なる場合、対象ブロックと周辺ブロックの有意係数の最大個数を一致させるように、CBPビットを求める。以下では図2を用いて説明するが、図2においてブロックCが可変長符号化または可変長復号化を施そうとしているブロックであるとする。   When the CBP bit of each block is encoded or decoded, the CBP bit of the peripheral block is referred to. Here, a case will be described in which blocks located above and to the left of the target block are used as peripheral blocks. Assuming that all the peripheral blocks are in the screen, are in the same slice, and are of the same type as the target block to be encoded (decoded), when the CBP bit of the target block is encoded or decoded, the peripheral block The probability table for variable length coding (decoding) is determined depending on the presence or absence of the significant coefficient. In this case, whether or not the total value of the number of significant coefficients of the block located to the left of the target block is 0, and the total value of the number of significant coefficients of the block located above the target block is 0. The probability table used when arithmetically coding the CBP bit of the target block is selected from the four combinations. Here, when the maximum number of significant coefficients of the target block is different from the maximum number of significant coefficients of the peripheral block, the CBP bit is obtained so that the maximum number of significant coefficients of the target block and the peripheral block are matched. In the following, description will be made with reference to FIG. 2. In FIG. 2, it is assumed that block C is a block to be subjected to variable length coding or variable length decoding.

第1の例を図2(a)を用いて説明する。図2(a)において、ブロックA1、A2、B1、B2はそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックA1とA2との有意係数の個数の合計値が0であるか否か、およびブロックB1とB2との有意係数の個数の合計値が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA1とA2との有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックA1(またはブロックA2)の有意係数の個数が0であるか否かという判断基準や、ブロックB1とB2との有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックB1(またはブロックB2)の有意係数の個数が0であるか否か、という判断基準を用いても良い。   A first example will be described with reference to FIG. In FIG. 2A, blocks A1, A2, B1, and B2 are peripheral blocks located on the left and top of block C, respectively. In this case, there are four ways of determining whether the total number of significant coefficients of the blocks A1 and A2 is 0 and whether the total value of the number of significant coefficients of the blocks B1 and B2 is 0. Which combination is determined, thereby selecting a probability table to be used when arithmetically coding the CBP bits of block C. In this case, whether or not the number of significant coefficients in block A1 (or block A2) is 0 is used instead of using the criterion of whether or not the sum of the number of significant coefficients in blocks A1 and A2 is 0. And the number of significant coefficients in block B1 (or block B2) is 0 instead of using the criterion for determining whether or not the sum of the number of significant coefficients in blocks B1 and B2 is 0. It may be possible to use a criterion of whether or not.

第2の例を図2(b)を用いて説明する。図2(b)において、ブロックA1、A2、A3、A4、B1、B2、B3、B4はそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックA1、A2、A3、A3の有意係数の個数の合計値が0であるか否か、およびブロックB1、B2、B3、B4との有意係数の個数の合計値が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA1、A2、A3、A4の有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックCに隣接するブロックA2とA4の有意係数の個数の和が0であるか否かという判断基準や、ブロックB1、B2、B3、B4の有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックCに隣接するブロックB3とB4との有意係数の個数の和が0であるか否か、という判断基準を用いても良い。   A second example will be described with reference to FIG. In FIG. 2 (b), blocks A1, A2, A3, A4, B1, B2, B3, and B4 are peripheral blocks located on the left and top of block C, respectively. In this case, whether the total value of the number of significant coefficients of the blocks A1, A2, A3, A3 is 0, and whether the total value of the number of significant coefficients of the blocks B1, B2, B3, B4 is 0 The probability table to be used when arithmetically coding the CBP bit of block C is selected. In this case, instead of using the criterion of whether or not the sum of the number of significant coefficients of the blocks A1, A2, A3, and A4 is 0, the number of significant coefficients of the blocks A2 and A4 adjacent to the block C Instead of using a criterion for determining whether the sum is 0 or a criterion for determining whether the sum of the number of significant coefficients of the blocks B1, B2, B3, and B4 is 0, a block adjacent to the block C A criterion of whether or not the sum of the number of significant coefficients of B3 and B4 is 0 may be used.

第3の例を図2(c)を用いて説明する。図2(c)において、ブロックA、BはそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックAの有意係数の個数が0であるか否か、およびブロックBの有意係数の個数が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA(ブロックB)の有意係数の個数が0であるか否か、という判断基準を用いる代わりに、ブロックA(ブロックB)の有意係数の個数の1/2が0であるか否かという判断基準や、ブロックA(ブロックB)の有意係数の個数が所定値以上であるか未満であるかという判断基準を用いても良い。   A third example will be described with reference to FIG. In FIG. 2C, blocks A and B are peripheral blocks located on the left and above block C, respectively. In this case, it is determined whether there are four combinations of whether the number of significant coefficients in block A is 0 and whether the number of significant coefficients in block B is 0, and thereby A probability table used when arithmetically coding the CBP bits of block C is selected. In this case, instead of using the criterion of whether or not the number of significant coefficients in block A (block B) is 0, 1/2 of the number of significant coefficients in block A (block B) is 0. Or a criterion for determining whether the number of significant coefficients of block A (block B) is greater than or less than a predetermined value may be used.

第4の例を図2(d)を用いて説明する。図2(d)において、ブロックA1、A2、B1、B2はそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックA1とA2との有意係数の個数の和が0であるか否か、およびブロックB1とB2との有意係数の個数の和が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA1とA2(ブロックB1とB2)の有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックA1とA2(ブロックB1とB2)の有意係数の個数の和の1/2が0であるか否かという判断基準や、ブロックA1とA2(ブロックB1とB2)の有意係数の個数が所定値以上であるか未満であるかという判断基準を用いても良い。   A fourth example will be described with reference to FIG. In FIG. 2D, blocks A1, A2, B1, and B2 are peripheral blocks located on the left and top of block C, respectively. In this case, there are four combinations of whether the sum of the number of significant coefficients of the blocks A1 and A2 is 0 and whether the sum of the number of significant coefficients of the blocks B1 and B2 is 0. Which is then selected, thereby selecting a probability table to be used when arithmetically coding the CBP bits of block C. Also, in this case, instead of using the criterion of whether or not the sum of the number of significant coefficients of the blocks A1 and A2 (blocks B1 and B2) is 0, the significant coefficient of the blocks A1 and A2 (blocks B1 and B2) A criterion for determining whether or not half of the sum of the numbers is 0, and a criterion for determining whether the number of significant coefficients of blocks A1 and A2 (blocks B1 and B2) is greater than or less than a predetermined value. It may be used.

第5の例を図2(e)を用いて説明する。図2(e)において、ブロックA1、A2、A3、A4、B1、B2、B3、B4はそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックA1とA2との有意係数の個数の和が0であるか否か、およびブロックB3とB4との有意係数の個数の和が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA1とA2の有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックA1、A2、A3、A4の有意係数の個数の和、またはその和の1/2が0であるか否か、または所定値以上であるか未満であるか、という判断基準や、ブロックB3とB4の有意係数の個数の和が0であるか否か、という判断基準を用いる代わりに、ブロックB1、B2、B3、B4の有意係数の個数の和、またはその和の1/2(切り捨て値)が0であるか否か、または所定値以上であるか未満であるか、という判断基準等を用いても良い。   A fifth example will be described with reference to FIG. In FIG. 2 (e), blocks A1, A2, A3, A4, B1, B2, B3, and B4 are peripheral blocks located on the left and top of block C, respectively. In this case, there are four combinations of whether the sum of the number of significant coefficients of the blocks A1 and A2 is 0 and whether the sum of the number of significant coefficients of the blocks B3 and B4 is 0. Which is then selected, thereby selecting a probability table to be used when arithmetically coding the CBP bits of block C. In this case, instead of using the criterion of whether or not the sum of the number of significant coefficients of the blocks A1 and A2 is 0, the sum of the number of significant coefficients of the blocks A1, A2, A3, and A4, or the sum thereof Of whether or not 1/2 of the block B3 is equal to or greater than or less than a predetermined value and whether the sum of the number of significant coefficients of the blocks B3 and B4 is equal to 0 Instead of using the criterion, whether the sum of the number of significant coefficients of the blocks B1, B2, B3, B4, or ½ of the sum (rounded down value) is 0, or less than or equal to a predetermined value. A judgment criterion such as whether or not there is a possibility may be used.

第6の例を図2(f)を用いて説明する。図2(f)において、ブロックA、BはそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックAの有意係数の個数が0であるか否か、およびブロックBの有意係数の個数が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA(ブロックB)の有意係数の個数が0であるか否か、という判断基準を用いる代わりに、ブロックA(ブロックB)の有意係数の個数の1/4が0であるか否かという判断基準や、ブロックA(ブロックB)の有意係数の個数が所定値以上であるか未満であるかという判断基準等を用いても良い。   A sixth example will be described with reference to FIG. In FIG. 2F, blocks A and B are peripheral blocks located on the left and above block C, respectively. In this case, it is determined whether there are four combinations of whether the number of significant coefficients in block A is 0 and whether the number of significant coefficients in block B is 0, and thereby A probability table used when arithmetically coding the CBP bits of block C is selected. In this case, instead of using the criterion of whether or not the number of significant coefficients in block A (block B) is 0, 1/4 of the number of significant coefficients in block A (block B) is 0. A criterion for determining whether or not the number of significant coefficients of block A (block B) is greater than or less than a predetermined value may be used.

第7の例を図2(g)を用いて説明する。図2(g)において、ブロックA1、A2、B1、B2はそれぞれブロックCの左および上に位置する周辺ブロックである。この場合、ブロックA2の有意係数の個数が0であるか否か、およびブロックB1の有意係数の個数が0であるか否か、の4通りの組合せのいずれであるかを求め、それによって、ブロックCのCBPビットを算術符号化する際に用いる確率テーブルを選択する。またこの場合、ブロックA2(ブロックB1)の有意係数の個数が0であるか否か、という判断基準を用いる代わりに、ブロックA2(ブロックB1)の有意係数の個数の1/2が0であるか否かや、ブロックA2(ブロックB1)の有意係数の個数が所定値以上であるか未満であるか、という判断基準や、ブロックA1とA2(ブロックB1とB2)の有意係数の個数の和、またはその和の1/2(切り捨て値)が0であるか否か、または所定値以上であるか未満であるか、という判断基準等を用いても良い。   A seventh example will be described with reference to FIG. In FIG. 2G, blocks A1, A2, B1, and B2 are peripheral blocks located on the left and top of block C, respectively. In this case, it is determined which of the four combinations of whether the number of significant coefficients of the block A2 is 0 and whether the number of significant coefficients of the block B1 is 0, and thereby, A probability table used when arithmetically coding the CBP bits of block C is selected. In this case, instead of using the criterion of whether or not the number of significant coefficients in block A2 (block B1) is 0, 1/2 of the number of significant coefficients in block A2 (block B1) is 0. Whether the number of significant coefficients in block A2 (block B1) is greater than or less than a predetermined value, and the sum of the number of significant coefficients in blocks A1 and A2 (blocks B1 and B2) Alternatively, a criterion such as whether or not half (the cut-off value) of the sum is 0, or whether it is greater than or less than a predetermined value may be used.

次に、符号列生成部104または可変長復号化部311において、CABAC方式によって、ブロック内の各係数が有意係数であるか否かを示すビットの符号化方法について説明する。ブロック内の係数は、従来例の説明において図6を用いて説明したように、所定の走査順序で並べ替えたのち、SIGビットとLASTビットとを用いて表現し、これらのビットを算術符号化するとする。   Next, a coding method of bits indicating whether or not each coefficient in a block is a significant coefficient in the code string generation unit 104 or the variable length decoding unit 311 by the CABAC method will be described. As described with reference to FIG. 6 in the description of the conventional example, the coefficients in the block are rearranged in a predetermined scanning order and then expressed using SIG bits and LAST bits, and these bits are arithmetically encoded. Then.

第1の例では、SIGビットおよびLASTビットを算術符号化する際の確率テーブルを、ブロックの大きさ別に用意する。すなわち、4×4ブロック用の確率テーブル、4×8ブロック用の確率テーブル、8×4ブロック用の確率テーブル、8×8ブロック用の確率テーブル、といったように確率テーブルを用意する。そして各ブロックの種類毎に、各係数位置(走査順での位置)毎に確率テーブルを用意する。したがって例えば、4×4ブロックに対しては、SIGビット、LASTビットのそれぞれに対して確率テーブルが15個ずつ用いられ、8×8ブロックに対しては、SIGビット、LASTビットのそれぞれに対して確率テーブルが63個ずつ用いる。これは最終位置に有意係数が存在する場合、この係数は符号化する必要がないためである。   In the first example, a probability table for arithmetic coding of SIG bits and LAST bits is prepared for each block size. That is, a probability table is prepared such as a probability table for 4 × 4 blocks, a probability table for 4 × 8 blocks, a probability table for 8 × 4 blocks, and a probability table for 8 × 8 blocks. A probability table is prepared for each coefficient position (position in scanning order) for each block type. Thus, for example, for a 4 × 4 block, 15 probability tables are used for each of the SIG and LAST bits, and for an 8 × 8 block, for each of the SIG and LAST bits. 63 probability tables are used. This is because if there is a significant coefficient at the final position, this coefficient does not need to be encoded.

第2の例では、SIGビットおよびLASTビットを算術符号化する際の確率テーブルを、ブロックの大きさに関係なく1組のテーブルとする。すなわち、最大のブロックサイズに合わせて確率テーブルを用意する。ここで、最大のブロックサイズが8×8であるとすると、SIGビット、LASTビットのそれぞれに対して確率テーブルが63個ずつ用いられる。そして、4×4ブロックに対しては、最初の15個の確率テーブルを用い、4×8ブロックや8×4ブロックに対しては、最初の31個の確率テーブルを用いる。   In the second example, the probability table when the SIG bit and the LAST bit are arithmetically encoded is a set of tables regardless of the block size. That is, a probability table is prepared according to the maximum block size. Here, assuming that the maximum block size is 8 × 8, 63 probability tables are used for each of the SIG bits and the LAST bits. The first 15 probability tables are used for 4 × 4 blocks, and the first 31 probability tables are used for 4 × 8 blocks and 8 × 4 blocks.

以上のように、本発明の可変長符号化方法および可変長復号化方法は、CAVLC方式によって、各ブロックの有意係数の個数を符号化する場合、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合には、周辺ブロックの有意係数の個数を、符号化対象ブロックと周辺ブロックとの大きさの比に基づいて変換し、この変換された値を可変長符号化テーブルの決定に用いる。   As described above, the variable length coding method and the variable length decoding method of the present invention encode the number of significant coefficients of each block by the CAVLC method, and the size of the encoding target block and the size of the surrounding blocks. Are different from each other, the number of significant coefficients of the surrounding blocks is converted based on the ratio of the size of the encoding target block to the surrounding blocks, and the converted value is used to determine the variable length coding table. .

以上のような動作により、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合であっても、符号化対象ブロックの大きさに応じた可変長テーブルの決定を行うことができ、符号化効率の向上を図ることが出来る。   With the operation as described above, even when the size of the encoding target block is different from the size of the surrounding blocks, the variable length table can be determined according to the size of the encoding target block. It is possible to improve the conversion efficiency.

また、本発明の可変長符号化方法は、CABAC方式によって、各ブロックが有意係数を有するか否かを示すビット(CBPビット)を符号化する場合、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合には、周辺ブロックの有意係数の有無を、符号化対象ブロックと周辺ブロックとの大きさの比に基づいて変換し、この変換された値をCABAC方式において用いる確率テーブルの決定に用いる。   Also, the variable length coding method of the present invention uses the CABAC method to encode a bit (CBP bit) indicating whether each block has a significant coefficient or not. If the size is different, the presence / absence of a significant coefficient in the surrounding block is converted based on the ratio of the size of the encoding target block to the surrounding block, and the probability table used in the CABAC method is determined. Used for.

以上のような動作により、符号化対象ブロックの大きさと、周辺ブロックの大きさとが異なる場合であっても、符号化対象ブロックの大きさに応じた確率テーブルの決定を行うことができ、符号化効率の向上を図ることが出来る。   With the operation as described above, even when the size of the encoding target block and the size of the surrounding blocks are different, the probability table can be determined according to the size of the encoding target block, Efficiency can be improved.

また、本発明の可変長符号化方法は、CABAC方式によって、ブロック内の各係数が有意係数であるか否かを示すビットの符号化方法する場合、符号化対象ブロックの大きさ別に確率テーブルを用意し、ブロックサイズ毎に異なる組の確率テーブルを用意する。または、符号化対象ブロックの最大ブロックサイズに合わせて確率テーブルを用意し、ブロックの大きさの違いに関わらず同じ確率テーブルの組を用いる。   The variable length coding method of the present invention uses a CABAC method to encode a bit indicating whether or not each coefficient in a block is a significant coefficient. Prepare a different set of probability tables for each block size. Alternatively, a probability table is prepared in accordance with the maximum block size of the encoding target block, and the same set of probability tables is used regardless of the difference in block size.

以上のような動作により、ブロックが複数の大きさを有する場合であっても、ブロックの大きさ別に確率テーブルの組を持つことにより、符号化効率の向上を図ることができる。また、ブロックの大きさの最大値に合わせて確率テーブルを用意し、ブロックの大きさの違いに関わらず同じ確率テーブルの組を用いることにより、確率テーブルの数を減らすことができ、メモリサイズを小さくすることができる。   By the operation as described above, even if a block has a plurality of sizes, it is possible to improve the coding efficiency by having a set of probability tables for each block size. In addition, by preparing a probability table according to the maximum block size and using the same set of probability tables regardless of the difference in block size, the number of probability tables can be reduced, and the memory size can be reduced. Can be small.

なお、本実施の形態においては、マクロブロックは水平16×垂直16画素の単位で、動き補償は16×16から4×4画素のブロック単位で処理する場合について説明したが、これらの単位は別の画素数でも良い。   In the present embodiment, a case has been described in which macroblocks are processed in units of horizontal 16 × vertical 16 pixels and motion compensation is processed in units of blocks of 16 × 16 to 4 × 4 pixels, but these units are different. The number of pixels may be sufficient.

また、本実施の形態においては、周波数変換は8×8、8×4、4×8、4×4のいずれかのブロック単位で処理する場合について説明したが、これらの単位は別の画素数でも良い。   In the present embodiment, the case where the frequency conversion is processed in units of 8 × 8, 8 × 4, 4 × 8, or 4 × 4 blocks has been described. But it ’s okay.

また、本実施の形態においては、符号化対象ブロックの周辺ブロックとして、左および上に位置するブロックを参照して、可変長符号化テーブルや確率テーブルを決定する場合について説明したが、これらの周辺ブロックは、他のブロックであっても良い。例えば、右上や左上のブロック等を用いる方法、等がある。   In the present embodiment, the case where the variable length coding table and the probability table are determined with reference to the blocks located on the left and the top as the peripheral blocks of the encoding target block has been described. The block may be another block. For example, there is a method using the upper right or upper left block or the like.

また本実施の形態においては、CAVLC方式の説明においては、図4に示す3つの可変長符号化テーブルを用いる場合について説明したが、可変長符号化テーブルの個数およびテーブルの構成については、図4に限るものではない。また、周辺ブロックの有意係数の個数に対するしきい値として、N/8、N/4といった値を用いる場合について説明したが、これらの値は他の値であっても良い。また、符号化対象ブロックの大きさ毎に異なるしきい値を用いても良い。   In the present embodiment, the case of using the three variable length coding tables shown in FIG. 4 has been described in the description of the CAVLC method. However, the number of variable length coding tables and the configuration of the tables are described in FIG. It is not limited to. Further, the case where values such as N / 8 and N / 4 are used as threshold values for the number of significant coefficients of the peripheral blocks has been described, but these values may be other values. A different threshold may be used for each size of the encoding target block.

また、本実施の形態では、周辺ブロックが画面内にあり、かつ同じスライス内である場合について説明したが、これらの周辺ブロックがこの条件を満たさない場合には、条件を満たす周辺ブロックのみを使って、可変長符号化テーブルや確率テーブルの決定を行えばよい。   In this embodiment, the case where the peripheral blocks are in the screen and in the same slice has been described. However, when these peripheral blocks do not satisfy this condition, only the peripheral blocks that satisfy the condition are used. Thus, the variable length coding table and the probability table may be determined.

(実施の形態2)
次に、インタレース信号に対してマクロブロック毎、又はMBP(マクロブロックペア;以下MBPと記す)毎にフレーム構造又はフィールド構造が混在する場合において動画像符号化及び動画像復号化を行う場合に、CAVLC方式又はCABAC方式を用いてコンテキストを決定する方法について説明する。ここでMBPは、上下に隣接する2つのマクロブロックをまとめた単位であり、詳しい構成は後述する。
(Embodiment 2)
Next, in the case where a frame structure or a field structure is mixed for each macroblock or MBP (macroblock pair; hereinafter referred to as MBP) with respect to the interlace signal, when moving picture coding and moving picture decoding are performed. A method for determining a context using the CAVLC method or the CABAC method will be described. Here, MBP is a unit in which two macroblocks adjacent in the vertical direction are combined, and a detailed configuration will be described later.

図7は、本実施の形態2に係る動画像符号化装置の構成を示す機能ブロック図である。本実施の形態2においては、上述した実施の形態1に係る動画像符号化装置に示す構成に加えて、ブロックカウンタ701が備えられている。   FIG. 7 is a functional block diagram showing the configuration of the moving picture encoding apparatus according to the second embodiment. In the second embodiment, a block counter 701 is provided in addition to the configuration shown in the moving picture coding apparatus according to the first embodiment described above.

このブロックカウンタ701は、前記フレームメモリ101に対して、可変長符号化の対象となるブロック単位での出力を指示し、また、前記符号列生成部104に対して、その対象ブロックがMBPの境界であるか否かの指示を行う。また、モード選択部109では、当該MBPをフレーム構造とフィールド構造のいずれで符号化するかを決定し、その結果を符号列生成部104に対して出力する。ブロックカウンタ701から出力されるMBPの境界情報、およびモード選択部109から出力されるMBPの構造情報とにより、符号列生成部104は、本実施の形態2に係る対象ブロックの可変長符号化をスタートさせる。なお、動画像符号化装置の全体的な動作は、上述した動作と同様である。   The block counter 701 instructs the frame memory 101 to output in units of blocks to be subjected to variable-length encoding, and also instructs the code string generation unit 104 that the target block is an MBP boundary. Instruct whether or not. Further, the mode selection unit 109 determines whether the MBP is to be encoded with the frame structure or the field structure, and outputs the result to the code string generation unit 104. Based on the MBP boundary information output from the block counter 701 and the MBP structure information output from the mode selection unit 109, the code string generation unit 104 performs variable length encoding of the target block according to the second embodiment. Start it. The overall operation of the video encoding apparatus is the same as that described above.

図8は、フレーム構造で符号化されるMBPのデータ構造とフィールド構造で符号化されるMBPのデータ構造との関係を示す説明図である。同図において、白丸は奇数水平走査線上の画素を示し、斜線でハッチングした黒丸は偶数水平走査線上の画素を示している。入力画像を表す各フレームからMBPを切り出した場合、図8の中央に示すように、奇数水平走査線上の画素と偶数水平走査線上の画素とは垂直方向に交互に配置されている。このようなMBPをフレーム構造で符号化する場合、当該MBPは2つのマクロブロック1およびマクロブロック2毎に処理される。また、フィールド構造で符号化する場合、当該MBPは、水平走査線方向にインタレースした場合のトップフィールドを表すマクロブロックMBtとボトムフィールドを表すマクロブロックMBbとに分けられる。   FIG. 8 is an explanatory diagram showing the relationship between the MBP data structure encoded with the frame structure and the MBP data structure encoded with the field structure. In the figure, white circles indicate pixels on odd horizontal scanning lines, and black circles hatched with diagonal lines indicate pixels on even horizontal scanning lines. When MBP is cut out from each frame representing an input image, as shown in the center of FIG. 8, pixels on odd horizontal scanning lines and pixels on even horizontal scanning lines are alternately arranged in the vertical direction. When such an MBP is encoded with a frame structure, the MBP is processed for each of two macroblocks 1 and 2. When encoding with a field structure, the MBP is divided into a macroblock MBt representing the top field and a macroblock MBb representing the bottom field when interlaced in the horizontal scanning line direction.

図9は、本実施の形態2に係るCAVLC方式でコンテキストを決定し、対応するVLCテーブルを決定する場合における計算手順の大きな流れを示すフローチャートである。   FIG. 9 is a flowchart showing a large flow of calculation procedures when a context is determined by the CAVLC method according to the second embodiment and a corresponding VLC table is determined.

なお、符号化対象ブロックCの周辺ブロックであるブロックA及びブロックBの位置関係は、前記図5と同様のものとして説明する。また、符号化対象ブロックCと周辺ブロックA、Bとは、4×4画素(係数)の大きさを有し、各ブロックの有意係数の個数の最大値は16として説明する。また、符号化対象ブロックCの左に位置する周辺ブロックAの有意係数の個数をNL、符号化対象ブロックCの上に位置する周辺ブロックBの有意係数の個数をNUとする。   Note that the positional relationship between blocks A and B, which are peripheral blocks of the encoding target block C, will be described as being the same as in FIG. The encoding target block C and the peripheral blocks A and B have a size of 4 × 4 pixels (coefficients), and the maximum value of the number of significant coefficients in each block will be described as 16. In addition, the number of significant coefficients of the peripheral block A located on the left of the encoding target block C is NL, and the number of significant coefficients of the peripheral block B positioned on the encoding target block C is NU.

まず、符号列生成部104は、符号化対象ブロックCの左に位置する対象ブロックAの有意係数の個数NLを決定する(ステップ901)。次に、符号化対象ブロックCの上に位置する対象ブロックBの有意係数NUの個数を決定し(ステップ902)、最後に、それらNLとNUとを利用することにより、対象ブロックの有意係数の個数Nを決定する(ステップ903)。   First, the code string generation unit 104 determines the number NL of significant coefficients of the target block A located to the left of the encoding target block C (step 901). Next, the number of significant coefficients NU of the target block B located above the encoding target block C is determined (step 902). Finally, by using these NL and NU, the significant coefficient of the target block is determined. The number N is determined (step 903).

なお、Nの決定は後述する方法により行い、Nの値に対応するVLCテーブルを可変長符号に用いるVLCテーブルとして決定する。   Note that N is determined by a method described later, and the VLC table corresponding to the value of N is determined as the VLC table used for the variable length code.

ここで、最終的に決定された有意係数の個数NとVLCテーブルとの関係は、例えば、図10に示される表の通りである。ここでは、有意係数の個数Nが0から2の場合には、図4に示されたVLC0のテーブルを用い、有意係数の個数Nが3から10の場合には、VLC1のVLCテーブルを用い、有意係数の個数Nが11から16の場合には、VLC2のVLCテーブルを用いることが示されている。   Here, the relationship between the finally determined number N of significant coefficients and the VLC table is, for example, as shown in the table of FIG. Here, when the number N of significant coefficients is 0 to 2, the VLC0 table shown in FIG. 4 is used, and when the number N of significant coefficients is 3 to 10, the VLC table of VLC1 is used. When the number N of significant coefficients is 11 to 16, it is indicated that the VLC table of VLC2 is used.

以下、図9に示されたフローチャートにおける各ステップの詳細な手順を説明する。   Hereinafter, a detailed procedure of each step in the flowchart shown in FIG. 9 will be described.

図11は、図9におけるステップ901、つまり、周辺ブロックAの有意係数の個数NLを求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートである。   FIG. 11 is a flowchart showing details of step 901 in FIG. 9, that is, the calculation procedure (two types (a) and (b)) for obtaining the number NL of significant coefficients of the peripheral block A.

まず、図11(a)を用いて第1の動作手順を説明すると、符号列生成部104は、符号化対象ブロックCの左に位置する周辺ブロックAが同じMBP内に位置するか調べ(ステップ1101)、同じMBP内であるならば、それら2つのブロックは同一タイプであるので、周辺ブロックAの有意係数の個数NLとして、NL=Num(A)で特定する(ステップ1104)。ここでNum(x)は、ブロックxの有意係数の個数を示す。また、タイプとは、対象のブロックがフィールド構造で符号化されているかフレーム構造で符号化されているかの符号化構造を指す。   First, the first operation procedure will be described with reference to FIG. 11A. The code string generation unit 104 checks whether the peripheral block A located to the left of the encoding target block C is located in the same MBP (step S1). 1101) If they are within the same MBP, the two blocks are of the same type, so the number NL of significant coefficients of the peripheral block A is specified as NL = Num (A) (step 1104). Here, Num (x) indicates the number of significant coefficients of the block x. The type refers to a coding structure indicating whether a target block is coded with a field structure or a frame structure.

そして、周辺ブロックAが同じMBP内に位置しないと判断した場合には、周辺ブロックAが対象ブロックCと同じタイプのMBPかを調べる(ステップ1102)。その結果、周辺ブロックAと対象ブロックCとが同じタイプのMBPである場合には、NL=Num(A)(ステップ1104)とし、それらのタイプが異なる場合には、NL=(Num(A)+Num(A´))/2として算出する(ステップ1103)。なお、周辺ブロックA´は、ブロックAに対応するブロックのことであり、その詳細な位置関係については後述する。   If it is determined that the peripheral block A is not located in the same MBP, it is checked whether the peripheral block A is the same type of MBP as the target block C (step 1102). As a result, if the peripheral block A and the target block C are the same type of MBP, NL = Num (A) (step 1104). If the types are different, NL = (Num (A) It is calculated as + Num (A ′)) / 2 (step 1103). The peripheral block A ′ is a block corresponding to the block A, and the detailed positional relationship will be described later.

次に、図11(b)を用いて第2の動作手順を説明すると、符号化対象ブロックCの左に位置する周辺ブロックAが同じMBP内に位置するか調べ(ステップ1101)、同じMBP内であるならば、周辺ブロックAの有意係数の個数を用いて、NL=Num(A)とし(ステップ1104)、周辺ブロックAが同じMBP内に位置しないと判断された場合には、周辺ブロックAは、対象ブロックCと同じタイプのMBPか調べる(ステップ1102)。そして、周辺ブロックAは、対象ブロックCと同じタイプのMBPである場合には、NL=Num(A)(ステップ1104)とし、それらのタイプが異なる場合には、NL=N・A(Not Available;不定)とする(ステップ1105)。   Next, the second operation procedure will be described with reference to FIG. 11B. It is checked whether the peripheral block A located to the left of the encoding target block C is located in the same MBP (step 1101). If NL = Num (A) using the number of significant coefficients of the peripheral block A (step 1104), if it is determined that the peripheral block A is not located in the same MBP, the peripheral block A Is checked whether it is the same type of MBP as the target block C (step 1102). If the peripheral block A is the same type of MBP as the target block C, NL = Num (A) (step 1104), and if the types are different, NL = N · A (Not Available) ; Undefined) (step 1105).

図12は、符号化対象ブロックCがフィールド構造及びフレーム構造である場合における周辺ブロックA及びA´の配置の一例を示す図である。   FIG. 12 is a diagram illustrating an example of the arrangement of the peripheral blocks A and A ′ when the encoding target block C has a field structure and a frame structure.

図12(a)は、符号化対象ブロックCがフィールド構造で符号化されたMBP1201に属し、周辺ブロックAがフレーム構造で符号化されたMBP1202に属する場合を示している。周辺ブロックA´は、周辺ブロックAの下に位置することとなる。これは、図8に示されたフレーム構造及びフィールド構造のMBPから分かるように、各ブロックに属する画素の走査線が同一となるように、対応関係が決定されているからである。つまり、ブロックCに属する走査線は、ブロックA及びA´に分散されるので、ブロックCの有意係数の個数を決定するのに用いるNLとして、ブロックA及びA´の有意係数の個数を採用している。   FIG. 12A shows a case where the encoding target block C belongs to the MBP 1201 encoded with the field structure and the peripheral block A belongs to the MBP 1202 encoded with the frame structure. The peripheral block A ′ is located below the peripheral block A. This is because the correspondence is determined so that the scanning lines of the pixels belonging to each block are the same, as can be seen from the MBP having the frame structure and the field structure shown in FIG. That is, since the scanning lines belonging to the block C are distributed to the blocks A and A ′, the number of significant coefficients of the blocks A and A ′ is adopted as the NL used to determine the number of significant coefficients of the block C. ing.

一方、図12(b)は、符号化対象ブロックCがフレーム構造で符号化されたMBP1203に属し、周辺ブロックAがフィールド構造で符号化されたMBP1204に属する場合を示している。周辺ブロックA´は、周辺ブロックが属するMBの下に位置するMBにおける同一の相対位置に位置する。これは、上記図12(a)と同一の理由、つまり、ブロックCに属する走査線は、ブロックA及びA´に分散されるので、ブロックCの有意係数の個数を決定するのに用いるNLとして、ブロックA及びA´の有意係数の個数を採用するためである。   On the other hand, FIG. 12B shows a case where the encoding target block C belongs to the MBP 1203 encoded with the frame structure and the peripheral block A belongs to the MBP 1204 encoded with the field structure. The peripheral block A ′ is located at the same relative position in the MB located under the MB to which the peripheral block belongs. This is the same reason as in FIG. 12A, that is, since the scanning lines belonging to the block C are distributed to the blocks A and A ′, the NL used to determine the number of significant coefficients of the block C is This is because the number of significant coefficients of the blocks A and A ′ is employed.

図13は、図9におけるステップ902、つまり、CAVLC方式を用いて周辺ブロックBの有意係数の個数NUを求める計算手順((a)及び(b)の2通り)の詳細を説明するフローチャートである。   FIG. 13 is a flowchart for explaining the details of step 902 in FIG. 9, that is, the calculation procedure (two types (a) and (b)) for obtaining the number NU of the significant coefficients of the peripheral block B using the CAVLC method. .

第1の計算手順を示す図13(a)では、符号列生成部104は、周辺ブロックBに位置するブロック又はマクロブロックが同じMBP内に位置するか調べる(ステップ1301)。同じMBP内に位置する場合には、それらブロックは同一タイプとなるので、周辺ブロックBの有意係数の個数NUとして、NU=Num(B)とする(ステップ1305)。そして、同じMBP内に位置しない場合には、符号化対象ブロックCがフレーム構造かを調べる(ステップ1302)。フレーム構造でなくフィールド構造である場合には、続いて周辺ブロックBがフレーム構造か否かを調べ(ステップ1303)、周辺ブロックBがフレーム構造である場合には、周辺ブロックBの有意係数の個数NUとして、NU=Num(B)(ステップ1305)とする。また、周辺ブロックBがフィールド構造の場合には、有意係数の個数Nuとして、Nu=(Num(B)+Num(B´))/2として算出する(ステップ1308)。   In FIG. 13A showing the first calculation procedure, the code string generation unit 104 checks whether a block or a macroblock located in the peripheral block B is located in the same MBP (step 1301). If they are located in the same MBP, these blocks are of the same type, so the number NU of the significant coefficients of the peripheral block B is set to NU = Num (B) (step 1305). If it is not located in the same MBP, it is checked whether the encoding target block C is a frame structure (step 1302). If it is not a frame structure but a field structure, then it is checked whether the peripheral block B has a frame structure (step 1303). If the peripheral block B has a frame structure, the number of significant coefficients of the peripheral block B As NU, NU = Num (B) (step 1305). If the peripheral block B has a field structure, the number Nu of significant coefficients is calculated as Nu = (Num (B) + Num (B ′)) / 2 (step 1308).

そして、対象ブロックCが前記フィールド構造の場合には、周辺ブロックBがフィールド構造か否かを調べ(ステップ1304)、周辺ブロックBがフィールド構造の場合には、有意係数の個数NUとして、NU=Num(B´)(ステップ1306)とする。一方、周辺ブロックBがフレーム構造の場合には、有意係数の個数Nuとして、NU=Num(B)又はNU=(Num(B)+Num(B´))/2として算出する(ステップ1307)。そして、前記各ステップを経て前記ステップ803へ続く。   If the target block C has the field structure, it is checked whether the peripheral block B has the field structure (step 1304). If the peripheral block B has the field structure, the number NU = Num (B ′) (step 1306). On the other hand, when the peripheral block B has a frame structure, the number Nu of significant coefficients is calculated as NU = Num (B) or NU = (Num (B) + Num (B ′)) / 2 (step 1307). Then, the process continues to step 803 through the steps.

また、第2の計算手順を示す図13(b)では、周辺ブロックBに位置するブロック又はマクロブロックが同じMBP内に位置するか調べ(ステップ1301)、同じMBP内に位置する場合には、それらブロックは同一タイプであるので、周辺ブロックBの有意係数の個数NUとして、NU=Num(B)とする(ステップ1305)。そして、同じMBP内に位置しない場合には、符号化対象ブロックCはフレーム構造かを調べ(ステップ1302)、フレーム構造でない場合には、続いて、周辺ブロックBがフレーム構造か否かを調べ(ステップ1303)、周辺ブロックBがフレーム構造である場合には、有意係数の個数NUとして、NU=N・A(不定)(ステップ1305)とする。また、周辺ブロックBがフィールド構造の場合には、有意係数の個数として、Nu=(Num(B)+Num(B´))/2として算出する(ステップ1308)。そして、対象ブロックCが前記フィールド構造の場合には、周辺ブロックBがフィールド構造か否かを調べ(ステップ1304)、周辺ブロックBがフィールド構造の場合には、有意係数の個数NUとして、NU=Num(B´)(ステップ1306)とする一方、周辺ブロックBがフレーム構造の場合には、有意係数の個数Nuとして、NU=N・A(不定)とし(ステップ1307)、前記ステップ903へ続く。   Further, in FIG. 13B showing the second calculation procedure, it is checked whether the block or macroblock located in the peripheral block B is located in the same MBP (step 1301). Since these blocks are the same type, NU = Num (B) is set as the number NU of the significant coefficients of the peripheral block B (step 1305). If it is not located in the same MBP, it is checked whether the encoding target block C is a frame structure (step 1302). If it is not a frame structure, then it is checked whether the peripheral block B is a frame structure (step 1302). Step 1303) When the peripheral block B has a frame structure, the number NU of significant coefficients is set to NU = NA · undefined (step 1305). If the peripheral block B has a field structure, the number of significant coefficients is calculated as Nu = (Num (B) + Num (B ′)) / 2 (step 1308). If the target block C has the field structure, it is checked whether the peripheral block B has the field structure (step 1304). If the peripheral block B has the field structure, the number NU = On the other hand, if the peripheral block B has a frame structure, the number Nu of significant coefficients is set to NU = NA (undefined) (step 1307), and the process continues to step 903. .

図14は、符号化対象ブロックCがフィールド構造及びフレーム構造である場合における周辺ブロックB及びB´の配置の一例を示す図である。   FIG. 14 is a diagram illustrating an example of the arrangement of the peripheral blocks B and B ′ when the encoding target block C has a field structure and a frame structure.

図14(a)は、符号化対象ブロックCがフィールド構造で符号化されたMBP1401に属し、周辺ブロックBがフレーム構造で符号化されたMBP1402に属する場合を示している。周辺ブロックB´は、周辺ブロックB上に位置する。これは、図8に示されたフレーム構造及びフィールド構造のMBPから分かるように、フィールド構造のブロックCは、空間的な大きさとして、フレーム構造の2つの縦に連続するブロックB及びB´と同一となるので、ブロックCの有意係数の個数を決定するのに用いるNUとして、ブロックB及びB´の有意係数の個数を採用している。ただし、空間的にはブロックCとブロックB´には連続性はないため、S1307に示すように、NU=Num(B)又はNU=(Num(B)+Num(B´))/2と2通りの計算方法が考えられる。   FIG. 14A shows a case where the encoding target block C belongs to the MBP 1401 encoded with the field structure and the peripheral block B belongs to the MBP 1402 encoded with the frame structure. The peripheral block B ′ is located on the peripheral block B. As can be seen from the frame structure and field structure MBP shown in FIG. 8, the field structure block C has two spatially continuous blocks B and B ′. Since they are the same, the number of significant coefficients of blocks B and B ′ is used as the NU used to determine the number of significant coefficients of block C. However, since there is no continuity between the block C and the block B ′ spatially, as shown in S1307, NU = Num (B) or NU = (Num (B) + Num (B ′)) / 2 and 2 The street calculation method can be considered.

一方、図14(b)は、符号化対象ブロックCがフィールド構造で符号化されたMBP1401に属し、周辺ブロックBもフィールド構造で符号化されたMBP1403に属する場合を示している。周辺ブロックB´は、周辺ブロックBが属するMBの上に位置するMBにおける同一の相対位置に位置する。これは、ブロックC及びB´は同一の種類のフィールド(トップフィールド/ボトムフィールド)構造で符号化されたMBに属するので、ブロックCの有意係数の個数を決定するのに用いるNUとして、ブロックB´の有意係数の個数を採用するためである。   On the other hand, FIG. 14B shows a case where the encoding target block C belongs to the MBP 1401 encoded with the field structure, and the peripheral block B also belongs to the MBP 1403 encoded with the field structure. The peripheral block B ′ is located at the same relative position in the MB located above the MB to which the peripheral block B belongs. This is because the blocks C and B ′ belong to MBs encoded with the same type of field (top field / bottom field) structure, so that the block B is used as the NU used to determine the number of significant coefficients of the block C. This is because the number of significant coefficients of ′ is adopted.

さらに一方、図14(c)は、符号化対象ブロックCがフレーム構造で符号化されたMBP1404に属し、周辺ブロックがフィールド構造で符号化されたMBP1403に属する場合を示している。周辺ブロックB´は、周辺ブロックBが属するMBの上に位置するMBにおける同一の相対位置に位置する。これは、ブロックB及びB´とはMBPにおける空間位置が同一領域であるので、ブロックCの有意係数の個数を決定するのに用いるNUとして、ブロックB及びB´の有意係数の個数を採用するためである。   On the other hand, FIG. 14C shows a case where the encoding target block C belongs to the MBP 1404 encoded with the frame structure and the peripheral block belongs to the MBP 1403 encoded with the field structure. The peripheral block B ′ is located at the same relative position in the MB located above the MB to which the peripheral block B belongs. This is because the blocks B and B ′ have the same spatial position in MBP, and therefore the number of significant coefficients of the blocks B and B ′ is adopted as the NU used to determine the number of significant coefficients of the block C. Because.

次に、図15は、図9におけるステップ903、つまり、本実施の形態2に係るVLCテーブルの決定手順((a)及び(b)の2通り)の詳細を示すフローチャートである。   FIG. 15 is a flowchart showing details of step 903 in FIG. 9, that is, the VLC table determination procedure (two types (a) and (b)) according to the second embodiment.

第1の決定手順を示す図15(a)において、符号列生成部104は、まず符号化対象ブロックCの有意係数の個数Nを、対象ブロックB及びAの有意係数の個数NL及びNUを用いて、N=(NL+NU)/2により決定する(ステップ1501)。次に、このNと前記図10に示すテーブルを用いてVLCテーブルを決定することが可能となる(ステップ1502)。   In FIG. 15A showing the first determination procedure, the code string generation unit 104 first uses the number N of significant coefficients of the encoding target block C and the number of significant coefficients NL and NU of the target blocks B and A. N = (NL + NU) / 2 is determined (step 1501). Next, it becomes possible to determine the VLC table using this N and the table shown in FIG. 10 (step 1502).

また、第2の決定手順を示す図15(b)においては、符号列生成部104は、まずNL、NUのいずれかがN・A(不定)かを調べ(ステップ1503)、NLとNUとが不定の場合には、例えば、N=0のVLCテーブルを用いる等のデフォルトを採用し(ステップ1504)、一方、NUのみが不定の場合には、N=NLとし、そのNに対応するVLCテーブルを決定し(ステップ1505)、さらに一方、NLのみが不定の場合には、N=NUとし、そのNによりVLCテーブルを決定し(ステップ1506)、そして、NL及びNUのいずれも不定でない場合、すなわちNL及びNUが共に決定している場合には、「その他」を採用し、N=(NL+NU)/2として算出し、VLCテーブルを決定することができる(ステップ1507)。   In FIG. 15B showing the second determination procedure, the code string generation unit 104 first checks whether NL or NU is N · A (undefined) (step 1503), and determines whether NL, NU, Is undefined, for example, a default such as using a VLC table with N = 0 is adopted (step 1504). On the other hand, when only NU is undefined, N = NL is set, and the VLC corresponding to N is determined. If the table is determined (step 1505), and if only NL is undefined, N = NU, and the VLC table is determined based on N (step 1506), and neither NL nor NU is undefined In other words, when both NL and NU are determined, “others” is adopted and calculated as N = (NL + NU) / 2 to determine the VLC table (step 15). 07).

次に、本実施の形態2に係るCABAC方式のコンテキストに用いる確率テーブルの決定手順について説明する。   Next, a procedure for determining a probability table used for the context of the CABAC scheme according to the second embodiment will be described.

図16は、本実施の形態2に係るCABAC方式でコンテキストを決定し、対応する確率テーブルを決定する場合における計算手順の大きな流れを示すフローチャートである。符号列生成部104は、まず、符号化対象ブロックCの左に位置する周辺ブロックAのコンテキスト値ctxAを決定し(ステップ1601)、次に符号化対象ブロックCの上に位置する周辺ブロックBのコンテキスト値ctxBを決定する(ステップ1602)。そして、これらのctxA及びctxBの値を利用することにより、符号化対象ブロックCのコンテキスト値ctxCを決定する(ステップ1603)。   FIG. 16 is a flowchart showing a large flow of calculation procedures when a context is determined by the CABAC method according to the second embodiment and a corresponding probability table is determined. The code string generation unit 104 first determines the context value ctxA of the peripheral block A located to the left of the encoding target block C (step 1601), and then determines the surrounding block B positioned above the encoding target block C. The context value ctxB is determined (step 1602). Then, by using the values of ctxA and ctxB, the context value ctxC of the encoding target block C is determined (step 1603).

そして、決定したコンテキスト値ctxCに対応する確率テーブルを用いて可変長符号化を行う。   Then, variable length coding is performed using a probability table corresponding to the determined context value ctxC.

以下、図16に示されたフローチャートにおける各ステップの詳細な手順を説明する。   The detailed procedure of each step in the flowchart shown in FIG. 16 will be described below.

図17は、図16におけるステップ1601、つまり、CABAC方式を用いて周辺ブロックAのコンテキスト値ctxAを求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートである。ここで、コンテキスト値は、どのような情報(CBPビット、マクロブロックの符号化モード、参照ピクチャ番号、差分量子化パラメータ、等)を扱うかにより、取りうる値が異なる。例えばCBPビット(有意係数を有するか否かを示すビット)を符号化する場合には、コンテキストは各ブロックの有意係数の有無により0と1とに分けられ、例えば、有意係数がある場合には1となり、有意係数が含まれない場合には0となる。従って、ここでのコンテキスト値は有意係数の存否に対応する。その他、マクロブロックの符号化モードを符号化する場合には、コンテキストは各ブロックがスキップブロックであるか、ダイレクトモードで符号化されたブロックであるか、等により、それぞれ0と1に分けられる。また、参照ピクチャ番号、差分量子化パラメータは0であるか否かにより0と1に分けられる。   FIG. 17 is a flowchart showing details of step 1601 in FIG. 16, that is, the calculation procedure (two types (a) and (b)) for obtaining the context value ctxA of the peripheral block A using the CABAC method. Here, the value that can be taken as the context value varies depending on what information (CBP bit, macroblock coding mode, reference picture number, differential quantization parameter, etc.) is handled. For example, when encoding CBP bits (bits indicating whether or not they have significant coefficients), the context is divided into 0 and 1 depending on the presence or absence of significant coefficients in each block. 1 and 0 if no significant coefficient is included. Therefore, the context value here corresponds to the presence or absence of a significant coefficient. In addition, when coding the coding mode of the macroblock, the context is divided into 0 and 1 depending on whether each block is a skip block or a block coded in the direct mode, respectively. The reference picture number and differential quantization parameter are divided into 0 and 1 depending on whether they are 0 or not.

図17(a)を用いて第1の計算手順を説明すると、符号列生成部104は、周辺ブロックAに位置するブロック又はマクロブロックが符号化対象ブロックCと同じMBP内かを調べる(ステップ1701)。同じMBP内であれば、周辺ブロックAのコンテキスト値ctxAとして、ctxA=ctx(A)(ステップ1704)とする。ここでctx(x)はブロックxのコンテキスト値を示す。   The first calculation procedure will be described with reference to FIG. 17A. The code string generation unit 104 checks whether the block or macroblock located in the peripheral block A is in the same MBP as the encoding target block C (step 1701). ). If within the same MBP, the context value ctxA of the peripheral block A is set to ctxA = ctx (A) (step 1704). Here, ctx (x) indicates the context value of the block x.

また、周辺ブロックAが符号化対象ブロックCと同じMBP内でない場合には、周辺ブロックAが符号化対象ブロックCと同じ構造のタイプのMBPか否かを調べる(ステップ1702)。この場合、同じ構造のタイプであれば、周辺ブロックAのコンテキスト値ctxAとして、ctxA=ctx(A)(ステップ1704)とする。一方、周辺ブロックAと対象ブロックCとの構造が異なるタイプのブロックである場合には、周辺ブロックAのコンテキスト値ctxAとして、コンテキスト値ctxA=F1(ctx(A),ctx(A´))と算出する(ステップ1703)。ここで、F1は、何らかの演算操作を施す関数であり、例えば、F1(a,b)=a+b、a+2b、a&bである。そして、前記ステップ1602へ続く。   If the peripheral block A is not in the same MBP as the encoding target block C, it is checked whether the peripheral block A is the same type of MBP as the encoding target block C (step 1702). In this case, if the types have the same structure, the context value ctxA of the peripheral block A is set to ctxA = ctx (A) (step 1704). On the other hand, when the peripheral block A and the target block C are different types of blocks, the context value ctxA = F1 (ctx (A), ctx (A ′)) is used as the context value ctxA of the peripheral block A. Calculate (step 1703). Here, F1 is a function that performs some arithmetic operation, for example, F1 (a, b) = a + b, a + 2b, a & b. Then, the process continues to step 1602.

そして、図17(b)を用いて第2の動作手順について説明すると、周辺ブロックAに位置するブロック又はマクロブロックが符号化対象ブロックCと同じMBP内かを調べ(ステップ1701)、同じMBP内であれば、周辺ブロックAのコンテキスト値ctxAとして、ctxA=ctx(A)(ステップ1704)とし、また、周辺ブロックAが符号化対象ブロックCと同じMBP内でない場合には、周辺ブロックAは符号化対象ブロックCと同じ構造のタイプのMBPか否かを調べる(ステップ1702)。この場合、同じ構造のタイプであれば、周辺ブロックAのコンテキスト値ctxAとして、ctxA=ctx(A)(ステップ1704)とする一方、周辺ブロックAと対象ブロックCとの構造が異なるタイプのブロックである場合には、コンテキスト値ctxAをデフォルト値に設定する(ステップ1705)。このデフォルト値としては、コンテキスト値が取りうる値のいずれかであり、例えば、0又は1である。   Then, the second operation procedure will be described with reference to FIG. 17B. It is checked whether the block or macroblock located in the peripheral block A is in the same MBP as the encoding target block C (step 1701). If so, the context value ctxA of the peripheral block A is set to ctxA = ctx (A) (step 1704). If the peripheral block A is not in the same MBP as the encoding target block C, the peripheral block A is encoded. It is checked whether the MBP has the same type as that of the block C to be converted (step 1702). In this case, if the type is the same structure, the context value ctxA of the peripheral block A is ctxA = ctx (A) (step 1704), while the peripheral block A and the target block C are different types of blocks. If there is, the context value ctxA is set to a default value (step 1705). This default value is one of the values that the context value can take, for example, 0 or 1.

図18は、図16におけるステップ1602、つまり、CABAC方式を用いて周辺ブロックBのコンテキスト値を求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートである。   FIG. 18 is a flowchart showing details of step 1602 in FIG. 16, that is, the calculation procedure (two types (a) and (b)) for obtaining the context value of the peripheral block B using the CABAC method.

第1の計算手順を示す図18(a)では、まず、符号列生成部104は、周辺ブロックBに位置するブロック又はマクロブロックがMBPかを調べる(ステップ1801)。同じMBP内に位置する場合には、コンテキスト値ctxB=ctx(B)(ステップ1805)とする。そして、対象ブロックCが周辺ブロックBと同じMBP内に位置しない場合には、対象ブロックCがフレーム構造か否かを調べる(ステップ1802)。この結果、対象ブロックCがフレーム構造である場合には、周辺ブロックBがフレーム構造かを調べる(ステップ1803)。周辺ブロックBがフレーム構造である場合には、コンテキスト値ctxB=ctx(B)(ステップ1805)とする。一方、対象ブロックCがフレーム構造であり、周辺ブロックBがフィールド構造である場合には、コンテキスト値ctxB=F1(ctx(B),ctx(B´))とする(ステップ1808)。   In FIG. 18A showing the first calculation procedure, first, the code string generation unit 104 checks whether the block or macroblock located in the peripheral block B is MBP (step 1801). When located in the same MBP, the context value ctxB = ctx (B) is set (step 1805). If the target block C is not located in the same MBP as the neighboring block B, it is checked whether the target block C has a frame structure (step 1802). As a result, if the target block C has a frame structure, it is checked whether the peripheral block B has a frame structure (step 1803). If the peripheral block B has a frame structure, the context value ctxB = ctx (B) is set (step 1805). On the other hand, when the target block C has a frame structure and the peripheral block B has a field structure, the context value ctxB = F1 (ctx (B), ctx (B ′)) is set (step 1808).

また、対象ブロックCがフィールド構造の場合には、次に、周辺ブロックBがフィールド構造かを調べる(ステップ1804)。周辺ブロックBがフィールド構造である場合には、コンテキスト値ctxB=ctx(B´)(ステップ1806)とする。また、対象ブロックCがフィールド構造であり、周辺ブロックBがフレーム構造である場合には、コンテキスト値ctxB=ctx(B)、又はctxB=F1(ctx(B),ctx(B´))とする(ステップ1807)。なお、ここでF1の処理は上述と同様となる。そして、前記各ステップを経て前記ステップ1603へ続く。   If the target block C has a field structure, it is next checked whether the peripheral block B has a field structure (step 1804). If the peripheral block B has a field structure, the context value ctxB = ctx (B ′) is set (step 1806). When the target block C has a field structure and the peripheral block B has a frame structure, the context value ctxB = ctx (B) or ctxB = F1 (ctx (B), ctx (B ′)) is set. (Step 1807). Here, the processing of F1 is the same as described above. Then, the process continues to step 1603 through the steps.

図19は、図16におけるステップ1603、つまり、本実施の形態2に係る確率テーブルの決定手順の詳細を示すフローチャートである。   FIG. 19 is a flowchart showing details of step 1603 in FIG. 16, that is, the determination procedure of the probability table according to the second embodiment.

図19においては、前記図18に続くステップであり、符号列生成部104は、まず符号化対象ブロックCのコンテキスト値をctxC=F2(ctx(A),ctx(B))とする(ステップ1901)。ここで、F2は、F1と同様に何らかの演算操作を施す関数であり、例えば、F2(a,b)=a+b、a+2b、a&b、a、bである。次に、このctxCを用いることにより確率テーブルを決定することができる(ステップ1902)。   In FIG. 19, the code string generation unit 104 is a step subsequent to FIG. 18, and first sets the context value of the encoding target block C to ctxC = F2 (ctx (A), ctx (B)) (step 1901). ). Here, F2 is a function that performs some kind of arithmetic operation in the same manner as F1, and is, for example, F2 (a, b) = a + b, a + 2b, a & b, a, b. Next, a probability table can be determined by using this ctxC (step 1902).

尚、上述した動画像符号化のみでなく動画像復号化において、CAVLC方法におけるVLCテーブルの決定方法、CABAC方法におけるコンテキストの決定方法は、前記図3に示す可変長復号部311における動作となり、前記符号列生成部104と同様の動作を行うものとなる。ここで、可変長復号部311において、VLCテーブルの決定、コンテキストの決定を行う際に必要となる、ブロックがMBPの境界であるか否か、またMBPがフレームまたはフィールドのいずれの構造で符号化されているかを示す情報は、符号列解析部301から得られる。   Note that in the video decoding as well as the video encoding described above, the VLC table determination method in the CAVLC method and the context determination method in the CABAC method are operations in the variable length decoding unit 311 shown in FIG. The same operation as that of the code string generation unit 104 is performed. Here, in the variable length decoding unit 311, whether the block is an MBP boundary or not, and MBP is encoded with any structure of a frame or a field, which is necessary when determining a VLC table and a context. Information indicating whether or not the code string has been processed is obtained from the code string analysis unit 301.

以上のように、実施の形態2に係る可変長符号化方法及び可変長復号化方法においては、CAVLC方式やCABAC方式を用いる際に、複数の周辺ブロックの有意係数の情報を用いる。従って、より効果的に符号化効率が向上するVLCテーブルや確率テーブルの選択方法を実現することができる。尚、本実施の形態2において、マクロブロックの構造のタイプをMBPごとにフレーム構造及びフィールド構造に相互に変換することができるのは言うまでもない。また、フレーム構造及びフィールド構造のいずれを選択する単位は、MBPでなくても構わず、例えばマクロブロックを単位としても良い。   As described above, in the variable length coding method and the variable length decoding method according to Embodiment 2, information on significant coefficients of a plurality of peripheral blocks is used when the CAVLC method or the CABAC method is used. Therefore, it is possible to realize a method of selecting a VLC table or a probability table that improves the coding efficiency more effectively. In the second embodiment, it is needless to say that the structure type of the macroblock can be mutually converted into a frame structure and a field structure for each MBP. In addition, the unit for selecting either the frame structure or the field structure may not be MBP, and may be a macro block, for example.

また、本実施の形態においては、図9および図16を用いて説明した形態において、符号化または復号化対象ブロックの左側に位置するブロックの有意係数の個数またはコンテキストを求めた後、符号化または復号化対象ブロックの上側に位置するブロックの有意係数の個数またはコンテキストを求める場合について説明したが、これらの順序は逆であっても構わず、図9におけるS903、図16におけるS1603の決定結果には影響は及ぼさない。   In the present embodiment, after obtaining the number or context of significant coefficients of the block located on the left side of the block to be encoded or decoded in the form described using FIG. 9 and FIG. Although the case where the number of significant coefficients or the context of the block located above the decoding target block is obtained has been described, the order of these may be reversed, and the determination result of S903 in FIG. 9 and S1603 in FIG. Has no effect.

さらにここで、上記実施の形態で示した可変長符号化方法や可変長復号化方法の応用例とそれを用いたシステムを説明する。   Further, application examples of the variable length coding method and variable length decoding method shown in the above embodiment and a system using the same will be described.

図20は、コンテンツ配信サービスを実現するコンテンツ供給システムex100の全体構成を示すブロック図である。通信サービスの提供エリアを所望の大きさに分割し、各セル内にそれぞれ固定無線局である基地局ex107〜ex110が設置されている。   FIG. 20 is a block diagram showing an overall configuration of a content supply system ex100 that implements a content distribution service. The communication service providing area is divided into desired sizes, and base stations ex107 to ex110, which are fixed radio stations, are installed in each cell.

このコンテンツ供給システムex100は、例えば、インターネットex101にインターネットサービスプロバイダex102および電話網ex104、および基地局ex107〜ex110を介して、コンピュータex111、PDA(personal digital assistant)ex112、カメラex113、携帯電話ex114、カメラ付きの携帯電話ex115などの各機器が接続される。   The content supply system ex100 includes, for example, a computer ex111, a PDA (personal digital assistant) ex112, a camera ex113, a mobile phone ex114, a camera via the Internet ex101, the Internet service provider ex102, the telephone network ex104, and the base stations ex107 to ex110. Each device such as the attached mobile phone ex115 is connected.

しかし、コンテンツ供給システムex100は図20のような組合せに限定されず、いずれかを組み合わせて接続するようにしてもよい。また、固定無線局である基地局ex107〜ex110を介さずに、各機器が電話網ex104に直接接続されてもよい。   However, the content supply system ex100 is not limited to the combination as shown in FIG. 20, and any of the combinations may be connected. Further, each device may be directly connected to the telephone network ex104 without going through the base stations ex107 to ex110 which are fixed wireless stations.

カメラex113はデジタルビデオカメラ等の動画撮影が可能な機器である。また、携帯電話は、PDC(Personal Digital Communications)方式、CDMA(Code Division Multiple Access)方式、W−CDMA(Wideband-Code Division Multiple Access)方式、若しくはGSM(Global System for Mobile Communications)方式の携帯電話機、またはPHS(Personal Handyphone System)等であり、いずれでも構わない。   The camera ex113 is a device capable of shooting a moving image such as a digital video camera. The mobile phone is a PDC (Personal Digital Communications) system, a CDMA (Code Division Multiple Access) system, a W-CDMA (Wideband-Code Division Multiple Access) system, or a GSM (Global System for Mobile Communications) system mobile phone, Alternatively, PHS (Personal Handyphone System) or the like may be used.

また、ストリーミングサーバex103は、カメラex113から基地局ex109、電話網ex104を通じて接続されており、カメラex113を用いてユーザが送信する符号化処理されたデータに基づいたライブ配信等が可能になる。撮影したデータの符号化処理はカメラex113で行っても、データの送信処理をするサーバ等で行ってもよい。また、カメラ116で撮影した動画データはコンピュータex111を介してストリーミングサーバex103に送信されてもよい。カメラex116はデジタルカメラ等の静止画、動画が撮影可能な機器である。この場合、動画データの符号化はカメラex116で行ってもコンピュータex111で行ってもどちらでもよい。また、符号化処理はコンピュータex111やカメラex116が有するLSIex117において処理することになる。なお、画像符号化・復号化用のソフトウェアをコンピュータex111等で読み取り可能な記録媒体である何らかの蓄積メディア(CD−ROM、フレキシブルディスク、ハードディスクなど)に組み込んでもよい。さらに、カメラ付きの携帯電話ex115で動画データを送信してもよい。このときの動画データは携帯電話ex115が有するLSIで符号化処理されたデータである。   Further, the streaming server ex103 is connected from the camera ex113 through the base station ex109 and the telephone network ex104, and live distribution based on the encoded data transmitted by the user using the camera ex113 can be performed. The encoded processing of the captured data may be performed by the camera ex113 or may be performed by a server or the like that performs data transmission processing. Further, the moving image data shot by the camera 116 may be transmitted to the streaming server ex103 via the computer ex111. The camera ex116 is a device that can shoot still images and moving images, such as a digital camera. In this case, the encoding of the moving image data may be performed by the camera ex116 or the computer ex111. The encoding process is performed in the LSI ex117 included in the computer ex111 and the camera ex116. Note that image encoding / decoding software may be incorporated into any storage medium (CD-ROM, flexible disk, hard disk, etc.) that is a recording medium readable by the computer ex111 or the like. Furthermore, you may transmit moving image data with the mobile telephone ex115 with a camera. The moving image data at this time is data encoded by the LSI included in the mobile phone ex115.

このコンテンツ供給システムex100では、ユーザがカメラex113、カメラex116等で撮影しているコンテンツ(例えば、音楽ライブを撮影した映像等)を上記実施の形態同様に符号化処理してストリーミングサーバex103に送信する一方で、ストリーミングサーバex103は要求のあったクライアントに対して上記コンテンツデータをストリーム配信する。クライアントとしては、上記符号化処理されたデータを復号化することが可能な、コンピュータex111、PDAex112、カメラex113、携帯電話ex114等がある。このようにすることでコンテンツ供給システムex100は、符号化されたデータをクライアントにおいて受信して再生することができ、さらにクライアントにおいてリアルタイムで受信して復号化し、再生することにより、個人放送をも実現可能になるシステムである。   In this content supply system ex100, the content (for example, video shot of music live) captured by the user with the camera ex113, camera ex116, etc. is encoded and transmitted to the streaming server ex103 as in the above embodiment. On the other hand, the streaming server ex103 distributes the content data to the requested client. Examples of the client include a computer ex111, a PDA ex112, a camera ex113, a mobile phone ex114, and the like that can decode the encoded data. In this way, the content supply system ex100 can receive and reproduce the encoded data at the client, and also realize personal broadcasting by receiving, decoding, and reproducing in real time at the client. It is a system that becomes possible.

このシステムを構成する各機器の符号化、復号化には上記各実施の形態で示した可変長符号化装置あるいは可変長復号化装置を用いるようにすればよい。
その一例として携帯電話について説明する。
The variable length encoding device or variable length decoding device described in the above embodiments may be used for encoding and decoding of each device constituting this system.
A mobile phone will be described as an example.

図21は、上記実施の形態で説明した可変長符号化方法と可変長復号化方法を用いた携帯電話ex115を示す図である。携帯電話ex115は、基地局ex110との間で電波を送受信するためのアンテナex201、CCDカメラ等の映像、静止画を撮ることが可能なカメラ部ex203、カメラ部ex203で撮影した映像、アンテナex201で受信した映像等が復号化されたデータを表示する液晶ディスプレイ等の表示部ex202、操作キーex204群から構成される本体部、音声出力をするためのスピーカ等の音声出力部ex208、音声入力をするためのマイク等の音声入力部ex205、撮影した動画もしくは静止画のデータ、受信したメールのデータ、動画のデータもしくは静止画のデータ等、符号化されたデータまたは復号化されたデータを保存するための記録メディアex207、携帯電話ex115に記録メディアex207を装着可能とするためのスロット部ex206を有している。記録メディアex207はSDカード等のプラスチックケース内に電気的に書換えや消去が可能な不揮発性メモリであるEEPROM(Electrically Erasable and Programmable Read Only Memory)の一種であるフラッシュメモリ素子を格納したものである。   FIG. 21 is a diagram showing the mobile phone ex115 using the variable length coding method and the variable length decoding method described in the above embodiment. The cellular phone ex115 includes an antenna ex201 for transmitting and receiving radio waves to and from the base station ex110, a camera such as a CCD camera, a camera unit ex203 capable of taking a still image, a video shot by the camera unit ex203, and an antenna ex201. A display unit ex202 such as a liquid crystal display that displays data obtained by decoding received video and the like, a main body unit composed of a group of operation keys ex204, an audio output unit ex208 such as a speaker for audio output, and audio input To store encoded data or decoded data such as a voice input unit ex205 such as a microphone, captured video or still image data, received mail data, video data or still image data, etc. Recording medium ex207, and slot portion ex20 for enabling recording medium ex207 to be attached to mobile phone ex115 The has. The recording medium ex207 stores a flash memory element which is a kind of EEPROM (Electrically Erasable and Programmable Read Only Memory) which is a nonvolatile memory that can be electrically rewritten and erased in a plastic case such as an SD card.

さらに、携帯電話ex115について図22を用いて説明する。携帯電話ex115は表示部ex202及び操作キーex204を備えた本体部の各部を統括的に制御するようになされた主制御部ex311に対して、電源回路部ex310、操作入力制御部ex304、画像符号化部ex312、カメラインターフェース部ex303、LCD(Liquid Crystal Display)制御部ex302、画像復号化部ex309、多重分離部ex308、記録再生部ex307、変復調回路部ex306及び音声処理部ex305が同期バスex313を介して互いに接続されている。   Further, the cellular phone ex115 will be described with reference to FIG. The cellular phone ex115 controls the power supply circuit ex310, the operation input control unit ex304, and the image coding for the main control unit ex311 which is configured to control the respective units of the main body unit including the display unit ex202 and the operation key ex204. Unit ex312, camera interface unit ex303, LCD (Liquid Crystal Display) control unit ex302, image decoding unit ex309, demultiplexing unit ex308, recording / reproducing unit ex307, modulation / demodulation circuit unit ex306, and audio processing unit ex305 via a synchronization bus ex313 Are connected to each other.

電源回路部ex310は、ユーザの操作により終話及び電源キーがオン状態にされると、バッテリパックから各部に対して電力を供給することによりカメラ付ディジタル携帯電話ex115を動作可能な状態に起動する。   When the end call and power key are turned on by a user operation, the power supply circuit ex310 activates the camera-equipped digital mobile phone ex115 by supplying power from the battery pack to each unit. .

携帯電話ex115は、CPU、ROM及びRAM等でなる主制御部ex311の制御に基づいて、音声通話モード時に音声入力部ex205で集音した音声信号を音声処理部ex305によってディジタル音声データに変換し、これを変復調回路部ex306でスペクトラム拡散処理し、送受信回路部ex301でディジタルアナログ変換処理及び周波数変換処理を施した後にアンテナex201を介して送信する。また携帯電話機ex115は、音声通話モード時にアンテナex201で受信した受信信号を増幅して周波数変換処理及びアナログディジタル変換処理を施し、変復調回路部ex306でスペクトラム逆拡散処理し、音声処理部ex305によってアナログ音声信号に変換した後、これを音声出力部ex208を介して出力する。   The mobile phone ex115 converts the voice signal collected by the voice input unit ex205 in the voice call mode into digital voice data by the voice processing unit ex305 based on the control of the main control unit ex311 including a CPU, a ROM, a RAM, and the like. The modulation / demodulation circuit unit ex306 performs spread spectrum processing, and the transmission / reception circuit unit ex301 performs digital analog conversion processing and frequency conversion processing, and then transmits the result via the antenna ex201. In addition, the cellular phone ex115 amplifies the received signal received by the antenna ex201 in the voice call mode, performs frequency conversion processing and analog-digital conversion processing, performs spectrum despreading processing by the modulation / demodulation circuit unit ex306, and analog audio by the voice processing unit ex305. After conversion into a signal, this is output via the audio output unit ex208.

さらに、データ通信モード時に電子メールを送信する場合、本体部の操作キーex204の操作によって入力された電子メールのテキストデータは操作入力制御部ex304を介して主制御部ex311に送出される。主制御部ex311は、テキストデータを変復調回路部ex306でスペクトラム拡散処理し、送受信回路部ex301でディジタルアナログ変換処理及び周波数変換処理を施した後にアンテナex201を介して基地局ex110へ送信する。   Further, when an e-mail is transmitted in the data communication mode, text data of the e-mail input by operating the operation key ex204 of the main body is sent to the main control unit ex311 via the operation input control unit ex304. The main control unit ex311 performs spread spectrum processing on the text data in the modulation / demodulation circuit unit ex306, performs digital analog conversion processing and frequency conversion processing in the transmission / reception circuit unit ex301, and then transmits the text data to the base station ex110 via the antenna ex201.

データ通信モード時に画像データを送信する場合、カメラ部ex203で撮像された画像データをカメラインターフェース部ex303を介して画像符号化部ex312に供給する。また、画像データを送信しない場合には、カメラ部ex203で撮像した画像データをカメラインターフェース部ex303及びLCD制御部ex302を介して表示部ex202に直接表示することも可能である。   When transmitting image data in the data communication mode, the image data captured by the camera unit ex203 is supplied to the image encoding unit ex312 via the camera interface unit ex303. When image data is not transmitted, the image data captured by the camera unit ex203 can be directly displayed on the display unit ex202 via the camera interface unit ex303 and the LCD control unit ex302.

画像符号化部ex312は、本願発明で説明した画像符号化装置を備えた構成であり、カメラ部ex203から供給された画像データを上記実施の形態で示した画像符号化装置に用いた符号化方法によって圧縮符号化することにより符号化画像データに変換し、これを多重分離部ex308に送出する。また、このとき同時に携帯電話機ex115は、カメラ部ex203で撮像中に音声入力部ex205で集音した音声を音声処理部ex305を介してディジタルの音声データとして多重分離部ex308に送出する。   The image encoding unit ex312 has a configuration including the image encoding device described in the present invention, and an encoding method using the image data supplied from the camera unit ex203 in the image encoding device described in the above embodiment. The encoded image data is converted into encoded image data by compression encoding, and sent to the demultiplexing unit ex308. At the same time, the cellular phone ex115 sends the sound collected by the audio input unit ex205 during imaging by the camera unit ex203 to the demultiplexing unit ex308 as digital audio data via the audio processing unit ex305.

多重分離部ex308は、画像符号化部ex312から供給された符号化画像データと音声処理部ex305から供給された音声データとを所定の方式で多重化し、その結果得られる多重化データを変復調回路部ex306でスペクトラム拡散処理し、送受信回路部ex301でディジタルアナログ変換処理及び周波数変換処理を施した後にアンテナex201を介して送信する。   The demultiplexing unit ex308 multiplexes the encoded image data supplied from the image encoding unit ex312 and the audio data supplied from the audio processing unit ex305 by a predetermined method, and the multiplexed data obtained as a result is a modulation / demodulation circuit unit A spectrum spread process is performed at ex306, a digital-analog conversion process and a frequency conversion process are performed at the transmission / reception circuit unit ex301, and then transmitted through the antenna ex201.

データ通信モード時にホームページ等にリンクされた動画像ファイルのデータを受信する場合、アンテナex201を介して基地局ex110から受信した受信信号を変復調回路部ex306でスペクトラム逆拡散処理し、その結果得られる多重化データを多重分離部ex308に送出する。   When receiving data of a moving image file linked to a home page or the like in the data communication mode, the received signal received from the base station ex110 via the antenna ex201 is subjected to spectrum despreading processing by the modulation / demodulation circuit unit ex306, and the resulting multiplexing is obtained. Is sent to the demultiplexing unit ex308.

また、アンテナex201を介して受信された多重化データを復号化するには、多重分離部ex308は、多重化データを分離することにより画像データの符号化ビットストリームと音声データの符号化ビットストリームとに分け、同期バスex313を介して当該符号化画像データを画像復号化部ex309に供給すると共に当該音声データを音声処理部ex305に供給する。   In addition, in order to decode the multiplexed data received via the antenna ex201, the demultiplexing unit ex308 separates the multiplexed data to generate an encoded bitstream of image data and an encoded bitstream of audio data. The encoded image data is supplied to the image decoding unit ex309 via the synchronization bus ex313, and the audio data is supplied to the audio processing unit ex305.

次に、画像復号化部ex309は、本願発明で説明した画像復号化装置を備えた構成であり、画像データの符号化ビットストリームを上記実施の形態で示した符号化方法に対応した復号化方法で復号することにより再生動画像データを生成し、これをLCD制御部ex302を介して表示部ex202に供給し、これにより、例えばホームページにリンクされた動画像ファイルに含まれる動画データが表示される。このとき同時に音声処理部ex305は、音声データをアナログ音声信号に変換した後、これを音声出力部ex208に供給し、これにより、例えばホームページにリンクされた動画像ファイルに含まる音声データが再生される。   Next, the image decoding unit ex309 is configured to include the image decoding device described in the present invention, and a decoding method corresponding to the encoding method described in the above embodiment for an encoded bit stream of image data. To generate playback moving image data, which is supplied to the display unit ex202 via the LCD control unit ex302, thereby displaying, for example, moving image data included in the moving image file linked to the homepage . At the same time, the audio processing unit ex305 converts the audio data into an analog audio signal, and then supplies the analog audio signal to the audio output unit ex208. Thus, for example, the audio data included in the moving image file linked to the home page is reproduced. The

なお、上記システムの例に限られず、最近は衛星、地上波によるディジタル放送が話題となっており、図23に示すようにディジタル放送用システムにも上記実施の形態の少なくとも画像符号化装置または画像復号化装置のいずれかを組み込むことができる。具体的には、放送局ex409では映像情報の符号化ビットストリームが電波を介して通信または放送衛星ex410に伝送される。これを受けた放送衛星ex410は、放送用の電波を発信し、この電波を衛星放送受信設備をもつ家庭のアンテナex406で受信し、テレビ(受信機)ex401またはセットトップボックス(STB)ex407などの装置により符号化ビットストリームを復号化してこれを再生する。また、記録媒体であるCDやDVD等の蓄積メディアex402に記録した符号化ビットストリームを読み取り、復号化する再生装置ex403にも上記実施の形態で示した画像復号化装置を実装することが可能である。この場合、再生された映像信号はモニタex404に表示される。また、ケーブルテレビ用のケーブルex405または衛星/地上波放送のアンテナex406に接続されたセットトップボックスex407内に画像復号化装置を実装し、これをテレビのモニタex408で再生する構成も考えられる。このときセットトップボックスではなく、テレビ内に画像復号化装置を組み込んでも良い。また、アンテナex411を有する車ex412で衛星ex410からまたは基地局ex107等から信号を受信し、車ex412が有するカーナビゲーションex413等の表示装置に動画を再生することも可能である。   Note that the present invention is not limited to the above-described system, and recently, digital broadcasting by satellite and terrestrial has become a hot topic. As shown in FIG. Any of the decoding devices can be incorporated. Specifically, in the broadcasting station ex409, the encoded bit stream of the video information is transmitted to the communication or broadcasting satellite ex410 via radio waves. Receiving this, the broadcasting satellite ex410 transmits a radio wave for broadcasting, and receives the radio wave with a home antenna ex406 having a satellite broadcasting receiving facility, such as a television (receiver) ex401 or a set top box (STB) ex407. The device decodes the encoded bit stream and reproduces it. In addition, the image decoding apparatus described in the above embodiment can also be implemented in a playback apparatus ex403 that reads and decodes an encoded bitstream recorded on a storage medium ex402 such as a CD or DVD that is a recording medium. is there. In this case, the reproduced video signal is displayed on the monitor ex404. Further, a configuration in which an image decoding device is mounted in a set-top box ex407 connected to a cable ex405 for cable television or an antenna ex406 for satellite / terrestrial broadcasting, and this is reproduced on the monitor ex408 of the television is also conceivable. At this time, the image decoding apparatus may be incorporated in the television instead of the set top box. It is also possible to receive a signal from the satellite ex410 or the base station ex107 by the car ex412 having the antenna ex411 and reproduce a moving image on a display device such as the car navigation ex413 that the car ex412 has.

更に、画像信号を上記実施の形態で示した画像符号化装置で符号化し、記録媒体に記録することもできる。具体例としては、DVDディスクex421に画像信号を記録するDVDレコーダや、ハードディスクに記録するディスクレコーダなどのレコーダex420がある。更にSDカードex422に記録することもできる。レコーダex420が上記実施の形態で示した画像復号化装置を備えていれば、DVDディスクex421やSDカードex422に記録した画像信号を再生し、モニタex408で表示することができる。   Further, the image signal can be encoded by the image encoding device shown in the above embodiment and recorded on a recording medium. As a specific example, there is a recorder ex420 such as a DVD recorder that records an image signal on a DVD disk ex421 or a disk recorder that records on a hard disk. Further, it can be recorded on the SD card ex422. If the recorder ex420 includes the image decoding device described in the above embodiment, the image signal recorded on the DVD disc ex421 or the SD card ex422 can be reproduced and displayed on the monitor ex408.

なお、カーナビゲーションex413の構成は例えば図22に示す構成のうち、カメラ部ex203とカメラインターフェース部ex303、画像符号化部ex312を除いた構成が考えられ、同様なことがコンピュータex111やテレビ(受信機)ex401等でも考えられる。   The configuration of the car navigation ex 413 is, for example, the configuration shown in FIG. 22 excluding the camera unit ex203, the camera interface unit ex303, and the image encoding unit ex312. The same applies to the computer ex111 and the television (receiver). ) Ex401 can also be considered.

また、上記携帯電話ex114等の端末は、符号化器・復号化器を両方持つ送受信型の端末の他に、符号化器のみの送信端末、復号化器のみの受信端末の3通りの実装形式が考えられる。   In addition to the transmission / reception type terminal having both the encoder and the decoder, the terminal such as the mobile phone ex114 has three mounting formats: a transmitting terminal having only an encoder and a receiving terminal having only a decoder. Can be considered.

このように、上記実施の形態で示した可変長符号化方法あるいは可変長復号化方法を上述したいずれの機器・システムに用いることは可能であり、そうすることで、上記実施の形態で説明した効果を得ることができる。   As described above, the variable-length encoding method or the variable-length decoding method shown in the above embodiment can be used in any of the above-described devices / systems, and as a result, described in the above embodiment. An effect can be obtained.

本発明の実施の形態を説明するためのブロック図Block diagram for describing an embodiment of the present invention 本発明の実施の形態を説明するための模式図Schematic diagram for explaining an embodiment of the present invention 本発明の実施の形態を説明するためのブロック図Block diagram for describing an embodiment of the present invention 本発明の実施の形態および従来例を説明するための模式図Schematic diagram for explaining an embodiment of the present invention and a conventional example 従来例を説明するための模式図Schematic diagram for explaining a conventional example 従来例を説明するための模式図Schematic diagram for explaining a conventional example 本実施の形態2に係る動画像符号化装置の構成を示す機能ブロック図Functional block diagram showing the configuration of the video encoding apparatus according to the second embodiment 実施の形態2に係るフレーム構造で符号化されるMBPのデータ構造とフィールド構造で符号化されるMBPのデータ構造との関係を示す説明図Explanatory drawing which shows the relationship between the data structure of MBP encoded with the frame structure which concerns on Embodiment 2, and the data structure of MBP encoded with a field structure 実施の形態2に係るCAVLC方式でコンテキストを決定し、対応するVLCテーブルを決定する場合における計算手順の大きな流れを示すフローチャートThe flowchart which shows the big flow of the calculation procedure in the case of determining a context with the CAVLC system which concerns on Embodiment 2, and determining a corresponding VLC table. 実施の形態2に係る有意係数の個数とVLCテーブルとの関係を例示する表Table illustrating the relationship between the number of significant coefficients and the VLC table according to the second embodiment 実施の形態2に係る周辺ブロックAの有意係数の個数NLを求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートThe flowchart which shows the detail of the calculation procedure (two types of (a) and (b)) which calculates | requires the number NL of the significant coefficients of the surrounding block A which concerns on Embodiment 2. FIG. 実施の形態2に係る符号化対象ブロックCがフィールド構造及びフレーム構造である場合における周辺ブロックA及びA´の配置の一例を示す図The figure which shows an example of arrangement | positioning of the surrounding blocks A and A 'in case the encoding object block C which concerns on Embodiment 2 is a field structure and a frame structure. 実施の形態2に係るCAVLC方式を用いて周辺ブロックBの有意係数の個数NUを求める計算手順((a)及び(b)の2通り)の詳細を説明するフローチャートThe flowchart explaining the detail of the calculation procedure (two types of (a) and (b)) which calculates | requires the number NU of the significant coefficient of the surrounding block B using the CAVLC system which concerns on Embodiment 2. FIG. 実施の形態2に係る符号化対象ブロックCがフィールド構造及びフレーム構造である場合における周辺ブロックB及びB´の配置の一例を示す図The figure which shows an example of arrangement | positioning of the surrounding blocks B and B 'in case the encoding object block C which concerns on Embodiment 2 is a field structure and a frame structure. 本実施の形態2に係るVLCテーブルの決定手順((a)及び(b)の2通り)の詳細を示すフローチャートThe flowchart which shows the detail of the determination procedure (two types of (a) and (b)) of the VLC table which concerns on this Embodiment 2. 実施の形態2に係るCABAC方式でコンテキストを決定し、対応する確率テーブルを決定する場合における計算手順の大きな流れを示すフローチャートThe flowchart which shows the big flow of the calculation procedure in the case of determining a context with the CABAC system which concerns on Embodiment 2, and determining a corresponding probability table. 実施の形態2に係るCABAC方式を用いて周辺ブロックAのコンテキスト値ctxAを求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートThe flowchart which shows the detail of the calculation procedure (two types of (a) and (b)) which calculates | requires the context value ctxA of the surrounding block A using the CABAC system which concerns on Embodiment 2. FIG. 実施の形態2に係るCABAC方式を用いて周辺ブロックBのコンテキスト値を求める計算手順((a)及び(b)の2通り)の詳細を示すフローチャートThe flowchart which shows the detail of the calculation procedure (two types of (a) and (b)) which calculates | requires the context value of the surrounding block B using the CABAC system which concerns on Embodiment 2. FIG. 本実施の形態2に係る確率テーブルの決定手順の詳細を示すフローチャートThe flowchart which shows the detail of the determination procedure of the probability table which concerns on this Embodiment 2. コンテンツ供給システムの全体構成を示すブロック図Block diagram showing the overall configuration of the content supply system 動画像符号化方法、動画像復号化方法を用いた携帯電話の例Example of mobile phone using moving picture coding method and moving picture decoding method 携帯電話のブロック図Mobile phone block diagram ディジタル放送用システムの例Example of digital broadcasting system 従来の確率テーブルの算出の仕方を示す参考図Reference diagram showing how to calculate a conventional probability table

符号の説明Explanation of symbols

101、107 フレームメモリ
102 差分演算部
103 予測誤差符号化部
104 符号列生成部
105 予測誤差復号化部
106 加算演算部
108 動きベクトル検出部
109 モード選択部
701 ブロックカウンタ
MBP マクロブロックペア
101, 107 Frame memory 102 Difference calculation unit 103 Prediction error encoding unit 104 Code string generation unit 105 Prediction error decoding unit 106 Addition calculation unit 108 Motion vector detection unit 109 Mode selection unit 701 Block counter MBP Macroblock pair

Claims (8)

画像を複数のブロックに分割し、前記ブロックを単位として符号化を行う際に用いる可変長符号化方法であって、
符号化対象ブロックの情報を符号化する際に用いる可変長符号化テーブルを、前記符号化対象ブロックの周辺ブロックの情報に応じて決定し、前記符号化対象ブロックと前記周辺ブロックとの大きさが異なる際には、前記周辺ブロックの情報を前記符号化対象ブロックの大きさに変換して使用することを特徴とする可変長符号化方法。
A variable length encoding method used when an image is divided into a plurality of blocks and encoding is performed in units of the blocks,
A variable length coding table used when coding the information of the encoding target block is determined according to the information of the peripheral blocks of the encoding target block, and the sizes of the encoding target block and the peripheral blocks are determined. When different, the variable length coding method is characterized in that the information of the neighboring blocks is converted into the size of the block to be coded and used.
前記情報はブロックの有意係数の個数であることを特徴とする請求項1記載の可変長符号化方法。   2. The variable length coding method according to claim 1, wherein the information is the number of significant coefficients of the block. 前記符号化対象ブロックの大きさが前記周辺ブロックの大きさよりも大きい際には、前記符号化対象ブロックの大きさと等しい大きさとなる複数の前記周辺ブロックの組を特定し、前記周辺ブロックの情報として、特定した複数の前記周辺ブロックの組における有意係数の個数の和を使用することを特徴とする請求項1記載の可変長符号化方法。When the size of the encoding target block is larger than the size of the peripheral block, a plurality of sets of the peripheral blocks having a size equal to the size of the encoding target block are specified, and information on the peripheral block is obtained. 2. The variable length coding method according to claim 1, wherein a sum of the number of significant coefficients in a set of the plurality of specified peripheral blocks is used. 前記符号化対象ブロックの大きさが前記周辺ブロックの大きさよりも小さい際には、前記周辺ブロックの情報として、前記周辺ブロックに対する前記符号化対象ブロックの大きさの比を前記周辺ブロックにおける有意係数の個数に乗算して使用することを特徴とする請求項1記載の可変長符号化方法。When the size of the encoding target block is smaller than the size of the peripheral block, as the peripheral block information, the ratio of the size of the encoding target block to the peripheral block is a significant coefficient in the peripheral block. 2. The variable length coding method according to claim 1, wherein the number is used by multiplying the number. 画像を複数のブロックに分割し、前記ブロックを単位として復号化を行う際に用いる可変長復号化方法であって、
復号化対象ブロックの情報を復号化する際に用いる可変長復号化テーブルを、前記復号化対象ブロックの周辺ブロックの情報に応じて決定し、前記復号化対象ブロックと前記周辺ブロックとの大きさが異なる際には、前記周辺ブロックの情報を前記復号化対象ブロックの大きさに変換して使用することを特徴とする可変長復号化方法。
A variable length decoding method used when dividing an image into a plurality of blocks and performing decoding in units of the blocks,
A variable length decoding table used when decoding the information of the decoding target block is determined according to the information of the peripheral block of the decoding target block, and the size of the decoding target block and the peripheral block is determined. When different, the variable length decoding method is characterized in that the information of the neighboring blocks is converted into the size of the decoding target block and used.
前記情報はブロックの有意係数の個数であることを特徴とする請求項記載の可変長復号化方法。 6. The variable length decoding method according to claim 5, wherein the information is the number of significant coefficients of the block. 前記復号化対象ブロックの大きさが前記周辺ブロックの大きさよりも大きい際には、前記復号化対象ブロックの大きさと等しい大きさとなる複数の前記周辺ブロックの組を特定し、前記周辺ブロックの情報として、特定した複数の前記周辺ブロックの組における有意係数の個数の和を使用することを特徴とする請求項5記載の可変長復号化方法。When the size of the block to be decoded is larger than the size of the peripheral block, a plurality of sets of the peripheral blocks having a size equal to the size of the block to be decoded is specified, and information on the peripheral block 6. The variable length decoding method according to claim 5, wherein a sum of the number of significant coefficients in a set of the plurality of specified peripheral blocks is used. 前記復号化対象ブロックの大きさが前記周辺ブロックの大きさよりも小さい際には、前記周辺ブロックの情報として、前記周辺ブロックに対する前記復号化対象ブロックの大きさの比を前記周辺ブロックにおける有意係数の個数に乗算して使用することを特徴とする請求項5記載の可変長復号化方法。When the size of the decoding target block is smaller than the size of the peripheral block, as the peripheral block information, the ratio of the size of the decoding target block to the peripheral block is a significant coefficient in the peripheral block. 6. The variable length decoding method according to claim 5, wherein the number is multiplied and used.
JP2008119337A 2002-06-06 2008-04-30 Variable length encoding method and variable length decoding method Expired - Lifetime JP4767992B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008119337A JP4767992B2 (en) 2002-06-06 2008-04-30 Variable length encoding method and variable length decoding method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2002166233 2002-06-06
JP2002166233 2002-06-06
JP2008119337A JP4767992B2 (en) 2002-06-06 2008-04-30 Variable length encoding method and variable length decoding method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2002290541A Division JP4230188B2 (en) 2002-06-06 2002-10-02 Variable length encoding method and variable length decoding method

Publications (2)

Publication Number Publication Date
JP2008259224A JP2008259224A (en) 2008-10-23
JP4767992B2 true JP4767992B2 (en) 2011-09-07

Family

ID=39982271

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008119337A Expired - Lifetime JP4767992B2 (en) 2002-06-06 2008-04-30 Variable length encoding method and variable length decoding method

Country Status (1)

Country Link
JP (1) JP4767992B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5702377B2 (en) * 2009-06-29 2015-04-15 トムソン ライセンシングThomson Licensing Method and apparatus for adaptive probability update for uncoded syntax
WO2014120368A1 (en) 2013-01-30 2014-08-07 Intel Corporation Content adaptive entropy coding for next generation video
EP3490253A1 (en) 2017-11-23 2019-05-29 Thomson Licensing Encoding and decoding methods and corresponding devices

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0774969A (en) * 1993-08-31 1995-03-17 Canon Inc Picture processing method and its device
JP3222875B2 (en) * 1996-11-07 2001-10-29 松下電器産業株式会社 Image encoding method, image encoding device, and recording medium recording image encoding program
JP2000333020A (en) * 1999-05-20 2000-11-30 Matsushita Electric Ind Co Ltd Binary image coding method, binary image coder and recording medium

Also Published As

Publication number Publication date
JP2008259224A (en) 2008-10-23

Similar Documents

Publication Publication Date Title
JP4230188B2 (en) Variable length encoding method and variable length decoding method
KR101257212B1 (en) Image coding apparatus and image decoding apparatus
JP4594201B2 (en) Image coding method, image coding apparatus, program, and integrated circuit
KR101019358B1 (en) Variable length coding method and variable length decoding method
JP2008187734A (en) Filtering strength determination method
JP4641995B2 (en) Image encoding method and image encoding apparatus
JP4767992B2 (en) Variable length encoding method and variable length decoding method
JP4580626B2 (en) Filtering strength determination method, video encoding method, and video decoding method
JP4580901B2 (en) Filtering strength determination method, video encoding method, and video decoding method
JP4580902B2 (en) Filtering strength determination method, video encoding method, and video decoding method
JP4580903B2 (en) Filtering strength determination method, video encoding method, and video decoding method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100521

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100928

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101124

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110615

R150 Certificate of patent or registration of utility model

Ref document number: 4767992

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20140624

Year of fee payment: 3

EXPY Cancellation because of completion of term