JP2001308718A - Method and device for variable length encoding - Google Patents

Method and device for variable length encoding

Info

Publication number
JP2001308718A
JP2001308718A JP2001117333A JP2001117333A JP2001308718A JP 2001308718 A JP2001308718 A JP 2001308718A JP 2001117333 A JP2001117333 A JP 2001117333A JP 2001117333 A JP2001117333 A JP 2001117333A JP 2001308718 A JP2001308718 A JP 2001308718A
Authority
JP
Japan
Prior art keywords
code
decoding
codeword
decoded
orthogonal transform
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2001117333A
Other languages
Japanese (ja)
Other versions
JP3417934B2 (en
Inventor
Takeshi Nakajo
健 中條
Takeshi Nagai
剛 永井
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.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2001117333A priority Critical patent/JP3417934B2/en
Publication of JP2001308718A publication Critical patent/JP2001308718A/en
Application granted granted Critical
Publication of JP3417934B2 publication Critical patent/JP3417934B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a variable length encoding device which can decode both to the forward direction and to the reverse direction, and can compose a variable length code high in encoding efficiency with few useless bit patterns. SOLUTION: The variable length encoding device assigns a cord word having a code length responding to the occurrence probability to an orthogonal transformation coefficient generated by performing orthogonal transformation of a block unit, and outputs the cord word corresponding to the orthogonal transformation coefficient generated by a dynamic image encoder 709 as coded data. Furthermore the variable length encoding device composes the first cord word table storing a plurality of cord words which can be decoded to the forward direction and to the reverse direction for every encoding mode making respond to the orthogonal transformation coefficient other than the last of a block and the second cord word table provided in common to each encoding mode, and storing the plurality of cord words which can be decoded to the forward direction and to the reverse direction making respond to the orthogonal transformation coefficient of the last of the block, and selects the cord word corresponding to the orthogonal transformation coefficient from the first and second cord word tables to output it as the coded data.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】この発明は、可変長符号化方
法及び装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a variable length coding method and apparatus.

【0002】[0002]

【従来の技術】可変長符号は、シンボルの発生頻度に基
づいて、頻繁に出現するシンボルは短い符号長の符号、
希にしか出現しないシンボルは長い符号長の符号を割り
当てることにより、平均的に短い符号長となるようにし
た符号系である。従って、可変長符号を用いると、符号
化前のデータと比較して、データ量を大幅に圧縮するこ
とができる。このような可変長符号の構成方法として
は、無記憶情報源で最適なハフマンのアルゴリズムが知
られている。
2. Description of the Related Art A variable-length code is based on the frequency of occurrence of a symbol.
A symbol system which rarely appears is a code system in which a code having a long code length is assigned so that the code length becomes short on average. Therefore, when the variable length code is used, the data amount can be significantly reduced as compared with the data before encoding. As a method of constructing such a variable length code, Huffman's algorithm which is optimal for a memoryless information source is known.

【0003】可変長符号の一般的な問題として、符号化
データに伝送路誤りその他の理由で誤りが混入した場合
に、誤りが混入した以後のデータについては、その影響
が伝搬することにより復号化装置で正しく復号すること
ができなくなってしまうという点が挙げられる。そのた
め、伝送路において誤りが生じる可能性がある場合に
は、ある間隔で周期的に同期符号を挿入し、誤りの伝搬
を防止する方法がとられるのが一般的である。同期符号
には、可変長符号の組み合わせでは出現しないようなビ
ットパターンが割り当てられる。この方法によれば、符
号化データに誤りが生じ、復号できなくなったとして
も、次の同期符号を見つけることにより、誤りの伝搬を
防止し、正しく復号を行うことができる。しかし、この
ように同期符号を用いた場合でも、図39(a)に示す
ように誤りが生じて正しく復号できない地点から、次の
同期符号が見つかる地点までの間の符号化データについ
ては、復号を行うことができない。
[0003] As a general problem of the variable length code, when an error is mixed in the coded data due to a transmission line error or other reasons, the data after the error is mixed is decoded by the influence of the error. The point is that decoding cannot be performed correctly by the device. Therefore, when there is a possibility that an error may occur in the transmission path, a method is generally adopted in which a synchronization code is periodically inserted at certain intervals to prevent the propagation of the error. A bit pattern that does not appear in a combination of variable length codes is assigned to the synchronization code. According to this method, even if an error occurs in encoded data and decoding becomes impossible, finding the next synchronization code prevents the propagation of the error and enables correct decoding. However, even when the synchronization code is used in this way, as shown in FIG. 39 (a), the encoded data from the point where an error occurs and cannot be decoded correctly to the point where the next synchronization code is found is not decoded. Can not do.

【0004】そこで、可変長符号を図40に示す通常の
構成から図41に示すように変更して、図39(b)に
示すように通常の順方向から復号可能な性質だけでな
く、逆方向からも復号可能な符号の構成にする方法が知
られている。また、このような符号は符号化データを逆
方向からも読めることから、符号化データを蓄積するデ
ィスクメモリなどの蓄積媒体において逆転再生に用いる
こともできる。このような順方向のみならず逆方向から
も復号可能な可変長符号のことを、ここではリバーシブ
ル符号と呼ぶこととする。リバーシブル符号の一例は、
例えば特開平5−300027号公報「可逆可変長符号
化方式」に記載されている。この公知例のリバーシブル
符号は、図40に示した順方向から復号可能な可変長符
号であるハフマン符号の符号語の末尾に、図41に示す
ようにそれぞれの符号語がそれより符号長の長い他の符
号語の末尾と一致しない条件でビットを追加することに
よって、逆方向からも復号可能とした可変長符号であ
る。
Therefore, the variable length code is changed from the normal configuration shown in FIG. 40 to that shown in FIG. 41, so that not only the characteristic that can be decoded from the normal forward direction as shown in FIG. There is known a method of forming a code that can be decoded also from a direction. In addition, since such a code can read encoded data in the reverse direction, it can be used for reverse reproduction in a storage medium such as a disk memory for storing encoded data. Such a variable length code that can be decoded not only in the forward direction but also in the reverse direction is referred to as a reversible code here. One example of a reversible code is
For example, it is described in JP-A-5-300027 "Reversible variable length coding system". In the reversible code of this known example, as shown in FIG. 41, each codeword has a longer code length at the end of the codeword of the Huffman code which is a variable length code decodable from the forward direction as shown in FIG. This is a variable-length code that can be decoded in the opposite direction by adding bits under conditions that do not match the end of another codeword.

【0005】しかし、このリバーシブル符号は順方向か
らのみ復号可能な可変長符号の符号語の末尾にビットを
付加するために、無駄なビットが多くなって平均符号長
が長くなる。この結果、順方向からのみ復号可能な可変
長符号と比較して符号化効率が大きく低下してしまう。
However, in this reversible code, since bits are added to the end of a code word of a variable length code that can be decoded only in the forward direction, useless bits increase and the average code length increases. As a result, the coding efficiency is greatly reduced as compared with a variable length code that can be decoded only in the forward direction.

【0006】また、従来のリバーシブル符号のもう一つ
の問題点として、情報シンボル数が大きい場合には、可
変長符号化/復号化装置で必要とされる記憶量が多くな
るために、実用に適さないという点があった。情報シン
ボル数が大きい場合の例としては、動画像や静止画像の
画像符号化でよく用いられるDCT係数の符号化があ
る。通常、画像符号化では8×8のDCT(離散コサイ
ン変換)を行い、これにより得られたDCT係数と呼ば
れる直交変換係数について8ビットの線形量子化を行
う。さらに、量子化されたDCT変換係数について低域
からジグザクスキャンを行い、零ランと非零の係数を組
にして可変長符号化を行っている。
[0006] Another problem of the conventional reversible code is that when the number of information symbols is large, the amount of storage required by the variable-length encoding / decoding device increases, so that it is not suitable for practical use. There was no point. An example of a case where the number of information symbols is large is DCT coefficient encoding which is often used in image encoding of a moving image or a still image. Normally, in image coding, 8 × 8 DCT (discrete cosine transform) is performed, and 8-bit linear quantization is performed on orthogonal transform coefficients obtained as DCT coefficients. Further, a zigzag scan is performed on the quantized DCT transform coefficients from a low frequency band, and variable length coding is performed using a set of zero-run and non-zero coefficients.

【0007】例えば、ITU−T DRAFT Rec
ommendation H.263(1995)で
は、量子化インデックス値は−127〜+127(イン
デックス値0はランなので、インデックス数は25
3)、零ラン数は最大63であり、またブロックの最後
のDCT換係数が非零の係数かどうかの区別をするよう
な符号化を採用しているので、情報シンボル数は253
×64×2=32384と非常に大きな数になってい
る。そこで、H.263では出現確率の高いDCT係数
については可変長符号で符号化するが、出現確率の低い
DCT係数についてはブロックの最後の非零係数かどう
かの区別を示す符号に1ビットの符号、零ランに6ビッ
トの符号、量子化インデックスに8ビットの符号の計1
5ビットの符号で固定長符号化を行い、この固定長符号
の先頭にエスケープ符号と呼ばれる符号を付加する構成
となっている。
For example, ITU-T DRAFT Rec
ommendation H .; In H.263 (1995), the quantization index value is -127 to +127 (because the index value 0 is a run, the index number is 25
3) Since the number of zero runs is a maximum of 63, and the coding that discriminates whether the last DCT coefficient of the block is a non-zero coefficient is adopted, the number of information symbols is 253.
It is a very large number of × 64 × 2 = 32384. Then, H. In H.263, the DCT coefficient with a high appearance probability is coded with a variable length code, but the DCT coefficient with a low appearance probability is a 1-bit code and a zero run as a code indicating whether it is the last non-zero coefficient of a block. 6-bit code, 8-bit code for quantization index, total 1
The fixed-length coding is performed using a 5-bit code, and a code called an escape code is added to the head of the fixed-length code.

【0008】全ての符号語を符号語テーブルとして持っ
ていても符号化/復号化は可能であるが、上記のような
符号構成になっていると、15ビットの固定長符号の部
分は可変長符号とは別個に符号化/復号化が可能である
ため、出現確率の高いDCT係数とエスケープ符号の符
号語テーブルを用意するだけでよい。従って、可変長符
号の符号語テーブルを削減して記憶容量を低減すること
が可能となる。
[0008] Encoding / decoding is possible even if all codewords are stored as a codeword table. However, with the above-described code configuration, a fixed-length 15-bit code is variable-length. Since encoding / decoding can be performed separately from codes, it is only necessary to prepare a code word table of DCT coefficients and escape codes having a high appearance probability. Therefore, it is possible to reduce the storage capacity by reducing the codeword table of the variable length code.

【0009】しかし、従来のリバーシブル符号は前述し
たように順方向からのみ復号可能な可変長符号の符号語
の末尾にビットを付加する必要があるために、エスケー
プ符号を付加することができない。従って、情報シンボ
ル数が多い場合にも全ての情報シンボルに対応した符号
語を用意する必要があり、記憶量が莫大なものとなって
しまう。
However, as described above, the conventional reversible code cannot add an escape code because it is necessary to add a bit to the end of a variable-length code word that can be decoded only in the forward direction. Therefore, even when the number of information symbols is large, it is necessary to prepare code words corresponding to all information symbols, and the storage amount becomes enormous.

【0010】[0010]

【発明が解決しようとする課題】上述したように、従来
技術によるリバーシブル符号、すなわち順方向からも逆
方向からも復号可能な可変長符号は、順方向からのみ復
号可能な可変長符号の符号語の末尾にビットを付加する
ことによってリバーシブル符号を構成するため、無駄な
ビットパターンが多くなって平均符号長が長くなり、順
方向からのみ復号可能な可変長符号と比較して符号化効
率の低下が著しくなるという問題があり、またこのよう
なリバーシブル符号を用いる可変長符号化/復号化装置
では、何らかの形で全ての情報シンボルに対応した符号
語を有する符号語テーブルを用意する必要があり、画像
符号化のように情報シンボルの数が大きい場合、大きな
記憶量を必要とするという問題があるため、いずれにし
ても実用に適さないという問題があった。
As described above, a reversible code according to the prior art, that is, a variable length code that can be decoded in both the forward and reverse directions, is a code word of a variable length code that can be decoded only in the forward direction. Since the reversible code is configured by adding a bit to the end of the code, the useless bit pattern increases, the average code length increases, and the coding efficiency decreases compared to a variable length code that can be decoded only in the forward direction. And a variable-length encoding / decoding device using such a reversible code needs to prepare a codeword table having codewords corresponding to all information symbols in some form. When the number of information symbols is large as in image coding, there is a problem that a large storage amount is required. There is a problem in that.

【0011】本発明は、順方向にも逆方向にも復号可能
であって、実用性に富んだ可変長符号化方法及び装置を
提供することを目的とする。
SUMMARY OF THE INVENTION An object of the present invention is to provide a variable-length coding method and apparatus which can be decoded in both forward and reverse directions and which is practical.

【0012】より具体的には、順方向にも逆方向にも復
号可能であって、しかも無駄なビットパターンが少なく
符号化効率の高い可変長符号化方法及び装置を提供する
ことを目的とする。
More specifically, it is an object of the present invention to provide a variable length coding method and apparatus capable of decoding in both the forward and reverse directions and having a small amount of useless bit patterns and high coding efficiency. .

【0013】また、順方向にも逆方向にも復号可能であ
って、しかも情報シンボルの数が多い場合にも大きな記
憶量を必要としない可変長符号化方法及び装置を提供す
ることを目的とする。
It is another object of the present invention to provide a variable length coding method and apparatus which can decode in both forward and backward directions and do not require a large storage amount even when the number of information symbols is large. I do.

【0014】[0014]

【課題を解決するための手段】上記の課題を解決するた
め、本発明はブロック単位の直交変換を行って生成され
得る直交変換係数に対して、該直交変換係数の生起確率
に応じた符号長を有する符号語をそれぞれ割り当て、前
記動画像符号化器で生成された直交変換係数に対応した
符号語を符号化データとして出力する可変長符号化方法
において、複数の符号化モード毎に、順方向にも逆方向
にも復号可能である複数の符号語をブロックの最後以外
の直交変換係数にそれぞれ対応させて格納した第1の符
号語テーブルと、前記複数の符号化モードに対して共通
に設けられ、順方向にも逆方向にも復号可能である複数
の符号語をブロックの最後の直交変換係数にそれぞれ対
応させて格納した第2の符号語テーブルを構成し、前記
第1および第2の符号語テーブルから前記直交変換係数
に対応する符号語を選択して符号化データとして出力す
ることを特徴とする。
In order to solve the above-mentioned problems, the present invention provides an orthogonal transform coefficient which can be generated by performing an orthogonal transform in block units, and a code length corresponding to the occurrence probability of the orthogonal transform coefficient. In the variable-length coding method of allocating codewords having the following formulas and outputting codewords corresponding to the orthogonal transform coefficients generated by the video encoder as coded data, for each of a plurality of coding modes, A first codeword table storing a plurality of codewords that can be decoded in the opposite direction and corresponding to orthogonal transformation coefficients other than the last of the block, and a common codeword table is provided for the plurality of encoding modes. A second codeword table in which a plurality of codewords that can be decoded in both the forward and reverse directions are stored in correspondence with the last orthogonal transform coefficients of the block, and the first and second codeword tables are stored. And outputs as coded data from the issue word table by selecting a code word corresponding to the orthogonal transform coefficients.

【0015】また、本発明はブロック単位の直交変換を
行って生成され得る直交変換係数に対して、該直交変換
係数の生起確率に応じた符号長を有する符号語をそれぞ
れ割り当て、前記動画像符号化器で生成された直交変換
係数に対応した符号語を符号化データとして出力する可
変長符号化装置において、複数の符号化モード毎に、順
方向にも逆方向にも復号可能である複数の符号語をブロ
ックの最後以外の直交変換係数にそれぞれ対応させて格
納した第1の符号語テーブルと、前記複数の符号化モー
ドに対して共通に設けられ、順方向にも逆方向にも復号
可能である複数の符号語をブロックの最後の直交変換係
数にそれぞれ対応させて格納した第2の符号語テーブル
と、前記第1および第2の符号語テーブルから前記直交
変換係数に対応する符号語を選択して符号化データとし
て出力する符号化手段とを有することを特徴とする。
Further, according to the present invention, a code word having a code length corresponding to the probability of occurrence of the orthogonal transform coefficient is assigned to an orthogonal transform coefficient which can be generated by performing an orthogonal transform on a block basis. Variable-length coding apparatus that outputs codewords corresponding to orthogonal transform coefficients generated by the encoder as coded data, for each of a plurality of coding modes, a plurality of codes that can be decoded in both the forward and reverse directions. A first codeword table in which codewords are stored corresponding to orthogonal transform coefficients other than the end of the block, and are provided in common for the plurality of coding modes, and can be decoded in both forward and reverse directions. And a second codeword table that stores a plurality of codewords corresponding to the last orthogonal transform coefficient of the block, and a codeword corresponding to the orthogonal transform coefficient from the first and second codeword tables. And having a coding means for selecting a code word as the coded data.

【0016】動画像符号化/復号化器では符号化方式に
シンタックスがあるため、可変長符号を両方向から復号
できるのみでなく、シンタックス的にも両方向から復号
できるようにする必要があるが、本発明に基づく可変長
符号化ではこの要求に応えることが可能である。すなわ
ち、動画像符号化器におけるシンタックスは、例えば符
号化モードを示すモード情報や動きベクトル情報などを
上位階層とし、DCT係数のような直交変換係数を下位
階層として、符号化データが階層化されることが前提と
なっており、下位階層では各ブロック(マクロブロッ
ク)の符号化モードは上位階層の復号によって既に分か
っているものとして、ブロックの区切りが分かれば両方
向からの復号が可能なシンタックスとなっている。
In a moving picture encoder / decoder, since there is a syntax in an encoding method, it is necessary not only to be able to decode a variable length code from both directions but also to be able to decode the syntax from both directions. The variable length coding according to the present invention can meet this demand. That is, the syntax in the moving picture encoder is such that, for example, mode information indicating a coding mode, motion vector information, and the like are set as an upper layer, and orthogonal transform coefficients such as DCT coefficients are set as a lower layer. It is assumed that the coding mode of each block (macroblock) in the lower layer is already known from the decoding of the upper layer, and that the decoding is possible in both directions if the block break is known. It has become.

【0017】本発明においては、複数の符号化モードに
対してブロックの最後以外の直交変換係数に対応する第
1の符号語テーブルは個々に構成されるが、ブロックの
最後の直交変換係数に対応する第2の符号語テーブルは
各符号化モードに対して共通化することによって、符号
化モードによる符号語テーブルの変更に対応できると共
に、復号化に際してブロックの最後の直交変換係数を表
す符号語や、1つ前のブロックの最後の直交変換係数を
表す符号語の出現によってブロックの区切りが分かるた
め、シンタックス的にも両方向から復号を行うことが可
能である。
In the present invention, the first codeword table corresponding to the orthogonal transform coefficients other than the last of the block is individually formed for a plurality of encoding modes, but the first codeword table is corresponding to the last orthogonal transform coefficient of the block. The second codeword table to be used is common to each coding mode, so that it is possible to cope with a change in the codeword table depending on the coding mode, and to decode a codeword representing the last orthogonal transform coefficient of a block during decoding. Since a block delimiter can be identified by the appearance of a codeword representing the last orthogonal transform coefficient of the previous block, decoding can be performed from both directions in terms of syntax.

【0018】また、異なる符号化モード、例えばイント
ラモードとインターモードとでは、生成される直交変換
係数とそれらの出現頻度が異なるため、これらに対応す
る第2の符号語テーブルを別々に構成することにより、
符号化効率が向上する。
In addition, since the orthogonal transform coefficients to be generated and their appearance frequencies are different between different encoding modes, for example, between the intra mode and the inter mode, the second codeword tables corresponding to these are separately formed. By
Encoding efficiency is improved.

【0019】[0019]

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

【0020】図1は、本発明の一実施形態に係る可変長
符号化/復号化装置の構成を示すブロック図である。本
実施形態の可変長符号化/復号化装置は、大きく分けて
符号語テーブル作成部101、符号化部114、伝送系
または蓄積系104および復号化部115からなる。ま
ず、これら各部の機能について簡単に説明すると、符号
語テーブル作成部101は情報シンボルの生起確率に基
づいて符号語テーブルを作成し、符号化部114内の符
号語テーブル102と、復号化部115内の順方向符号
語テーブル110および逆方向符号語テーブル112に
送る。符号化部114は、情報シンボルを可変長符号に
符号化し、その可変長符号を符号化データとして伝送系
または蓄積系104へ出力する。復号化部115は、伝
送系または蓄積系104を介して入力されてきた符号化
データを復号して元の情報シンボルを再生する。
FIG. 1 is a block diagram showing a configuration of a variable length encoding / decoding device according to one embodiment of the present invention. The variable-length encoding / decoding device according to the present embodiment is roughly divided into a codeword table creation unit 101, an encoding unit 114, a transmission or accumulation system 104, and a decoding unit 115. First, the function of each of these units will be briefly described. The codeword table creation unit 101 creates a codeword table based on the occurrence probabilities of information symbols, and the codeword table 102 in the encoding unit 114 and the decoding unit 115 To the forward codeword table 110 and the backward codeword table 112. Encoding section 114 encodes the information symbol into a variable-length code, and outputs the variable-length code to transmission system or storage system 104 as encoded data. Decoding section 115 decodes the coded data input via transmission system or storage system 104 to reproduce the original information symbols.

【0021】次に、本実施形態の各部の詳細な構成と動
作を説明する。符号化部114において、入力された情
報シンボルは符号化器103に入力される。一方、符号
語テーブル102は、符号語テーブル作成部101によ
って予め作成された情報シンボルと可変長符号の符号語
とを対応させて格納している。符号化器103は符号語
テーブル102に格納されている符号語の中から、入力
された情報シンボルに対応した符号語を選択して符号化
データとして出力する。この符号化データは、伝送系ま
たは蓄積系104を通して復号化部115に送られる。
この際、符号化データには一定周期毎に同期コードが挿
入される。
Next, the detailed configuration and operation of each part of the present embodiment will be described. In the encoding unit 114, the input information symbols are input to the encoder 103. On the other hand, the codeword table 102 stores information symbols created in advance by the codeword table creation unit 101 and codewords of variable-length codes in association with each other. The encoder 103 selects a codeword corresponding to the input information symbol from the codewords stored in the codeword table 102 and outputs the selected codeword as encoded data. This encoded data is sent to the decoding unit 115 via the transmission system or the storage system 104.
At this time, a synchronization code is inserted into the encoded data at regular intervals.

【0022】復号化部115では、伝送系または蓄積系
104より入力された符号化データから同期コード検出
部105で同期コードを検出し、同期コードと同期コー
ドの間の符号化データをバッファ106に蓄積する。順
方向復号化器110では、順方向復号木作成部111か
らの順方向復号木に基づいて、バッファ106に蓄積さ
れた符号化データの先頭から復号を開始し、逆方向復号
化器108では、逆方向復号木作成部113からの逆方
向復号木に基づいて、バッファ106に蓄積された符号
化データの末尾から復号を開始する。
In the decoding unit 115, a synchronization code is detected by the synchronization code detection unit 105 from the encoded data input from the transmission system or the storage system 104, and the encoded data between the synchronization codes is stored in the buffer 106. accumulate. The forward decoder 110 starts decoding from the beginning of the encoded data stored in the buffer 106 based on the forward decoding tree from the forward decoding tree creating unit 111, and the backward decoder 108 The decoding is started from the end of the encoded data stored in the buffer 106 based on the backward decoding tree from the backward decoding tree creating unit 113.

【0023】復号値判定部109では、順方向復号化器
107によって得られた復号結果(順方向復号結果とい
う)と、逆方向復号化器108によって得られた復号結
果(逆方向復号値という)から復号値を判定し、最終的
な復号結果を出力する。すなわち、復号値判定部109
では符号化データに誤りがあると、復号木に出現しない
ビットパターンが生じることから誤りの存在が分かるの
で、順方向復号結果と逆方向復号結果から図2に示すよ
うに復号値を判定する。図2は、同期コードと同期コー
ドとの間の復号値判定方法を示している。
The decoding value judgment unit 109 decodes the decoding result obtained by the forward decoding unit 107 (referred to as a forward decoding result) and the decoding result obtained by the backward decoding unit 108 (referred to as a backward decoding value). , And a final decoding result is output. That is, the decryption value determination unit 109
In the case where there is an error in the encoded data, a bit pattern that does not appear in the decoding tree is generated, so that the presence of the error can be known. Therefore, the decoded value is determined from the forward decoding result and the backward decoding result as shown in FIG. FIG. 2 shows a method of determining a decoded value between synchronization codes.

【0024】まず、図2(a)に示すように順方向復号
結果と逆方向復号結果で誤りが検出される符号語の位置
(誤り検出位置)が交差しない場合は、誤りが検出され
なかった復号結果のみを復号値として使用し、二つの誤
り検出位置の復号結果は復号値として使用せず、放棄す
る。
First, as shown in FIG. 2 (a), if the position of a code word at which an error is detected in the forward decoding result and the backward decoding result does not intersect (error detection position), no error is detected. Only the decoding result is used as the decoding value, and the decoding results at the two error detection positions are not used as the decoding values and are discarded.

【0025】また、図2(b)に示すように順方向復号
結果と逆方向復号結果の誤り検出位置が交差する場合
は、両方で誤りが検出されなかった復号結果を復号結果
値として使用する。また、この場合には二つの誤り検出
位置の符号語の間の復号結果は復号値として使用せず、
放棄する。
When the error detection positions of the forward decoding result and the backward decoding result intersect as shown in FIG. 2B, the decoding result in which no error is detected in both cases is used as the decoding result value. . In this case, the decoding result between the codewords at the two error detection positions is not used as a decoding value,
Abandon.

【0026】また、図2(c)に示すように順方向復号
結果および逆方向復号結果のうち片方向の復号結果にし
か誤りが検出されない場合(この例では、順方向復号結
果にのみ誤りが検出されている)は、誤り検出位置の符
号語に対する復号値を放棄し、それ以後の符号語に対す
る復号値は逆方向の復号結果を使用する。
Also, as shown in FIG. 2C, when an error is detected only in the one-way decoding result of the forward decoding result and the backward decoding result (in this example, the error is detected only in the forward decoding result). Has been detected), the decoded value for the codeword at the error detection position is discarded, and the decoded values for the subsequent codewords use the decoded results in the reverse direction.

