JP3417933B2 - Variable length decoding method and apparatus - Google Patents

Variable length decoding method and apparatus

Info

Publication number
JP3417933B2
JP3417933B2 JP2001117332A JP2001117332A JP3417933B2 JP 3417933 B2 JP3417933 B2 JP 3417933B2 JP 2001117332 A JP2001117332 A JP 2001117332A JP 2001117332 A JP2001117332 A JP 2001117332A JP 3417933 B2 JP3417933 B2 JP 3417933B2
Authority
JP
Japan
Prior art keywords
code
decoding
decoded
length
variable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP2001117332A
Other languages
Japanese (ja)
Other versions
JP2001308717A (en
Inventor
健 中條
剛 永井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP2001117332A priority Critical patent/JP3417933B2/en
Publication of JP2001308717A publication Critical patent/JP2001308717A/en
Application granted granted Critical
Publication of JP3417933B2 publication Critical patent/JP3417933B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】この発明は、可変長復号化方
法及び装置に関する。
TECHNICAL FIELD The present invention relates to a variable length decoding method and apparatus.

【0002】[0002]

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

【0003】可変長符号の一般的な問題として、符号化
データに伝送路誤りその他の理由で誤りが混入した場合
に、誤りが混入した以後のデータについては、その影響
が伝搬することにより復号化装置で正しく復号すること
ができなくなってしまうという点が挙げられる。そのた
め、伝送路において誤りが生じる可能性がある場合に
は、ある間隔で周期的に同期符号を挿入し、誤りの伝搬
を防止する方法がとられるのが一般的である。同期符号
には、可変長符号の組み合わせでは出現しないようなビ
ットパターンが割り当てられる。この方法によれば、符
号化データに誤りが生じ、復号できなくなったとして
も、次の同期符号を見つけることにより、誤りの伝搬を
防止し、正しく復号を行うことができる。しかし、この
ように同期符号を用いた場合でも、図39(a)に示す
ように誤りが生じて正しく復号できない地点から、次の
同期符号が見つかる地点までの間の符号化データについ
ては、復号を行うことができない。
As a general problem of the variable length code, when an error is mixed in the encoded data due to a transmission path error or other reasons, the data after the error is mixed is decoded by the influence of the propagation. The point is that the device will not be able to decrypt correctly. Therefore, when there is a possibility that an error will occur in the transmission path, it is general to insert a synchronization code periodically at a certain interval 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 the encoded data and the decoding cannot be performed, the propagation of the error can be prevented and the decoding can be correctly performed by finding the next synchronization code. However, even when the sync code is used in this way, the coded data from the point where an error occurs as shown in FIG. Can't 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 the variable length code is not only decodable from the normal forward direction as shown in FIG. A method of forming a code that can be decoded from the direction is known. Further, since such a code can read the encoded data from the reverse direction, it can be used for reverse reproduction in a storage medium such as a disk memory for storing the 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. An 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 code word has a longer code length at the end of the code word of the Huffman code which is a variable length code that can be decoded from the forward direction shown in FIG. It is a variable length code that can be decoded from the reverse direction by adding a bit under the condition that it does not match the end of another code word.

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

【0006】また、従来のリバーシブル符号のもう一つ
の問題点として、情報シンボル数が大きい場合には、可
変長符号化/復号化装置で必要とされる記憶量が多くな
るために、実用に適さないという点があった。情報シン
ボル数が大きい場合の例としては、動画像や静止画像の
画像符号化でよく用いられるDCT係数の符号化があ
る。通常、画像符号化では8×8のDCT(離散コサイ
ン変換)を行い、これにより得られたDCT係数と呼ば
れる直交変換係数について8ビットの線形量子化を行
う。さらに、量子化されたDCT変換係数について低域
からジグザクスキャンを行い、零ランと非零の係数を組
にして可変長符号化を行っている。
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 coding / decoding device is large, and therefore it is suitable for practical use. There was no point. As an example of a case where the number of information symbols is large, there is coding of DCT coefficients which is often used in video coding of moving images and still images. Normally, in image coding, 8 × 8 DCT (discrete cosine transform) is performed, and 8-bit linear quantization is performed on orthogonal transform coefficients called DCT coefficients obtained by this. Furthermore, the quantized DCT transform coefficient is subjected to zigzag scanning from the low frequency band, and variable length coding is performed by combining 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係数につ
いては可変長符号で符号化するが、出現確率の低いDC
T係数についてはブロックの最後の非零係数かどうかの
区別を示す符号に1ビットの符号、零ランに6ビットの
符号、量子化インデックスに8ビットの符号の計15ビ
ットの符号で固定長符号化を行い、この固定長符号の先
頭にエスケープ符号と呼ばれる符号を付加する構成とな
っている。
For example, ITU-T DRAFT Rec
Ommendation H.M. In H.263 (1995), the quantization index value is -127 to +127 (the index value 0 is a run, so the number of indexes is 25).
3), the number of zero runs is 63 at the maximum, and since the coding that distinguishes whether the last DCT coefficient of a 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.
Therefore, H. In H.263, DCT coefficients with a high appearance probability are coded with a variable length code, but DC with a low appearance probability is used.
For the T coefficient, a fixed-length code with a total of 15-bit code including a 1-bit code for distinguishing whether it is the last non-zero coefficient of a block, a 6-bit code for a zero run, and a 8-bit code for a quantization index. The fixed length code is added with a code called an escape code at the beginning.

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

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

【0010】[0010]

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

【0011】本発明は、順方向にも逆方向にも復号可能
であって、実用性に富んだ可変長復号化方法及び装置を
提供することを目的とする。
It is an object of the present invention to provide a variable length decoding method and apparatus which can be decoded in the forward direction and the backward direction and which are highly practical.

