JP2004364340A - Variable length coding method and device - Google Patents

Variable length coding method and device Download PDF

Info

Publication number
JP2004364340A
JP2004364340A JP2004266017A JP2004266017A JP2004364340A JP 2004364340 A JP2004364340 A JP 2004364340A JP 2004266017 A JP2004266017 A JP 2004266017A JP 2004266017 A JP2004266017 A JP 2004266017A JP 2004364340 A JP2004364340 A JP 2004364340A
Authority
JP
Japan
Prior art keywords
code
decoding
decoded
codeword
length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2004266017A
Other languages
Japanese (ja)
Other versions
JP3766426B2 (en
Inventor
Takeshi Nakajo
健 中條
Takeshi Nagai
剛 永井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2004266017A priority Critical patent/JP3766426B2/en
Publication of JP2004364340A publication Critical patent/JP2004364340A/en
Application granted granted Critical
Publication of JP3766426B2 publication Critical patent/JP3766426B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a variable length coding method capable of constituting a variable length code which can be decoded forwards and backwards, reduces useless bit patterns and improves coding efficiency. <P>SOLUTION: A code word table is configured for storing a plurality of code which can be decoded forward and backward and in which the code of the level of a DCT coefficient after quantization is added to the final bit in correspondence with the last DCT coefficient after quantization and the various combination of runs and levels, and a code word inputted from the code word table corresponding to the last DCT coefficient after quantization and the combination of runs and levels is selected and outputted as coded data. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

この発明は、可変長符号化方法及び装置に関する。   The present invention relates to a variable length coding method and apparatus.

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

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

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

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

また、従来のリバーシブル符号のもう一つの問題点として、情報シンボル数が大きい場合には、可変長符号化/復号化装置で必要とされる記憶量が多くなるために、実用に適さないという点があった。情報シンボル数が大きい場合の例としては、動画像や静止画像の画像符号化でよく用いられる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 encoding / decoding device increases, which is not suitable for practical use. was there. An example of a case where the number of information symbols is large is DCT coefficient encoding which is often used in image encoding of a moving image or a still image. Normally, in image coding, DCT (discrete cosine transform) of 8 × 8 is performed, and 8-bit linear quantization is performed on orthogonal transform coefficients obtained as DCT coefficients. Further, zigzag scanning is performed on the quantized DCT transform coefficients from a low frequency band, and variable length coding is performed using a set of zero-run and non-zero coefficients.

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

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

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

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

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

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

上記の課題を解決するため、本発明は入力される量子化後のDCT係数に対応した可変長の符号語からなる符号化データを出力する可変長符号化において、順方向にも逆方向にも復号可能であって、最終ビットに量子化後のDCT係数のレベルの符号を付加した複数の符号語を量子化後のDCT係数のラストとラン及びレベルの異なる組み合わせにそれぞれ対応させて格納した符号語テーブルを構成し、この符号語テーブルから入力される量子化後のDCT係数のラストとラン及びレベルの組み合わせに対応する符号語を選択して符号化データとして出力することを特徴とする。ここで、符号化テーブルに格納された複数の符号語は、例えば予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成される。   In order to solve the above-mentioned problem, the present invention provides a variable-length coding that outputs coded data composed of a variable-length codeword corresponding to an input quantized DCT coefficient. A code that is decodable and has a plurality of codewords obtained by adding a code of the level of the quantized DCT coefficient to the last bit and corresponding to different combinations of the last, run, and level of the quantized DCT coefficient, respectively. A word table is formed, and a code word corresponding to a combination of last, run, and level of the quantized DCT coefficient input from the code word table is selected and output as encoded data. Here, the plurality of codewords stored in the encoding table are configured such that the delimiter of the codeword can be identified by, for example, a predetermined number of “1” or “0”.

本発明によれば順方向にも逆方向にも復号可能で、しかも符号化効率や装置に必要な記憶量などの点で実用性に富んだ可変長符号化方法及び装置を提供することができる。   According to the present invention, it is possible to provide a variable-length encoding method and apparatus which can be decoded in both the forward and reverse directions, and which are practical in terms of encoding efficiency and storage capacity required for the apparatus. .

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

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

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

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

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

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

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

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

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

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

符号選択部21では、入力された情報シンボルを生起確率が大きい順に並べ替えてS={S1 ,S2 ,…,Sn }とし、これらの情報シンボルSの生起確率P={p1 ,p2 ,…,pn }に基づいて、構成可能な符号の集合Cの中から、

Figure 2004364340
The code selection unit 21 rearranges the input information symbols in descending order of the occurrence probabilities to S = {S1, S2,..., Sn}, and the occurrence probabilities P = {p1, p2,. pn}, based on a set C of configurable codes,
Figure 2004364340

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

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

図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 forming a codeword 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 codeword forming unit 22. First, as shown on the left side of FIG. 5, the weight (the number of “1”) is constant (the number of “1”) by the method of FIG. 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 formed by adding "1" to the beginning and end of each of the binary code sequences and assigning "0" to the shortest code. This reversible code always starts with the code “0” for the information symbol A and “1” for the other information symbols B to J, and when three “1” s appear in all three. This is a code configuration in which the code ends, that is, a configuration where the code delimiter (code length) is known.

可変長符号がリバーシブル符号、すなわち順方向にも逆方向にも復号可能な符号であるための必要十分条件は、全ての符号語が順方向の復号木の葉と逆方向の復号木の葉に割り当てられることである。復号木の葉とは、復号木の末端、つまりそれより先には何も無い個所をいう。例えば、図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 both the forward and reverse directions, is that all codewords are assigned to the leaves of the forward and backward decoding trees. is there. The leaf of the decoding tree is the end of the decoding tree, that is, a place where there is nothing earlier. For example, in the variable-length code of FIG. 5, the codewords corresponding to all the information symbols A to J are the leaves of the forward decoding tree shown in FIG. 6A and the leaves of the backward decoding tree of FIG. Is also assigned, it can be seen that decoding is possible in both the forward and reverse directions.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

次に、本実施形態の各部の詳細な構成と動作を説明する。
符号化部213において、入力された情報シンボルは符号化器203に入力される。符号語テーブル202は、符号語テーブル作成部201によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。但し、符号語テーブル202には入力され得る情報シンボルの全てに対応する符号語が格納されているわけではなく、比較的出現頻度の高い一部の情報シンボルに対応した符号語のみが格納されているものとする。符号化器203は符号語テーブル202に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択して符号化データとして出力する。
Next, a detailed configuration and operation of each unit of the present embodiment will be described.
In the encoding unit 213, the input information symbols are input to the encoder 203. The codeword table 202 stores information symbols created in advance by the codeword table creation unit 201 and codewords of variable-length codes in association with each other. However, the codeword table 202 does not store codewords corresponding to all of the information symbols that can be input, and stores only codewords corresponding to some information symbols having a relatively high appearance frequency. It is assumed that The encoder 203 selects a codeword corresponding to the input information symbol from the codewords stored in the codeword table 202 and outputs the selected codeword as encoded data.

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

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

復号化部214は、同期コード検出部206、バッファ207、復号グラフ・復号値テーブル作成部208、順方向復号化器209、固定長復号化部210、逆方向復号化器211および復号値判定部212からなり、まず伝送系または蓄積系205より入力された符号化データから同期コード検出部206で同期コードを検出し、同期コードと同期コードの間の符号化データをバッファ207に蓄積する。順方向復号化器209では、バッファ207に蓄積された符号化データの先頭から復号を開始し、逆方向復号化器211では、バッファ207に蓄積された符号化データの末尾から復号を開始する。復号値判定部212では、順方向復号化器209によって得られた復号結果(順方向復号値という)と、逆方向復号化器211によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。   The decoding unit 214 includes a synchronization code detection unit 206, a buffer 207, a decoding graph / decoding value table creation unit 208, a forward decoding unit 209, a fixed length decoding unit 210, a backward decoding unit 211, and a decoding value determination unit. The synchronization code detecting unit 206 detects a synchronization code from encoded data input from the transmission system or the storage system 205, and stores the encoded data between the synchronization codes 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. The decoded value determination unit 212 calculates a decoded value from a decoded result (referred to as a forward decoded value) obtained by the forward decoder 209 and a decoded result (referred to as a backward decoded value) obtained by the backward decoder 211. And outputs the final decoding result.

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

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

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

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

復号グラフ・復号値テーブル作成部208は、Shalkwijkのアルゴリズムを基にした復号グラフと、復号値テーブルを作成し、順方向復号化器209および逆方向復号化器211は、これらの復号グラフおよび復号値テーブルに基づいて復号化を行う。   The decoding graph / decoding value table creator 208 creates a decoding graph and a decoding value table based on the Sharkwijk algorithm, and the forward decoder 209 and the backward decoder 211 decode these decoding graph and decoding data. Perform decoding based on the value table.

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

そして、図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 following the route from the START point to the END point according to the input information symbol, the codeword “0” is selected when the left route (arrow) is selected, and the right route is selected. When (arrow) is selected, a binary code sequence having a weight of 2 can be generated by associating the codeword “1” with each other. Here, the value obtained by subtracting the value of the node at the start of the arrow from the value of the node at the end of the arrow when “0” is selected is the code word of the same code length of the binary code sequence. Is the ordinal value of For example, if the input information symbol is “01001”, the sum of the differences between the node values for three “0” s is (1-1) + (3-2) + (4-3) = 2 is the order value. Here, the sequential value is a value for ordering different codewords having the same code length. FIG. 17B shows the relationship between information symbols and order values in this case.

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

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

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

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

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

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

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

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

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

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

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

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

一方、情報源符号化器702からの符号化データのうち、DCT係数は下位階層可変長符号化器903でリバーシブル符号に符号化され、さらに下位階層通信路符号化器904で冗長度の少ない誤り訂正検出符号により通信路符号化された後、多重化部905に送られる。多重化部905では、上位階層の符号化データと下位階層の符号化データを多重化し、伝送バッファ704に送る。   On the other hand, among the encoded data from the information source encoder 702, the DCT coefficients are encoded into a reversible code by the lower layer variable length encoder 903, and the lower layer channel encoder 904 generates an error with less redundancy. After being channel-coded by the correction detection code, it is 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, and sends the multiplexed data to the transmission buffer 704.

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

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

ここで、図23(a)中の下位階層可変長符号化器903は図15中の符号化部213に、図23(b)中の下位階層可変長復号化器910は図15中の復号化部214にそれぞれ対応している。   Here, the lower layer variable length encoder 903 in FIG. 23A is used for the encoding unit 213 in FIG. 15, and the lower layer variable length decoder 910 in FIG. 23B is used for the decoding in FIG. Respectively corresponding to the conversion units 214.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

なお、上記実施形態ではDCT係数の可変長符号化に本発明を適用したが、他の情報シンボルについても同様の可変長符号化を適用できることは、言うまでもない。
また、上記実施形態では2元符号のみの議論を示したが、多元符号にも拡張することが容易であり、同様な効果を得ることができる。
In the above embodiment, the present invention is applied to variable-length coding of DCT coefficients. However, it goes without saying that the same variable-length coding can be applied to other information symbols.
Further, in the above-described embodiment, only the binary code has been discussed, but it is easy to extend to a multiple code, and the same effect can be obtained.

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

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

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

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

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

本発明の一実施形態に係る可変長符号化/復号化装置の構成を示すブロック図1 is a block diagram illustrating a configuration of a variable-length encoding / decoding device according to an embodiment of the present invention. 図1における復号値判定部の動作を説明するための図FIG. 4 is a diagram for explaining the operation of the decoded value determination unit in FIG. 図1における符号語テーブル作成部のブロック図FIG. 1 is a block diagram of a codeword table creation unit in FIG. 本発明に係る可変長符号の基となる重み一定の2進符号系列の作成方法を示す図FIG. 4 is a diagram showing a method for creating a binary code sequence having a constant weight as a basis of a variable length code according to the present invention. 図3における符号語構成部での第1の符号語構成方法を示す図FIG. 3 is a diagram showing a first codeword configuration method in a codeword configuration unit in FIG. 3. 第1の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図FIG. 3 is a diagram showing forward and backward decoding trees created from codewords configured by a first code configuration method. 図3における符号語構成部での第2の符号語構成方法を示す図FIG. 3 is a diagram showing a second codeword configuration method in the codeword configuration unit in FIG. 3. 第2の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図FIG. 7 is a diagram showing forward and backward decoding trees created from codewords configured by a second code configuration method. 図3における符号語構成部での第3の符号構成方法を示す図FIG. 3 is a diagram showing a third code configuration method in the codeword configuration unit in FIG. 第3の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図FIG. 10 is a diagram showing forward and backward decoding trees created from codewords configured by a third code configuration method. 図3における符号語構成部での符号短縮化方法を示す図FIG. 3 is a diagram showing a code shortening method in the code word forming unit in FIG. 符号短縮化方法で短縮化した符号語から作成した順方向および逆方向の復号木を示す図Diagram showing forward and backward decoding trees created from codewords shortened by a code shortening method 図3における符号語構成部での符号拡大化方法を示す図FIG. 3 is a diagram showing a code enlarging method in the code word forming unit in FIG. 本実施形態で構成された可変長符号と公知例の可変長符号の特性を比較して示す図FIG. 6 is a diagram showing a comparison between the characteristics of the variable length code configured in the present embodiment and the variable length code of the known example. 本発明の他の実施形態に係る可変長符号化/復号化装置の構成を示すブロック図FIG. 9 is a block diagram showing a configuration of a variable-length encoding / decoding device according to another embodiment of the present invention. 図15における符号語構成部での符号構成方法を示す図The figure which shows the code | cord | chord structure method in the codeword structure part in FIG. 重み一定の2進系列を数え上げる方法を示す図Diagram showing how to count binary sequences with constant weight 図15における順方向復号化器および逆方向復号化器の動作を示す図FIG. 15 is a diagram showing operations of the forward decoder and the backward decoder in FIG. 従来の復号木と本実施形態における復号グラフを比較して示す図FIG. 7 is a diagram showing a comparison between a conventional decoding tree and a decoding graph in the present embodiment. 本実施形態における復号値テーブルを説明するための図FIG. 7 is a diagram for explaining a decoded value table according to the present embodiment. 本発明による可変長符号化/復号化装置が組み込まれた動画像符号化/復号化器の概略構成を示すブロック図FIG. 1 is a block diagram showing a schematic configuration of a moving image encoder / decoder incorporating a variable length encoding / decoding device according to the present invention. 同実施形態に係る動画像符号化/復号化器における符号化データのシンタックスを示す図FIG. 3 is a diagram illustrating the syntax of encoded data in a video encoder / decoder according to the embodiment. 図21における動画像多重化部および動画像多重化分離部の構成を示すブロック図FIG. 21 is a block diagram showing a configuration of a video multiplexing unit and a video multiplexing / demultiplexing unit in FIG. 同実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの一部を示す図The figure which shows a part of codeword table of the non-LAST coefficient of INTRA and INTER in the embodiment. 同実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの他の一部を示す図FIG. 14 is a diagram showing another part of the codeword table of the non-LAST coefficients of INTRA and INTER in the embodiment. 同実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの一部を示す図FIG. 7 is a diagram illustrating a part of a codeword table of LAST coefficients of INTRA and INTER in the embodiment. 同実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの他の一部を示す図FIG. 10 is a diagram illustrating another part of the code word table of the LAST coefficient of INTRA and INTER in the embodiment. 同実施形態におけるエスケープ符号の符号語テーブルを示す図FIG. 3 is a diagram illustrating a codeword table of an escape code according to the first embodiment. 同実施形態における符号語テーブルにない符号語の符号化方法を示す図The figure which shows the encoding method of the codeword which is not in a codeword table in the embodiment. 同実施形態における符号化データの例を示す図FIG. 3 is a diagram illustrating an example of encoded data according to the first embodiment. 同実施形態における復号グラフを示す図The figure which shows the decoding graph in the embodiment. 同実施形態におけるINTRAおよびINTERの非LAST係数の復号値テーブルの一部を示す図The figure which shows a part of decoding value table of the non-LAST coefficient of INTRA and INTER in the embodiment. 同実施形態におけるINTRAおよびINTERの非LAST係数の復号値テーブルの他の一部を示す図FIG. 14 is a diagram showing another part of the decoded value table of the non-LAST coefficients of INTRA and INTER in the embodiment. 同実施形態におけるINTRAおよびINTERのLAST係数の復号値テーブルを示す図FIG. 7 is a diagram showing a decoded value table of LAST coefficients of INTRA and INTER in the embodiment. 同実施形態におけるエスケープ符号の復号値テーブルを示す図FIG. 7 is a diagram showing a decoded value table of an escape code in the embodiment. 図15における復号値判定部の動作を説明するための図FIG. 15 is a diagram for explaining the operation of the decoded value determination unit in FIG. 同実施形態におけるマクロブロックの符号化/復号化順序を示す図FIG. 3 is a diagram illustrating an encoding / decoding order of macroblocks in the embodiment. 本発明による可変長符号化/復号化装置が組み込まれる装置の一例を示す図FIG. 2 is a diagram showing an example of an apparatus in which a variable length encoding / decoding apparatus according to the present invention is incorporated. リバーシブル符号の一般的な復号方法を示す図Diagram showing a general decoding method for reversible codes 通常の可変長符号の説明図Illustration of ordinary variable length code 従来のリバーシブル符号の説明図Illustration of conventional reversible code

符号の説明Explanation of reference numerals

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…カメラ
DESCRIPTION OF SYMBOLS 101 ... Code word table preparation part 102 ... Code word table 103 ... Encoder 104 ... Transmission system or storage system 105 ... Synchronization code detection part 106 ... Buffer 107 ... Forward decoder 108 ... Reverse decoder 109 ... Decoding Value determination unit 110: forward decoded word table 111: forward decoding tree creation unit 112: backward codeword table 113 ... backward decoding tree creation unit 114: encoding unit 115: decoding unit 21: code selection unit 22 ... Codeword configuration unit 201 Codeword table creation unit 202 Codeword table 203 Encoder 204 Fixed length encoding unit 205 Transmission system or storage system 206 Synchronous code detection unit 207 Buffer 208 Decoding graph / decoding Value table creation unit 209: forward decoder 220: fixed-length code decoding unit 211: backward decoder 212: decoded value Judgment 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 or storage system 706 Reception buffer 707 Video Image demultiplexing unit 708 ... source decoder 709 ... video encoder 710 ... video decoder 901 ... lower-layer variable-length decoder 902 ... upper-layer channel encoder 903 ... lower-layer variable-length Encoder 904: Lower layer channel encoder 905: Multiplexer 906: Demultiplexer 907: Upper layer channel decoder 908 ... Lower layer channel decoder 909: Upper layer variable length decoder 910: lower layer variable length decoder 1001 ... personal computer 1002 ... workstation 1003 ... radio 1004 ... radio 1005 ... camera 10 06 ... Camera

Claims (4)

入力される量子化後のDCT係数に対応した可変長の符号語からなる符号化データを出力する可変長符号化方法において、
順方向にも逆方向にも復号可能であって、最終ビットに量子化後のDCT係数のレベルの符号を付加した複数の符号語を量子化後のDCT係数のラストとラン及びレベルの異なる組み合わせにそれぞれ対応させて格納した符号語テーブルを構成し、
この符号語テーブルから前記入力される量子化後のDCT係数のラストとラン及びレベルの組み合わせに対応する符号語を選択して符号化データとして出力することを特徴とする可変長符号化方法。
In a variable-length encoding method for outputting encoded data including a variable-length codeword corresponding to an input quantized DCT coefficient,
A plurality of codewords which can be decoded in both forward and reverse directions and in which the code of the level of the quantized DCT coefficient is added to the last bit are different combinations of the last, run and level of the quantized DCT coefficient. Constitute a codeword table stored in correspondence with
A variable length encoding method, wherein a codeword corresponding to a combination of the last, run, and level of the input DCT coefficient after quantization is selected from the codeword table and output as encoded data.
前記符号化テーブルに格納された複数の符号語は、予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成されることを特徴とする請求項1記載の可変長符号化方法。   2. The variable according to claim 1, wherein the plurality of codewords stored in the encoding table are configured so that a delimiter of the codeword can be identified by a predetermined number of "1" or "0". Long encoding method. 入力される量子化後のDCT係数に対応した可変長の符号語からなる符号化データを出力する可変長符号化装置において、
順方向にも逆方向にも復号可能であって、最終ビットに量子化後のDCT係数のレベルの符号を付加した複数の符号語を量子化後のDCT係数のラストとラン及びレベルの異なる組み合わせにそれぞれ対応させて格納した符号語テーブルと、
この符号語テーブルから前記入力される量子化後のDCT係数のラストとラン及びレベルの組み合わせに対応する符号語を選択して符号化データとして出力する符号化手段とを具備することを特徴とする可変長符号化装置。
In a variable-length encoding device that outputs encoded data including a variable-length codeword corresponding to an input quantized DCT coefficient,
A plurality of codewords which can be decoded in both forward and reverse directions and in which the code of the level of the quantized DCT coefficient is added to the last bit are different combinations of the last, run and level of the quantized DCT coefficient. And a codeword table stored in correspondence with
Encoding means for selecting a code word corresponding to the combination of the last, run, and level of the input DCT coefficient after quantization from the code word table and outputting the selected code word as encoded data. Variable length coding device.
前記符号化テーブルに格納された複数の符号語は、予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成されることを特徴とする請求項3記載の可変長符号化装置。   4. The variable according to claim 3, wherein the plurality of codewords stored in the encoding table are configured such that a delimiter of the codeword can be identified by a predetermined number of "1" or "0". Long encoding device.
JP2004266017A 1995-04-14 2004-09-13 Variable length coding method and apparatus Expired - Lifetime JP3766426B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004266017A JP3766426B2 (en) 1995-04-14 2004-09-13 Variable length coding method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP8977295 1995-04-14
JP2004266017A JP3766426B2 (en) 1995-04-14 2004-09-13 Variable length coding method and apparatus

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2002294316A Division JP3609813B2 (en) 1995-04-14 2002-10-07 Variable length coding method and apparatus

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2005374924A Division JP3822629B2 (en) 1995-04-14 2005-12-27 Variable length coding method and apparatus

Publications (2)

Publication Number Publication Date
JP2004364340A true JP2004364340A (en) 2004-12-24
JP3766426B2 JP3766426B2 (en) 2006-04-12

Family

ID=34066685

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004266017A Expired - Lifetime JP3766426B2 (en) 1995-04-14 2004-09-13 Variable length coding method and apparatus

Country Status (1)

Country Link
JP (1) JP3766426B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009505494A (en) * 2005-08-12 2009-02-05 マイクロソフト コーポレーション Efficient coding and decoding of transform blocks

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009505494A (en) * 2005-08-12 2009-02-05 マイクロソフト コーポレーション Efficient coding and decoding of transform blocks
JP4906855B2 (en) * 2005-08-12 2012-03-28 マイクロソフト コーポレーション Efficient coding and decoding of transform blocks
US8599925B2 (en) 2005-08-12 2013-12-03 Microsoft Corporation Efficient coding and decoding of transform blocks

Also Published As

Publication number Publication date
JP3766426B2 (en) 2006-04-12

Similar Documents

Publication Publication Date Title
US8942502B2 (en) Parallelization of variable length decoding
EP1802132A2 (en) Moving picture coding and/or decoding systems
JP3431368B2 (en) Variable length encoding / decoding method and variable length encoding / decoding device
JP3579410B2 (en) Variable length encoding method and apparatus
JP3579411B2 (en) Variable length encoding method and apparatus
JP3579409B2 (en) Variable length encoding method and apparatus
JP3579412B2 (en) Variable length decoding method and apparatus
JP3766426B2 (en) Variable length coding method and apparatus
JP3609814B2 (en) Variable length decoding method and apparatus
JP3822629B2 (en) Variable length coding method and apparatus
JP3822630B2 (en) Variable length decoding method and apparatus
JP3764466B2 (en) Variable length decoding method and apparatus
JP3869342B2 (en) Variable length decoding method and apparatus
JP3612315B2 (en) Variable length decoding method and apparatus
JP3612314B2 (en) Variable length coding method and apparatus
JP3233360B2 (en) Variable length decoding method and apparatus
JP3609813B2 (en) Variable length coding method and apparatus
JP3748215B2 (en) Variable length coding method and apparatus
JP3164806B2 (en) Variable length encoding method and apparatus
JP3866687B2 (en) Variable length coding method and apparatus
JP3944049B2 (en) Variable length decoding method and apparatus
JP3417934B2 (en) Variable length encoding method and apparatus
JP3417933B2 (en) Variable length decoding method and apparatus
KR20090113208A (en) Method for encoding a sequence of integers, storage device and signal carrying an encoded integer sequence and method for decoding a sequence of integers

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040913

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20051128

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20051206

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051227

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20060124

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060126

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

Free format text: PAYMENT UNTIL: 20100203

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100203

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110203

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120203

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120203

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130203

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20140203

Year of fee payment: 8

EXPY Cancellation because of completion of term