【0027】さらに、図2(d)に示すように同一の符
号語について順方向復号結果および逆方向復号結果の両
方に誤りが検出される場合は、図2(c)と同様に誤り
検出位置の符号語に対する復号値は放棄し、それ以後の
符号語に対する復号値としては逆方向の復号結果を使用
する。
Further, when an error is detected in both the forward decoding result and the backward decoding result for the same code word as shown in FIG. Are discarded, and the decoded values for the subsequent code words use the decoded results in the reverse direction.

【0028】符号語テーブル作成部101では、情報シ
ンボルの生起確率に基づいて順方向にも逆方向にも復号
可能な符号の符号語テーブルを作成する。符号語テーブ
ル作成部101によって作成された符号語テーブルは、
符号化部114内の符号語テーブル102と、復号化部
115内の順方向符号語テーブル110および逆方向符
号語テーブル112に送られる。順方向復号木作成部1
11では、順方向符号語テーブル110から順方向復号
木を作成する。また、逆方向復号木作成部113では、
逆方向符号語テーブル112から逆方向復号木を作成す
る。
The codeword table creation unit 101 creates a codeword table of codes that can be decoded in both forward and backward directions based on the occurrence probability of information symbols. The codeword table created by the codeword table creation unit 101 is
It is sent to the codeword table 102 in the encoding unit 114 and to the forward codeword table 110 and the backward codeword table 112 in the decoding unit 115. Forward decoding tree creation unit 1
At 11, a forward decoding tree is created from the forward codeword table 110. Also, in the backward decoding tree creating unit 113,
A backward decoding tree is created from the backward codeword table 112.

【0029】図3は、符号語テーブル作成部101の構
成を示すブロック図である。符号選択部21は、情報シ
ンボルの生起確率の情報を入力として、この情報に基づ
いて選択可能な符号系の中から最も平均符号長の小さい
ものを選択し、選択結果を符号語構成部22に送る。符
号語構成部22では、符号語選択部21で選択された符
号の符号語を構成して、符号語テーブルを作成する。符
号語構成部22で作成された符号語テーブルは、符号化
部114内の符号語テーブル102および復号化部11
5内の順方向符号語テーブル110に送られる。復号化
部115内の逆方向符号語テーブル112には、順方向
とは逆向きに記述された符号語テーブルが送られる。
FIG. 3 is a block diagram showing the configuration of the codeword table creation unit 101. The code selection unit 21 receives information on the occurrence probabilities of the information symbols as input, selects a code system having the smallest average code length from the selectable code systems based on this information, and sends the selection result to the codeword configuration unit 22. send. The codeword configuration unit 22 configures the codeword of the code selected by the codeword selection unit 21 and creates a codeword table. The codeword table created by the codeword configuration unit 22 is stored in the codeword table 102 and the decoding unit 11 in the encoding unit 114.
5 to the forward codeword table 110. To the backward codeword table 112 in the decoding unit 115, a codeword table described in a direction opposite to the forward direction is sent.