【0012】より具体的には、順方向にも逆方向にも復
号可能であって、しかも情報シンボルの数が多い場合に
も大きな記憶量を必要としない可変長復号化方法及び装
置を提供することを目的とする。
More specifically, there is provided a variable length decoding method and apparatus which can be decoded in the forward direction and the backward direction and do not require a large storage amount even when the number of information symbols is large. The purpose is to

【0013】[0013]

【課題を解決するための手段】上記課題を解決するた
め、本発明は固定長符号の先頭及び末尾に該先頭及び末
尾を示す特定の符号(エスケープ符号、例えば順方向に
も逆方向にも復号可能な特定の符号、順方向にも逆方向
にも復号可能な特定の可変長符号)を付加した符号を含
む、順方向にも逆方向にも復号可能な可変長符号化デー
タを復号する可変長復号化方法において、可変長符号化
データを順方向または逆方向から復号する際に、前記先
頭及び末尾を示す特定の符号の復号値を格納した第1の
復号値テーブルを用いて前記先頭及び末尾を示す特定の
符号が復号されたときは、前記固定長符号の復号値を格
納した第2の復号値テーブルを参照して、前記先頭を示
す特定の符号に続く符号を固定長符号とみなして復号す
ることを特徴とする。
In order to solve the above-mentioned problems, the present invention provides a specific code (escape code, for example, forward or backward decoding at the beginning and end of a fixed-length code) indicating the beginning and end. Variable to decode variable-length coded data that can be decoded in the forward direction or in the backward direction, including a code added with a specific possible code, a specific variable-length code that can be decoded in the forward direction or the backward direction. In the long decoding method, when decoding variable-length coded data from the forward direction or the backward direction, the first and second decoding value tables that store the decoding values of the specific codes indicating the first and last values are used. When the specific code indicating the end is decoded, the code following the specific code indicating the head is regarded as the fixed length code by referring to the second decoded value table storing the decoded value of the fixed length code. Characterized by decoding