【0030】符号選択部21では、入力された情報シン
ボルを生起確率が大きい順に並べ替えてS={S1 ,S
2 ,…,Sn }とし、これらの情報シンボルSの生起確
率P={p1 ,p2 ,…,pn }に基づいて、構成可能
な符号の集合Cの中から、
The code selecting section 21 rearranges the input information symbols in descending order of the probability of occurrence to obtain S = {S1, S
2,..., Sn}, and based on the probability of occurrence P of these information symbols S = {p1, p2,.

【0031】[0031]

【数1】 (Equation 1)

【0032】を満足する符号cを選択する。ここで、L
iは符号語構成部22より与えられる符号語の重みによ
って計算することができる符号長である。この場合の符
号語の重みとは、符号語における“1”または“0”の
数をいう。
The code c satisfying the above is selected. Where L
i is a code length that can be calculated by the weight of the code word provided from the code word forming unit 22. The code word weight in this case refers to the number of “1” or “0” in the code word.

【0033】以下、符号語構成部22における符号語の
構成方法について述べる。
Hereinafter, a method of forming a code word in the code word forming unit 22 will be described.

【0034】図4は、本実施形態による可変長符号の基
となる重みが一定の2進符号系列の作り方の例を示して
いる。図4(a)に示すように、start地点からe
nd地点に至る格子状の有向グラフを形成する。この有
向グラフについてstart地点からend地点までの
経路をたどる際、左側の経路を選択した時は“0”、右
側の経路を選択した時は“1”をそれぞれ対応させるこ
とにより、図4(b)に示す2進符号系列を生成する。
この例では、符号長が5ビットで、重み(“1”の数)
が2の2進符号系列を生成している。一般に、符号長が
nビットで重みがwの2進符号系列は、n個からw個を
選択する組み合わせの数だけ存在する。ここでは、5個
から2個を選択する組み合わせの数=10個の2進符号
系列が存在することになる。
FIG. 4 shows an example of how to form a binary code sequence having a constant weight serving as a basis of a variable length code according to the present embodiment. As shown in FIG. 4A, from the start point e
Form a grid-like directed graph to the nd point. When following the route from the start point to the end point in this directed graph, “0” is selected when the left route is selected, and “1” is selected when the right route is selected. Is generated.
In this example, the code length is 5 bits and the weight (the number of “1”)
Generates a binary code sequence of 2. In general, there are as many binary code sequences having a code length of n bits and a weight of w as the number of combinations that select w from n. Here, there will be 10 binary code sequences, the number of combinations of selecting two out of five.

【0035】図5は、符号語構成部22における順方向
にも逆方向にも復号可能な可変長符号(以下、リバーシ
ブル符号という)の符号語の第1の構成方法を示してい
る。まず、図5の左側に示すように、符号長が短い順に
(情報シンボル−1)個(この場合は、9個)だけ、図
4の方法によって重み(“1”の数)が一定(この場合
は、1個)の2進符号系列を作成する。次に、図5の右
側に示すように、この2進符号系列のそれぞれの先頭と
末尾に“1”を追加し、最も短い符号には0”を割り当
てることによって、リバーシブル符号の符号語を構成す
る。このリバーシブル符号は、情報シンボルAに対して
は符号“0”、それ以外の情報シンボルB〜Jに対して
は符号が“1”から必ず始まり、“1”が全部で3個出
現したら符号が終わる符号構成、つまり符号の区切り
(符号長)が分かる構成となっている。
FIG. 5 shows a first method of constructing a codeword of a variable length code (hereinafter, referred to as a reversible code) that can be decoded in the forward and backward directions in the codeword constructing section 22. First, as shown on the left side of FIG. 5, the weight (the number of “1”) is constant (the number of “1”) by the method of FIG. 4 only for (information symbols−1) (in this case, 9) in ascending code length. In this case, one binary code sequence is created. Next, as shown on the right side of FIG. 5, "1" is added to the beginning and end of each of the binary code sequences, and "0" is assigned to the shortest code, thereby forming a codeword of the reversible code. This reversible code always starts with a code “0” for information symbol A and a code “1” for other information symbols B to J. If three “1” appear in all, This is a code configuration in which the code ends, that is, a configuration where the code delimiter (code length) is known.

【0036】可変長符号がリバーシブル符号、すなわち
順方向にも逆方向にも復号可能な符号であるための必要
十分条件は、全ての符号語が順方向の復号木の葉と逆方
向の復号木の葉に割り当てられることである。復号木の
葉とは、復号木の末端、つまりそれより先には何も無い
個所をいう。例えば、図5の可変長符号は、全ての情報
シンボルA〜Jに対応する符号語が図6(a)に示す順
方向の復号木の葉にも、図6(b)の逆方向の復号木の
葉にも割り当てられることから、順方向にも逆方向にも
復号可能であることが分かる。
A necessary and sufficient condition for a variable length code to be a reversible code, that is, a code that can be decoded in both the forward and reverse directions, is that all codewords are assigned to the leaves of the forward and backward decoding trees. Is to be done. The leaf of the decoding tree is the end of the decoding tree, that is, a place where there is nothing earlier. For example, in the variable-length code of FIG. 5, the codewords corresponding to all the information symbols A to J are the leaves of the forward decoding tree shown in FIG. 6A and the leaves of the backward decoding tree shown in FIG. , It can be seen that decoding can be performed in both the forward and reverse directions.

【0037】図5の可変長符号の符号語構成方法のパラ
メータは、符号語中の“1”の数を重みとし、重みを2
以上の自然数wとすることにより、様々な情報シンボル
の生起確率に対応することができる。もちろん、ビット
を反転させて、“0”の数を重みと考えて議論しても同
様である。
The parameters of the method of constructing the code word of the variable length code shown in FIG.
By setting the above natural number w, it is possible to cope with the occurrence probabilities of various information symbols. Of course, the same applies to the case where the bit is inverted and the number "0" is considered as a weight and discussed.

【0038】図7は、符号語構成部22におけるリバー
シブル符号の符号語の第2の構成方法を示している。ま
ず、図7の左側に示すように、符号長が短い順に(情報
シンボル/2)個だけ、図4の方法によって重み
(“1”の数)が一定(この場合は、1個)の2進符号
系列を作成する。次に、図7の中央に示すように、この
2進符号系列のそれぞれの先頭と末尾に“1”を追加
し、さらに図7の右側に示すように、各符号語をビット
反転させた符号語を追加する。
FIG. 7 shows a second method of forming a codeword of a reversible code in the codeword forming unit 22. First, as shown on the left side of FIG. 7, the weight (the number of “1”) is constant (in this case, one) by the method of FIG. Create a hexadecimal code sequence. Next, as shown in the center of FIG. 7, "1" is added to the beginning and end of each of the binary code sequences, and further, as shown on the right side of FIG. Add words.

【0039】この可変長符号では、各符号の最初にある
シンボルの個数をカウントすることによって符号長が分
かる。図7の例では、各符号の最初にあるシンボルが4
つ出現したら符号が終わる符号構成、つまり符号の区切
り(符号長)が分かる符号構成となっている。
In this variable length code, the code length can be determined by counting the number of symbols at the beginning of each code. In the example of FIG. 7, the first symbol of each code is 4
The code configuration is such that the code ends when it appears once, that is, the code configuration allows the code delimiter (code length) to be known.

【0040】この図7の可変長符号は、全ての情報シン
ボルA〜Jに対応する符号語が図8(a)に示す順方向
の復号木の葉にも、図8(b)の逆方向の復号木の葉に
も割り当てられることから、順方向にも逆方向にも復号
可能であることが分かる。
In the variable length code of FIG. 7, the codewords corresponding to all the information symbols A to J are also applied to the leaves of the decoding tree in the forward direction shown in FIG. Since it is also assigned to the leaves of the tree, it can be seen that decoding can be performed in both the forward and reverse directions.

【0041】図9は、符号語構成部22におけるリバー
シブル符号の符号語の第3の構成方法を示している。こ
のリバーシブル符号は、“0”と“1”の数が同じ数に
なることで、符号語の符号長が分かるような符号構成と
なっている。すなわち、図9(a)に示す格子状の有向
グラフを考え、この有向グラフについてstart地点
から出発して左側の経路を選択した時は“0”、右側の
経路を選択した時は“1”をそれぞれ対応させ、sta
rt地点を通る対角線上の黒丸の点に到達する経路を符
号語として生成する。
FIG. 9 shows a third method of forming a codeword of a reversible code in the codeword forming unit 22. The reversible code has a code configuration in which the number of “0” and “1” are the same, so that the code length of the codeword can be known. That is, considering the lattice-like directed graph shown in FIG. 9A, “0” is selected when the left route is selected and the right route is selected, and “1” is selected for the directed graph, starting from the start point. Correspond, sta
A path that reaches a diagonal black dot passing through the rt point is generated as a codeword.

【0042】この場合、全ての情報シンボルA〜Jに対
応する符号語が図10(a)に示す順方向の復号木の葉
にも、図10(b)の逆方向の復号木の葉にも割り当て
られることから、順方向にも逆方向にも復号可能である
ことが分かる。
In this case, the code words corresponding to all the information symbols A to J are assigned to the leaves of the forward decoding tree shown in FIG. 10A and the leaves of the backward decoding tree shown in FIG. 10B. Thus, it can be seen that decoding can be performed in both the forward direction and the reverse direction.

【0043】次に、本発明に係るリバーシブル符号の短
縮化方法について説明する。情報シンボルの数、つまり
可変長符号の符号数は有限であるため、可変長符号の一
部の符号を短縮化することが可能である。ここで、短縮
化とは他の符号の符号長を増やすことなく、一部の符号
の符号長を縮めることをいう。図11は、リバーシブル
符号の短縮化方法の一例を示している。
Next, a method for shortening a reversible code according to the present invention will be described. Since the number of information symbols, that is, the number of codes of the variable length code is finite, it is possible to shorten some codes of the variable length code. Here, shortening refers to reducing the code length of some codes without increasing the code length of other codes. FIG. 11 shows an example of a method for shortening a reversible code.

【0044】例えば、図7に示したリバーシブル符号は
情報シンボルG,H,I,Jに対応する符号語の末尾の
1ビットを削除しても、順方向および逆方向のいずれの
方向からも復号可能である。これを利用して、図11で
は情報シンボルG,H,I,Jに対応する4つの符号語
の符号長を短縮化している。
For example, in the reversible code shown in FIG. 7, even if the last bit of the codeword corresponding to the information symbols G, H, I, and J is deleted, decoding can be performed in either the forward direction or the reverse direction. It is possible. By utilizing this, in FIG. 11, the code lengths of the four codewords corresponding to the information symbols G, H, I, and J are reduced.

【0045】そして、この図11に示す可変長符号は、
全ての情報シンボルA〜Jに対応する符号語が図12
(a)に示す順方向の復号木の葉にも、図12(b)の
逆方向の復号木の葉にも割り当てられることから、順方
向にも逆方向にも復号可能であることが分かる。
The variable length code shown in FIG.
Code words corresponding to all information symbols A to J are shown in FIG.
Since it is assigned to both the leaves of the forward decoding tree shown in FIG. 12A and the leaves of the backward decoding tree in FIG. 12B, it can be seen that decoding is possible in both the forward and backward directions.

【0046】次に、図13を参照して本発明に係るリバ
ーシブル符号の拡張化方法について説明する。リバーシ
ブル符号の拡張化は、各符号の先頭および末尾の少なく
とも一方に等長符号を付加して、同一の符号長の符号語
数を拡大することで実現することができる。図13の例
では、左側に示すリバーシブル符号のそれぞれの末尾に
2ビットの等長符号を付加している。この場合、リバー
シブル符号の各符号は全体的に符号長が2ビット増加し
ているが、同じ符号長の符号語の数は4倍に拡大されて
いる。一般に、nビットの等長符号を付加した場合、符
号長は全体的にnビット増加するが、同じ符号長の符号
語の数を2n 倍にすることができる。等長符号は、明ら
かにリバーシブル符号なので、等長符号をリバーシブル
符号の先頭や末尾に付加しても、やはりリバーシブル符
号である。
Next, a method for extending a reversible code according to the present invention will be described with reference to FIG. Extension of a reversible code can be realized by adding an equal-length code to at least one of the beginning and end of each code to increase the number of codewords having the same code length. In the example of FIG. 13, a 2-bit equal length code is added to the end of each of the reversible codes shown on the left side. In this case, the code length of each code of the reversible code is increased by 2 bits as a whole, but the number of codewords having the same code length is quadrupled. In general, when an n-bit equal-length code is added, the code length increases by n bits as a whole, but the number of code words having the same code length can be increased by 2 n times. Since the isometric code is obviously a reversible code, even if the isometric code is added to the beginning or end of the reversible code, it is still a reversible code.

【0047】図14は、英語のアルファベットである情
報シンボルに対して本発明により可変長符号化を行って
得られたリバーシブル符号を公知例(特開平5−300
027号公報)に開示されているリバーシブル符号と比
較して示したものである。図14中に示される本発明に
基づくリバーシブル符号は、図5で示した方法において
符号語の重みを0とした時の符号を末尾に2ビットの等
長符号を付加することによって拡張化した符号である。
FIG. 14 shows a known example (Japanese Unexamined Patent Publication No. 5-300) of a reversible code obtained by subjecting an information symbol, which is an English alphabet, to variable length coding according to the present invention.
027) in comparison with the reversible code disclosed in Japanese Patent Application Laid-Open No. 027). The reversible code according to the present invention shown in FIG. 14 is a code obtained by expanding a code when the weight of a code word is set to 0 in the method shown in FIG. It is.

【0048】この本発明に基づくリバーシブル符号は、
順方向のみ復号可能な可変長符号の最適符号であるハフ
マン符号には劣るものの、公知例に開示されたリバーシ
ブル符号と比較して平均符号長が短く、優れた性能を持
っていることが分かる。これは、公知例のリバーシブル
符号は順方向にのみ復号可能な可変長符号であるハフマ
ン符号の末尾にビットを付加したものであるのに対し
て、本発明では余分なビットを付加することなく、初め
からリバーシブル符号を構成するので、無駄なビットパ
ターンが少ないことによる。
The reversible code according to the present invention is:
Although it is inferior to the Huffman code, which is the optimal code of the variable length code that can be decoded only in the forward direction, the average code length is shorter than that of the reversible code disclosed in the known example, indicating that the Huffman code has excellent performance. This is because the known reversible code is a variable-length code that can be decoded only in the forward direction with a bit added to the end of a Huffman code, whereas the present invention does not add an extra bit, This is because the reversible code is formed from the beginning, so that there is little useless bit pattern.

【0049】次に、本発明の他の実施形態を説明する。
図15は、本発明の他の実施形態に係る可変長符号化/
復号化装置の構成を示すブロック図である。本実施形態
の可変長符号化/復号化装置は、大きく分けて符号語テ
ーブル作成部201、符号化部213、伝送系または蓄
積系205および復号化部214からなる。
Next, another embodiment of the present invention will be described.
FIG. 15 is a diagram illustrating a variable-length coding / coding scheme according to another embodiment of the present invention.
It is a block diagram which shows the structure of a decoding device. The variable-length encoding / decoding device according to the present embodiment is roughly divided into a codeword table creation unit 201, an encoding unit 213, a transmission or storage system 205, and a decoding unit 214.

【0050】これら各部の機能について簡単に説明する
と、符号語テーブル作成部201は情報シンボルの生起
確率に基づき符号語テーブルを作成して、符号化部21
3内の符号語テーブル202に送り、さらに作成した符
号語テーブルの符号語のパラメータを復号化部214内
の復号グラフ・復号値テーブル作成部208に送る。符
号化部213は、情報シンボルを可変長符号に符号化
し、その可変長符号を符号化データとして伝送系また蓄
積系205へ出力する。復号化部214は、伝送系また
は蓄積系205を介して入力されてきた符号化データを
復号して元の情報シンボルを再生する。
The function of each of these units will be briefly described. The codeword table creation unit 201 creates a codeword table based on the occurrence probability of information symbols,
3 and sends the created codeword parameters of the codeword table to the decoded graph / decoded value table creation unit 208 in the decoding unit 214. The encoding unit 213 encodes the information symbol into a variable length code, and outputs the variable length code to the transmission system or the storage system 205 as encoded data. Decoding section 214 decodes the encoded data input via transmission system or storage system 205 to reproduce the original information symbols.

【0051】次に、本実施形態の各部の詳細な構成と動
作を説明する。
Next, the detailed configuration and operation of each part of the present embodiment will be described.

【0052】符号化部213において、入力された情報
シンボルは符号化器203に入力される。符号語テーブ
ル202は、符号語テーブル作成部201によって予め
作成された情報シンボルと可変長符号の符号語とを対応
させて格納している。但し、符号語テーブル202には
入力され得る情報シンボルの全てに対応する格納されて
いる符号語が格納されているわけではなく、比較的出現
頻度の高い一部の情報シンボルに対応した符号語のみが
格納されているものとする。符号化器203は符号語テ
ーブル202に格納されている符号語の中から、入力さ
れた情報シンボルに対応した符号語を選択して符号化デ
ータとして出力する。
[0052] In the coding section 213, the input information symbols are input to the encoder 203. The codeword table 202 stores information symbols created in advance by the codeword table creation unit 201 and codewords of variable-length codes in association with each other. However, the codewords stored in the codeword table 202 do not necessarily correspond to all of the information symbols that can be input. Is stored. The encoder 203 selects a codeword corresponding to the input information symbol from the codewords stored in the codeword table 202 and outputs the selected codeword as encoded data.

【0053】一方、符号化部213に符号語テーブル2
02に対応する符号語が存在しない情報シンボル、つま
り出現頻度の比較的低い情報シンボルが入力されたとき
は、その情報シンボルに対応した固定長符号を固定長符
号符号化部204で作成し、さらに符号語テーブル20
2中のエスケープ符号を固定長符号の先頭と末尾に付加
して符号語とし、これを符号化データとして出力する。
On the other hand, the encoding unit 213 stores the codeword table 2
When an information symbol having no code word corresponding to 02, that is, an information symbol having a relatively low appearance frequency is input, a fixed-length code corresponding to the information symbol is created by the fixed-length code encoding unit 204, and Codeword table 20
2 is added to the beginning and end of the fixed-length code to form a codeword, which is output as encoded data.

【0054】こうして符号化部213内の符号化器20
3から出力された符号化データは、伝送系または蓄積系
205を通して復号化部214に送られる。この際、符
号化データには一定周期毎に同期コードが挿入される。
Thus, the encoder 20 in the encoder 213
3 is transmitted to the decoding unit 214 through the transmission system or the storage system 205. At this time, a synchronization code is inserted into the encoded data at regular intervals.

【0055】復号化部214は、同期コード検出部20
6、バッファ207、復号グラフ・復号値テーブル作成
部208、順方向復号化器209、固定長復号化部21
0、逆方向復号化器211および復号値判定部212か
らなり、まず伝送系または蓄積系205より入力された
符号化データから同期コード検出部206で同期コード
を検出し、同期コードと同期コードの間の符号化データ
をバッファ207に蓄積する。順方向復号化器209で
は、バッファ207に蓄積された符号化データの先頭か
ら復号を開始し、逆方向復号化器211では、バッファ
207に蓄積された符号化データの末尾から復号を開始
する。復号値判定部212では、順方向復号化器209
によって得られた復号結果(順方向復号値という)と、
逆方向復号化器211によって得られた復号結果(逆方
向復号値という)から復号値を判定し、最終的な復号結
果を出力する。
The decoding section 214 is provided with the synchronization code detecting section 20.
6, buffer 207, decoded graph / decoded value table creating section 208, forward decoder 209, fixed length decoding section 21
0, a backward decoder 211 and a decoded value judging unit 212. First, a synchronous code detecting unit 206 detects a synchronous code from encoded data input from a transmission system or a storage system 205, and outputs a synchronous code and a synchronous code. The encoded data between them is stored in the buffer 207. The forward decoder 209 starts decoding from the beginning of the coded data stored in the buffer 207, and the backward decoder 211 starts decoding from the end of the coded data stored in the buffer 207. In the decoded value determination unit 212, the forward decoder 209
The decoding result (referred to as forward decoding value) obtained by
A decoding value is determined from a decoding result (referred to as a backward decoding value) obtained by the backward decoder 211, and a final decoding result is output.

【0056】図16は、図15中の符号語テーブル作成
部201において、固定長符号の先頭と末尾にエスケー
プ符号を付加して符号語を構成する方法を示した図であ
る。図16(a)に示すように、符号語テーブル作成部
201が作成する符号語は、情報シンボルが“A”以外
のときは、“1”の数が3つ出現することで符号の区切
りがわかるリバーシブル符号を基本としている。このリ
バーシブル符号を符号(1)と呼ぶこととする。
FIG. 16 is a diagram showing a method of constructing a code word by adding an escape code to the beginning and end of a fixed-length code in the code word table creating unit 201 in FIG. As shown in FIG. 16A, when the information symbol is other than “A”, the code word created by the code word table creation unit 201 has a code delimiter because three “1” s appear. It is based on reversible codes that can be understood. This reversible code is referred to as code (1).

【0057】一方、図16(b)に示す符号(2)は、
符号(1)の情報シンボル“C”に対応する符号語“1
011”を固定長符号の先頭と末尾を示すためのエスケ
ープ符号として、3ビットの固定長符号の先頭と末尾に
付加することにより構成された符号語を符号(1)に新
たに加えたものとなっている。但し、符号(2)のうち
符号(1)に相当するリバーシブル符号の部分は、符号
(2)でエスケープ符号として用いた符号語“101
1”は使用せず、符号(1)により1個少ない情報シン
ボルA〜Iに対応した符号語のみを用いている。図16
(a)(b)を比較して明らかなように、符号(2)は
符号化できる情報シンボルの数が符号(1)の「10」
から「17」に増えている。
On the other hand, reference numeral (2) shown in FIG.
Codeword “1” corresponding to information symbol “C” of code (1)
"011" as an escape code for indicating the beginning and end of the fixed-length code, a code word formed by adding to the beginning and end of the 3-bit fixed-length code, a code word newly added to code (1). However, the part of the reversible code corresponding to the code (1) in the code (2) is the code word “101” used as the escape code in the code (2).
1 "is not used, and only code words corresponding to information symbols A to I which are one less than code (1) are used.
As is clear from the comparison between (a) and (b), the code (2) has the number of information symbols that can be coded is “10” of the code (1).
To "17".

【0058】このような符号(2)を復号するために
は、図16(a)(b)から分かるように順方向から復
号する場合も逆方向から復号する場合も、必ず符号
(1)を一度復号することになり、また固定長符号は順
方向からも逆方向からも復号可能であるため、符号
(1)が順方向からも逆方向からも復号可能ならば、符
号(2)も順方向からも逆方向からも復号可能となる。
In order to decode such a code (2), as can be seen from FIGS. 16 (a) and 16 (b), the code (1) must be always decoded regardless of whether it is decoded in the forward direction or in the reverse direction. Since the fixed-length code can be decoded in both the forward and reverse directions, if the code (1) can be decoded in both the forward and reverse directions, the code (2) is also decoded. Decoding is possible from both directions.

【0059】従来のリバーシブル符号の場合は、入力さ
れ得る情報シンボルに対応する符号語を全て符号語テー
ブルとして符号化部213および復号化部214におい
て用意しておく必要があった。これに対し、符号(2)
によると、固定長符号の部分については、3ビットの2
進符号として別途に固定長符号符号化部204および固
定長符号復号化部210として用意できるので、符号語
テーブル202には符号(1)の符号語だけを格納して
おけばよい。したがって、従来のリバーシブル符号と比
較して、可変長符号化/復号化装置の記憶量を大幅に削
減することが可能となる。
In the case of the conventional reversible code, it is necessary to prepare all the codewords corresponding to the information symbols that can be inputted in the coding section 213 and the decoding section 214 as a codeword table. On the other hand, code (2)
According to the above, for the fixed-length code part, 3 bits 2
Since the fixed-length code encoding unit 204 and the fixed-length code decoding unit 210 can be separately prepared as binary codes, the codeword table 202 needs to store only the codeword of the code (1). Therefore, compared with the conventional reversible code, the storage amount of the variable-length encoding / decoding device can be significantly reduced.

【0060】復号グラフ・復号値テーブル作成部208
は、Shalkwijkのアルゴリズムを基にした復号
グラフと、復号値テーブルを作成し、順方向復号化器2
09および逆方向復号化器211は、これらの復号グラ
フおよび復号値テーブルに基づいて復号化を行う。
Decoded graph / decoded value table creation unit 208
Creates a decoding graph and a decoding value table based on the Sharkwijk algorithm, and generates a forward decoder 2
09 and the backward decoder 211 perform decoding based on the decoded graph and the decoded value table.

【0061】図17は、重み一定の2進符号系列の数え
上げの方法を示している。重み一定の2進符号系列の数
え上げを行うアルゴリズムとしては、J.P.M.Shalkwijk:
“Analgorithm for source coding”,IEEE Trans.Infr
om Theory,vol.IT-18,no.3,pp.395-399,May 1972.がS
halkwijkのアルゴリズムとしてよく知られてい
る。Shalkwijkのアルゴリズムでは、図17
(a)に示すように「パスカルの三角形」を基本とし
た、START地点からEND地点に至る格子状の有向
グラフを形成する。各節点に数字で示された値は、ST
ART地点の節点の値を1として、各節点に入ってくる
2つの矢の起点にある節点の値の合計値となっている。
すなわち、各節点の値はパスカルの三角形によって決定
される。
FIG. 17 shows a method of counting a binary code sequence having a constant weight. JPMShalkwijk is an algorithm for counting binary code sequences with a constant weight:
“Analgorithm for source coding”, IEEE Trans.Infr
om Theory, vol. IT-18, no. 3, pp. 395-399, May 1972.
It is well-known as a halkwijk algorithm. In the Sharkwijk algorithm, FIG.
As shown in (a), a grid-like directed graph from the START point to the END point is formed based on the “Pascal's triangle”. The value indicated by a number at each node is ST
Assuming that the value of the node at the ART point is 1, it is the sum of the values of the nodes at the starting points of the two arrows entering each node.
That is, the value of each node is determined by the Pascal's triangle.

【0062】そして、図17(a)の有向グラフについ
て、入力される情報シンボルに従ってSTART地点か
らEND地点までの経路をたどる際に、左側の経路
(矢)を選択したときには符号語の“0”、右側の経路
(矢)を選択したときには符号語の“1”をそれぞれ対
応させることにより、重み2の2進符号系列を生成する
ことができる。ここで、“0”を選択したときに矢の終
点にある節点の値から矢の起点にある節点の値を引いた
値を合計した値が、その2進符号系列の同一符号長の符
号語についての順序値となる。例えば入力される情報シ
ンボルが“01001”であれば、3つある“0”に対
して節点の値の差分の合計である(1−1)+(3−
2)+(4−3)=2が順序値となる。ここで、順次値
とは同一符号長の異なる符号語を順序付けるための値で
ある。図17(b)は、この場合の情報シンボルと順序
値との関係を示している。
In the directed graph of FIG. 17A, when following the route from the START point to the END point according to the input information symbol, when the left-side route (arrow) is selected, the codeword “0” is selected. When the path (arrow) on the right side is selected, a binary code sequence having a weight of 2 can be generated by associating the codeword “1” with each other. Here, the value obtained by subtracting the value of the node at the start of the arrow from the value of the node at the end of the arrow when “0” is selected is the code word of the same code length of the binary code sequence. Is the ordinal value of For example, if the input information symbol is "01001", the sum of the differences of the node values with respect to three "0" s is (1-1) + (3-
2) + (4-3) = 2 is the order value. Here, the sequential value is a value for ordering different code words having the same code length. FIG. 17B shows the relationship between information symbols and order values in this case.

【0063】このShalkwijkのアルゴリズムを
符号化に適用した例は公知であり、その場合は上記の順
序値に相当する値を2進符号に変換することによって符
号化を行う。これに対し、本実施形態ではこのアルゴリ
ズムを以下に説明するように復号化に用いる。
An example in which the Sharkwijk algorithm is applied to encoding is known. In this case, encoding is performed by converting a value corresponding to the above order value into a binary code. In contrast, in the present embodiment, this algorithm is used for decoding as described below.

【0064】すなわち、復号グラフ・復号値テーブル作
成部208では、上述したShalkwijkのアルゴ
リズムを基にして有向グラフを復号グラフとして作成す
る。すなわち、この復号グラフはパスカルの三角形によ
って決まる値を節点の値とし、符号語の“1”および
“0”を矢とした有向グラフであり、その一例を図18
(a)に示す。図18(b)は、この復号グラフを用い
た順方向復号化器208および逆方向復号化器211に
おける復号値の計算方法の一例を示している。
That is, the decoding graph / decoding value table creation unit 208 creates a directed graph as a decoding graph based on the above-mentioned Sharkwijk algorithm. That is, this decoded graph is a directed graph in which values determined by Pascal's triangle are used as node values and codewords "1" and "0" are used as arrows.
(A). FIG. 18B shows an example of a method of calculating a decoded value in the forward decoder 208 and the backward decoder 211 using the decoded graph.