【0014】また、本発明は固定長符号の先頭及び末尾
に該先頭及び末尾を示す特定の符号(エスケープ符号、
例えば順方向にも逆方向にも復号可能な特定の符号、順
方向にも逆方向にも復号可能な特定の可変長符号)を付
加した符号を含む、順方向にも逆方向にも復号可能な可
変長符号化データを復号する可変長復号化装置におい
て、前記先頭及び末尾を示す特定の符号の復号値を格納
した第1の復号値テーブル及び前記固定長符号の復号値
を格納した第2の復号値テーブルを作成する手段と、前
記可変長符号化データを順方向から復号する順方向復号
手段と、前記可変長符号化データを逆方向から復号する
逆方向復号手段と、固定長符号を復号する固定長符号復
号手段とを有し、前記順方向復号手段および前記逆方向
復号手段で前記可変長符号化データを復号する際に、前
記第1の復号値テーブルを用いて前記先頭及び末尾を示
す特定の符号が復号されたときは、前記第2の復号値テ
ーブルを参照して、前記先頭を示す特定の符号に続く符
号を固定長符号とみなして前記固定長符号復号手段で復
号することを特徴とする。
Further, according to the present invention, at the beginning and the end of the fixed length code, a specific code (escape code,
For example, it can be decoded both forward and backward, including a specific code that can be decoded in the forward and backward directions, and a code with a specific variable length code that can be decoded in both the forward and backward directions. In a variable length decoding device for decoding variable length encoded data, a first decoded value table storing the decoded value of a specific code indicating the beginning and the end and a second decoded value table storing the decoded value of the fixed length code. For decoding the variable length coded data from the forward direction, a backward decoding means for decoding the variable length coded data from the reverse direction, and a fixed length code. Fixed-length code decoding means for decoding, wherein when decoding the variable-length coded data by the forward decoding means and the backward decoding means, the first and second decoding value tables are used for the start and end. Decoding a specific code that indicates When, referring to the second decoding value table, characterized in that decoded by the fixed-length code decoding means is regarded as a fixed length code the code following the specific code indicating the beginning.

【0015】このようにすることにより、例えば出現確
率の低い情報シンボルをエスケープ符号を付加した固定
長符号として符号化しておけば、固定長符号の部分につ
いてはリバーシブル符号とは独立に復号化ができるの
で、入力され得る情報シンボルの数が増えても、最大符
号長を抑え、記憶量を削減することができる。
By doing so, for example, if an information symbol having a low occurrence probability is encoded as a fixed length code with an escape code added, the fixed length code portion can be decoded independently of the reversible code. Therefore, even if the number of information symbols that can be input increases, the maximum code length can be suppressed and the storage amount can be reduced.

【0016】[0016]

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

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

【0018】次に、本実施形態の各部の詳細な構成と動
作を説明する。符号化部114において、入力された情
報シンボルは符号化器103に入力される。一方、符号
語テーブル102は、符号語テーブル作成部101によ
って予め作成された情報シンボルと可変長符号の符号語
とを対応させて格納している。符号化器103は符号語
テーブル102に格納されている符号語の中から、入力
された情報シンボルに対応した符号語を選択して符号化
データとして出力する。この符号化データは、伝送系ま
たは蓄積系104を通して復号化部115に送られる。
この際、符号化データには一定周期毎に同期コードが挿
入される。
Next, the detailed configuration and operation of each part of this embodiment will be described. In the encoding unit 114, the input information symbol is input to the encoder 103. On the other hand, the code word table 102 stores the information symbols previously created by the code word table creating unit 101 and the code words of the variable length code 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 it 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.

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

【0020】復号値判定部109では、順方向復号化器
107によって得られた復号結果(順方向復号結果とい
う)と、逆方向復号化器108によって得られた復号結
果(逆方向復号結果という)から復号値を判定し、最終
的な復号結果を出力する。すなわち、復号値判定部10
9では符号化データに誤りがあると、復号木に出現しな
いビットパターンが生じることから誤りの存在が分かる
ので、順方向復号結果と逆方向復号結果から図2に示す
ように復号値を判定する。図2は、同期コードと同期コ
ードとの間の復号値判定方法を示している。
In the decoded value decision unit 109, the decoding result obtained by the forward decoder 107 (referred to as the forward decoding result) and the decoding result obtained by the backward decoder 108 (referred to as the backward decoding result). The decoded value is determined from and the final decoded result is output. That is, the decoded value determination unit 10
In No. 9, if there is an error in the encoded data, the existence of an error can be known because a bit pattern that does not appear in the decoding tree occurs, so 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 sync codes.

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

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

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

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

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

【0026】図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 code word table creating section 101. The code selecting unit 21 receives the information of the occurrence probability of the information symbol, selects the one having the smallest average code length from the selectable code systems based on this information, and outputs the selection result to the code word forming unit 22. send. The code word constructing unit 22 composes the code word of the code selected by the code word selecting unit 21 and creates a code word table. The codeword table created by the codeword constructing unit 22 is the codeword table 102 and the decoding unit 11 in the encoding unit 114.
5 to the forward codeword table 110. The codeword table described in the reverse direction to the forward direction is sent to the backward codeword table 112 in the decoding unit 115.

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

【0028】[0028]

【数1】 [Equation 1]

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

【0030】以下、符号語構成部22における符号語の
構成方法について述べる。
The method of constructing the codeword in the codeword constructing section 22 will be described below.

【0031】図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 create a binary code sequence with a constant weight, which is the basis of the variable length code according to this embodiment. As shown in FIG. 4A, from the start point to e
A grid-like directed graph reaching the nd point is formed. When tracing the route from the start point to the end point in this directed graph, "0" is made to correspond when the left route is selected, and "1" is made when the right route is selected. The binary code sequence shown in is generated.
In this example, the code length is 5 bits and the weight (the number of "1")
Generate a binary code sequence of 2. Generally, there are as many binary code sequences having a code length of n bits and a weight of w as the number of combinations for selecting w from n. In this case, there are 10 binary code sequences, which is the number of combinations for selecting 2 from 5.

【0032】図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 code word of a variable length code (hereinafter referred to as a reversible code) that can be decoded in the forward direction and the backward direction in the code word construction unit 22. First, as shown on the left side of FIG. 5, the weight (the number of “1”) is fixed by the method of FIG. In this case, one binary code sequence is created. Next, as shown on the right side of FIG. 5, a code word of the reversible code is constructed by adding "1" to the beginning and the end of each of the binary code sequences and assigning 0 to the shortest code. This reversible code always starts with a code “0” for the information symbol A and starts with a code “1” for the other information symbols B to J, and when three “1” appear in total. The code configuration ends the code, that is, the code delimiter (code length) is known.

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

【0034】図5の可変長符号の符号語構成方法のパラ
メータは、符号語中の“1”の数を重みとし、重みを2
以上の自然数wとすることにより、様々な情報シンボル
の生起確率に対応することができる。もちろん、ビット
を反転させて、“0”の数を重みと考えて議論しても同
様である。
The parameter of the method of constructing the code word of the variable length code of 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 when the bits are inverted and the number of “0” is considered as the weight.

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

【0036】この可変長符号では、各符号の最初にある
シンボルの個数をカウントすることによって符号長が分
かる。図7の例では、各符号の最初にあるシンボルが4
つ出現したら符号が終わる符号構成、つまり符号の区切
り(符号長)が分かる符号構成となっている。
In this variable length code, the code length can be known 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 one appears, that is, the code delimiter (code length) is known.

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

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

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

【0040】次に、本発明に係るリバーシブル符号の短
縮化方法について説明する。情報シンボルの数、つまり
可変長符号の符号数は有限であるため、可変長符号の一
部の符号を短縮化することが可能である。ここで、短縮
化とは他の符号の符号長を増やすことなく、一部の符号
の符号長を縮めることをいう。図11は、リバーシブル
符号の短縮化方法の一例を示している。
Next, a method of 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 a part of the codes of the variable length code. Here, shortening means reducing the code lengths of some codes without increasing the code lengths of other codes. FIG. 11 shows an example of a method of shortening a reversible code.

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

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

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

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

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

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

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

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

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

【0050】一方、符号化部213に符号語テーブル2
02に対応する符号語が存在しない情報シンボル、つま
り出現頻度の比較的低い情報シンボルが入力されたとき
は、その情報シンボルに対応した固定長符号を固定長符
号符号化部204で作成し、さらに符号語テーブル20
2中のエスケープ符号を固定長符号の先頭と末尾に付加
して符号語とし、これを符号化データとして出力する。
On the other hand, the code word table 2 is supplied to the encoding unit 213.
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 further, Codeword table 20
The escape code in 2 is added to the beginning and end of the fixed length code to form a code word, which is output as encoded data.

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

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

【0053】図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 the end of a fixed length code in the code word table creating unit 201 in FIG. As shown in FIG. 16A, in the codeword created by the codeword table creating unit 201, when the information symbol is other than “A”, the number of “1” appears three times, and the code delimiter is separated. It is based on the known reversible code. This reversible code will be referred to as code (1).

【0054】一方、図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.
Code word "1" corresponding to information symbol "C" of code (1)
011 "is an escape code for indicating the beginning and the end of the fixed length code, and a code word configured by adding to the beginning and the end of the 3-bit fixed length code is newly added to the code (1). However, the reversible code part 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 the code words corresponding to the information symbols A to I that are one less by the code (1) are used.
As is clear from comparison between (a) and (b), the code (2) has the number of codeable information symbols of “10” of the code (1).
Has increased from 17 to.

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

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

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

【0058】図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 binary code sequences with constant weight. As an algorithm for counting binary code sequences with constant weight, JPMShalkwijk:
“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. According to the algorithm of Sharkwijk, FIG.
As shown in (a), a lattice-like directed graph from the START point to the END point is formed based on the "Pascal's triangle". The numerical value at each node is ST
The value of the node at the ART point is 1, and it is the total value of the values of the nodes at the starting points of the two arrows coming into each node.
That is, the value of each node is determined by Pascal's triangle.

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

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

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

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

【0063】一方、逆方向については上述の順方向の場
合と同様に、まずリバーシブル符号の先頭が“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 beginning of the reversible code is "0", the decoded value is set to 0, and in other cases, the leading and trailing "1" are deleted. Then, after inverting the rest, S
The ordinal value is calculated by the algorithm of halkwijk.
Then, the sum of this order value and the sum of the nodes on the diagonally right upper side of the END point +1, is taken as the decoded value.

【0064】図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, referring to FIGS. 18 (a) and 18 (b), for example, if the codeword to be decoded by the reversible code is "10101", first the leading and trailing "1" s are deleted and "1" is deleted. 010 ". Sh for this "010"
When the ordinal value is calculated by the alkwijk algorithm, 2
For a certain “0”, (1-1) + (3-2) = 1. In this case, the sum of the values of the nodes diagonally upper right of the END point is 1 + 2 = 3, so this value +1 (= 4) is added to the sequence value (= 1), and the decoded value is obtained as 5.

【0065】このような復号グラフを用いて復号化を行
うと、記憶量を大きく低減することができる。図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 storage amount can be greatly reduced. FIG. 19
(A) and (b) are a decoding method using a conventional decoding tree,
FIG. 11 is a diagram showing a difference in storage amount required in the decoding method using the decoding graph according to the present embodiment. Comparing the two by the number of nodes, the number of arrows coming out from each node is the same, but the number of arrows coming into each node is always one in the case of the decoding tree of FIG. 19A. . On the other hand, in the case of the decoding graph of FIG. 19B, since two arrows enter each node, the total number of nodes required for the same codeword decreases accordingly. In this example, the decoding tree in FIG. 19 (a) requires 15 nodes, whereas the decoding graph in FIG. 19 (b) 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.

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

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

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

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

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

【0071】図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 more detailed structures of the moving picture multiplexing unit 703 and the moving picture multiplexing separating unit 707 in FIG. FIG. 23 (a)
In the moving picture multiplexing unit 703 shown in FIG. 21, among the encoded data from the information source encoder 702 in FIG. 21, macroblock mode information, motion vector information, and INTRAD
Although information other than the DCT coefficient, such as C, is used as an upper layer, normal variable length coding is performed by the upper layer variable length encoder 901, and then redundancy is further increased by the upper layer communication channel encoder 902. The channel is coded by an error correction detection code having a high correction capability and sent to the multiplexing unit 905.

【0072】一方、情報源符号化器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 the lower layer variable length encoder 9
It is encoded into a reversible code at 03, and further, is channel-coded at the lower layer communication channel encoder 904 by an error correction detection code having a low degree of redundancy, and then sent to the multiplexing unit 905. The multiplexing unit 905 multiplexes the encoded data of the upper layer and the encoded data of the lower layer,
Send to 4.

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

【0074】下位階層可変長復号化器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 higher layer variable length decoder 909. The upper layer variable length decoder 909 decodes the variable length code that is the encoded data of the upper layer, and rewrites the coding result based on the decoding result of the lower layer variable length decoder 910.

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

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

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

【0078】情報源符号化器702では、量子化後の8
×8のDCT係数のブロックについてはブロック内のス
キャンを行って、LAST(0:ブロックの最後でない
非零係数、1:ブロックの最後の非零係数)、RUN
(非零係数までの零ランの数)およびLEVEL(係数
の絶対値)を求め、動画像符号化器709に送る。
In the information source encoder 702, the quantized 8
For a block of DCT coefficients of × 8, scan inside the block is performed, and LAST (0: non-zero coefficient not at the end of block, 1: non-zero coefficient at the end of 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.

【0079】動画像符号化器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 coder 903 in the moving picture coder 709 has the non-last coefficients of INTRA and INTER shown in FIGS. 24 to 25, RUN and LEVEL.
To the reversible code (VLC_CODE) for the non-LAST coefficient codeword table (first codeword table), and INTRA and INT shown in FIGS.
It has a codeword table (second codeword table) of LAST coefficients in which reversible codes (VLC_CODE) are associated with LAST coefficients of ER, RUN, and LEVEL. Then, based on the mode information, the codeword table of the INLAST non-LAST coefficient and the LAST coefficient is selected in the case of INTRA, and the codeword table of the INTER non-LAST coefficient and the LAST coefficient is selected in the case of INTER, respectively. 26 to 27, VLC_
The last bit "S" of CODE represents the sign of LEVEL, and when "S" is "0", the sign of LEVEL is positive,
It is negative when "1".

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

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

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

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

【0084】図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 this embodiment. The decoded value can be calculated by this decoding graph for the encoded data excluding the first bit and the last 2 bits of the code word when viewed from the forward direction.

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

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

【0087】一方、復号値を求めるには、先頭のビット
が“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 diagonally to the right of the terminal node to the sequence value is 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 diagonally to the right of the terminal node + the value of the terminal node plus the sequence value.

【0088】例えば、復号対象の符号列が“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, the code string to be decoded is "01101".
If it is 01 ”, first, looking from the forward direction, the first 1 bit and the last 2 bits are removed and set to“ 1101. ”Since the first bit is“ 0 ”, if“ 0 ”appears in the decoding graph, the right arrow is displayed. Proceed and if the "1" appears, proceed to the left sign.
In this case, the difference between the nodes when the left arrow is advanced is (1-
1) + (1-1) + (4-3) = 1, so the ordinal value is 1
Is. Since the most significant bit is “0”, it is twice the sum of the nodes diagonally to the right of the end node (1 + 2 + 3) × 2 = 1
If order 1 is added to 2, it becomes 13, and the decoded value of this code word is obtained as 13.

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

【0090】この例では、例えば復号値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 shown in FIG.
As can be seen from (a), it is found that the LAST number is 3, the absolute value of LEVEL is 1, and the least significant bit is "1", so LEVEL is negative. . Furthermore, 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 the coefficient is the LAST coefficient or the non-LAST coefficient, and the fixed-length code decoding unit 2 determines the subsequent 13 bits.
After decoding the absolute values of RUN and LEVEL in 10, the escape code is decoded again, and the sign of LEVEL is determined by the last bit.

【0091】一例として、符号化対象の符号列が“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, the code string to be encoded is "11".
0000010000111000101111000
Consider the case of 010 ”. In this case, since the last bit of the escape code“ 11000010 ”at the beginning is“ 0 ”, it is a non-LAST coefficient, and the fixed length code of the subsequent 13 bits is calculated. Since 6 bits represent RUN, "000111" means RUN is 7,
Since the lower 7 bits represent the absolute value of LEVEL, "00"
With 01011, the absolute value of LEVEL is 12, and the last bit of the escape code "11000010" at the end is "0".
Therefore, LEVEL can be decoded as positive.

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

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

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

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

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

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

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

【0099】また、上記実施形態では2元符号のみの議
論を示したが、多元符号にも拡張することが容易であ
り、同様な効果を得ることができる。
In the above embodiment, only binary codes have been discussed, but it is easy to extend to multi-level codes and similar effects can be obtained.

【0100】最後に、本発明の応用例として、本発明に
よる可変長符号化/復号化装置を適用した画像送受信装
置の実施形態を図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 coding / decoding apparatus according to the present invention is applied will be described with reference to FIG. The image signal input from the camera 1002 provided in the personal computer (PC) 1001 is encoded by the variable length encoding device incorporated in the PC 1001. The information symbol in this case is not limited to this,
For example, it may be DCT coefficient data obtained by performing a discrete cosine transform on the input image signal or a difference between the input image signal and the predicted image signal by the DCT circuit, and further quantizing the signal by the quantization circuit. The coded data output from the variable-length coding device is multiplexed with other voice and data information, and then wirelessly transmitted by the wireless device 1003 and received by the other wireless device 1004. Radio 1
The signal received at 004 is decomposed into encoded data of an image signal and information of voice and data. Of these,
The encoded data of the image signal is the workstation (EW
S) Decoded by the variable length code decoding device incorporated in 1005, and displayed on the display of EWS 1005.

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

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

【0103】以上説明したように、本発明の可変長符号
化/復号化装置は、従来と比較して、少ない記憶量で復
号することができ、従来適用することのできなかったよ
うな情報シンボル数が大きな符号化に対しても適用する
ことができる。具体的には、動画像符号化/復号化装置
にも適用することが可能であり、誤りに強い動画像符号
化/復号化装置を提供することができる。
As described above, the variable-length coding / decoding device of the present invention can decode with a smaller storage amount as compared with the conventional one, and the information symbol which cannot be applied conventionally. It can also be applied to coding with a large number. Specifically, it can be applied to a moving picture coding / decoding apparatus, and an error resistant moving picture coding / decoding apparatus can be provided.

【0104】[0104]

【発明の効果】以上説明したように、本発明によれば順
方向にも逆方向にも復号可能で、しかも符号化効率や装
置に必要な記憶量などの点で実用性に富んだ可変長復号
化方法及び装置を提供することができる。
As described above, according to the present invention, it is possible to perform decoding in the forward direction and the backward direction, and the variable length is practical in terms of the coding efficiency and the storage amount required for the device. A decoding method and device can be provided.

【0105】すなわち、出現確率の低い情報シンボルを
エスケープ符号を付加した固定長符号として符号化し、
固定長符号の部分についてはリバーシブル符号とは独立
に符号化/復号化ができるので、画像符号化/復号化器
における量子化された直交変換係数のような数の極めて
多い情報シンボルを符号化する場合でも、最大符号長を
抑えて記憶量を効果的に削減することができる。
That is, an information symbol having a low appearance probability is encoded as a fixed length code with an escape code added,
Since the fixed-length code part can be encoded / decoded independently of the reversible code, an extremely large number of information symbols such as quantized orthogonal transform coefficients in the image encoder / decoder are encoded. Even in such a case, the maximum code length can be suppressed to effectively reduce the storage amount.

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

【図1】本発明の一実施形態に係る可変長符号化/復号
化装置の構成を示すブロック図
FIG. 1 is a block diagram showing a configuration of a variable length coding / 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.

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

【図5】図3における符号語構成部での第1の符号語構
成方法を示す図
5 is a diagram showing a first codeword constructing method in the codeword constructing 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 constructing method in the codeword constructing unit in FIG. 3;

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

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

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

【図11】図3における符号語構成部での符号短縮化方
法を示す図
FIG. 11 is a diagram showing a code shortening method in the code word construction 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 enlargement method in the code word configuration unit in FIG.

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

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

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

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

【図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 diagram for explaining a decoded value table according to the present embodiment.

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

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

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

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

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

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

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

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

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

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

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

【図32】同実施形態におけるINTRAおよびINT
ERの非LAST係数の復号値テーブルの一部を示す図
FIG. 32 is an INTRA and INT in the same 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 is an INTRA and INT in the same 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 is an INTRA and INT in the same embodiment.
The figure which shows the decoding value table of the LAST coefficient of ER.

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

【図36】図15における復号値判定部の動作を説明す
るための図
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 macroblocks in the embodiment.

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

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

【図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 system or storage system 105 ... Sync code detection unit 106 ... buffer 107 ... Forward decoder 108 ... Inverse decoder 109 ... Decoded value determination unit 110 ... Forward decoding word table 111 ... Forward decoding tree creation unit 112 ... Reverse codeword table 113 ... Reverse decoding tree creation unit 114 ... Encoding unit 115 ... Decoding unit 21 ... Code selection unit 22 ... Codeword constructing section 201 ... Codeword table creation unit 202 ... Code word table 203 ... Encoder 204 ... Fixed-length code encoder 205 ... Transmission system or storage system 206 ... Sync code detector 207 ... buffer 208 ... Decoding graph / decoding value table creation unit 209 ... Forward decoder 220 ... Fixed-length code decoding unit 211 ... Inverse decoder 212 ... Decoded 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 storage system 706 ... Receive buffer 707 ... Moving image multiplexing / separating unit 708 ... Information source decoder 709 ... Moving image encoder 710 ... Video decoder 901 ... Lower layer variable length decoder 902 ... Upper layer communication channel encoder 903 ... Lower layer variable length encoder 904 ... Lower layer communication channel encoder 905 ... Multiplexing unit 906 ... Multiplexing / separating unit 907 ... Upper layer communication channel decoder 908 ... Lower layer channel decoder 909 ... Upper layer variable length decoder 910 ... Lower layer variable length decoder 1001 ... Personal computer 1002 ... work station 1003 ... radio 1004 ... radio 1005 ... camera 1006 ... camera

フロントページの続き (56)参考文献 特開 平5−300027(JP,A) 特開 平4−213988(JP,A) 特開 平6−21830(JP,A) 特開 平6−237184(JP,A) Y.Takishima,et a l,Reversible Varia ble Length Codes,I EEE TRANSACTIONS O N COMMUNICATIONS,米 国,IEEE,1995年 2月,Volu me 43,Issue 2,pp158− 162 (58)調査した分野(Int.Cl.7,DB名) H03M 7/42 H04N 7/30 Continuation of the front page (56) Reference JP-A-5-300027 (JP, A) JP-A-4-213988 (JP, A) JP-A-6-21830 (JP, A) JP-A-6-237184 (JP , A) Y. Takashima, et al, Reversible Variable length Codes, IEE TRANSACTIONS ON COMMUNICATIONS, USA, February 1995, Vol. 43, Issue 162, p. 7 , DB name) H03M 7/42 H04N 7/30

Claims (8)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】固定長符号の先頭及び末尾に該先頭及び末
尾を示す特定の符号を付加した符号を含む、順方向にも
逆方向にも復号可能な可変長符号化データを復号する可
変長復号化方法であって、 前記可変長符号化データを順方向または逆方向から復号
する際に、前記先頭及び末尾を示す特定の符号の復号値
を格納した第1の復号値テーブルを用いて前記先頭及び
末尾を示す特定の符号が復号されたときは、前記固定長
符号の復号値を格納した第2の復号値テーブルを参照し
て、前記先頭を示す特定の符号に続く符号を固定長符号
とみなして復号することを特徴とする可変長復号化方
法。
1. A variable length for decoding variable length encoded data which includes a fixed length code having a head and a tail added with a specific code indicating the head and the tail and which can be decoded in a forward direction and a backward direction. A decoding method, wherein when decoding the variable-length coded data from a forward direction or a backward direction, using the first decoded value table storing decoded values of specific codes indicating the head and the tail, When the specific code indicating the head and the end is decoded, the code following the specific code indicating the head is fixed length code by referring to the second decoded value table storing the decoded value of the fixed length code. A variable length decoding method, which is characterized in that
【請求項2】固定長符号の先頭及び末尾に該先頭及び末
尾を示す順方向にも逆方向にも復号可能な特定の符号を
付加した符号を含む、順方向にも逆方向にも復号可能な
可変長符号化データを復号する可変長復号化方法であっ
て、 前記可変長符号化データを順方向または逆方向から復号
する際に、前記先頭及び末尾を示す順方向にも逆方向に
も復号可能な特定の符号の復号値を格納した第1の復号
値テーブルを用いて前記先頭及び末尾を示す順方向にも
逆方向にも復号可能な特定の符号が復号されたときは、
前記固定長符号の復号値を格納した第2の復号値テーブ
ルを参照して、前記先頭を示す順方向にも逆方向にも復
号可能な特定の符号に続く符号を固定長符号とみなして
復号することを特徴とする可変長復号化方法。
2. Decoding in a forward direction or a backward direction, which includes a code in which a specific code that indicates the beginning and the end of a fixed-length code and that can be decoded in the forward direction or the backward direction is added A variable-length decoding method for decoding variable-length coded data, wherein when decoding the variable-length coded data from a forward direction or a backward direction, the forward and backward directions indicating the head and the tail are shown. When a specific code that can be decoded in the forward direction or the backward direction indicating the head and the end is decoded using the first decoded value table that stores the decoded value of the specific code that can be decoded,
By referring to the second decoded value table that stores the decoded value of the fixed length code, the code following the specific code that can be decoded in the forward direction or the backward direction indicating the head is regarded as the fixed length code and decoded. A variable length decoding method comprising:
【請求項3】固定長符号の先頭及び末尾に該先頭及び末
尾を示す順方向にも逆方向にも復号可能な特定の可変長
符号を付加した符号を含む、順方向にも逆方向にも復号
可能な可変長符号化データを復号する可変長復号化方法
であって、 前記可変長符号化データを順方向または逆方向から復号
する際に、前記先頭及び末尾を示す順方向にも逆方向に
も復号可能な特定の可変長符号の復号値を格納した第1
の復号値テーブルを用いて前記先頭及び末尾を示す順方
向にも逆方向にも復号可能な特定の可変長符号が復号さ
れたときは、前記固定長符号の復号値を格納した第2の
復号値テーブルを参照して、前記先頭を示す順方向にも
逆方向にも復号可能な特定の可変長符号に続く符号を固
定長符号とみなして復号することを特徴とする可変長復
号化方法。
3. A forward code or a backward code, which includes a code in which a specific variable-length code that can be decoded in the forward direction or the backward direction indicating the head and the end of the fixed-length code is added. A variable-length decoding method for decoding decodable variable-length coded data, wherein when decoding the variable-length coded data from a forward direction or a backward direction, the forward direction and the backward direction indicating the beginning and the end are also reversed. Stored the decoded value of a specific variable-length code that can also be decoded by
When a specific variable-length code that can be decoded in the forward direction or the backward direction indicating the head and the tail is decoded using the decoded value table of No. 2, the second decoding that stores the decoded value of the fixed-length code A variable-length decoding method, which refers to a value table and decodes a code following a specific variable-length code that can be decoded in the forward direction or the backward direction indicating the beginning as a fixed-length code.
【請求項4】前記特定の符号または前記特定の可変長符
号はエスケープ符号であることを特徴とする請求項1乃
至3のいずれか1項記載の可変長復号化方法。
4. The variable length decoding method according to claim 1, wherein the specific code or the specific variable length code is an escape code.
【請求項5】固定長符号の先頭及び末尾に該先頭及び末
尾を示す特定の符号を付加した符号を含む、順方向にも
逆方向にも復号可能な可変長符号化データを復号する可
変長復号化装置であって、 前記先頭及び末尾を示す特定の符号の復号値を格納した
第1の復号値テーブル及び前記固定長符号の復号値を格
納した第2の復号値テーブルを作成する手段と、 前記可変長符号化データを順方向から復号する順方向復
号手段と、 前記可変長符号化データを逆方向から復号する逆方向復
号手段と、 固定長符号を復号する固定長符号復号手段とを有し、 前記順方向復号手段および前記逆方向復号手段で前記可
変長符号化データを復号する際に、前記第1の復号値テ
ーブルを用いて前記先頭及び末尾を示す特定の符号が復
号されたときは、前記第2の復号値テーブルを参照し
て、前記先頭を示す特定の符号に続く符号を固定長符号
とみなして前記固定長符号復号手段で復号することを特
徴とする可変長復号化装置。
5. A variable length for decoding variable length coded data which includes a fixed length code having a head and a tail added with a specific code indicating the head and the tail and which can be decoded in the forward direction and the backward direction. A decoding device, which is configured to create a first decoded value table storing a decoded value of a specific code indicating the start and the end, and a second decoded value table storing a decoded value of the fixed length code. A forward decoding means for decoding the variable length coded data from the forward direction, a backward decoding means for decoding the variable length coded data from the reverse direction, and a fixed length code decoding means for decoding a fixed length code. And, when decoding the variable length coded data by the forward decoding means and the backward decoding means, a specific code indicating the head and the tail is decoded using the first decoded value table. When the second Referring to issue value table, the variable length decoding apparatus characterized by decoding by the fixed-length code decoding means codes following the specific code is regarded as a fixed length code indicating the beginning.
【請求項6】固定長符号の先頭及び末尾に該先頭及び末
尾を示す順方向にも逆方向にも復号可能な特定の符号を
付加した符号を含む、順方向にも逆方向にも復号可能な
可変長符号化データを復号する可変長復号化装置であっ
て、 前記先頭及び末尾を示す順方向にも逆方向にも復号可能
な特定の符号の復号値を格納した第1の復号値テーブル
及び前記固定長符号の復号値を格納した第2の復号値テ
ーブルを作成する手段と、 前記可変長符号化データを順方向から復号する順方向復
号手段と、 前記可変長符号化データを逆方向から復号する逆方向復
号手段と、 固定長符号を復号する固定長符号復号手段とを有し、 前記順方向復号手段および前記逆方向復号手段で前記可
変長符号化データを復号する際に、前記第1の復号値テ
ーブルを用いて前記先頭及び末尾を示す順方向にも逆方
向にも復号可能な特定の符号が復号されたときは、前記
第2の復号値テーブルを参照して、前記先頭を示す順方
向にも逆方向にも復号可能な特定の符号に続く符号を固
定長符号とみなして前記固定長符号復号手段で復号する
ことを特徴とする可変長復号化装置。
6. A forward- or backward-direction code including a code in which a fixed-length code is added to the start and end of the fixed-length code and a specific code that indicates the start and end can be decoded in the forward or reverse direction. Variable-length decoding apparatus for decoding variable-length coded data, which is a first decoded value table storing decoded values of a specific code that can be decoded in the forward direction and the backward direction indicating the start and end. And means for creating a second decoded value table storing decoded values of the fixed-length code, forward decoding means for decoding the variable-length coded data from the forward direction, and reverse direction for the variable-length coded data. Backward decoding means for decoding from, and fixed length code decoding means for decoding fixed length code, wherein when decoding the variable length coded data by the forward decoding means and the backward decoding means, Using the first decoded value table When a specific code that can be decoded in the forward and backward directions indicating the beginning and the end is decoded, the second decoded value table is referred to and the forward or backward direction indicating the beginning is detected. A variable length decoding device characterized in that a code following a specific decodable code is regarded as a fixed length code and is decoded by said fixed length code decoding means.
【請求項7】固定長符号の先頭及び末尾に該先頭及び末
尾を示す順方向にも逆方向にも復号可能な特定の可変長
符号を付加した符号を含む、順方向にも逆方向にも復号
可能な可変長符号化データを復号する可変長復号化方法
であって、 前記先頭及び末尾を示す順方向にも逆方向にも復号可能
な特定の可変長符号の復号値を格納した第1の復号値テ
ーブル及び前記固定長符号の復号値を格納した第2の復
号値テーブルを作成する手段と、 前記可変長符号化データを順方向から復号する順方向復
号手段と、 前記可変長符号化データを逆方向から復号する逆方向復
号手段と、 固定長符号を復号する固定長符号復号手段とを有し、 前記順方向復号手段および前記逆方向復号手段で前記可
変長符号化データを復号する際に、前記第1の復号値テ
ーブルを用いて前記先頭及び末尾を示す順方向にも逆方
向にも復号可能な特定の可変長符号が復号されたとき
は、前記第2の復号値テーブルを参照して、前記先頭を
示す順方向にも逆方向にも復号可能な特定の可変長符号
に続く符号を固定長符号とみなして前記固定長符号復号
手段で復号することを特徴とする可変長復号化装置。
7. A forward code or a backward code, which includes a code in which a specific variable-length code that can be decoded in the forward and backward directions indicating the head and the end of the fixed-length code is added. A variable-length decoding method for decoding decodable variable-length coded data, which stores a decoded value of a specific variable-length code that can be decoded in a forward direction indicating the head and an end and a backward direction. Means for creating a second decoded value table storing the decoded value table and the fixed-length code decoded value, forward decoding means for decoding the variable-length coded data from the forward direction, and the variable-length coding It has a backward decoding means for decoding the data from the backward direction and a fixed length code decoding means for decoding a fixed length code, and decodes the variable length coded data by the forward decoding means and the backward decoding means. When the first decoded value table When a specific variable-length code that can be decoded in the forward and backward directions indicating the start and end is decoded using, the second decoded value table is referred to, and the forward direction indicating the start is indicated. A variable length decoding device characterized in that a code following a specific variable length code that can be decoded in the opposite direction is regarded as a fixed length code and is decoded by the fixed length code decoding means.
【請求項8】前記特定の符号または前記特定の可変長符
号はエスケープ符号であることを特徴とする請求項5乃
至7のいずれか1項記載の可変長復号化装置。
8. The variable length decoding device according to claim 5, wherein the specific code or the specific variable length code is an escape code.
JP2001117332A 1995-04-14 2001-04-16 Variable length decoding method and apparatus Expired - Lifetime JP3417933B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001117332A JP3417933B2 (en) 1995-04-14 2001-04-16 Variable length decoding method and apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8977295 1995-04-14
JP7-89772 1995-04-14
JP2001117332A JP3417933B2 (en) 1995-04-14 2001-04-16 Variable length decoding 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
JP2001308717A JP2001308717A (en) 2001-11-02
JP3417933B2 true JP3417933B2 (en) 2003-06-16

Family

ID=26431181

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001117332A Expired - Lifetime JP3417933B2 (en) 1995-04-14 2001-04-16 Variable length decoding method and apparatus

Country Status (1)

Country Link
JP (1) JP3417933B2 (en)

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Y.Takishima,et al,Reversible Variable Length Codes,IEEE TRANSACTIONS ON COMMUNICATIONS,米国,IEEE,1995年 2月,Volume 43,Issue 2,pp158−162

Also Published As

Publication number Publication date
JP2001308717A (en) 2001-11-02

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
JP3417933B2 (en) Variable length decoding method and apparatus
JP3417934B2 (en) Variable length encoding method and apparatus
JP3609814B2 (en) Variable length decoding method and apparatus
JP3766426B2 (en) Variable length coding method and apparatus
JP3233360B2 (en) Variable length decoding method and apparatus
JP3612315B2 (en) Variable length decoding method and apparatus
JP3609813B2 (en) Variable length coding method and apparatus
JP3869342B2 (en) Variable length decoding method and apparatus
JP3612314B2 (en) Variable length coding method and apparatus
JP3866687B2 (en) Variable length coding method and apparatus
JP3944049B2 (en) Variable length decoding method and apparatus
JP3579409B2 (en) Variable length encoding method and apparatus
JP3748215B2 (en) Variable length coding method and apparatus
JP3579410B2 (en) Variable length encoding method and apparatus
JP3764466B2 (en) Variable length decoding method and apparatus
JP3579411B2 (en) Variable length encoding method and apparatus
JP3822630B2 (en) Variable length decoding method and apparatus
JP3579412B2 (en) Variable length decoding method and apparatus
JP3822629B2 (en) Variable length coding method and apparatus
JP3164806B2 (en) Variable length encoding 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