【0065】図16(a)に示した符号(1)は、先頭
が“0”以外のときは“1”が3つ出現した地点で区切
りが分かるリバーシブル符号である。この符号(1)の
リバーシブル符号の復号値を計算する際には、順方向に
ついてはリバーシブル符号の先頭が“0”ならば復号値
を0とし、それ以外のときは先頭と末端の“1”を削除
した後、Shalkwijkのアルゴリズムによって順
序値を計算する。今、復号しようとしている符号語より
符号長の短い符号語の数は、図18(a)におけるEN
D地点の右斜めの節点の値の合計+1となるので、その
値を順序値に足したものが復号値となる。
Code (1) shown in FIG. 16 (a) is a reversible code in which, when the head is other than "0", a break can be recognized at the point where three "1" appear. When calculating the decoded value of the reversible code of the code (1), if the head of the reversible code is "0" in the forward direction, the decoded value is set to 0; Is deleted, and the order value is calculated by the Sharkwijk algorithm. The number of codewords having a code length shorter than the codeword to be decoded is EN EN in FIG.
Since the sum of the values of the diagonal right nodes at the point D is +1, the sum of the value and the order value is the decoded value.

【0066】一方、逆方向については上述の順方向の場
合と同様に、まずリバーシブル符号の先頭が“0”なら
ば復号値を0とし、それ以外のときは先頭と末端の
“1”を削除し、さらに残りの部分を反転させた後、S
halkwijkのアルゴリズムで順序値を計算する。
そして、この順序値にEND地点の右斜め上にある節点
の合計+1を足したものを復号値とする。
On the other hand, in the reverse direction, as in the case of the above-mentioned forward direction, first, if the head of the reversible code is "0", the decoded value is set to 0; otherwise, the head and tail "1" are deleted. Then, after inverting the remaining part, S
The order value is calculated by the algorithm of halkwijk.
Then, a value obtained by adding +1 to the sum of the nodes at the upper right of the END point to the order value is set as a decoded value.

【0067】図18(a)(b)を参照して具体的に説
明すると、例えばリバーシブル符号の復号対象の符号語
が“10101”ならば、まず先頭と末端の“1”を削
除して“010”とする。この“010”に対してSh
alkwijkのアルゴリズムで順序値を求めると、2
つある“0”に対して、(1−1)+(3−2)=1と
なる。この場合のEND地点の斜め右上にある節点の値
の合計は1+2=3なので、この値+1(=4)を順序
値(=1)に加えて、復号値が5として求まることにな
る。
More specifically, with reference to FIGS. 18A and 18B, for example, if the code word to be decoded for the reversible code is “10101”, first, the leading and trailing “1” are deleted and “ 010 ". Sh for this “010”
When the order value is obtained by the algorithm of alkwijk, 2
For one “0”, (1-1) + (3-2) = 1. In this case, the sum of the values of the nodes at the diagonally upper right of the END point is 1 + 2 = 3, so this value + 1 (= 4) is added to the order value (= 1), and the decoded value is obtained as 5.

【0068】このような復号グラフを用いて復号化を行
うと、記憶量を大きく低減することができる。図19
(a)(b)は、従来の復号木を用いる復号化方法と、
本実施形態による復号グラフを用いる復号化方法で必要
な記憶量の違いを示した図である。両者を節点の数で比
較すると、各節点から出る矢の数は共に2つで同じであ
るが、各節点に入ってくる矢は図19(a)の復号木の
場合、必ず1つである。これに対して、図19(b)の
復号グラフの場合は、各節点に2つの矢が入ってくるの
で、その分だけ同じ符号語で必要とする節点の総数が少
なくなる。この例では、図19(a)の復号木が15個
の節点を必要としているのに対し、図19(b)の復号
グラフでは8個の節点で済む。従って、復号グラフを用
いる本実施形態の復号化方法は、従来の復号木を用いる
方法よりも必要な記憶量が少なくなるという利点があ
る。
When decoding is performed using such a decoding graph, the amount of storage can be greatly reduced. FIG.
(A) and (b) show a decoding method using a conventional decoding tree;
FIG. 11 is a diagram illustrating a difference in storage amount required in a decoding method using a decoding graph according to the present embodiment. Comparing both with the number of nodes, the number of arrows coming out of each node is the same for both, but the number of arrows coming into each node is always one in the case of the decoding tree in FIG. . On the other hand, in the case of the decoded graph of FIG. 19B, since two arrows enter each node, the total number of nodes required by the same codeword is reduced by that amount. In this example, the decoding tree in FIG. 19A requires 15 nodes, whereas the decoding graph in FIG. 19B requires only 8 nodes. Therefore, the decoding method of the present embodiment using the decoding graph has an advantage that the required storage amount is smaller than that of the conventional method using the decoding tree.

【0069】また、本実施形態では図16(b)に示し
たエスケープ符号を付加した符号(2)を復号するため
に、図20(a)に示す符号(1)の復号値テーブル
と、図20(b)に示す固定長符号の復号値テーブルの
2つを用意し、符号(1)の復号値テーブルでエスケー
プ符号が復号されたときは、固定長符号の復号値テーブ
ルを読みに行く。例えば、符号語が“10110011
011”の場合、先頭の“1011”、すなわちエスケ
ープ符号が復号されたら、次の3ビット“001”は固
定長符号であると見なして固定長符号復号化部210で
復号を行う。この場合、“001”の復号値として1が
得られるので、図20(a)の固定長符号の復号値テー
ブルから、復号結果は情報シンボル“K”となる。
In this embodiment, in order to decode the code (2) to which the escape code shown in FIG. 16B is added, the decoded value table of the code (1) shown in FIG. Two fixed value code decoded value tables shown in FIG. 20 (b) are prepared, and when the escape code is decoded in the code (1) decoded value table, the fixed length code decoded value table is read. For example, if the codeword is "10110011"
In the case of “011”, if the leading “1011”, that is, the escape code is decoded, the next three bits “001” are regarded as a fixed-length code and are decoded by the fixed-length code decoding unit 210. In this case, Since 1 is obtained as the decoded value of “001”, the decoded result is an information symbol “K” from the fixed-length code decoded value table of FIG.

【0070】次に、本発明を動画像符号化/復号化器に
適用した一実施形態について説明する。図21は、上述
した可変長符号化/復号化装置が組み込まれた動画像符
号化/復号化器の概略的構成を示すブロック図である。
Next, an embodiment in which the present invention is applied to a moving image encoder / decoder will be described. FIG. 21 is a block diagram showing a schematic configuration of a moving image encoder / decoder in which the above-described variable length encoding / decoding device is incorporated.

【0071】図21(a)に示す動画像符号化器709
において、情報源符号化器702で符号化されたデータ
は、動画像多重化部703で可変長符号化、通信路符号
化および多重化等が行われ、さらに伝送バッファ704
で伝送速度の平滑化がなされた後に、符号化データとし
て伝送系または蓄積系705に送り出される。符号化制
御部701は、伝送バッファ704のバッファ量を考慮
して、情報源符号化器702および動画像多重化部70
3の制御を行う。
The moving picture encoder 709 shown in FIG.
, The data coded by the information source coder 702 is subjected to variable-length coding, channel coding, multiplexing, and the like by a video multiplexing unit 703, and further to a transmission buffer 704.
After the transmission speed is smoothed in step (1), the data is sent to the transmission system or storage system 705 as encoded data. The encoding control section 701 considers the buffer amount of the transmission buffer 704 and takes into account the information source encoder 702 and the video multiplexing section 70.
3 is performed.

【0072】一方、図21(b)に示す動画像復号化器
710においては、伝送系または蓄積系705からの符
号化データが受信バッファ706に一旦溜められ、動画
像多重化分離部707で符号化データの多重化分離、通
信路符号復号化および可変長符号復号化が行われた後、
情報源復号化器708に送られ、最終的に動画像が復号
化される。
On the other hand, in the moving picture decoder 710 shown in FIG. 21B, the coded data from the transmission system or the storage system 705 is temporarily stored in the reception buffer 706, After the demultiplexing of the encoded data, channel code decoding and variable length code decoding,
The information is sent to the information source decoder 708, and the moving image is finally decoded.

【0073】図22は、図21における動画像符号化器
709および動画像多重化分離部707での動画像符号
化方式のシンタックスを示している。図22(a)に示
すピクチャ階層のうち、上位階層にはマクロブロックの
モード情報や動きベクトル情報やINTRA DCなど
のDCT係数以外の情報を配し、下位階層にはDCT係
数情報を配しており、下位階層部分に本発明によるリバ
ーシブル符号を適用している。
FIG. 22 shows the syntax of the moving picture coding method in the moving picture coder 709 and the moving picture multiplexing / demultiplexing section 707 in FIG. Among the picture layers shown in FIG. 22A, information other than DCT coefficients such as macroblock mode information and motion vector information and INTRA DC is arranged in an upper layer, and DCT coefficient information is arranged in a lower layer. Thus, the reversible code according to the present invention is applied to the lower layer part.

【0074】図23(a)(b)は、図21における動
画像多重化部703および動画像多重化分離部707の
より詳しい構成を示すブロック図である。図23(a)
に示す動画像多重化部703においては、図21の情報
源符号化器702からの符号化データのうち、マクロブ
ロックのモード情報や動きベクトル情報やINTRAD
Cなどの、DCT係数以外の情報は上位階層として、上
位階層可変長符号化器901で通常の可変長符号化が行
われた後、さらに上位階層通信路符号化器902で冗長
度は大きいが訂正能力の高い誤り訂正検出符号により通
信路符号化され、多重化部905に送られる。
FIGS. 23A and 23B are block diagrams showing a more detailed configuration of the moving picture multiplexing section 703 and the moving picture multiplexing / demultiplexing section 707 in FIG. FIG. 23 (a)
In the moving image multiplexing unit 703 shown in FIG. 21, among the encoded data from the information source encoder 702 in FIG.
Information other than DCT coefficients, such as C, is set as an upper layer, and after normal variable-length coding is performed by an upper-layer variable-length encoder 901, the redundancy is higher in an upper-layer communication channel encoder 902. The data is channel-coded by an error correction detection code having a high correction capability and sent to the multiplexing unit 905.

【0075】一方、情報源符号化器702からの符号化
データのうち、DCT係数は下位階層可変長符号化器9
03でリバーシブル符号に符号化され、さらに下位階層
通信路符号化器904で冗長度の少ない誤り訂正検出符
号により通信路符号化された後、多重化部905に送ら
れる。多重化部905では、上位階層の符号化データと
下位階層の符号化データを多重化し、伝送バッファ70
4に送る。
On the other hand, among the encoded data from the information source encoder 702, the DCT coefficient is
In step 03, the signal is encoded into a reversible code. In the lower layer channel encoder 904, the channel is encoded with an error correction detection code having a low degree of redundancy, and then sent to a multiplexing unit 905. The multiplexing unit 905 multiplexes the encoded data of the upper layer and the encoded data of the lower layer, and
Send to 4.

【0076】図23(b)に示す動画像多重化分離部7
07においては、まず受信バッファ706からの符号化
データが多重化分離部906で上位階層と下位階層に分
離される。上位階層の符号化データは上位階層通信路復
号化器907で復号され、その復号結果は上位階層可変
長復号化器909に送られる。下位階層の符号化データ
は下位階層通信路復号化器908で復号され、その復号
結果は下位階層可変長復号化器910に送られる。
The moving image demultiplexing / separating unit 7 shown in FIG.
At 07, first, the coded data from the reception buffer 706 is separated by the demultiplexer 906 into an upper layer and a lower layer. The encoded data of the upper layer is decoded by the upper layer channel decoder 907, and the decoding result is sent to the upper layer variable length decoder 909. The lower layer encoded data is decoded by the lower layer channel decoder 908, and the decoding result is sent to the lower layer variable length decoder 910.

【0077】下位階層可変長復号化器910はリバーシ
ブル符号の復号を行い、復号結果を情報源復号化器70
8および上位階層可変長復号化器909に送る。上位階
層可変長復号化器909は、上位階層の符号化データで
ある可変長符号の復号を行うと共に、下位階層可変長復
号化器910の復号結果を基に符号化結果の書き換えを
行う。
The lower layer variable length decoder 910 decodes the reversible code, and outputs the decoding result to the information source decoder 70.
8 and the upper layer variable length decoder 909. The upper layer variable length decoder 909 decodes a variable length code which is encoded data of an upper layer, and rewrites the encoding result based on the decoding result of the lower layer variable length decoder 910.

【0078】ここで、図23(a)中の下位階層可変長
符号化器903は図15中の符号化部213に、図23
(b)中の下位階層可変長復号化器910は図15中の
復号化部214にそれぞれ対応している。
Here, the lower-layer variable-length encoder 903 in FIG. 23A has the encoding unit 213 in FIG.
The lower layer variable length decoder 910 in (b) corresponds to the decoding unit 214 in FIG.

【0079】本実施形態の動画像符号化/復号化器に見
られるように、符号化方式に図22に示したようなシン
タックスがある場合には、可変長符号そのものを両方向
から復号できるのみでなく、シンタックス的にも両方向
から復号できるようにする必要がある。本実施形態で
は、以下に説明する符号語テーブルを用いることによっ
て、この要求を実現している。
As can be seen from the moving picture encoder / decoder of this embodiment, when the encoding scheme has the syntax shown in FIG. 22, the variable length code itself can be decoded from both directions. In addition, it is necessary to be able to decode from both directions in terms of syntax. In the present embodiment, this request is realized by using a codeword table described below.

【0080】図24〜図28は、下位階層可変長符号化
器903で用いるDCT係数の可変長符号の符号語テー
ブルの一例を示している。また、図29はエスケープ符
号の符号語テーブルを示している。
FIGS. 24 to 28 show examples of codeword tables of variable length codes of DCT coefficients used in the lower layer variable length encoder 903. FIG. FIG. 29 shows a codeword table of escape codes.

【0081】情報源符号化器702では、量子化後の8
×8のDCT係数のブロックについてはブロック内のス
キャンを行って、LAST(0:ブロックの最後でない
非零係数、1:ブロックの最後の非零係数)、RUN
(非零係数までの零ランの数)およびLEVEL(係数
の絶対値)を求め、動画像符号化器709に送る。
In the information source encoder 702, the 8
For a block with a DCT coefficient of × 8, scanning inside the block is performed, and LAST (0: non-zero coefficient not at the end of the block, 1: non-zero coefficient at the end of the block), RUN
(Number of zero runs up to non-zero coefficient) and LEVEL (absolute value of coefficient) are obtained and sent to the moving picture encoder 709.

【0082】動画像符号化器709内の下位階層可変長
符号化器903は、図24〜図25に示すINTRAお
よびINTERの非LAST係数、RUN、LEVEL
にリバーシブル符号(VLC_CODE)を対応させた
非LAST係数の符号語テーブル(第1の符号語テーブ
ル)と、図26〜図27に示すINTRAおよびINT
ERのLAST係数、RUN、LEVELにリバーシブ
ル符号(VLC_CODE)を対応させたLAST係数
の符号語テーブル(第2の符号語テーブル)を持ってい
る。そして、モード情報に基づいてINTRAのときは
INTRAの非LAST係数とLAST係数の符号語テ
ーブル、INTERのときはINTERの非LAST係
数とLAST係数の符号語テーブルをそれぞれ選択して
符号化を行う。なお、図26〜図27においてVLC_
CODEの最終ビットの“S”はLEVELの符号を表
し、“S”が“0”のときLEVELの符号は正、
“1”のとき負である。
The lower layer variable length encoder 903 in the moving picture encoder 709 includes INTRA and INTER non-LAST coefficients, RUN, and LEVEL shown in FIGS.
And a non-LAST coefficient codeword table (first codeword table) corresponding to reversible code (VLC_CODE), and INTRA and INT shown in FIGS.
It has a code word table (second code word table) of LAST coefficients in which a reversible code (VLC_CODE) is associated with the LAST coefficient, RUN, and LEVEL of ER. Then, based on the mode information, the coding is performed by selecting the code word table of the non-LAST coefficient and the LAST coefficient of the INTRA at the time of INTRA and the code word table of the non-LAST coefficient and the LAST coefficient of the INTER at the time of INTER. Note that VLC_ in FIGS.
“S” of the last bit of CODE indicates the sign of LEVEL, and when “S” is “0”, the sign of LEVEL is positive,
It is negative when “1”.

【0083】また、この符号語テーブルに存在しない係
数は、図29に示すようにRUNとLEVELの絶対値
を固定長符号に符号化し、この固定長符号の先頭と末端
にエスケープ符号を付加し、エスケープ符号の最終ビッ
トでLAST係数とLEVELの正負を区別できるよう
に符号化する。図28は、このエスケープ符号の符号語
テーブルであり、エスケープ符号として用いられている
VLC_CODEの最終ビットの“t”は、固定長符号
の先頭に付加されたときはLAST係数か否かを表し、
これが“0”のときは非LAST係数、“1”のときは
LAST係数である。また、“t”は固定長符号の末尾
に付加されたときはLEVELの符号を表し、これが
“0”のときLEVELの符号は正、“1”のときは負
である。
For the coefficients not present in this code word table, as shown in FIG. 29, the absolute values of RUN and LEVEL are encoded into fixed-length codes, and escape codes are added to the beginning and end of the fixed-length codes. The last bit of the escape code is encoded so that the positive and negative of the LAST coefficient and LEVEL can be distinguished. FIG. 28 is a codeword table of this escape code. The last bit “t” of VLC_CODE used as an escape code indicates whether or not it is a LAST coefficient when added to the beginning of a fixed-length code.
When this is "0", it is a non-LAST coefficient, and when it is "1", it is a LAST coefficient. “T” represents the LEVEL code when added to the end of the fixed-length code. When this is “0”, the LEVEL code is positive, and when it is “1”, it is negative.

【0084】図30は、本実施形態における符号化デー
タの例を示している。同図に示されるように、下位階層
において順方向から復号を行うときは、8×8画素のD
CT係数のブロックの末尾に必ずLAST係数の符号が
存在するため、ブロックの末尾を判定することができ
る。一方、逆方向から復号を行うときは、1つアドレス
が前のブロックのLAST係数の符号が出現することに
より、ブロックの先頭を判定できる。この符号は、LA
ST係数がINTRAモードとINTERモードで共通
化されているため、マククロブロック毎にモードが存在
していてもブロックの先頭を判定することができる。
FIG. 30 shows an example of encoded data in the present embodiment. As shown in the figure, when decoding is performed in the lower layer from the forward direction, the 8 × 8 pixel D
Since the sign of the LAST coefficient always exists at the end of the block of the CT coefficient, the end of the block can be determined. On the other hand, when decoding is performed in the reverse direction, the beginning of the block can be determined by the appearance of the code of the LAST coefficient of the block one address earlier. This code is LA
Since the ST coefficient is shared between the INTRA mode and the INTER mode, the head of a block can be determined even if a mode exists for each macro block.

【0085】下位階層の最初のブロックについては、予
め下位階層可変長符号化器903で下位階層の先頭にダ
ミーのLAST係数を符号化しておくか、あるいは、下
位階層可変長復号化器910で、次のフレームの同期符
号までのビット数から予め下位階層のビット数を計算し
ておき、これを復号したビット数と比較するか、あるい
は、下位階層可変長復号化器910内のバッファで下位
階層の先頭にダミーのLAST係数を挿入する方法をと
ることにより、逆方向に復号したときに下位階層の先頭
を判定することができる。
For the first block of the lower layer, a dummy LAST coefficient is coded at the beginning of the lower layer by the lower layer variable length encoder 903 or the lower layer variable length decoder 910 generates The number of bits in the lower layer is calculated in advance from the number of bits up to the synchronization code of the next frame, and the calculated number is compared with the number of bits decoded. Alternatively, a buffer in the lower layer variable length decoder 910 is used. By inserting a dummy LAST coefficient at the head of the lower layer, it is possible to determine the head of the lower layer when decoding in the reverse direction.

【0086】図24〜図27に示した符号語テーブルに
格納されたリバーシブル符号は、順方向の場合、先頭の
1ビットが“0”ならば、“0”が2つ出現するまで読
み、“1”ならば、“1”が2つ出現するまで読み、そ
の次の1ビットがLEVELの正負を表す最終ビットと
なることが分かる。逆方向の場合は、最初の1ビットが
LEVELの正負を表しており、次の1ビットが“0”
ならば、“0”が2つ出現するまで読み、“1”なら
ば、“1”が2つ出現するまで読めばよい。
The reversible codes stored in the code word tables shown in FIGS. 24 to 27 are read in the forward direction if the first bit is “0” until two “0” appear, and If it is "1", it is read until two "1" appear, and it can be seen that the next one bit is the last bit indicating the positive / negative of LEVEL. In the case of the reverse direction, the first one bit indicates the sign of LEVEL, and the next one bit is “0”.
Then, it is sufficient to read until two "0" appear, and if it is "1", it is sufficient to read until two "1" appear.

【0087】図31は、本実施形態における下位階層可
変長符号化器903で用いるDCT係数の可変長符号に
適用したリバーシブル符号を復号するための復号グラフ
を示している。順方向からみて符号語の先頭ビットと末
尾の2ビットを除いた符号化データについて、この復号
グラフによって復号値を計算することができる。
FIG. 31 shows a decoding graph for decoding a reversible code applied to the variable length code of the DCT coefficient used in the lower layer variable length encoder 903 in the present embodiment. A decoded value can be calculated from the decoded graph of the encoded data except for the first two bits and the last two bits of the codeword when viewed from the forward direction.

【0088】この復号グラフは、先頭のビットが“0”
ならば、“0”が現れれば右の矢を進み、“1”が現れ
れば左の矢を進むこととする。先頭のビットが“1”な
らば、“1”が現れれば右の矢を進み、“0”が現れれ
ば左の矢を進むこととする。
In this decoded graph, the first bit is “0”.
Then, when "0" appears, the right arrow advances, and when "1" appears, the left arrow advances. If the first bit is "1", the right arrow is advanced if "1" appears, and the left arrow is advanced if "0" appears.

【0089】同一の符号長の2進符号系列についての順
序値を求めるには、先に説明したShalkwijkの
アルゴリズムに従って、左側の矢を選択したときに矢の
終点の節点の値から起点の節点の値を引いた値の合計値
をその符号長での順序値とすればよい。
In order to determine the order value for a binary code sequence having the same code length, according to the Sharkwijk algorithm described above, when the left arrow is selected, the value of the node at the end point of the arrow and the value of the node at the start point are determined. The sum of the subtracted values may be used as the order value at the code length.

【0090】一方、復号値を求めるには、先頭のビット
が“0”ならば、終端の節点の右斜め上の節点の値の合
計値の2倍を順序値に足した値を復号値とすればよい。
先頭ビットが“1”ならば、終端の節点の右斜め上の節
点の値の合計値の2倍+終端の節点の値に順序値を足し
た値を復号値とればよい。
On the other hand, in order to obtain the decoded value, if the leading bit is “0”, a value obtained by adding twice the sum of the values of the nodes at the upper right corner of the terminal node to the order value as the decoded value do it.
If the first bit is “1”, the decoded value may be twice the sum of the values of the nodes at the upper right of the terminal node plus the order value to the value of the terminal node.

【0091】例えば、復号対象の符号列が“01101
01”ならば、まず順方向からみて先頭の1ビットと末
尾の2ビットを除いて、“1101”とする。先頭ビッ
トが“0”なので、復号グラフで“0”が現れれば右の
矢を進み、“1”が現れれば左の印を進むことになる。
この場合、左の矢を進んだときの節点の差分は(1−
1)+(1−1)+(4−3)=1なので、順序値は1
である。最上位ビットが“0”なので、終端の節点の右
斜め上にある節点の合計の2倍(1+2+3)×2=1
2に順序1を加えると13となり、この符号語の復号値
は13として求められることになる。
For example, if the code string to be decoded is “01101”
If “01”, the first bit and the last two bits are removed from the forward direction and set to “1101.” Since the first bit is “0”, if “0” appears in the decoded graph, the right arrow is drawn. Go to the left mark if "1" appears.
In this case, the difference between the nodes when the left arrow is advanced is (1-
1) + (1-1) + (4-3) = 1, the order value is 1
It is. Since the most significant bit is “0”, it is twice (1 + 2 + 3) × 2 = 1 the total of the nodes diagonally right above the terminal node.
When the order 1 is added to 2, the result becomes 13, and the decoded value of this code word is obtained as 13.

【0092】図32〜図34は、下位階層可変長復号化
器910で用いる復号値テーブルの一例であり、図32
〜図33はINTRAおよびINTERの非LAST係
数、RUN、LEVELに復号値を対応させた非LAS
T係数の復号値テーブルであり、図34(a)(b)は
INTRAおよびINTERのLAST係数、RUN、
LEVELに復号値を対応させたLAST係数の復号値
テーブルである。また、図34(c)はエスケープ符号
の復号値テーブルである。
FIGS. 32 to 34 show an example of a decoded value table used in the lower layer variable length decoder 910.
33 shows a non-LAST coefficient obtained by associating a decoded value with a non-LAST coefficient, RUN, and LEVEL of INTRA and INTER.
FIG. 34 (a) and FIG. 34 (b) are decoded value tables of T coefficients, and LAST coefficients, RUN,
It is a decoded value table of the LAST coefficient which made the decoded value correspond to LEVEL. FIG. 34C shows a decoded value table of the escape code.

【0093】この例では、例えば復号値13は図34
(a)で分かるように、LAST係数で、RUN数は
3、LEVELの絶対値が1であることが分かり、また
最下位ビットが“1”であることから、LEVELは負
であることが分かる。さらに、図34(c)で分かるよ
うに、復号値41が復号された場合は、エスケープ符号
が復号されたと判定する。このエスケープ符号の最後の
ビットでLAST係数か非LAST係数かの判定を行
い、その後の13ビットについて固定長符号復号化部2
10でRUNとLEVELの絶対値を復号した後、再び
エスケープ符号を復号し、最後のビットでLEVELの
正負を決定する。
In this example, for example, the decoded value 13 is
As can be seen from (a), the LAST coefficient is RUN number 3, the absolute value of LEVEL is 1, and the least significant bit is "1", indicating that LEVEL is negative. . Further, as can be seen from FIG. 34C, when the decoded value 41 is decoded, it is determined that the escape code has been decoded. The last bit of this escape code is used to determine whether it is a LAST coefficient or a non-LAST coefficient.
After decoding the absolute values of RUN and LEVEL at 10, the escape code is decoded again, and the sign of LEVEL is determined by the last bit.

【0094】一例として、符号化対象の符号列が“11
0000010000111000101111000
010”の場合を考える。この場合、先頭のエスケープ
符号“11000010”の最終ビットが“0”なの
で、非LAST係数であり、その後の13ビットの固定
長符号を計算する。この13ビットのうち上位6ビット
がRUNを表すので、“000111”でRUNは7、
下位7ビットがLEVELの絶対値を表すので、“00
01011”でLEVELの絶対値は12、末尾のエス
ケープ符号“11000010”の最終ビットが“0”
なのでLEVELは正、というように復号を行うことが
できる。
As an example, if the code string to be coded is "11
000000010000111000101111000
010. In this case, since the last bit of the leading escape code “11000010” is “0”, it is a non-LAST coefficient, and the subsequent 13-bit fixed-length code is calculated. Since 6 bits represent the RUN, the RUN is 7, with "000111".
Since the lower 7 bits represent the absolute value of LEVEL, "00"
01011 ”, the absolute value of LEVEL is 12, and the last bit of the last escape code“ 11000010 ”is“ 0 ”.
Therefore, LEVEL can be decoded as positive.

【0095】復号値判定部212では、このようにして
順方向復号化器209によって得られた復号結果(順方
向復号結果という)と、逆方向復号化器211によって
得られた復号結果(逆方向復号値という)から復号値を
判定し、最終的な復号結果を出力する。すなわち、復号
値判定部212では符号化データに誤りがあると、下位
階層通信路復号化器908の復号結果、あるいは、符号
語として存在しなかったビットパターンが生じることか
ら、誤りの存在が分かるので、これらの順方向復号結果
と逆方向復号結果から、図36に示すようにして復号値
を判定する。なお、図36は下位階層の復号値判定方法
を示している。
The decoding value determination section 212 compares the decoding result obtained by the forward decoder 209 (referred to as forward decoding result) with the decoding result obtained by the backward decoder 211 (reverse decoding result). A decoded value is determined from the decoded value, and a final decoded result is output. That is, if there is an error in the encoded data, the decoded value determination unit 212 recognizes the presence of the error because the decoding result of the lower layer channel decoder 908 or a bit pattern that did not exist as a codeword occurs. Therefore, a decoded value is determined from the forward decoding result and the backward decoding result as shown in FIG. FIG. 36 shows a method of determining a decoded value of a lower layer.

【0096】まず、図36(a)に示すように順方向復
号結果と逆方向復号結果で誤りが検出されるマクロブロ
ックの位置(誤り検出位置)が交差しない場合は、誤り
が検出されなかったマクロブロックの復号結果のみを復
号値として使用し、二つの誤り検出位置の復号結果は復
号値として使用しない。そして、上位階層のモード情報
の復号結果に基づいて、INTRAマクロブロックにつ
いては前フレームをそのまま表示するように、INTE
Rマクロブロックについては前フレームより動き補償の
みで表示するように、上位階層の復号結果を書き換え
る。
First, as shown in FIG. 36 (a), when the macroblock position (error detection position) where an error is detected in the forward decoding result and the reverse decoding result does not intersect, no error is detected. Only the decoding result of the macroblock is used as a decoding value, and the decoding results of two error detection positions are not used as decoding values. Then, based on the decoding result of the mode information of the upper layer, the INTER
The decoding result of the upper layer is rewritten so that the R macroblock is displayed only by the motion compensation from the previous frame.

【0097】また、図36(b)に示すように順方向復
号結果と逆方向復号結果で誤りが検出位置が交差する場
合は、両方で誤りが検出されなかった復号結果を復号結
果値として使用する。また、この場合には二つの誤り検
出位置の符号語の間の復号結果は復号値として使用せ
ず、上位階層のモード情報の復号結果に基づいて、IN
TRAマクロブロックについては前フレームをそのまま
表示するように、INTERマクロブロックについては
前フレームより動き補償のみで表示するように、上位階
層の復号結果を書き換える。
When an error detection position intersects between a forward decoding result and a backward decoding result as shown in FIG. 36 (b), a decoding result in which no error is detected in both is used as a decoding result value. I do. Also, in this case, the decoding result between the codewords at the two error detection positions is not used as a decoding value, and IN
The decoding result of the upper layer is rewritten so that the previous frame is displayed as it is for the TRA macroblock, and only the motion compensation is displayed for the INTER macroblock from the previous frame.

【0098】また、図36(c)に示すように順方向復
号結果および逆方向復号結果のうち、片方向の復号結果
にしか誤りが検出されない場合(この例では、順方向復
号結果のみ誤りが検出されている)は、誤り検出位置の
マクロブロックは復号値として使用せず、上位階層のモ
ード情報の復号結果に基づいて、INTRAマクロブロ
ックについては前フレームをそのまま表示するように、
INTERマクロブロックについては前フレームより動
き補償のみで表示するように、上位階層の復号結果を書
き換える。それ以後のマクロブロックに対する復号値
は、逆方向の復号結果を使用する。
As shown in FIG. 36 (c), when an error is detected only in the one-way decoding result among the forward decoding result and the backward decoding result (in this example, only the forward decoding result has an error). Is detected), the macroblock at the error detection position is not used as a decoded value, and based on the decoding result of the mode information of the upper layer, the previous frame is displayed as it is for the INTRA macroblock,
The decoding result of the upper layer is rewritten so that the INTER macroblock is displayed only by the motion compensation from the previous frame. The decoded value for the subsequent macroblock uses the decoding result in the reverse direction.

【0099】さらに、図36(d)に示すように同一の
マクロブロックで順方向復号結果および逆方向復号結果
の両方に誤りが検出される場合は、誤り検出位置のマク
ロブロックの復号値は放棄して復号値として使用せず、
上位階層のモード情報の復号結果に基づいて、INTR
Aマクロブロックについては前フレームをそのまま表示
するように、INTERマクロブロックについては前フ
レームより動き補償のみで表示するように、上位階層の
復号結果を書き換え、それ以後のマクロブロックに対す
る復号値は逆方向の復号結果を使用する。
Further, when an error is detected in both the forward decoding result and the backward decoding result in the same macroblock as shown in FIG. 36 (d), the decoded value of the macroblock at the error detection position is abandoned. Without using it as a decryption value.
Based on the decoding result of the mode information of the upper layer, INTR
The decoding result of the upper layer is rewritten so that the previous frame of A macroblock is displayed as it is, and the macroblock of INTER is displayed only by motion compensation from the previous frame. Use the decryption result of

【0100】マクロブロックの符号化/復号化の順序に
ついては、上記実施形態以外の方法でもよく、例えば誤
りがあったときに、復号画像のうちより重要な画面中央
部が救済されるように、図37に示すような順序とする
方法でもよい。すなわち、両方向から復号することを前
提とすると、同期符号と同期符号の間の符号化データの
うち、最初の方の部分と最後の方の部分が正しく復号さ
れる確率が高いので、これの部分が中央部にくるように
順序を決めるのである。
The order of encoding / decoding macroblocks may be a method other than the above embodiment. For example, when an error occurs, a more important central portion of the decoded image is rescued. A method shown in FIG. 37 may be used. That is, assuming that decoding is performed from both directions, the probability that the first part and the last part of the encoded data between the synchronization codes are correctly decoded is high. The order is determined so that is in the center.

【0101】なお、上記実施形態ではDCT係数の可変
長符号化に本発明を適用したが、他の情報シンボルにつ
いても同様の可変長符号化を適用できることは、言うま
でもない。
In the above embodiment, the present invention is applied to variable-length coding of DCT coefficients. However, it goes without saying that the same variable-length coding can be applied to other information symbols.

【0102】また、上記実施形態では2元符号のみの議
論を示したが、多元符号にも拡張することが容易であ
り、同様な効果を得ることができる。
In the above embodiment, only the binary code has been discussed. However, the present invention can be easily extended to a multiple code, and similar effects can be obtained.

【0103】最後に、本発明の応用例として、本発明に
よる可変長符号化/復号化装置を適用した画像送受信装
置の実施形態を図38を用いて説明する。パーソナルコ
ンピュータ(PC)1001に備えら付けられたカメラ
1002より入力された画像信号は、PC1001に組
み込まれた可変長符号化装置によって符号化される。こ
の場合の情報シンボルは、これに限るものではないが、
例えば入力画像信号または入力画像信号と予測画像信号
との差である予測誤差信号をDCT回路によって離散コ
サイン変換し、さらに量子化回路により量子化して得ら
れたDCT係数データなどである。可変長符号化装置か
ら出力される符号化データは、他の音声やデータの情報
と多重化された後、無線機1003により無線で送信さ
れ、他の無線機1004によって受信される。無線機1
004で受信された信号は、画像信号の符号化データお
よび音声やデータの情報に分解される。これらのうち、
画像信号の符号化データはワークステーション(EW
S)1005に組み込まれた可変長符号復号化装置によ
って復号され、EWS1005のディスプレイに表示さ
れる。
Finally, as an application example of the present invention, an embodiment of an image transmitting / receiving apparatus to which the variable length encoding / decoding apparatus according to the present invention is applied will be described with reference to FIG. An image signal input from a camera 1002 provided in a personal computer (PC) 1001 is encoded by a variable-length encoding device incorporated in the PC 1001. The information symbol in this case is not limited to this,
For example, DCT coefficient data obtained by performing discrete cosine transform by a DCT circuit on an input image signal or a prediction error signal which is a difference between the input image signal and the predicted image signal, and further quantizing by a quantization circuit. The coded data output from the variable length coding device is multiplexed with other voice and data information, transmitted by radio by the wireless device 1003, and received by the other wireless device 1004. Radio 1
The signal received at 004 is decomposed into coded data of the image signal and information of voice and data. Of these,
The encoded data of the image signal is transmitted to the workstation (EW
S) It is decoded by the variable length code decoding device incorporated in 1005 and displayed on the display of EWS 1005.

【0104】一方、EWS1005に備え付けられたカ
メラ1006より入力された画像信号は、EWS100
6に組み込まれた可変長符号化装置を用いて上記と同様
に符号化される。符号化データは、他の音声やデータの
情報と多重化され、無線機1004により無線で送信さ
れ、無線機1003によって受信される。無線機100
3によって受信された信号は、画像信号の符号化データ
および音声やデータの情報に分解される。これらのう
ち、画像信号の符号化データはPC1001に組み込ま
れた可変長符号復号化装置によって復号され、PC10
01のディスプレイに表示される。
On the other hand, an image signal input from a camera 1006 provided in the EWS 1005 is
6 is encoded in the same manner as described above using the variable length encoding device incorporated in 6. The encoded data is multiplexed with other voice or data information, transmitted wirelessly by the wireless device 1004, and received by the wireless device 1003. Wireless device 100
The signal received by 3 is decomposed into encoded data of an image signal and information of voice and data. Among them, the coded data of the image signal is decoded by the variable-length code decoding device incorporated in the PC 1001,
01 is displayed on the display.

【0105】本発明の可変長符号化/復号化装置は、情
報シンボルの出現頻度に応じた符号長を有し、従来と比
較して無駄なビットパターンが少なくて効率がよく、し
かも順方向にも逆方向にも復号が可能なリバーシブルの
可変長符号を構成することができるので、図38に示し
た無線伝送路のような誤りが多い伝送路を用いた送受信
装置において特に有効である。
The variable length coding / decoding device of the present invention has a code length corresponding to the frequency of appearance of information symbols, has less wasteful bit patterns and is more efficient than the conventional one, Since it is possible to form a reversible variable length code that can be decoded in the reverse direction as well, it is particularly effective in a transmission / reception apparatus using a transmission line having many errors such as the wireless transmission line shown in FIG.

【0106】以上実施形態で説明したように、本発明の
可変長符号化/復号化装置は、従来と比較して、少ない
記憶量で復号することができ、従来適用することのでき
なかったような情報シンボル数が大きな符号化に対して
も適用することができる。
As described in the above embodiment, the variable-length encoding / decoding device of the present invention can decode with a smaller storage amount as compared with the conventional one, and cannot be applied conventionally. It can also be applied to coding with a large number of information symbols.

【0107】具体的には、動画像符号化/復号化装置に
も適用することが可能であり、誤りに強い動画像符号化
/復号化装置を提供することができる。
More specifically, the present invention can be applied to a moving picture encoding / decoding apparatus, and can provide a moving picture encoding / decoding apparatus that is resistant to errors.

【0108】[0108]

【発明の効果】以上説明したように、本発明によれば順
方向にも逆方向にも復号可能で、しかも符号化効率や装
置に必要な記憶量などの点で実用性に富んだ可変長符号
化/復号化装置を提供することができる。
As described above, according to the present invention, a variable length code which can be decoded in both the forward and reverse directions, and which is practical in terms of coding efficiency and storage capacity required for the apparatus. An encoding / decoding device can be provided.

【0109】すなわち、本発明では複数の符号化モード
に対してブロックの最後以外の直交変換係数に対応する
第1の符号語テーブルは個々に構成されるが、ブロック
の最後の直交変換係数に対応する第2の符号語テーブル
は各符号化モードに対して共通化することによって、符
号化モードによる符号語テーブルの変更に対応できると
共に、復号化に際してブロックの最後の直交変換係数を
表す符号語や、1つ前のブロックの最後の直交変換係数
を表す符号語の出現によってブロックの区切りが分かる
ため、シンタックス的にも両方向から復号を行うことが
可能であり、またイントラモードとインターモードのよ
うに生成される直交変換係数と出現頻度の異なる複数の
符号化モードに対して第2の符号語テーブルを別々に設
けることにより、符号化効率を向上させることができ
る。
That is, in the present invention, the first codeword tables corresponding to the orthogonal transform coefficients other than the end of the block for a plurality of encoding modes are individually formed, but correspond to the last orthogonal transform coefficients of the block. The second codeword table to be used is common to each coding mode, so that it is possible to cope with a change in the codeword table depending on the coding mode, and to decode a codeword representing the last orthogonal transform coefficient of a block during decoding. Since the block delimiter can be identified by the appearance of a codeword representing the last orthogonal transform coefficient of the previous block, decoding can be performed from both directions in terms of syntax, as well as in intra mode and inter mode. By separately providing a second codeword table for a plurality of encoding modes having different occurrence frequencies from the orthogonal transform coefficients generated in It can be improved Goka efficiency.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の一実施形態に係る可変長符号化/復号
化装置の構成を示すブロック図
FIG. 1 is a block diagram showing a configuration of a variable-length encoding / decoding device according to an embodiment of the present invention.

【図2】図1における復号値判定部の動作を説明するた
めの図
FIG. 2 is a diagram for explaining the operation of a decoded value determination unit in FIG.

【図3】図1における符号語テーブル作成部のブロック
FIG. 3 is a block diagram of a codeword table creation unit in FIG. 1;

【図4】本発明に係る可変長符号の基となる重み一定の
2進符号系列の作成方法を示す図
FIG. 4 is a diagram showing a method for generating a binary code sequence having a constant weight as a basis of a variable length code according to the present invention;

【図5】図3における符号語構成部での第1の符号語構
成方法を示す図
FIG. 5 is a diagram showing a first codeword configuration method in a codeword configuration unit in FIG. 3;

【図6】第1の符号構成方法で構成した符号語から作成
した順方向および逆方向の復号木を示す図
FIG. 6 is a diagram showing forward and backward decoding trees created from codewords configured by the first code configuration method;

【図7】図3における符号語構成部での第2の符号語構
成方法を示す図
FIG. 7 is a diagram showing a second codeword configuration method in the codeword configuration unit in FIG. 3;

【図8】第2の符号構成方法で構成した符号語から作成
した順方向および逆方向の復号木を示す図
FIG. 8 is a diagram showing forward and backward decoding trees created from codewords configured by a second code configuration method;

【図9】図3における符号語構成部での第3の符号構成
方法を示す図
9 is a diagram showing a third code configuration method in the codeword configuration unit in FIG. 3;

【図10】第3の符号構成方法で構成した符号語から作
成した順方向および逆方向の復号木を示す図
FIG. 10 is a diagram showing forward and backward decoding trees created from codewords configured by a third code configuration method;

【図11】図3における符号語構成部での符号短縮化方
法を示す図
FIG. 11 is a diagram showing a code shortening method in the code word forming unit in FIG. 3;

【図12】符号短縮化方法で短縮化した符号語から作成
した順方向および逆方向の復号木を示す図
FIG. 12 is a diagram showing forward and backward decoding trees created from codewords shortened by a code shortening method.

【図13】図3における符号語構成部での符号拡大化方
法を示す図
FIG. 13 is a diagram showing a code enlarging method in the code word forming unit in FIG. 3;

【図14】本実施形態で構成された可変長符号と公知例
の可変長符号の特性を比較して示す図
FIG. 14 is a diagram showing a comparison between characteristics of the variable length code configured in the present embodiment and a variable length code of a known example.

【図15】本発明の他の実施形態に係る可変長符号化/
復号化装置の構成を示すブロック図
FIG. 15 is a diagram illustrating variable-length coding / coding according to another embodiment of the present invention.
FIG. 2 is a block diagram illustrating a configuration of a decoding device.

【図16】図15における符号語構成部での符号構成方
法を示す図
16 is a diagram showing a code configuration method in the codeword configuration unit in FIG.

【図17】重み一定の2進系列を数え上げる方法を示す
FIG. 17 is a diagram showing a method of counting a binary sequence having a constant weight.

【図18】図15における順方向復号化器および逆方向
復号化器の動作を示す図
FIG. 18 is a diagram showing operations of a forward decoder and a backward decoder in FIG.

【図19】従来の復号木と本実施形態における復号グラ
フを比較して示す図
FIG. 19 is a diagram showing a comparison between a conventional decoding tree and a decoding graph according to the present embodiment;

【図20】本実施形態における復号値テーブルを説明す
るための図
FIG. 20 is a view for explaining a decoded value table according to the embodiment;

【図21】本発明による可変長符号化/復号化装置が組
み込まれた動画像符号化/復号化器の概略構成を示すブ
ロック図
FIG. 21 is a block diagram showing a schematic configuration of a moving image encoder / decoder incorporating the variable length encoding / decoding device according to the present invention;

【図22】同実施形態に係る動画像符号化/復号化器に
おける符号化データのシンタックスを示す図
FIG. 22 is a view showing the syntax of encoded data in the video encoder / decoder according to the embodiment;

【図23】図21における動画像多重化部および動画像
多重化分離部の構成を示すブロック図
FIG. 23 is a block diagram showing a configuration of a moving image multiplexing unit and a moving image multiplexing / demultiplexing unit in FIG. 21;

【図24】同実施形態におけるINTRAおよびINT
ERの非LAST係数の符号語テーブルの一部を示す図
FIG. 24 shows INTRA and INT in the embodiment.
The figure which shows a part of codeword table of the non-LAST coefficient of ER

【図25】同実施形態におけるINTRAおよびINT
ERの非LAST係数の符号語テーブルの他の一部を示
す図
FIG. 25 shows INTRA and INT in the embodiment.
The figure which shows another part of codeword table of the non-LAST coefficient of ER

【図26】同実施形態におけるINTRAおよびINT
ERのLAST係数の符号語テーブルの一部を示す図
FIG. 26 shows INTRA and INT in the embodiment.
FIG. 4 is a diagram illustrating a part of a codeword table of LAST coefficients of ER;

【図27】同実施形態におけるINTRAおよびINT
ERのLAST係数の符号語テーブルの他の一部を示す
FIG. 27 shows INTRA and INT in the embodiment.
The figure which shows another part of codeword table of the LAST coefficient of ER

【図28】同実施形態におけるエスケープ符号の符号語
テーブルを示す図
FIG. 28 is a diagram showing a codeword table of an escape code in the embodiment.

【図29】同実施形態における符号語テーブルにない符
号語の符号化方法を示す図
FIG. 29 is a diagram showing an encoding method of a codeword not in a codeword table in the embodiment.

【図30】同実施形態における符号化データの例を示す
FIG. 30 is a view showing an example of encoded data in the embodiment.

【図31】同実施形態における復号グラフを示す図FIG. 31 is a view showing a decoding graph in the embodiment;

【図32】同実施形態におけるINTRAおよびINT
ERの非LAST係数の復号値テーブルの一部を示す図
FIG. 32 shows INTRA and INT in the embodiment.
The figure which shows a part of decoding value table of the non-LAST coefficient of ER

【図33】同実施形態におけるINTRAおよびINT
ERの非LAST係数の復号値テーブルの他の一部を示
す図
FIG. 33 shows INTRA and INT in the embodiment.
The figure which shows the other part of the decoding value table of the non-LAST coefficient of ER

【図34】同実施形態におけるINTRAおよびINT
ERのLAST係数の復号値テーブルを示す図
FIG. 34 shows INTRA and INT in the embodiment.
The figure which shows the decoding value table of the LAST coefficient of ER

【図35】同実施形態におけるエスケープ符号の復号値
テーブルを示す図
FIG. 35 is a view showing a decoded value table of an escape code in the embodiment.

【図36】図15における復号値判定部の動作を説明す
るための図
FIG. 36 is a diagram for explaining the operation of the decoded value determination unit in FIG.

【図37】同実施形態におけるマクロブロックの符号化
/復号化順序を示す図
FIG. 37 is a diagram showing an encoding / decoding order of macro blocks in the embodiment.

【図38】本発明による可変長符号化/復号化装置が組
み込まれる装置の一例を示す図
FIG. 38 is a diagram showing an example of an apparatus in which the variable length encoding / decoding apparatus according to the present invention is incorporated.

【図39】リバーシブル符号の一般的な復号方法を示す
FIG. 39 is a diagram showing a general decoding method of a reversible code.

【図40】通常の可変長符号の説明図FIG. 40 is an explanatory diagram of a normal variable length code.

【図41】従来のリバーシブル符号の説明図FIG. 41 is an explanatory diagram of a conventional reversible code.

【符号の説明】[Explanation of symbols]

101…符号語テーブル作成部 102…符号語テーブル 103…符号化器 104…伝送系または蓄積系 105…同期コード検出部 106…バッファ 107…順方向復号化器 108…逆方向復号化器 109…復号値判定部 110…順方向復号語テーブル 111…順方向復号木作成部 112…逆方向符号語テーブル 113…逆方向復号木作成部 114…符号化部 115…復号化部 21…符号選択部 22…符号語構成部 201…符号語テーブル作成部 202…符号語テーブル 203…符号化器 204…固定長符号符号化部 205…伝送系または蓄積系 206…同期コード検出部 207…バッファ 208…復号グラフ・復号値テーブル作成部 209…順方向復号化器 220…固定長符号復号化部 211…逆方向復号化器 212…復号値判定部 213…符号化部 214…復号化部 701…符号化制御部 702…情報源符号化器 703…動画像多重化部 704…伝送バッファ 705…伝送系または蓄積系 706…受信バッファ 707…動画像多重化分離部 708…情報源復号化器 709…動画像符号化器 710…動画像復号化器 901…下位階層可変長復号化器 902…上位階層通信路符号化器 903…下位階層可変長符号化器 904…下位階層通信路符号化器 905…多重化部 906…多重化分離部 907…上位階層通信路復号化器 908…下位階層通信路復号化器 909…上位階層可変長復号化器 910…下位階層可変長復号化器 1001…パーソナルコンピュータ 1002…ワークステーション 1003…無線機 1004…無線機 1005…カメラ 1006…カメラ 101 codeword table creation unit 102 codeword table 103 encoder 104 transmission or storage system 105 synchronization code detector 106 buffer 107 forward decoder 108 backward decoder 109 decoding Value judging unit 110: forward decoded word table 111: forward decoding tree creating unit 112: backward codeword table 113 ... backward decoding tree creating unit 114: encoding unit 115: decoding unit 21: code selecting unit 22 ... Codeword configuration unit 201 Codeword table creation unit 202 Codeword table 203 Encoder 204 Fixed length code encoding unit 205 Transmission or storage system 206 Synchronous code detection unit 207 Buffer 208 Decoding graph Decoded value table creation unit 209: forward decoder 220: fixed-length code decoding unit 211: backward decoder 212: decoding Signal value determination unit 213 Encoding unit 214 Decoding unit 701 Encoding control unit 702 Information source encoder 703 Moving image multiplexing unit 704 Transmission buffer 705 Transmission system or accumulation system 706 reception buffer 707 ··· Moving picture multiplexing and demultiplexing unit 708 ··· Information source decoder 709 ··· Moving picture encoder 710 ··· Moving picture decoder 901 · · · Lower layer variable length decoder 902 · · · Upper layer channel encoder 903 · Lower layer Variable length encoder 904: Lower layer channel encoder 905: Multiplexer 906 ... Demultiplexer 907 ... Upper layer channel decoder 908 ... Lower layer channel decoder 909: Upper layer variable length decoding 910: Lower layer variable length decoder 1001: Personal computer 1002: Workstation 1003: Wireless device 1004: Wireless device 1005: Camera 1006… Camera

───────────────────────────────────────────────────── フロントページの続き Fターム(参考) 5C059 KK09 MA23 ME03 ME10 ME13 ME15 RE01 SS06 SS11 UA02 UA05 UA34 5J064 AA04 BA09 BA16 BB08 BB09 BC01 BC02 BC14 BD02  ────────────────────────────────────────────────── ─── Continued on the front page F term (reference) 5C059 KK09 MA23 ME03 ME10 ME13 ME15 RE01 SS06 SS11 UA02 UA05 UA34 5J064 AA04 BA09 BA16 BB08 BB09 BC01 BC02 BC14 BD02

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】ブロック単位の直交変換を行って生成され
得る直交変換係数に対して、該直交変換係数の生起確率
に応じた符号長を有する符号語をそれぞれ割り当て、前
記動画像符号化器で生成された直交変換係数に対応した
符号語を符号化データとして出力する可変長符号化方法
において、 複数の符号化モード毎に、順方向にも逆方向にも復号可
能である複数の符号語をブロックの最後以外の直交変換
係数にそれぞれ対応させて格納した第1の符号語テーブ
ルと、前記複数の符号化モードに対して共通に設けら
れ、順方向にも逆方向にも復号可能である複数の符号語
をブロックの最後の直交変換係数にそれぞれ対応させて
格納した第2の符号語テーブルを構成し、 前記第1および第2の符号語テーブルから前記直交変換
係数に対応する符号語を選択して符号化データとして出
力することを特徴とする可変長符号化方法。
A codeword having a code length corresponding to the probability of occurrence of orthogonal transform coefficients is assigned to orthogonal transform coefficients that can be generated by performing orthogonal transform in block units. In a variable-length encoding method for outputting a codeword corresponding to a generated orthogonal transform coefficient as encoded data, a plurality of codewords that can be decoded in both forward and reverse directions for each of a plurality of encoding modes. A first codeword table stored in correspondence with orthogonal transform coefficients other than the last of the block, and a plurality of codeword tables provided in common for the plurality of encoding modes and capable of decoding in both forward and reverse directions. Constitutes a second codeword table in which codewords corresponding to the last orthogonal transform coefficients of the block are stored, and codes corresponding to the orthogonal transform coefficients from the first and second codeword tables. Variable length coding method characterized by select the output as coded data.
【請求項2】ブロック単位の直交変換を行って生成され
得る直交変換係数に対して、該直交変換係数の生起確率
に応じた符号長を有する符号語をそれぞれ割り当て、前
記動画像符号化器で生成された直交変換係数に対応した
符号語を符号化データとして出力する可変長符号化装置
において、 複数の符号化モード毎に、順方向にも逆方向にも復号可
能である複数の符号語をブロックの最後以外の直交変換
係数にそれぞれ対応させて格納した第1の符号語テーブ
ルと、 前記複数の符号化モードに対して共通に設けられ、順方
向にも逆方向にも復号可能である複数の符号語をブロッ
クの最後の直交変換係数にそれぞれ対応させて格納した
第2の符号語テーブルと、 前記第1および第2の符号語テーブルから前記直交変換
係数に対応する符号語を選択して符号化データとして出
力する符号化手段とを有することを特徴とする可変長符
号化装置。
2. A codeword having a code length corresponding to an occurrence probability of the orthogonal transform coefficient is assigned to an orthogonal transform coefficient which can be generated by performing an orthogonal transform on a block basis. In a variable-length encoding device that outputs codewords corresponding to generated orthogonal transform coefficients as encoded data, a plurality of codewords that can be decoded in both forward and reverse directions for each of a plurality of encoding modes. A first codeword table stored corresponding to orthogonal transform coefficients other than the last of the block, and a plurality of codeword tables provided in common for the plurality of encoding modes and capable of decoding in both forward and reverse directions. A codeword corresponding to the orthogonal transform coefficient is selected from a second codeword table storing the codewords corresponding to the last orthogonal transform coefficient of the block, and a codeword corresponding to the orthogonal transform coefficient from the first and second codeword tables. To the variable length coding apparatus characterized by comprising an encoding means for outputting as encoded data.
JP2001117333A 1995-04-14 2001-04-16 Variable length encoding method and apparatus Expired - Lifetime JP3417934B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001117333A JP3417934B2 (en) 1995-04-14 2001-04-16 Variable length encoding method and apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8977295 1995-04-14
JP7-89772 1995-04-14
JP2001117333A JP3417934B2 (en) 1995-04-14 2001-04-16 Variable length encoding method and apparatus

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP26038395A Division JP3431368B2 (en) 1995-03-15 1995-10-06 Variable length encoding / decoding method and variable length encoding / decoding device

Publications (2)

Publication Number Publication Date
JP2001308718A true JP2001308718A (en) 2001-11-02
JP3417934B2 JP3417934B2 (en) 2003-06-16

Family

ID=26431182

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001117333A Expired - Lifetime JP3417934B2 (en) 1995-04-14 2001-04-16 Variable length encoding method and apparatus

Country Status (1)

Country Link
JP (1) JP3417934B2 (en)

Also Published As

Publication number Publication date
JP3417934B2 (en) 2003-06-16

Similar Documents

Publication Publication Date Title
EP1267582B1 (en) Moving picture coding System, and variable-length coding system
JP3431368B2 (en) Variable length encoding / decoding method and variable length encoding / decoding device
JP3164806B2 (en) Variable length encoding method and apparatus
JP3233360B2 (en) Variable length decoding method and apparatus
JP3579411B2 (en) Variable length encoding method and apparatus
JP3579409B2 (en) Variable length encoding method and apparatus
JP3579410B2 (en) Variable length encoding method and apparatus
JP3579412B2 (en) Variable length decoding method and apparatus
JP3766426B2 (en) Variable length coding method and apparatus
JP3609814B2 (en) Variable length decoding method and apparatus
JP3417934B2 (en) Variable length encoding method and apparatus
JP3869342B2 (en) Variable length decoding method and apparatus
JP3612315B2 (en) Variable length decoding method and apparatus
JP3612314B2 (en) Variable length coding method and apparatus
JP3822629B2 (en) Variable length coding method and apparatus
JP3822630B2 (en) Variable length decoding method and apparatus
JP3609813B2 (en) Variable length coding method and apparatus
JP3417933B2 (en) Variable length decoding method and apparatus
JP3866687B2 (en) Variable length coding method and apparatus
JP3748215B2 (en) Variable length coding method and apparatus
JP3944049B2 (en) Variable length decoding method and apparatus
JP3764466B2 (en) Variable length decoding method and apparatus

Legal Events

Date Code Title Description
FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080411

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090411

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20100411

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20100411

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110411

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130411

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20140411

Year of fee payment: 11

EXPY Cancellation because of completion of term