JP3819638B2 - Variable length coding device - Google Patents

Variable length coding device Download PDF

Info

Publication number
JP3819638B2
JP3819638B2 JP19633299A JP19633299A JP3819638B2 JP 3819638 B2 JP3819638 B2 JP 3819638B2 JP 19633299 A JP19633299 A JP 19633299A JP 19633299 A JP19633299 A JP 19633299A JP 3819638 B2 JP3819638 B2 JP 3819638B2
Authority
JP
Japan
Prior art keywords
code
codeword
decoding
decoded
code word
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP19633299A
Other languages
Japanese (ja)
Other versions
JP2000036758A (en
Inventor
條 健 中
邊 敏 明 渡
池 義 浩 菊
井 剛 永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP19633299A priority Critical patent/JP3819638B2/en
Publication of JP2000036758A publication Critical patent/JP2000036758A/en
Application granted granted Critical
Publication of JP3819638B2 publication Critical patent/JP3819638B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
この発明は、動画像信号などの圧縮符号化/復号化に用いられる可変長符号化/復号化装置に係り、特に順方向からも逆方向からも復号化可能な可変長符号化/復号化装置およびこの装置で用いられるデータまたはプログラムを記録する記録媒体に関する。
【0002】
【従来の技術】
可変長符号は、シンボルの発生頻度に基づいて、頻繁に出現するシンボルは短い符号長の符号、希にして出現しないシンボルは長い符号長の符号をそれぞれ割り当てることにより、平均的に短い符号長となるようにした符号系である。従って、可変長符号を用いると、符号化前のデータと比較して、データ量を大幅に圧縮することができる。このような可変長符号の構成方法としては、無記録情報源で最適なハフマンのアルゴリズムが知られている。
【0003】
可変長符号の一般的な問題として、符号化データの伝送路誤りやその他の理由により符号内に誤りが混入した場合に、誤りが混入した後のデータはその影響が伝搬することにより復号化装置で正しく復号することができなくなってしまうという点が挙げられる。この問題を避けるため、伝送路において誤りが生じる可能性がある場合には、ある間隔で同期符号を挿入し、誤りの伝搬を防止する方法がとられるのが一般的である。同期符号には、可変長符号の組み合わせでは出現しないようなビットパターンが割り当てられる。この方法によれば、符号化データに誤りが生じ、復号できなくなったとしても、次の同期符号を見つけることにより、誤りの伝搬を防止し、正しく復号を行なうことができる。
【0004】
しかし、同期符号を用いた場合でも、図71(a)に示すように誤りが生じて正しく復号できない箇所から、次の同期符号が見つかる箇所までの間の符号化データについては、復号を行なうことができない。
【0005】
そこで、可変長符号を図72に示す通常の構成から図73に示すように変更して、図71(b)に示すように通常の順方向から復号可能な性質だけでなく、逆方向からも復号可能な符号構成にする方法が知られている。また、このような符号は符号化データを逆方向からも読めることから、符号化データを蓄積するディスクメモリなどの蓄積媒体において逆転再生に用いることもできる。このような順方向のみならず逆方向からも復号可能な可変長符号のことを、ここではリバーシブル符号と呼ぶこととする。
【0006】
リバーシブル符号の一例は、例えば特開平5−300027号公報「可逆可変長符号化方式」に記載されている。この公知例のリバーシブル符号は、図72に示した順方向から復号可能な可変長符号であるハフマン符号の符号語の末尾に、図73に示すようにそれぞれの符号語がそれより符号長の長い他の符号語の末尾と一致しない条件でビットを追加することによって、逆方向からも復号可能とした可変長符号である。しかし、このリバーシブル符号は順方向からのみ復号可能な可変長符号の符号語の末尾にビットを付加するために、無駄なビットが多くなって平均符号長が長くなる。この結果、順方向からのみ復号可能な可変長符号と比較して符号化効率が大きく低下してしまう。
【0007】
また、従来のリバーシブル符号では同期区間を一定区間を単位に設定すると、逆方向復号ができないという問題点があった。例えば、ITU−T H.263(1996)では、同期符号を8ビット(=1バイト)毎にアライメントする、すなわち同期符号の挿入可能位置を1バイト単位の位置に設定することが可能となっている。このような同期区間のアライメントを実現するために、同期符号の前に図34に示すようなスタッフィング符号を挿入している。このような場合、従来のリバーシブル符号では、スタッフィング符号のために逆方向復号を行なうことができなくなるという問題点があった。
【0008】
さらに、単純にリバーシブル符号を復号する場合には、通常の順方向のみ復号可能な可変長符号の復号化装置と比較すると、逆方向に復号する分だけ2倍の回路規模と演算量を必要とするという問題点があった。
【0009】
従来のリバーシブル符号のもう一つの問題点として、入力される情報のシンタクスによって逆方向からの復号ができない場合が存在することが挙げられる。例えば図75(a)のシンタクスを持つ情報シンボルの場合、シンボルAによってシンボルBの符号が決定される。このようなシンタクスを持つ情報シンボルを符号化した符号化データは、図75(b)のようにAが先に復号できていなければBを復号できないので、逆方向からは復号できないことになる。
【0010】
また、情報シンボル数が大きい場合に適用される符号化方式として、エスケープ符号を用いた方式がある。このエスケープ符号を用いた方式は、少数の出現頻度の高い情報シンボルに対する符号語を符号語テーブルとして持ち、大多数の出現頻度の低い情報シンボルをエスケープ符号と固定長符号の組み合わせで符号化する方法である。このエスケープ符号を用いた方式においても、順方向にも逆方向にも復号可能な可変長符号の場合と同様に、固定長符号の先頭と末尾にエスケープ符号を付ける方式が提案されている。
【0011】
従来のエスケープ符号を用いた符号化/復号化方式では、符号語テーブルに存在する符号語とエスケープ符号を用いて符号化する符号語を区別するために、何らかの方法で、符号語テーブルに符号語が存在するか検索する必要があった。
【0012】
【発明が解決しようとする課題】
本発明は、少ない計算量と記憶量で効率的に符号化/復号化することができる順方向にも逆方向にも復号可能な可変長符号化/復号化装置を提供することを目的とする。
【0013】
つまり、上述したように、従来技術によるリバーシブル符号、すなわち順方向からも逆方向からも復号可能な可変長符号は、順方向からのみ復号可能な可変長符号の符号語の末尾にビットを付加することによってリバーシブル符号を構成するため、無駄なビットパターンが多くなって平均符号長が長くなり、順方向からのみ復号可能な可変長符号と比較して符号化効率の低下が著しくなるという問題があり、また、スタッフィング符号を用いて同期区間を一定区間を単位に設定すると、スタッフィング符号のためにリバーシブル符号の逆方向復号ができなくなるという問題があり、さらに、単純にリバーシブル符号を復号する場合には、通常の順方向のみ復号可能な可変長符号の復号化装置と比較すると、逆方向に復号する分だけ2倍の回路規模と演算量を必要とし、また入力される情報シンボルのシンタクスによっては逆方向からの復号が不可能である場合が存在するという問題点があった。
【0014】
本発明は、無駄なビットパターンを減らして符号化効率を高め、しかもスタッフィング符号を用いて同期区間を一定区間を単位として設定する場合でも、順方向にも逆方向にも復号可能な可変長符号化/復号化装置を提供することを目的とする。
【0015】
また、本発明は無駄なビットパターンを減らして符号化効率を高めると共に、逐次的に復号処理を行なうことで回路規模と演算量を削減して効率的に復号できる、順方向にも逆方向にも復号可能な可変長符号化/復号化装置を提供することを目的とする。
【0016】
さらに、本発明は入力される情報シンボルのシンタクスによらず順方向にも逆方向にも復号可能であって、より誤りに強い可変長符号化/復号化装置を提供することを目的とする。
【0017】
【課題を解決するための手段】
本発明に係る可変長符号化装置は、複数の情報シンボルに対して該情報シンボルの生起確率に応じた符号長を有する符号語をそれぞれ割り当て、入力された情報シンボルに対応した符号語を符号化データとして出力する可変長符号化装置において、入力された情報シンボルを重要度に応じて階層化する階層化手段と、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語を含む複数の符号語を情報シンボルにそれぞれ対応させて格納した符号語テーブルと、この符号語テーブルから階層化手段により階層化された情報シンボルに対応する符号語を選択する符号語選択手段と、この符号語選択手段により選択された符号語を用いて所定の同期区間毎に階層毎の符号化データを作成すると共に、該階層毎の符号化データを多重化する多重化手段とを有することを特徴とする。
【0018】
ここで、「符号語の重み」とは、その符号語の最小値または最大値に対するハミング距離に相当するものである。符号語が2進符号である場合には、符号語の最小値はオール“0”であり、最大値はオール“1”であるから、符号語の重みは“1”または“0”の数に相当する。この符号語の重みが予め定められた値になった位置が可変長符号における符号の区切りを示す。
【0019】
この可変長符号化装置では、符号語の重みという符号語の順序関係に依存しない値によって符号の区切り、つまりは符号長が定められた符号語からなる可変長符号を構成する。従って、この可変長符号は順方向からも逆方向からも符号の区切りが分かるので、これらの両方向から復号可能なリバーシブル符号となる。また、従来のリバーシブル符号のような順方向にのみ復号可能な可変長符号の末尾にビットを付加する符号と異なり、余分なビットを付加することなく、初めからリバーシブル符号を構成するので、無駄なビットパターンが少なく符号化効率の高い可変長符号が得られる。
【0020】
さらに、この可変長符号化装置では、一定区間単位の同期区間の設定を行なう場合でも、逆方向に復号可能なスタッフィング符号を用いることにより、リバーシブル符号を逆方向に復号することが可能となる。すなわち、リバーシブル符号を逆方向復号する場合、リバーシブル符号の末尾(逆方向に見たときは先頭)が分かる必要があるが、逆方向に復号可能なスタッフィング符号を用いれば、リバーシブル符号の末尾が分かるので、リバーシブル符号の逆方向復号が実現できることになる。
【0021】
この可変長符号化装置では、入力された情報シンボルを階層化した上で先と同様の符号化テーブルを用いて可変長符号化を行ない、さらに階層毎に同期区間を設定することによって、入力された情報シンボルのシンタクスによらず順方向にも逆方向にも復号可能であって、より誤りに強い可変長符号化が可能となる。
【0022】
上記構成の可変長符号化装置において、符号語テーブルに格納された複数の符号語のうち、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語は、好ましくは、例えば順方向にも逆方向にも復号可能な第1の符号語の先頭および末尾の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成されるか、または順方向にも逆方向にも復号可能な第1の符号語の各ビットの直前および直後の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成される。
【0023】
このように符号語を構成すると、より幅広い情報シンボルの確率分布に対応することができるため、符号化効率が向上し、また符号語のビットパターンの自由度が高い符号設計ができるため、同期符号を用いて同期区間の設定を行なう場合でも、同期符号と符号語のビットパターンが一致することによる擬似同期の問題を回避できる。
【0024】
また、上記構成の可変長符号化装置において、符号語テーブルに格納された複数の符号語のうち、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語は、順方向にも逆方向にも復号可能な符号語の各ビットの間に、固定長符号の符号語が所定ビットずつ挿入された符号語であってもよい。
【0025】
また、符号語テーブルに格納された複数の符号語のうち、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語は、第1の順方向にも逆方向にも復号可能な符号語の各ビットの間に、第2の順方向にも逆方向にも復号可能な符号語が挿入された符号語であってもよい。
【0026】
このように符号語を構成すると、より幅広い情報シンボルの確率分布に対応することができるため、符号化効率が向上し、また符号語のビットパターンの自由度が高い符号設計ができるため、同期符号を用いて同期区間の設定を行なう場合でも、同期符号と符号語のビットパターンが一致することによる擬似同期の問題を回避できる。
【0027】
本発明に係る第1の可変長復号化装置は、第1の可変長符号化装置に対応した可変長復号化装置であり、順方向にも逆方向にも復号可能であって、所定の同期区間毎に逆方向に復号可能なスタッフィング符号が挿入された符号語を含む符号語で構成された可変長符号からなる符号化データを復号する可変長復号化装置において、符号化データの同期区間を検出する同期区間検出手段と、この同期区間検出手段により検出された同期区間の符号化データを順方向から復号する順方向復号化手段と、同期区間検出手段により検出された同期区間の符号化データを逆方向から復号する逆方向復号化手段とを有することを特徴とする。
【0028】
この可変長復号化装置は、順方向復号化手段および逆方向復号化手段の復号結果から復号値を判定する復号値判定手段とを有してもよい。
【0029】
ここで、同期区間検出手段は、例えばスタッフィング符号を逆方向から復号することで、符号化データのビット数を検出する。
【0030】
また、順方向復号化手段および逆方向復号化手段の少なくとも一方は、可変長符号の符号語テーブルに存在しない符号語が符号化データに出現したとき、該符号語を誤りとして検出する可変長符号の符号語テーブルに存在しない符号語が符号化データに出現によって誤りを検出するか、あるいは復号した符号化データのビット数が伝送されてきた符号化データのビット数と一致しない場合、誤りと検出する。
【0031】
また、順方向復号化手段および逆方向復号化手段の少なくとも一方は、符号化データを復号して得られた復号値が不適な場合に、復号処理の誤りとして検出する。
【0032】
一方、復号値判定手段は、例えば順方向復号化手段および逆方向復号化手段の少なくとも一方で誤りが検出された場合は、順方向復号化手段および逆方向復号化手段の復号結果のうち正しいと推定される復号結果を使用し、いずれの復号結果でも復号できなかった部分は放棄する。
【0033】
具体的には、
(a)前記順方向復号化手段および逆方向復号化手段の両方で前記誤りが検出され、かつそれらの誤り検出位置が交差しない場合は、誤りが検出されなかった復号結果のみ復号値として使用し、
(b)前記順方向復号化手段および逆方向復号化手段の両方で前記誤りが検出され、かつそれらの誤りが検出され、かつそれらの誤りが検出された位置が交差する場合は、順方向復号化手段で誤りが発見された位置の直前までの符号語に対する復号値は順方向の復号結果を使用し、それ以後の符号語に対する復号値は逆方向の復号結果を使用し、
(c)前記順方向復号化手段および逆方向復号化手段のいずれか一方のみで前記誤りが検出された場合は、該誤りが検出された位置の直前までの符号語に対する復号値は順方向の復号結果を使用し、それ以後の符号語に対する復号値は逆方向の復号結果を使用し、
(d)前記順方向復号化手段および逆方向復号化手段で同一の符号語について前記誤りが検出された場合は、該誤りが検出された位置の符号語に対する復号値を放棄し、それ以後の符号語に対する復号値は逆方向の復号結果を使用する。
【0034】
なお、復号値判定手段は、順方向復号化手段および逆方向復号化手段の少なくとも一方で誤りが検出された場合は、誤りが入っている可能性のある部分を全て放棄する構成でもよい。
【0035】
この可変長復号化装置では、可変長符号の符号語の誤り検出機能を有する順方向復号化手段および逆方向復号化手段の復号結果から復号値を判定する際、順方向復号化手段および逆方向復号化手段での誤り検出結果に応じて、符号化データの復号値を判定することにより、上記のような可変長符号化装置から出力されるリバーシブル符号を伝送路誤りに対して効果的に復号することが可能となる。
【0036】
また、スタッフィング符号として逆方向に復号可能な符号を用いているため、スタッフィング符号を用いて一定区間単位の同期区間の設定が行なわれている場合でも、リバーシブル符号の逆方向復号が可能となる。
【0037】
本発明に係る第2の可変長復号化装置は、順方向にも逆方向にも復号可能な可変長符号からなり、所定の同期区間毎に逆方向に復号可能なスタッフィング符号が挿入された符号化データを復号する可変長復号化装置において、符号化データの同期区間を検出する同期区間検出手段と、この同期区間検出手段により検出された同期区間の符号化データを復号する順方向および逆方向の両方向の復号が可能な双方向復号化手段とを有することを特徴とする。
【0038】
ここで、双方向復号化手段は、順方向の復号処理および逆方向の復号処理の少なくとも一方において、符号化データを復号して得られた復号値が不適な場合、復号処理の誤りとして検出する。
【0039】
双方向復号化手段の復号方法としては、以下の方法を用いることができる。
【0040】
(a)順方向の復号処理を行なった後、符号化データの末尾より逆方向の復号処理を行なう。
【0041】
(b)順方向の復号処理で誤りを検出した場合に、該順方向の復号処理を中止し、符号化データの末尾より逆方向の復号処理を行なう。
【0042】
(c)順方向の復号処理で誤りを検出した場合に、該誤り位置より任意の距離離れた位置から順方向の復号処理を再開する。
【0043】
(d)順方向の復号処理で誤りを検出した場合に、該誤り位置より任意の距離離れた位置から該誤り位置まで逆方向の復号処理を行なう。
【0044】
(e)順方向の復号処理において符号化データの末尾で誤りを検出した場合に限り、逆方向の復号処理を行なう。
【0045】
この第2の可変長復号化装置においても、順方向復号化手段および逆方向復号化手段の復号結果から復号値を判定する復号値判定手段を有してもよい。
【0046】
この第2の可変長復号化装置では、可変長符号の符号語の誤り検出機能を有する双方向復号化手段で復号処理を行なう際に、順方向復号処理での誤り検出結果に応じて符号化データの復号処理を切り替えることにより、順方向と逆方向の復号処理手段を共用できることから、回路規模や演算量を大幅に増加させることなく、上記のような可変長符号化装置から出力されるリバーシブル符号を伝送路誤りに対して効果的に復号することが可能となる。
【0047】
本発明に係る第3の可変長復号化装置は、第3の可変長符号化装置に対応した可変長復号化装置であり、順方向にも逆方向にも復号可能な符号語を含む符号語で構成された可変長符号からなり、階層化された情報シンボルに対応する符号語により作成され、かつ多重化された符号化データを所定の同期区間毎に復号する可変長復号化装置において、多重化された符号化データを階層毎に分離する分離手段と、この分離手段により分離された符号化データの同期区間を検出する同期区間検出手段と、この同期区間検出手段により検出された同期区間の符号化データを順方向から復号する順方向復号化手段と、同期区間検出手段により検出された同期区間の符号化データを逆方向から復号する逆方向復号化手段と、これら順方向復号化手段および逆方向復号化手段により得られた階層毎の復号結果を合成する合成手段とを有することを特徴とする。
【0048】
この第3の可変長復号化装置においても、順方向復号化手段および逆方向復号化手段の復号結果から復号値を判定する復号値判定手段を有してもよい。
【0049】
この第3の可変長復号化装置を第3の可変長符号化装置と合わせて用いることによって、情報シンボルのシンタクスによらず順方向にも逆方向にも復号可能であって、より誤りに強い可変長符号化/復号化装置を実現することができる。
【0050】
また、本発明に係る第1の可変符号化/復号化装置が入出力可能な可変長符号化データを記録した記録媒体において、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りがわかるように構成された符号語を含む符号化データと、前記符号化データに所定の同期区間毎に逆方向に復号可能なスタッフィング符号を挿入したデータを記録した読み取り可能であることを特徴とする。
【0051】
さらに、本発明に係る可変長符号化/復号化装置を適応した画像符号化/復号化装置でブロック単位の直交変換を行なって生成され得る変換係数データを記録した記録媒体において、
前記変換係数データは、前記画像符号化/復号化装置がもつ複数の符号化モード毎に、順方向にも逆方向にも復号可能であ複数の符号後を、ブロックの最後以外の直交変換係数のうち出現頻度の高いものに対してそれぞれ対応させたデータと、前記画像符号化/復号化装置の複数の符号化モードに対して共通に設けられて、順方向にも逆方向にも復号可能であ複数の符号後を、ブロックの最後の直交変換係数のうち出現頻度の高いものに対してそれぞれ対応させたデータと、出現頻度の低い変換係数データを固定長符号で記述し、その先頭と末尾に順方向にも逆方向にも復号可能な符号語を付加したデータと、前記符号化データに所定の同期区間毎に逆方向に復号可能なスタッフィング符号を挿入したデータを記録した読み取り可能であことを特徴とする。
【0052】
また、本発明に係る可変符号化/復号化装置が入出力可能な可変長符号化データを記録した記録媒体は、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りがわかるように構成された符号語を含む符号化データと、前記符号化データに所定の同期区間毎に逆方向に復号可能なスタッフィング符号を挿入したデータと、を記録することを特徴としている。
【0053】
さらに、本発明に係る画像符号化/復号化装置でブロック単位の直交変換を行なって生成され得る変換係数データを記録した記録媒体は、前記変換係数データが前記画像符号化/復号化装置がもつ複数の符号化モード毎に、順方向にも逆方向にも復号可能である複数の符号語を、ブロックの最後以外の直交変換係数のうち出現頻度の高いものに対してそれぞれ対応させたデータと、前記画像符号化/復号化装置の複数の符号化モードに対して共通に設けられ、順方向にも逆方向にも復号可能である複数の符号語を、ブロックの最後の直交変換係数のうち出現頻度の高いものに対してそれぞれ対応させたデータと、出現頻度の低い変換係数データを固定長符号で記述し、その先頭と末尾に順方向にも逆方向にも復号可能な符号語を付加したデータと、前記符号化データに所定の同期区間毎に逆方向に復号可能なスッフィング符号を挿入したデータと、を記録することを特徴としている。
【0054】
また、複数の情報シンボルに対して該情報シンボルの生起確率に応じた符号長を有する符号語をそれぞれ割り当て、入力された情報シンボルに対応した符号語を符号化データとして出力する可変長符号化装置で用いられるプログラムを記録した記録媒体は、順方向にも逆方向にも復号可能であって、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語を含む複数の符号語を情報シンボルにそれぞれ対応させた符号語テーブルを格納する手順と、前記符号語テーブルから前記入力された情報シンボルに対応する符号語を選択する手順と、前記符号語を選択する手順により選択された符号語を用いて所定の同期区間毎に符号化データを作成すると共に、逆方向に復号可能なスタッフィング符号を挿入することにより前記符号語に同期区間を設定する手順と、を少なくとも含むプログラムを記録することを特徴としている。
【0055】
さらに、順方向にも逆方向にも復号可能な符号語を含む符号語で構成された可変長符号からなり、所定の同期区間毎に逆方向に復号可能なスタッフィング符号が挿入された符号化データを復号する可変長復号化装置で用いられるプログラムを記録した記録媒体は、前記符号化データの同期区間を検出する手順と、前記手順により検出された同期区間の符号化データを順方向から復号する手順と、前記同期区間を検出する手順により検出された同期区間の符号化データを逆方向から復号する手順と、を少なくとも含むプログラムを記録することを特徴とする。
【0056】
【発明の実施の形態】
以下、図面を参照して本発明の実施形態を説明する。
【0057】
(第1実施形態)
図1は、本発明の第1実施形態の可変長符号化/復号化装置の構成を示すブロック図である。
【0058】
第1実施形態の可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部101、符号化部113、伝送系または蓄積系105および復号化部114からなる。まず、これら各部の機能について簡単に説明すると、符号語テーブル作成部101は情報シンボルの生起確率に基づいて符号語テーブルを作成し、符号化部113内の符号語テーブル102と、復号化部114内の順方向符号語テーブル111および逆方向符号語テーブル112に符号語を送る。
【0059】
符号化部113は、情報シンボルを可変長符号に符号化し、その可変長符号を符号化データとして伝送系または蓄積系105へ出力する。復号化部114は、伝送系または蓄積系105を介して入力されてきた符号化データを復号して元の情報シンボルを再生する。
【0060】
次に、この第1実施形態の各部の詳細な構成と動作を説明する。
【0061】
符号化部113において、入力された情報シンボルは符号化器103に入力される。符号化部113は、符号語テーブル102と符号化器103および同期区間設定部104により構成される。符号語テーブル102は、符号語テーブル作成部101によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。符号化器103は、符号語テーブル102に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択して出力する。同期区間設定部104では、符号化器103が選択した符号語を同期区間毎にまとめ、さらに順方向にも逆方向にも復号可能なスタッフィング符号を挿入して、同期区間毎に符号化データを出力する。この符号化データは、伝送系または蓄積系105を通して復号化部114に送られる。
【0062】
前記復号化部114は、同期区間検出部106、バッファ107、順方向復号化器108、逆方向復号化器109、復号値判定部110、順方向復号化テーブル111および逆方向復号化テーブル112により構成される。復号化部114では、伝送系または蓄積系105より入力された符号化データから同期区間検出部106で符号化データの同期区間を検出し、符号化データをバッファ107に蓄積する。順方向復号化器108では、バッファ107に蓄積された符号化データの先頭から復号を開始する。逆方向復号化器109では、バッファ107に蓄積された符号化データの末尾から復号を開始する。
【0063】
順方向復号化器108では、符号化データに順方向符号語テーブル111に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。同様に逆方向復号化器109でも、符号化データに逆方向符号語テーブル112に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。
【0064】
復号値判定部110は、順方向復号化器108によって得られた復号結果(順方向復号結果という)と、逆方向復号化器109によって得られた復号結果(逆方向復号器という)から復号値を判定し、最終的な復号結果を出力する。図2は符号語テーブル作成部101の構成を示すブロック図である。符号選択部21は情報シンボルの生起確率の情報が入力され、選択可能な符号系の中から最も平均符号長の小さいものを選択して、選択結果を符号語構成部22に送る。符号語構成部22では、符号語選択部21で選択された符号の符号語を構成する。
【0065】
符号語構成部22で構成される符号語は、符号語の予め定められた重みにより符号の区切りが分かるように構成された順方向にも逆方向にも復号可能な可変長符号(以下、リバーシブル符号という)であり、例えば特願平7−89772、特願平7−260383に記載された符号である。
【0066】
この第1実施形態においては、より幅広い確率分布に対応し、符号語のビットパターンの自由度を上げるために、符号語構成部22における符号語の構成方法として以下に示す方法を用いている。
【0067】
図3は、符号語構成部22におけるリバーシブル符号の符号語の第1の構成方法を示している。まず、図3の左側に示すように、符号長が短い順にそれぞれの系列の重み(この場合、“1”の数)が一定で異なる重みを持つ2つの2進系列(この場合、重みは0個と1個)を作成する。次に、図3の中央に示すように、この2進系列のそれぞれ先頭と末尾に“1”を追加して2進系列のビットを反転させた後、これら2つの2進系列を図3の右側に示すように合成する。
【0068】
この可変長符号では、各符号の最初にあるシンボルの個数をカウントすることによって符号長が分かる。図3の例では、最初が“0”ならば、“0”が2つ出現したら符号の区切り(符号長)が分かり、最初が“1”ならば、“1”が3つ出現したら符号の区切りが分かる符号構成となっている。また、この図3に示す可変長符号は、全ての情報シンボルA〜Jに対応する符号語が図4(a)に示す順方向の復号木の葉にも、図4(b)の逆方向の復号木の葉にも割り当てられることから、順方向にも逆方向にも復号可能であることが分かる。
【0069】
図5は、符号語構成部22におけるリバーシブル符号の符号語の第2の構成方法を示している。まず、図5の左側に示すように、第1のリバーシブル符号と第2のリバーシブル符号を用意する。次に、図5の中央に示すように、第1のリバーシブル符号の全ての符号語の末尾に、第2のリバーシブル符号の最初の1つの符号語を追加する。以下、同様に第1のリバーシブル符号の全ての符号語の末尾に、第2のリバーシブル符号の全ての符号語を1つずつ追加した後、図5の右側に示すように並べ替えを行なって、新たなリバーシブル符号を構成する。このような構成方法によって、第1のリバーシブル符号の符号語数A(この例ではA=9)と第2のリバーシブル符号の符号語数B(この例ではB=3)を乗算した数A×B個(この例では27個)の新たなリバーシブル符号を構成することができる。
【0070】
この構成方法によるリバーシブル符号の復号に当たっては、順方向から復号する時は、まず第1のリバーシブル符号を復号し、次に第2のリバーシブル符号を復号するようにする。逆方向から復号する時は、まず第2のリバーシブル符号を復号し、次に第1のリバーシブル符号を復号する。従って、順方向にも逆方向にも復号可能であることが分かる。
【0071】
なお、この例では第1のリバーシブル符号の符号語の末尾に第2のリバーシブル符号を追加したが、第1のリバーシブル符号の先頭に第2のリバーシブル符号を追加してもよく、また第1のリバーシブル符号の末尾と先頭の両方に固定長符号を追加しても構わない。また、この例では第1のリバーシブル符号と第2のリバーシブル符号は異なるものを用いたが、同一のものを使用しても構わない。さらに、本実施形態では第1のリバーシブル符号も第2のリバーシブル符号も可変長符号を用いたが、どちらかを固定長符号に変更しても構わない。
【0072】
図6は、符号語構成部21におけるリバーシブル符号の第3の符号構成方法を示している。まず、図6の左側に示すように、可変長のリバーシブル符号と固定長のリバーシブル符号を用意する。次に、図6の右側に示すように、リバーシブル符号の符号語の各ビットの直後に固定長のリバーシブル符号を追加する。この構成方法により、Kビットの固定長のリバーシブル符号を用いた場合、Hビットの符号語を(K+1)Hビットにして符号語数を2KH倍にすることができる。なお、この例ではリバーシブル符号の符号語の各ビット毎の直後に固定長符号を追加したが、各ビットの直前に固定長符号を追加してもよく、また直前と直後の両方に固定長符号を追加しても構わない。
【0073】
次に、図7を用いて同期区間設定部104における符号化データの同期区間の設定方法の具体例について説明する。図7(a)は、同期符号を挿入することにより同期区間を設定する方法を示している。この場合、同期区間検出部106では符号化データの最初と最後の同期符号を検出することにより、同期区間を検出することができる。ここで、同期符号の挿入可能位置をある一定区間単位(この場合は、Mビット単位)に設定するようにするため、符号化データの末尾に1〜Mビットのスタッフィング符号を挿入している。
【0074】
図7(b)は、符号化データの先頭に同期区間の符号量を記述する方法、言い換えれば同期区間の終了位置を示すポインタを挿入する方法を示している。この場合、同期区間検出部106では、まず符号化データの先頭の同期区間の符号量の記述を復号することで、同期区間を検出することができる。そして、符号量の記述の単位はMビット単位となっているため、符号化データの末尾に1〜Mビットのスタッフィング符号を挿入する。
【0075】
ここで、図7(a)(b)で用いられるスタッフィング符号は、少なくとも逆方向に復号可能な構成となっていることが特徴である。図8は、このようなスタッフィング符号の具体例を示した図であり、このスタッフィング符号は順方向にも逆方向にも復号可能に構成されている。このスタッフィング符号の場合、1ビットの時は“1”が出現すればそれが区切りで、それ以外では“0”が2度出現すると区切りが分かるような、順方向にも逆方向にも復号可能な可変長符号となっていて、同期区間の最後からも逆方向に復号可能となっていると同時に、符号化データのビット数を計算することが可能になっている。符号化データのビット数の計算結果は、後述する誤り検出に用いられる。
【0076】
なお、この例ではスタッフィング符号を符号化データの末尾に挿入したが、符号化データの先頭でも符号化データの内部でもよく、同期区間の内部で文法上問題ない位置ならば、その挿入位置はどこでもよい。また、スタッフィング符号は図9に示すような逆方向にのみ復号可能な符号でもよい。この符号の場合は、逆方向から復号して“0”が出現したら区切りになるような符号となっている。
【0077】
次に、図10を用いて復号値判定部110における復号値の判定方法について説明する。図10(a)に示すように、順方向復号結果と逆方向復号結果で誤りが検出される復号語の位置(誤り検出位置)が交差しない場合は、誤りが検出されなかった復号結果のみを復号値として使用し、2つの誤り検出位置の復号結果は復号値として使用せず放棄する。また、図10(b)に示すように、順方向復号結果と逆方向復号結果の誤り検出位置が交差する場合は、順方向復号結果の誤り検出位置までの復号値は順方向復号結果を使用し、それ以降の部分は逆方向復号結果を復号値として使用する。
【0078】
なお、逆方向復号結果を優先して、逆方向復号結果の誤り検出位置までの復号値としては逆方向復号結果を使用し、それ以前の部分は順方向復号結果を復号値として使用してもよい。
【0079】
また、図10(c)に示すように、順方向復号結果および逆方向復号結果のうち片方向の復号結果にしか誤りが検出されない場合(この例では、順方向復号結果のみ誤りが検出されている)は、誤り検出位置までの復号値は、順方向復号結果を使用し、それ以降の部分は逆方向復号結果を復号値として使用する。さらに図10(d)に示すように、同一の符号語について順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、誤り検出位置の符号語に対する復号値を放棄し、それ以後の符号語に対する復号値として、逆方向復号結果を使用する。なお、順方向復号化器108および逆方向復号化器109での誤り判定に際しては、符号語として存在しないビットパターンが生じた場合、検出位置はその場所とし、前記の判定方法で誤りが検出されない場合で、復号したビット数が同期区間内の符号化データのビット数と一致しない場合は、復号化の最初の位置を誤り検出位置とする。
【0080】
この第1実施形態では、4つの誤り検出位置のパターンによる復号値判定方法の1つの例を示したが、復号値判定部は順方向復号結果および逆方向復号結果の両方あるいはいずれか一方で誤りが検出された場合は、正しいと推定される順方向復号結果もしくは逆方向復号結果を使用し、いずれの復号結果でも復号できなかった部分は放棄すれば、どのような方法でもよいことはいうまでもない。
【0081】
(第2実施形態)
次に、本発明の第2実施形態として本発明による可変長符号化/復号化装置の応用例について説明する。図11は、本発明の第2実施形態に係る可変長符号化/復号化装置が組み込まれた動画像符号化/復号化システムの概念図である。まず、動画像符号化器709においては、情報源符号化器702で符号化されたデータに対して動画像多重化器703で可変長符号化と多重化等が行なわれ、送信バッファ704で平滑化された後、符号化データとして伝送系または蓄積系705に送り出される。符号化制御部701は、送信バッファ704のバッファ量を考慮して、情報源符号化器702と動画像多重化器703の制御を行なう。
【0082】
一方、動画像復号化器710においては、伝送系または蓄積系705からの符号化データが受信バッファ706に溜められ、動画像多重化分離器707で符号化データの多重化分離と可変長復号化が行なわれた後、情報源復号化器708に送られ、最終的に動画像情報が復号化される。ここで、動画像多重化器703および動画像多重化分離器707には第1実施形態で説明した可変長符号化/復号化装置が適用されている。
【0083】
図12は、第2実施形態における動画像多重化器703および動画像多重化分離器707における動画像符号化方式のシンタクスを示している。マクロブロックのモード情報、動きベクトル情報およぴINTRA DC(フレーム内符号化におけるDCT係数の直流成分)の情報を上位階層とし、INTRA DC以外のDCT係数情報を下位階層として、下位階層にリバーシブル符号を適用している。
【0084】
図13(a)(b)は、この第2実施形態における動画像多重化器703および動画像多重化分離器707の構成を示すブロック図である。
【0085】
図13(a)に示す動画像多重化器703においては、図11中の情報源符号化器702で符号化されたデータのうち、マクロブロックのモード情報、動きベクトル情報およびINTRA DCなどの情報を上位階層とし、上位階層可変長符号化器901で通常の可変長符号化が行なわれ、多重化器903に送られる。また、情報源符号化器702で符号化されたデータのうち、INTRA DC以外のDCT係数は下位階層可変長符号化器903においてリバーシブル符号で符号化され、多重化器903に送られる。多重化器903では、上位階層の符号化データと下位階層の符号化データを多重化し、送信バッファ704に送る。
【0086】
一方、図13(b)に示す動画像復号化器707においては、上位階層の符号化データと下位階層の符号化データが多重化分離部904により分離され、これらが上位階層可変長復号化器905および下位階層可変長復号化器906によりそれぞれ可変長復号化される。
【0087】
図14〜図16、図17〜図18および図19は、下位階層可変長符号化器902で用いられる符号語テーブルの一例である。この符号語テーブルに格納された符号は、前述した符号語構成部22におけるリバーシブル符号の符号語の第1の構成方法によって作成した符号を末尾に2ビットの固定長符号を追加した符号である。
【0088】
情報源符号化器702では、量子化後の8×8のDCT係数のブロック毎にブロック内のスキャンを行ない、LAST(0:ブロックの最後でない非零係数、1:ブロックの最後の非零係数)、RUN(非零係数までの零ランの数)およびLEVEL(係数の量子化値)を求め、動画像多重化部703に送る。
【0089】
動画像多重化部703内の下位階層可変長符号化器902は、図14〜図16に示すINTRA(フレーム内符号化)およびINTER(フレーム間符号化)の非LAST係数、RUN、LEVELにリバーシブル符号の符号語(VLC_ CODE)を対応させた非LAST係数の符号語テーブルと、図17〜図18に示すINTRAおよびINTERのLAST係数、RUN、LEVELにリバーシブル符号の符号語(VLC_ CODE)を対応させたLAST係数の符号語テーブルを持っている。
【0090】
そして、モード情報に基づいて、INTRAの時はINTRAの非LAST係数とLAST係数の符号語テーブル、INTERの時はINTERの非LAST係数とLAST係数の符号語テーブルを選択して符号化を行なう。符号語の最終ビットの“s”は、LEVELの符号を表し、“s”が“0”の時、LEVELの符号は正、“s”が“1”の時、LEVELの符号は負である。
【0091】
また、この符号語テーブルに存在しない係数は、図20に示すようにLAST係数どうかの1ビットとRUNとLEVELの絶対値を固定長符号化し、この固定長符号部の先頭に2つのエスケープ符号のうち、“00001”を付加し、末端にもエスケープ符号を付加する。図19は、エスケープ符号の符号語テーブルであり、エスケープ(ESCAPE)符号として用いられるVLC_ CODEの最終ビットの“s”はLEVELの符号を表し、“s”が“0”ならばLEVELは正、“1”ならばLEVELは負である。
【0092】
図21はこの符号語テーブルを用いた時の零ランが最大になる場合を示している。通常、同期符号は零ランが続いた後に“1”を付加するビットパターンが選択されている。例えばITU−T H.263では16個の“0”の後に“1”が付くようなビットパターンが同期符号となっている。DCT係数の可変長符号化では、零ランが最大になるのを、エスケープ符号を使う係数で、LEVELが+64で、次もエスケープ符号を使う符号が出現する場合で、15個“0”が連続するのが最大となる。ゆえに“0”が16個連続するようなビットパターンを同期符号にすれば、擬似同期符号が生じるおそれはない。
【0093】
復号値判定部110では、順方向復号化器108により得られた復号結果(順方向復号結果という)と、逆方向復号化器109により得られた復号結果(逆方向復号結果という)から復号値を判定し、最終的な復号結果を出力する。
【0094】
順方向復号化器108および逆方向復号化器109での誤り判定は、符号語として存在しないビットパターンが生じた場合、およびチェックビット等で誤りを検出した場合、検出位置はその場所とし、前記の判定方法で誤りが検出されない場合で、復号したビット数が同期区間内の符号化データのビット数と一致しない場合は、復号化の最初の位置を誤り検出位置とする。
【0095】
図22は、下位階層の復号値判定方法を示している。まず、図22(a)に示すように、順方向復号結果と逆方向復号結果で誤りが検出されるマクロブロック(MB)の位置(誤り検出位置)が交差しない場合は、誤りが検出されなかったマクロブロックの復号結果のみを復号値として使用し、二つの誤り検出位置の復号結果は復号値として使用せず、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロック(フレーム内符号化されたマクロブロック)については前フレームをそのまま表示するように、INTERマクロブロック(フレーム間符号化されたマクロブロック)については前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換える。
【0096】
また、図22(b)に示すように、順方向復号結果と逆方向復号結果の誤りの検出位置が交差する場合は、順方向復号の結果で誤りが検出されたマクロブロックまでの復号値は、順方向復号結果を使用し、それ以降の部分は、逆方向復号結果を復号値として使用する。なお、逆方向復号結果を優先して、逆方向復号の結果で誤りが検出されたマクロブロックまでの復号値は、逆方向復号結果を使用し、それ以前の部分は、順方向復号結果を復号値として使用してもよい。
【0097】
また、図22(c)に示すように、順方向復号結果および逆方向復号結果のうち片方向の復号結果にしか誤りが検出されない場合(この例では、順方向復号結果のみ誤りが検出されている)は、誤り検出位置以降のマクロブロックに対する復号値は逆方向の復号結果を使用する。さらに、図22(d)に示すように、同一のマクロブロックで順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、誤り検出位置のマクロブロックの復号値は放棄し、復号値として使用せずに、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては前フレームをそのまま表示するように、INTERマクロブロックについては前フレームよりの動き補償のみで表示するように、上位階層の復号結果を書き換え、それ以降のマクロブロックに対する復号値は逆方向の復号結果を使用する。
【0098】
なお、図22の復号値判定方法では、マクロブロックを単位に復号値の判定を行なったが、ブロックの単位あるいは符号語の単位で判定を行なってもよい。また、この第2実施形態ではDCT係数の可変長符号化に本発明を適用したが、可変長符号化を行なう場合には、他の情報シンボルについても適用することができることは言うまでもない。
【0099】
(第3実施形態)
次に、図23を参照しながら本発明の第3実施形態に係る可変長符号化/復号化装置について説明する。
【0100】
この第3実施形態に係る可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部101、符号化部113、伝送系または蓄積系105および復号化部121からなる。まず、これら各部の機能について簡単に説明すると、符号語テーブル作成部101は情報シンボルの生起確率に基づいて符号語テーブルを作成し、符号化部113内の符号語テーブル102と、復号化部121内の順方向符号語テーブル111および逆方向符号語テーブル112に符号語を送る。符号化部113は、情報シンボルを可変長符号に符号化し、その可変長符号を符号化データとして伝送系または蓄積系104へ出力する。復号化部121は、伝送系または蓄積系105を介して入力されてきた符号化データを復号して元の情報シンボルを再生する。
【0101】
次に、第3実施形態の各部の詳細な構成と動作を説明する。符号化部113は図1に示した第1実施形態と同様である。すなわち、符号化部113において、入力された情報シンボルは符号化器103に入力される。符号語テーブル102は、符号語テーブル作成部101によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。符号化器103は符号語テーブル102に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択する。同期区間設定部104では、符号化器103が選択した符号語を同期区間毎にまとめ、さらに順方向にも逆方向にも復号可能なスタッフィング符号を挿入して、同期区間毎に符号化データを出力する。この符号化データは、伝送系または蓄積系104を通して復号化部121に送られる。
【0102】
復号化部121は、同期区間検出部106、バッファ107、符号化データ切替器122、復号化器124、符号語テーブル切替器125、復号値判定部110、順方向復号化テーブル111および逆方向復号化テーブル112により構成される。符号化データ切替器122および符号語テーブル切替器125は、復号化器124により制御されて切り替わる。
【0103】
復号化部121では、伝送系または蓄積系105より入力された符号化データから同期区間検出部106で符号化データの同期区間を検査しながら、符号化データを復号化器124へ入力する。その際、符号化データをバッファ107にも蓄積する。復号化器124は、入力された符号化データの復号(順方向復号化という)を開始する。ここで、復号化器124は符号化データに順方向符号語テーブル111に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。
【0104】
誤り検出と判定された場合、復号化器124は符号語テーブル切替器123で符号語テーブルを順方向符号語テーブル111から逆方向符号語テーブル112に切り替えると同時に、符号化データ切替器122により復号化器124への入力をバッファ107側に切り替える。バッファ107は、同期区間検出部106により次の同期を検出した場合、蓄積した符号化データを末尾から読み出し、復号化器124へ出力する。復号化器124では、入力された符号化データの復号(逆方向復号化という)を開始する。ここで、復号化器124は順方向復号化と同様に、符号化データに逆方向符号語テーブル112に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。復号値判定部110では、順方向復号化によって得られた復号結果(順方向復号結果という)と、逆方向復号化によって得られた復号結果(逆方向復号結果という)から復号値を判定し、最終的な復号結果を出力する。
【0105】
この第3実施形態における符号語テーブル作成部101は、基本的に第1の実施形態と同様であり、図2に示したように、情報シンボルの生起確率の情報を入力し、選択可能な符号系の中から最も平均符号長の小さいものを選択する符号選択部21と、この符号語選択部21で選択された符号の符号語を構成する符号語構成部22からなる。ただし、本実施形態ではより幅広い確率分布に対応し、符号語のビットパターンを自由度を上げるために、符号語構成部22における符号語の構成方法として以下の方法を用いている。
【0106】
図24は、符号語構成部22におけるリバーシブル符号の符号語の第1の構成方法を示している。まず、図24の左側に示すように、第1のリバーシブル符号を用意する。次に、図24の中央に示すように、第1のリバーシブル符号のそれぞれの符号語に対して、破線で囲まれた(符号長−1)ビットの固定長符号を用意し、図24の右側に示すように、第1のリバーシブル符号の符号語の各ビットの間に固定長符号の符号語を破線で囲むように1ビットずつ挿入する。この図24の可変長符号は、第1のリバーシブル符号を復号しながら、1ビット毎に固定長符号を復号することにより、順方向にも逆方向にも復号可能であることが分かる。図24の例では、第1のリバーシブル符号の符号語の各ビットの間に固定長符号の符号語を1ビットずつ挿入したが、第1のリバーシブル符号のそれぞれの符号語に対して、(符号長−1)×nビットの固定長符号を用意し、第1のリバーシブル符号の符号語の各ビットの間に固定長符号の符号語をnビットずつ付加してもよい。
【0107】
図25は、符号語構成部22におけるリバーシブル符号の符号語の第2の構成方法を示している。図25の左側に示すように、第1のリバーシブル符号を用意する。次に、図25の上側に破線で囲んで示すように、第2のリバーシブル符号を用意し、図25の右側に示すように、第1のリバーシブル符号の符号語の各ビットの間に破線で囲んだように第2のリバーシブル符号を挿入する。この図25の可変長符号は、第1のリバーシブル符号を復号しながら、1ビット毎に第2のリバーシブル符号を復号することにより、順方向にも逆方向にも復号可能であることが分かる。なお、図25の例では、第1のリバーシブル符号と第2のリバーシブル符号を同じ符号として示したが、異なる符号を用いても構わない。
【0108】
この第3実施形態においては、図26に示すように図23中の順方向符号語テーブル111と逆方向符号語テーブル112を共通化した双方向符号語テーブル51を用いてもよい。この場合、図23中の復号化器124から順方向復号化/逆方向復号化の区別を示す識別信号53を入力し、この識別信号53によりアドレス変換器52を動作させて、双方向符号語テーブル51から符号語を読み出すためのアドレスを生成する。そして、このアドレスに対応する符号値を双方向符号語テーブル51から読み出す。
【0109】
また、この第3実施形態においては、図27に示すように復号化器124に誤り検出機能が付加される。復号化器61に接続された誤り検出部62は、復号化器61の内部状態を監視し、これが異常となった場合、誤り検出信号を出力する。異常な内部状態とは、例えば以下のような状態をいう。
【0110】
(1)符号語テーブルに存在しない符号化データを受信した場合。
【0111】
(2)符号化データの長さと、実際に復号化器61で復号したデータの長さが一致しない場合。
【0112】
(3)符号語テーブルには値が存在するため復号値を求めることは可能であるが、その値が不適な値である場合。この(3)の具体例としては(3−1)復号値が存在範囲を超えている場合、(3−2)データの個数が上限を超えた場合、および(3−3)前に復号した復号値と整合性の合わない復号値を出力した場合等が挙げられる。
【0113】
(4)誤り検出符号等により、誤りを検出した場合。
【0114】
次に、図28を用いてこの第3実施形態における復号方法を説明する。先の説明では、復号化器124での順方向および逆方向の復号処理は図28(a)に示すように順方向、逆方向双方で復号処理を並行して同時に行ない、それぞれが誤りを検出するまで復号を実行し復号値を求めていた。本実施形態はこれに限られず、図28(b)(c)(d)に示すような方法で復号を行なってもよい。なお、図28(a)(b)(c)(d)において、Xは誤り検出点を示し、また右側に向かう矢印は順方向の復号処理、左側に示す矢印は逆方向の復号処理をそれぞれ示している。
【0115】
図28(b)に示す方法では、順方向の復号処理を行ない、誤りが検出された場合は、そこで順方向の復号処理を停止し、同期区間の符号化データの末尾から逆方向に、誤りが検出されるまで復号処理を行なう。図28(c)に示す方法では、順方向の復号処理で誤りが検出された場合、その誤り検出位置のnビット先から順方向の復号処理を再開する。この処理を現在の同期区間内の符号化データを全て処理するまで繰り返し行なう。順方向の復号処理の最後に、もし同期区間の符号化データ数と復号処理により復号を行なったデータ数とが一致しない場合は誤り検出とみなし、符号化データの末尾から逆方向の復号処理を誤りが発見されるまで行なう。図28(d)に示す方法では、順方向の復号処理で誤りが検出された場合、一旦その誤り検出位置のnビット先から逆方向にnビット分復号処理を行なう。その後、順方向の復号処理を誤り検出位置のnビット先(逆方向の復号処理を開始した位置)から行なう。この処理を現在の同期区間内の符号化データを全て処理するまで繰り返し行なう。最後に、もし同期区間の符号化データ数と復号処理により復号を行なったデータ数が一致しない場合は誤り検出とみなし、符号化データの末尾から逆方向の復号処理を誤りが発見されるまで行なう。次に、図29を用いてこの第3実施形態における復号値判定部111での復号値の判定方法を説明する。なお、復号値判定部111で最終的に利用する復号値の選択にも、以下のような方法を用いることができる。図29(a)に示す復号値判定方法は、誤りを検出した場合、それ以降は復号を行なわない方法である。すなわち、誤りを検出した場合には、それ以降の復号は誤復号する可能性があるため、そのような誤復号の可能性のある復号値は利用せず、誤り検出位置までの復号値のみを利用する。
【0116】
図29(b)に示す復号値判定方法は、誤りを検出しても復号を続けてなるべく復号を行ない、利用できる復号値は全て利用するようにする方法である。可変長符号には、同期が外れた場合でも復号処理を続けると、自動的に同期が回復する特徴を有する符号が存在する。これを自己同期回復性と呼ぶ。この自己同期回復能力が高い符号語の場合には、図29(a)のように誤り検出後に復号処理を停止せずに、図29(b)のようにそのまま復号を続けることで正しい復号値をより多く得ることができる。ただし、この場合には復号値に誤って復号された値を含む可能性がある。このような誤復号の可能性を許容するシステムにおいては、図29(b)の復号値判定方法を用いることも可能である。
【0117】
(第4実施形態)
次に、図30を参照しながら本発明の第4実施形態に係る可変長符号化/復号化装置について説明する。
【0118】
第4実施形態の可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部201、符号化部213、伝送系または蓄積系205および復号化部214からなる。まず、これら各部の機能について簡単に説明すると、符号語テーブル作成部201は情報シンボルの生起確率に基づいて符号語テーブルを作成し、符号化部213内の符号語テーブル、復号化部214内の順方向符号語テーブルおよび逆方向符号語テーブルに符号語を送る。
【0119】
符号化部213は、入力データとして与えられる情報シンボルを階層化して、各階層毎に可変長符号に符号化し、それらの可変長符号を多重化して符号化データとして伝送系または蓄積系205へ出力する。復号化部214は、伝送系または蓄積系205を介して入力されてきた符号化データを多重化分離し、各階層毎に可変長復号を行ない、階層毎の復号結果を合成して元の情報シンボルを再生し、再生データを出力する。
【0120】
次に、第4実施形態の各部の詳細な構成と動作を説明する。符号化部213においては、入力データである情報シンボルはデータ階層化部202により重要度に応じて1からnまで(nは2以上の自然数)の階層に分離される。分離された各階層i(i=1,2,…,n)の情報シンボルは、階層i毎に用意された可変長符号化部203−iに入力され、符号化される。可変長符号化部203−iで得られた各階層iの符号化データは、多重化部204で多重化され、伝送系または蓄積系205を通して復号化部214に送られる。
【0121】
復号化部214では、伝送系または蓄積系205より入力された符号化データが多重化分離部206で各階層iの符号化データに分離される。分離された各階層の符号化データは、階層i毎に用意された可変長復号化部207−iに入力され、復号化される。可変長復号化部207−iで得られた各階層iの復号結果はデータ合成部208で合成され、再生データとして出力される。
【0122】
符号語テーブル作成部201の構成は、第1の実施形態で用いた図2に示した符号語テーブル作成部101と同様であり、情報シンボルの生起確率の情報に基づいて、選択可能な符号系の中から最も平均符号長の小さいものを選択し、選択した符号の符号語を構成する。その符号語は、符号語の予め定められた重みによって符号の区切りが分かるように構成された順方向にも逆方向にも復号可能な可変長符号(リバーシブル符号)である。
【0123】
次に、図30中の各階層iの可変長符号化部203−iの構成は図31に示す通りであり、図1中に示した符号化部113と同様に、符号語テーブル102と符号化器103および同期区間設定部104により構成される。すなわち、図30中のデータ階層化部202から入力された情報シンボルは、符号化器103に入力される。符号語テーブル102は、図30中の符号語テーブル作成部201によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。
【0124】
符号化器103は、符号語テーブル102に格納されている符号語の中から、データ階層化部202より入力された情報シンボルに対応した符号語を選択して出力する。同期区間設定部104では、符号化器103が選択した符号語を同期区間毎にまとめ、さらに必要に応じて順方向にも逆方向にも復号可能なスタッフィング符号を挿入して、同期区間毎に符号化データを出力する。この符号化データは図30中の多重化部204に送られる。
【0125】
一方、図30中の各階層iの可変長復号化部207−iの構成は図32に示す通りであり、図1中に示した復号化部114と同様に、同期区間検出部106、バッファ107、順方向復号化器108、逆方向復号化器109、復号値判定部110、順方向復号化テーブル111および逆方向復号化テーブル112により構成される。すなわち、可変長復号化部207−iでは、伝送系または蓄積系205より入力された符号化データから同期区間検出部106で符号化データの同期区間を検出して、符号化データをバッファ107に蓄積する。順方向復号化器108では、バッファ107に蓄積された符号化データの先頭から復号を開始する。逆方向復号化器109では、バッファ107に蓄積された符号化データの末尾から復号を開始する。
【0126】
順方向復号化器108では、符号化データに順方向符号語テーブル111に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。同様に逆方向復号化器109でも、符号化データに逆方向符号語テーブル112に存在しないビットパターンが出現した場合、およびバッファ107のビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。復号値判定部110では、順方向復号化器108によって得られた復号結果(順方向復号結果)と、逆方向復号化器109によって得られた復号結果(逆方向復号値)から復号値を判定し、最終的な復号結果を出力する。これらの各階層iの復号結果は、データ合成部208に送られる。
【0127】
図33に、データ階層化部202でのデータ階層化および多重化部204で多重化の例を示す。図33(a)に示すようなn階層に分けることが可能なシンタクスの入力データ(情報シンボル列)があるとすると、データ階層化部202では図33(b)に示すように各階層i毎に入力データが繰り返されるようにシンタクスを変更してデータ階層化を行ない、各階層i毎の情報シンボルを可変長符号化部203−iに送る。多重化部204では、図33(c)に示すように可変長符号化部203−iにより階層i毎に可変長符号化され、かつ同期符号iの付加により同期区間が設定された符号化データを多重化して出力する。
【0128】
図34は、図32中の復号値判定部110での復号値の判定方法の例を示している。各階層i毎の可変長復号化部207−iでは、それぞれ双方向復号が行なわれる。もし、ある階層の可変長復号化部に入力される符号化データに誤りがあった場合、その影響は当該階層より上位の階層と下位の階層の復号値に影響を与えるので、各階層iの可変長復号化部207−i内の復号値判定部110で情報をやりとりして、最終的な復号値を決定するようにする。
【0129】
この図34の例では、上位階層に誤りがあり、復号できない部分がある場合、それに関連する下位階層の符号化データで復号できない部分ができる。また、下位階層の符号化データに誤りがあり、復号できない部分がある場合、それに対応する上位階層の符号化データの復号値を変更するようにする。図34はあくまで復号値判定方法の一つの例であり、各階層iの可変長復号化部207−i内の復号値判定部110では、上位階層と下位階層の復号結果を用いて順方向復号結果および逆方向復号結果の少なくとも一方で誤りが検出された場合は、順方向復号結果および逆方向復号結果のうち正しいと推定される方の復号結果を使用し、順方向復号および逆方向復号のいずれでも復号ができなかった部分については、その復号結果を放棄する方法であれば、どのような方法でもよいことはいうまでもない。また、この第4実施形態では全ての階層で順方向にも逆方向にもリバーシブル符号を用いる構成としたが、一部の階層のみにリバーシブル符号を用いる構成でも構わない。
【0130】
(第5実施形態)
次に、図11に示した動画像符号化/復号化システムの動画像多重化部703および動画像多重化分離部707に第4実施形態で説明した可変長符号化/復号化装置を適用した第5実施形態について説明する。この場合の動画像符号化/復号化システムの基本的な構成と動作は第2の実施形態と同様であり、動画像多重化部703および動画像多重化分離部707における可変長符号化および可変長復号化の処理が階層毎に行なわれる点が異なる。
【0131】
図35、図36、図37および図38は、第5実施形態における動画像多重化部703での動画像符号化方式のシンタクスの種々の例を示している。まず、図35に示すシンタクスについて説明する。このシンタクスでは、符号化データである入力された情報シンボルを上位階層と下位階層の2つに階層化し、それぞれに対して同期符号RMおよびMMにより同期区間を設定している。下位階層のシンタクスの末尾のSTは、図9に示したような逆方向から復号可能なスタッフィング符号である。
【0132】
上位階層は、図35(a)に示したようにヘッダ情報と、マクロブロック毎の符号化モード、各ブロックを符号化するか否かの情報およびINTRA DCの値をモード情報として先頭側に固めて、これらを通常の順方向復号が可能な可変長符号で記述し、その後に動きベクトル情報を図39〜図46に示した符号化テーブルによりリバーシブル符号に可変長符号化して配置する。図39〜図46に示す符号化テーブルにおいて、“VECTOR DIFFERENCES”は動きベクトルの予測値(差分値)、“BIT NUMBER”は可変長符号の符号長、そして“VLC CODE”は可変長符号を表す。
【0133】
ここで、動きベクトルは図47に示すように一次元予測により得られ、予測値は差分値で表される。動きベクトルの予測方向を図47中に矢印で示す。図47に示すように、動きベクトルはマクロブロック(図47中に大きな四角で示す)に1本存在する場合と、各輝度ブロック(図47中に小さな四角で示す)毎に各1本の計4本存在する場合とがあるが、これらについて一次元予測を行ない、予測値を図39〜図46に示した符号化テーブルに従って可変長符号で記述する。なお、予測で得られない動きベクトルについては、その動きベクトルの値そのものを図39〜図46に示した符号化テーブルに従って可変長符号により記述する。図35(a)の末尾の動きベクトル情報がこれに相当する。一方、下位階層は図35(b)に示したようにINTRA DCを除くDCT係数情報であり、例えば図14〜図20や特願平7−260383に記載されたリバーシブル符号で記述される。
【0134】
次に、図36に示すシンタクスについて説明する。このシンタクスでは、上位階層は図36(a)に示すようにヘッダ情報とマクロ符号化毎の動きベクトルの数を表したモード情報1を先頭側に固めて、通常の順方向復号が可能な可変長符号で記述し、その後に動きベクトル情報の可変長符号を記述する。動きベクトル情報の可変長符号は、図35のシンタクスと同様である。下位階層は、図36(b)に示すように各ブロックのDCT係数があるか否かを示すモード情報2およびINTRA DCを先頭側に固めて、これらを通常の順方向復号が可能な可変長符号で記述し、その後にINTRA DCを除くDCT係数情報を図35のシンタクスと同様にリバーシブル符号で記述する。
【0135】
次に、図37に示すシンタクスについて説明する。このシンタクスでは、上位階層に順方向復号が可能な可変長符号のみを用いている。すなわち、上位階層は図37(a)に示すように、ヘッダ情報、モード情報および動きベクトル情報を順方向復号が可能な可変長符号で記述し、下位階層は図37(b)に示すように、DCT係数情報を図35のシンタクスと同様にリバーシブル符号により記述している。
【0136】
図38に示すシンタックスも、上位階層に順方向復号が可能な可変長符号のみを用いている。すなわち、上位階層は図38(a)に示すように、ヘッダ情報、マクロ符号化毎の動きベクトルの数を表したモード情報1および動きベクトル情報を順方向復号可能な可変長符号で記述する。下位階層は図38(b)に示すように、各ブロックのDCT係数があるか否かを示すモード情報2およびINTRA DCを先頭側に固めて、これらを通常の順方向復号が可能な可変長符号で記述し、その後にINTRA DC以外のDCT係数情報を図36のシンタクスと同様にリバーシブル符号で記述する。
【0137】
第5実施形態における動画像多重化部703および動画像多重化分離部707の基本構成は図13(a)(b)に示す通りであるが、上位階層可変長符号化器901、下位階層可変長符号化器903および上位階層可変長復号化器905、下位階層可変長復号化器906の構成が第2実施形態とは異なっている。すなわち、情報源符号化器702で符号化されたデータのうち、例えば図35(a)または図36(a)のシンタクスで示された上位階層のデータが上位階層可変長符号化器901で可変長符号化され、多重化部903に送られる。また、情報源符号化器702で符号化されたデータのうち、図35(b)または図36(b)のシンタクスで示された下位階層のデータが可変長符号化器903で可変長符号化され、多重化部903に送られる。多重化部903では、上位階層の符号化データおよび下位階層の符号化データを多重化し、送信バッファ704に送る。
【0138】
そして、この第5実施形態では上位階層可変長復号化器905および下位階層可変長復号化器906内の図32中に示した復号値判定部110では、順方向復号化器108によって得られた順方向復号結果から復号値を判定し、最終的な復号結果を出力する。各階層の順方向復号化器108および逆方向復号化器109での誤り判定は、符号語として存在しないビットパターンが出現した場合、およびチェックビット等で誤りを検出した場合には、検出位置はその場所とし、前記の判定方法で誤りが検出されない場合で、復号したビット数が同期区間内の符号化データのビット数と一致しない場合は、復号化の最初の位置を誤り検出位置とする。
【0139】
次に、第5実施形態における復号値判定方法について説明する。図48は、動画像多重化部703での動画像符号化方式のシンタクスが図35に示すシンタクスである場合の復号値判定方法を示している。図35のシンタクスでは、上位階層の動きベクトル情報と下位階層のDCT係数情報にリバーシブル符号を用いているので、上位階層および下位階層の両者で双方向復号が可能である。
【0140】
上位階層では、まずヘッダ情報とモード情報が復号される。ヘッダ情報やモード情報で誤りが発見されて全てが復号できない場合、誤りが生じた同期区間のマクロブロックの復号値は全てNot Codedとされ、前画面がそのまま表示される。もし、ヘッダ情報とモード情報が全て復号できた場合は、次に動きベクトル情報が双方向復号される。動きベクトル情報で復号ができない部分については、やはりNot Codedとされる。下位階層では、動きベクトルまで復号できたマクロブロックについてのみ、下位階層のDCT係数情報を使用される。誤りのためにDCT係数情報を放棄したマクロブロックは、Not Codedとされる。
【0141】
図49は、動画像多重化部703での動画像符号化方式のシクタクスが図36に示すシンタクスである場合の復号値判定方法を示している。図36のシンタクスによると、上位階層ではまずヘッダ情報とモード情報1が復号される。ヘッダ情報やモード情報1で誤りが発見され、全てが復号できない場合は、誤りが生じた同期区間のマクロブロックの復号値は全てNot Codedとされ、前画面がそのまま表示される。もし、ヘッダ情報とモード情報1が全て復号できた場合は、次に動きベクトル情報が双方向復号される。この動きベクトル情報で復号ができない部分については、やはりNot Codedとされる。下位階層では、動きベクトルまで復号できたマクロブロックについてのみ下位階層のDCT係数情報が使用される。誤りのためにDCT係数情報を放棄したマクロブロックは、Not Codedとされる。
【0142】
なお、図48および図49に示した復号値判定方法では、マクロブロック単位に復号値の判定を行なったが、ブロック単位でも符号語の単位で復号値の判定を行なってもよい。また、この第5実施形態では動きベクトル情報とDCT係数情報の可変長符号化に本発明を適用した場合について述べたが、可変長符号化を行なう他の情報シンボルについても本発明を適用できることはいうまでもない。
【0143】
(第6実施形態)
次に、本発明の第6実施形態に係る可変長符号化/復号化装置について説明する。この第6実施形態の基本的な構成は第1実施形態の構成を示す図1のブロック図と同一なので、図1を参照しながら説明する。
【0144】
符号化部113において、入力された情報シンボルは符号化器103に入力される。符号語テーブル102は、符号語テーブル作成部101によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。符号化器103は符号語テーブル102に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択する。同期区間設定部では、符号化器が選択した符号語を同期区間毎にまとめて符号化データとして出力する。この符号化データは、伝送系または蓄積系104を通して復号化部111に送られる。
【0145】
復号化部114では、伝送系または蓄積系105より入力された符号化データから同期区間検出部106で符号化データの同期区間を検出し、符号化データをバッファ107に蓄積する。順方向復号化器109では、バッファに蓄積された符号化データの先頭から復号を開始し、逆方向復号化器111では、バッファに蓄積された符号化データの末尾から復号を開始する。
【0146】
順方向復号化器では、符号化データに、順方向符号語テーブルに存在しないビットパターンが出現した場合、及びバッファのビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。同様に逆方向復号化器でも、符号化データに、逆方向符号語テーブルに存在しないビットパターンが出現した場合、及びバッファのビット数と異なるビット数の符号化データが復号された場合、誤り検出と判定する。
【0147】
復号値判定部では、順方向復号化器によって得られた復号結果(順方向復号結果という)と、逆方向復号化器によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。
【0148】
図50は、符号語テーブル作成部101のブロック図である。情報シンボルの生起確率は、確率モデル作成部23に入力され、確率モデルを作成し、符号選択部21に入力され、選択可能な符号系の中から最も平均符号長の小さいものを選択し、選択結果を符号語構成部22に送る。符号語構成部22では、符号語選択部21で選択された符号の符号語を構成する。
【0149】
この第6実施形態における確率モデルの設計方法は以下の通りである。第6実施形態では、様々な情報源の確率分布に対して、より汎用的で符号化効率のより確率モデルの設計方法について示す。
【0150】
まず、記法を示す。
θi 情報源(i=1,…,n)
X 情報源の情報シンボルX=(x1 ,x2 ,…,xm )
P(X| θi ) θi の頻度分布
一例としては、複数のテスト画像を情報源として、そのテスト画像を符号化して得られた頻度分布を考えればよい。
【0151】
ここで、設計する確率モデルQ(X)は、複数の情報源から得れた頻度分布を重み付けして平均して求めるものとする。
【0152】

Figure 0003819638
この時、いかに重み付け係数w(θi )を求めるかが問題となる。
【0153】
情報源θi をQ(X)で符号化した時の理想符号長L(X| θi )は、
Figure 0003819638
となる。各情報源に対して平均的に理想符号長L(X| θi )を最小化するには
Figure 0003819638
【0154】
この関数が最小になるのは、U(X)=Q(X)の時で、
w(θ1 )=…=w(θn )=1/n
となる。
【0155】
別の確率モデルQ(X)の設計方法として、最悪の情報源を想定して確率モデルQ(X)を設計する手法を示す。
【0156】
情報源θi をQ(X)で符号化した時の冗長度R(X| θi )は、
Figure 0003819638
となる。この冗長度の各情報源に対する重みづけ平均S(X)は、
Figure 0003819638
となって、事象Xと事象θの相互情報量を示す関数になっている。この関数の最大値を求める方法は、
S.Arimoto,"An algorithm for computing the capacity of arbitrary discretememoryless channels,"IEEE Trans.Inform.Theory,Vol.IT-18,pp.14-20,1972.
R.E.Blahut,"Computation of channel capacity and rate-distortion functions,"IEEE Trans.Inform.Theory,Vol.IT-18,pp.460-473,1972.
に示されるArimoto-Blahutのアルゴリズム等が知られており、これらのアルゴリズムによってS(X)を最大化するつまり最悪の場合のw(θi )(i=1,…n )を求めることができる。
【0157】
確率モデルQ(X)の設計方法として、理想符号長を平均的に最小にする方法と、平均的に最悪を想定する方法を示したが、2つの方法を組み合わせて、情報源をグループ化して前者の方法で確率モデルをいくつか作成し、その確率モデルに対して後者の方法を用いるなどの方法を適用してもよい。
【0158】
図50に示す符号選択部21では、確率モデル作成部23で作成した確率モデルQ(X)を、情報シンボルXを確率の高い順にソーティングしたQ(Y)を作成し、一方、符号構成部22で作成されたリバーシブル符号の符号長を短い順にソーティングしたものF(Z)を作成し、
Figure 0003819638
を計算して最も値が小さいものを選択し、情報シンボルと符号語を対応させて符号語テーブルを作成する。
【0159】
符号語構成部22で構成する符号は、例えば特願平7−89772および特願平7−260383並びに第1および第3実施形態で示されている符号語の重みを用いた順方向にも逆方向にも復号可能な可変長符号が用いられる。
【0160】
(第7実施形態)
次に、本発明の第7実施形態を説明する。図51は、本発明の第7実施形態による可変長符号化/復号化装置が組み込まれた動画像符号化/復号化装置の概念図である。動画像符号化器709では、情報源符号化器702で符号化されたデータは、動画像多重化部703で可変長符号化、多重化等がおこなわれ、伝送バッファ704で平滑化されたのちに、符号化データとして、伝送系または蓄積系705に送り出される。符号化制御部701は、伝送バッファ704のバッファ量を考慮して、情報源符号化器702、動画像多重化部703の制御を行なう。一方、動画像復号化器710では、伝送系または蓄積系705からの符号化データを受信バッファ706にためてから、動画像多重化分離部707で、符号化データの多重化分離、可変長復号化が行なわれ、情報源復号化器708に送られ、最終的に動画像が復号化される。
【0161】
第7実施形態において追加されたシンタクスについて説明する。図53は、第7実施形態における動画像多重化部703および、動画像多重化分離部707での動画像符号化方式のシンタクスを示している。符号化データは、上位階層と下位階層に階層化し、それぞれを同期符号RMとMMによって、同期区間を設定している。また、下位階層のSTは、図62で示すような逆方向から復号可能なスタッフィング符号である。フレーム内符号化フレームは、図63のように、マクロブロックのモード情報の一部とINTRA DCを上位階層とし、モード情報の一部とAC−DCT係数情報を下位階層として、AC−DCT係数情報にリバーシブル符号を適用している。フレーム間符号化フレームは、図64のように、マクロブロックのモード情報の一部と動きベクトル情報を上位階層とし、モード情報の一部とINTRA DCとAC−DCT係数情報を下位階層として、AC−DCT係数情報にリバーシブル符号を適用している。
【0162】
図53に示す上位階層と下位階層の符号化および復号化は、図52に示す動画像多重化部とにより行なわれている。これらの構成は、第5実施形態に係る符号化装置/復号化装置の構成と略同一である。すなわち、図51の動画像多重化部703および動画像多重化分離部707の基本構成は、図53(a)(b)に示す通りであるが、上位階層可変長符号化器801、下位階層可変長符号化器803および上位階層可変長復号化器805、下位階層可変長復号化器806の構成が第2実施形態とは異なっている。すなわち、情報源符号化器702で符号化されたデータのうち、例えば図53(a)のシンタクスで示された上位階層のデータが上位階層可変長符号化器801で可変長符号化され、多重化部803に送られる。また、情報源符号化器702で符号化されたデータのうち、図53(b)のシンタクスで示された下位階層のデータが可変長符号化器803で可変長符号化され、多重化部803に送られる。多重化部803では、上位階層の符号化データおよび下位階層の符号化データを多重化し、送信バッファ704に送る。
【0163】
そして、この第7実施形態では上位階層可変長復号化器805および下位階層可変長復号化器806内の図32中に示した復号値判定部110では、順方向復号化器108によって得られた順方向復号結果から復号値を判定し、最終的な復号結果を出力する。各階層の順方向復号化器108および逆方向復号化器109での誤り判定は、符号語として存在しないビットパターンが出現した場合、およびチェックビット等で誤りを検出した場合には、検出位置はその場所とし、前記の判定方法で誤りが検出されない場合で、復号したビット数が同期区間内の符号化データのビット数と一致しない場合は、復号化の最処理位置を誤り検出位置とする。
【0164】
(第8実施形態)
図54,図55は、本発明の第8実施形態に係る符号化/復号化装置における情報源符号化器702,情報源復号化器708の一例をそれぞれ示している。まず、図54において、入力画像信号は、ブロック化回路401でマクロブロックに分割される。マクロブロックに分割された入力画像信号は、減算器402に入力され、予測画像信号との差分がとられて、予測残差信号が生成される。この予測残差信号と、ブロック化回路401からの入力画像信号のいずれか一方を、モード選択スイッチ403により選択し、DCT(離散コサイン変換)回路404により離散コサイン変換される。DCT回路で得られたDCT係数データは、量子化回路405で量子化される。量子化されたデータは、2分岐され、一方はDCT係数情報として、動画像多重化器703におくられる。もう一方は、逆量子化回路406およびIDCT(逆離散コサイン変換)回路407により量子化回路405およびDCT回路406の処理と逆の処理が順次行なわれた後、加算器408でスイッチ410を介して入力される予測画像信号と加算されることにより、局部復号信号が生成される。この局部復号信号は、フレームメモリに蓄えられ、動き補償回路411に入力される。動き補償回路A010では、入力画像信号と局部復号信号との間で動き補償を行ない、動きベクトルを求め、予測画像信号を生成する。このとき求めめられた動きベクトル情報は、動画像多重化器703に送られる。モード選択回路412では、動き補償回路410からの情報に基づいて、各マクロブロックをどのような予測方式で符号化するかを決定し、その結果が量子化パラメータ等ともにモード情報として動画像多重化器703に送られる。なお、図54において、出力される符号化データはDCT符号化係数,動きベクトル情報,モード情報の3つが1つに纏められたデータである。
【0165】
次に、図54により符号化されたデータを復号化する情報源復号化器708の構成について図55を参照しながら説明する。図55は、図54に対応する情報源復号化器708の一例を示している。図55において、情報源復号化器708は、動画像多重化分離回路707で分離したモード情報、動きベクトル情報、DCT係数情報等が入力される。
【0166】
モード情報が入力されるモード判定回路504では、モード情報がINTRAならば、モード切替スイッチ505をオフに選択して、DCT係数情報を、逆量子化回路501で逆量子化し、IDCT回路502で逆離散コサイン変換処理を行なうことにより、再生画像信号を生成させる。この再生画像信号は、フレームメモリ506に参照画像として蓄積される一方、再生画像信号として出力する。モード情報かINTERならば、モード切替スイッチ505をオフに選択して、DCT係数情報を、逆量子化回路501で逆量子化し、IDCT回路502で逆離散コサイン変換処理をおこない、動きベクトル情報に基づいて、フレームメモリ504において参照画像を動き補償し、加算器503で足しあわせて、再生画像信号を生成させる。この再生画像信号は、フレームメモリ504に参照画像として蓄積される一方、再生画像信号として出力する。
【0167】
(第9実施形態)
次に、本発明の応用例として、本発明の可変長符号化/復号化装置が組み込まれた第9実施形態に係る動画像符号化/復号化システムを適用した画像送受信装置の実施形態を図56を用いて説明する。パーソナルコンピュータ(PC)1001に備え付けられたカメラ1002より入力された画像信号は、PC1001に組み込まれた動画像符号化器709によって符号化される。動画像符号化器709から出力される符号化データは、他の音声やデータの情報と多重化された後、無線機1003より無線で送信され、他の無線機1004によって受信される。無線機1004で受信された信号は、画像信号の符号化データおよび音声データに分解される。これらのうち、画像信号の符号化データはワークステーション(EWS)1005に組み込まれた動画像復号化器710によって復号され、EWS1005のディスプレイに表示される。
【0168】
一方、EWS1005に備え付けられたカメラ1006より入力された画像信号は、EWS1005に組み込まれた動画像符号化器709を用いて上記と同様に符号化される。符号化データは、他の音声やデータの情報と多重化され、無線機1004により無線で送信され、無線機1003によって受信される。無線機1003によって受信された信号は、画像信号の符号化データおよび音声やデータの情報に分解される。これらのうち、画像信号の符号化データはPC1001に組み込まれた動画像復号化器710によって復号され、PC1001のディスプレイに表示される。
【0169】
(第10実施形態)
なお、上述した第1ないし第9実施形態に係る動画像符号化/復号化装置は、ハードウェアとしての構成として発明を捉えていたが、本発明はこれを発展させて上記各々の実施形態に係る符号化/復号化装置において用いられるデータまたはプログラムを記録する記録媒体としても捉えることができる。以下、第10実施形態に係るデータまたはプログラムを記録した記録媒体について説明する。
【0170】
図51に示す情報源符号化器702では、量子化語の8×8のDCT係数のブロックについてブロックないのスキャンを行なって、LAST(0:ブロックの最後でない非零係数,1:ブロックの最後の非零係数),RUN(非零係数までの零ランの数)及びLEVEL(係数の量子化値)を求め、動画像多重化部703に送る。
【0171】
動画像多重化部703内の下位階層可変長符号化器802は、図60に示すINTRA(フレーム内符号化)の非LAST係数のRUN,LEVELにリバーシブル符号の符号語(VLC_CODE)のINDEXを対応させたINDEXテーブルと、図61に示すINTER(フレーム間符号化)の非LAST係数のRUN,LEVELにリバーシブル符号の符号語(VLC_CODE)のINDEXを対応させたINDEXにテーブルと、図62に示すINTRA,INTER共通のLAST係数のRUN,LEVELにリバーシブル符号の符号語(VLC−CODE)のINDEXを対応させたINDEXテーブルと、図63,図64に示すINDEX値と符号語を対応させた符号語テーブルを持っている。
【0172】
下位階層可変長符号化器802の動作を、図57のフローチャートに従って説明する。まず、モード情報に基づいて、INTERの時はINTRAの非LAST係数とLAST係数の符号語テーブル,INTERの時はINTERの非LAST係数とLAST係数のINDEXテーブルを選択する。(S101)
次に、符号語テーブルを用いて符号化するにあたって、(RUN,LEVEL)がINDEXテーブルのRUNの最大値R_max,LEVELの最大値L_maxと比較して、INDEXテーブル内に存在するかどうか確認する。(S102)
もし、存在した場合、図60〜図62のINDEXテーブルを引きINDEXの値が0であるかどうかチェックを行ない(S104),0でなければ、図12の符号語テーブルのINDEXの符号語を出力する。符号語テーブルの符号語の最終ビットの“s”は、LEVELの符号を表し、“s”が“0”のときは、LEVELの符号は正、“s”が“1”のときは、LEVELの符号は負である(S105)。INDEXの値が0であった場合と、範囲外であった場合は、符号語テーブルに存在しない係数で、図67に示すようにESCAPE符号を続けて、LAST係数かどうかの1ビットと図65および図66のRUNとLEVELの絶対値を固定長符号化し、この固定長符号化部の先頭に2つのエスケープのうち“00001”を付加し、末端にもエスケープ符号を付加する。図63,図64のINDEX値が0の符号語が、エスケープ符号であり、エスケープ(ESCAPE)符号として用いられるVLC_CODEの最終ビット“s”はLEVELの符号を表し、“s”が“0”ならばLEVELは正、“1”ならばLEVELは負である(S106)。
【0173】
以上説明したように、INDEXテーブルを用いることにより、ESCAPE符号を用いた場合にも、探索することなく効率的に、符号語を出力できる。下位階層可変長復号化器802は、図68,図69の復号値テーブルを備えており、可変長符号を復号した結果得られるINDEX値に基づいて動作する。
【0174】
次に、下位階層可変長復号化器の動作を、図58と図59のフローチャートに従って説明する。図58は、順方向の場合の復号動作である。まず、可変長復号を順方向復号する(S201)。次に、復号して得られたINDEX値が0かどうかをチェックし(S202)、0以外の場合は、上位階層のモード情報に基づいて、図68の復号値テーブルのINTRAとINTERを選択して、LAST,RUN,LEVELの復号値を得る(S203)。INDEX値が0の場合は、ESAPE符号であるから、次に続く固定長符号を復号して、LAST,RUN,LEVELの復号値を得る(S204)。つづいて、末尾のESCAPE符号を復号する(S205)。LEVELの正負は、符号語の最終ビットが“0”ならば、正であり、“1”ならば、負である(S206)。
【0175】
図59は、逆方向の場合の復号動作である。まず、符号語の最初の1ビットで、LEVELの正負を決定する。もし、“0”ならば、正であり、“1”ならば負である(S301)。次に可変長符号を逆方向復号する(S302)。逆方向復号して得られたINDEX値が0かどうかチェックし(S303)、0以外の場合は、上位階層のモード情報に基づいて、図68の復号値テーブルのINTRAとINTERを選択して、LAST,RUN,LEVELの復号値を得る(S304)。INDEX値が0の場合には、ESCAPE符号であるから、次に続く固定長符号を復号して、LEVEL,RUN,LASTの復号値を得る(S305)。つづいて、先頭のESCAPE符号を復号する(S306)。以上説明したように、復号値テーブルを用いることで、ESCAPE符号を使った場合にも記憶量を節約し、効率的に双方向に復号することができる。
【0176】
上記第10実施形態におけるデコードプロセスの補強例について説明する。すなわち、動画像多重化部703での動画像符号化方式のシンタクスが図53に示すシンタクスである場合の復号値判定方法について説明する。
【0177】
フレーム内符号化フレームでは、まず、上位階層のモード情報1とINTRADCが復号される。もし、誤りが発見されて全てを復号できない場合は、誤りの生じた同期区間のマクロブロックの復号値を全てNot Codedとする。もし、符号化が最初のフレームで時間的に前のフレームが存在しない場合は、灰色あるいは特定の色でマクロブロックを埋める。
【0178】
下位階層では、モード情報2が誤りのため復号できない場合、下位階層の符号化データを全て放棄し、上位階層の復号値を書き換えて、Not Codedとするか、INTRA DCのみで表示する。また、誤りのためDCT係数を放棄したマクロブロックは、Not Codedとするか、INTRA DCのみで表示する。
【0179】
また、INTRAモードのマクロブロックで、AC−DCT係数の予測を行なっているマクロブロックがある場合は、可変長符号は復号できるが、周辺のマクロブロックからの予測を行なっているので、周辺のマクロブロックが復号できていないために復号できない場合、Not Codedとする。
【0180】
フレーム間符号化フレームでは、まず、上位階層のモード情報1と動きベクトルが復号される。もし、誤りが発見されて全てを復号できない場合は、誤りが生じた同期区間のマクロブロックの復号値は全てNot Codedとされる。もし、全て復号できた場合、同期符号MMが存在することを確認し、もし、存在しなければ、やはり、同期区間のマクロブロックの復号値を全てNot Codedとする。
【0181】
下位階層では、モード情報2及びINTRA DCで誤りのため復号されない場合、下位階層の符号化データを放棄し、Not Codedと表示するか、または、前フレームからの動き補償のみでの表示(MC Not Coded)に上位階層の復号値を書き換える。また、誤りのためDCT係数を放棄したマクロブロックは、MC Not Codedとする。
【0182】
また、INTRAモードのマクロブロックで、AC−DCT係数の予測を行なっているマクロブロックがある場合は、可変長符号は復号できるが、周辺のマクロブロックからの予測を行なっているので、周辺のマクロブロックが復号できていないために復号できない場合、Not Codedとする。
【0183】
図70はフレーム間符号化フレームのAC−DCT係数部の詳しい復号値判定方法を示している。
【0184】
まず、図70(a)に示すように順方向復号結果と逆方向復号結果で誤りが検出されるマクロブロックの位置(誤り検出位置)が交差しない場合は、誤りが検出されなかったマクロブロックの復号結果のみを復号値として使用し、二つの誤り検出位置の復号結果は復号値として使用せず、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては、前フレームをそのまま表示するように、INTRAマクロブロックについては、前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換える。
【0185】
また、図70(b)に示すように順方向復号結果と逆方向復号結果の誤りの検出位置が交差する場合は、順方向復号の結果で誤りが検出されたマクロブロックまでの復号値は、順方向復号結果を使用し、それ以降の部分は、逆方向復号結果を復号値として使用する。
【0186】
なお、逆方向復号結果を優先して、逆方向復号の結果で誤りが検出されたマクロブロックまでの復号値は、逆方向復号結果を使用し、それ以前の部分は、順方向復号結果を復号値として使用してもよい。
【0187】
さらに、図70(c)に示すように同一のマクロブロックで順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、誤り検出位置のマクロブロックの復号値は放棄し、復号値として使用せずに、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては、前フレームをそのまま表示するように、INTERマクロブロックについては、前フレームよりの動き補償のみで表示するように、上位階層の復号結果を書き換え、それ以後のマクロブロックに対する復号値は逆方向の復号結果を使用する。
【0188】
また、図70(d)に示すようにスタッフィング符号で誤りが検出され、逆方向に復号できない場合は、順方向復号のみ復号を行ない、誤りが検出された場合、誤り検出位置以降のマクロブロックは、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては、前フレームをそのまま表示するように、INTERマクロブロックについては、前フレームよりの動き補償のみで表示するように、上位階層の復号結果を書き換え、それ以後のマクロブロックに対する復号値は逆方向の復号結果を使用する。
【0189】
図70の復号値判定方法では、マクロブロックを単位に復号値の判定をおこなったが、ブロックの単位でも、符号語の単位で判定をおこなってもよい。
【0190】
以上実施形態で説明したように、本発明の可変長符号化/復号化装置は、従来と比較して、より少ない計算量と記憶量で十分であり、効率的である。
【0191】
具体的には、動画像符号化/復号化装置にも適用することが可能であり、より少ない計算量と記憶量で効率的な動画像符号化/復号化装置を提供することができる。
【0192】
【発明の効果】
以上、説明したように本発明によれば、より少ない計算量と記憶量で効率的に符号化/復号化することができる順方向にも逆方向にも復号可能な可変長符号化/復号化装置を提供することができる。
【0193】
また、本発明によれば無駄なビットパターンを減らして符号化効率を高め、しかもスタッフィング符号を用いて同期区間を一定区間を単位に設定する場合でも、順方向にも逆方向にも復号可能な可変長符号化/復号化装置を提供することができる。
【0194】
また、本発明における符号語の構成方法によれば、より幅広い情報シンボルの確率分布に対応でき、従来適用することのできなかったような情報シンボル数が大きな符号化に対しても適用が可能となる。具体的には、動画像符号化/復号化システムにも適用することが可能であり、誤りに強い動画像符号化/復号化システムを提供することができる。
【0195】
しかも、この符号語の構成法によれば符号化効率が向上し、また符号語のビットパターンの自由度が高い符号設計ができるため、同期符号を用いて同期区間の設定を行なう場合でも、同期符号と符号語のビットパターンが一致することによる疑似同期の問題を回避することができる。
【0196】
さらに、本発明によれば順方向および逆方向の復号結果から復号値を判定する際、順方向および逆方向復号を行なう際の誤り検出結果に応じて、符号化データの復号値を判定することにより、リバーシブル符号を伝送路誤りに対して効果的に復号することが可能となる。
【0197】
また、本発明によれば可変長符号の符号語の誤り検出機能を有する双方向復号化手段で復号処理を行なう際に、順方向復号処理での誤り検出結果に応じて符号化データの復号処理を切り替えることで、順方向と逆方向の復号処理を共用することができることから、回路規模や演算量を大幅に増加させることなく、伝送路誤りに対して効果的に復号を行なうことができる。
【0198】
さらに、本発明によれば符号化側で情報シンボルを重要度に応じて階層化した上で可変長符号化を行ない、同期区間毎に階層毎の符号化データを作成し、かつ階層毎の符号化データを多重化することにより、情報シンボルのシンタクスによらず順方向にも逆方向にも復号可能であって、より誤りに強い可変長符号化/復号化を行なうことが可能となる。
【図面の簡単な説明】
【図1】本発明の第1実施形態に係る可変長符号化/復号化装置の構成を示すブロック図。
【図2】図1における符号語テーブル作成部を示すブロック図。
【図3】図2における符号語構成部での第1の符号語構成方法を説明する図。
【図4】第1の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図。
【図5】図2における符号語構成部での第2の符号語構成方法を説明する図。
【図6】図2における符号語構成部での第3の符号語構成方法を説明する図。
【図7】図2における同期区間設定部での同期区間設定方法を説明する図。
【図8】スタッフィング符号の第1の例を示す図。
【図9】スタッフィング符号の第2の例を示す図。
【図10】図2における復号値判定部の動作を説明する図。
【図11】本発明の第2実施形態に係る動画像符号化/復号化システムの概略構成を示すブロック図。
【図12】第2実施形態に係る動画像符号化/復号化システムにおける符号化データのシンタックスを示す図。
【図13】図11における動画像多重化部および動画像多重化分離部の構成を示すブロック図。
【図14】第2実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの一部を示す図。
【図15】第2実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの他の一部を示す図。
【図16】第2実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルのさらに別の一部を示す図。
【図17】第2実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの一部を示す図。
【図18】第2実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの他の一部を示す図。
【図19】第2実施形態におけるエスケープ符号の符号語テーブルを示す図。
【図20】第2実施形態における符号語テーブルにない符号語の符号化方式を示す図。
【図21】第2実施形態における最大の零ランの場合を示す図。
【図22】第2実施形態における復号値判定部の動作を説明するためたの図。
【図23】本発明の第3実施形態に係る可変長符号化/復号化装置の構成を示すブロック図。
【図24】図23における符号語構成部での第1の符号語構成方法を説明する図。
【図25】図23における符号語構成部での第2の符号語構成方法を説明する図。
【図26】順方向符号語テーブルと逆方向符号語テーブルを共通化した双方向符号語テーブルの構成を示す図。
【図27】復号化器に誤り検出部を付加した場合の構成を示すブロック図。
【図28】第3実施形態における復号化方法を説明する図。
【図29】第3実施形態における復号値判定部の復号値判定方法を説明するための図。
【図30】本発明の第4の実施形態に係る可変長符号化/復号化装置の構成を示すブロック図。
【図31】図30における一つの階層の可変長符号化部の構成を示すブロック図。
【図32】図30における一つの階層の可変長復号化部の構成を示すブロック図。
【図33】図30におけるデータ階層化部および多重化部でのデータ階層化および多重化の例を示す図。
【図34】図32における復号値判定部の復号値判定方法の例を示す図。
【図35】第4実施形態に係る可変長符号化/復号化装置を図11の動画像符号化/復号化システムに組み込んだ場合の動画像多重化部および動画像多重化分離部での動画像符号化方式のシンタックスの第1の例を示す図。
【図36】第4実施形態に係る可変長符号化/復号化装置を図11の動画像符号化/復号化システムに組み込んだ場合の動画像多重化部および動画像多重化分離部での動画像符号化方式のシンタックスの第2の例を示す図。
【図37】第4実施形態に係る可変長符号化/復号化装置を図11の動画像符号化/復号化システムに組み込んだ場合の動画像多重化部および動画像多重化分離部での動画像符号化方式のシンタックスの第3の例を示す図。
【図38】第4実施形態に係る可変長符号化/復号化装置を図11の動画像符号化/復号化システムに組み込んだ場合の動画像多重化部および動画像多重化分離部での動画像符号化方式のシンタックスの第4の例を示す図。
【図39】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図40】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図41】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図42】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図43】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図44】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図45】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図46】第4実施形態における動きベクトルの符号化テーブルを示す図。
【図47】第4実施形態における動きベクトルの一次元予測を説明するための図。
【図48】図35のシンタクスの場合の復号値判定方法を説明する図。
【図49】図36のシンタクスの場合の復号値判定方法を説明する図。
【図50】本発明の第6実施形態に係る符号化/復号化装置であり、図1における符号語テーブル作成部の詳細構成を示すブロック図。
【図51】本発明の第7実施形態に係る動画像符号化/復号化システムの概略構成を示すブロック図。
【図52】図50における動画像多重化部および動画像多重化分離部の構成を示すブロック図。
【図53】第7実施形態に係る動画像多重化部および動画像多重化分離部での動画像符号化方式のシンタクスの例を示す図。
【図54】本発明の第8実施形態に係る情報源符号化器の一例を示すブロック図。
【図55】本発明の第8実施形態に係る情報源復号化器の一例を示すブロック図。
【図56】本発明の第9実施形態に係る可変長符号化/復号化装置が組み込まれるシステムの一例を示す図。
【図57】本発明の第10実施形態の可変長符号化器の動作を示すフローチャート。
【図58】第10実施形態の順方向可変長復号化器の動作を示すフローチャート。
【図59】第10実施形態の逆方向可変長復号化器の動作を示すフローチャート。
【図60】INTRA係数のINDEXテーブルを示す図。
【図61】INTER係数のINDEXテーブルを示す図。
【図62】LASR係数のINDEXテーブルを示す図。
【図63】第10実施形態における符号語テーブルを示す図。
【図64】第10実施形態における符号語テーブルを示す図。
【図65】第10実施形態におけるRUNの固定長符号語テーブルを示す図。
【図66】第10実施形態におけるLEVELの固定長符号語テーブルを示す図。
【図67】符号語テーブルにない符号語の符号化方式を示す図
【図68】第10実施形態における復号値テーブル
【図69】第10実施形態における復号値テーブル
【図70】復号値判定部の動作を説明するための図
【図71】リバーシブル符号の一般的な復号方法を示す図。
【図72】通常の可変長符号の説明図。
【図73】従来のリバーシブル符号の説明図。
【図74】従来のスタッフィング符号を示す図。
【図75】従来の逆復号ができない情報シンボルのシンタックスを説明するための図。
【符号の説明】
51 双方向符号語テーブル
52 アドレス変換器
53 識別信号
61 誤り検出部
101 符号語テーブル作成部
102 符号語テーブル
103 符号化器
104 同期区間設定部
105,205,705 伝送系または蓄積系
106 同期区間検出部
107 バッファ
108 順方向復号化器
109 逆方向復号化器
110 復号値判定部
111 順方向符号語テーブル
112 逆方向符号語テーブル
113,213 符号化部
114,121,214 復号化部
122 符号化データ切替器
123 符号語テーブル切替器
124,62 復号化器
201 符号化テーブル作成部
202 データ階層化部
203 階層別可変長符号化部
204 多重化部
206 多重化分離部
207 階層別復号化部
208 データ合成部
401 ブロック化回路
402 減算器
403 モード選択スイッチ
404 DCT回路
405 量子化回路
406 逆量子化回路
407 IDCT回路
408 加算器
409 フレームメモリ
410 動き補償回路
411 スイッチ
412 モード選択回路
501 逆量子化回路
502 IDCT回路
503 加算器
504 モード判定回路
505 モード切替スイッチ
506 フレームメモリ
701 符号化制御部
702 情報源符号化器
703 動画像多重化器
704 送信バッファ
706 受信バッファ
707 動画像多重化分離器
708 情報源復号化器
709 動画像符号化器
710 動画像復号化器
901 上位階層可変長符号化器
902 下位階層可変長符号化器
903 多重化器
904 多重化分離器
905 上位階層可変長復号化器
906 下位階層可変長復号化器
1001 パーソナルコンピュータ
1002 ワークステーション
1003,1004 無線機
1005,1006 カメラ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a variable length encoding / decoding device used for compression encoding / decoding of moving image signals and the like, and in particular, a variable length encoding / decoding device capable of decoding from both forward and backward directions. The present invention also relates to a recording medium for recording data or programs used in this apparatus.
[0002]
[Prior art]
A variable-length code is based on the frequency of occurrence of a symbol, and assigns a short code length on average by assigning a short code length code to frequently appearing symbols and a long code length code to symbols that do not appear rarely. This is a code system designed to be Therefore, when a variable length code is used, the amount of data can be greatly compressed as compared with the data before encoding. As a method for constructing such a variable length code, an optimum Huffman algorithm for a non-recording information source is known.
[0003]
As a general problem of variable-length codes, when an error is mixed in a code due to an error in the transmission path of the encoded data or other reasons, the influence of the data after the error is mixed propagates to the decoding device. It will be impossible to decrypt correctly. In order to avoid this problem, when there is a possibility that an error occurs in the transmission path, a method is generally adopted in which a synchronization code is inserted at a certain interval to prevent error propagation. 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, it is possible to prevent error propagation and perform correct decoding by finding the next synchronization code.
[0004]
However, even when a synchronization code is used, decoding is performed on encoded data between a location where an error occurs and decoding cannot be performed correctly as shown in FIG. 71 (a) until a location where the next synchronization code is found. I can't.
[0005]
Therefore, the variable length code is changed from the normal configuration shown in FIG. 72 as shown in FIG. 73, and not only the property that can be decoded from the normal forward direction as shown in FIG. A method for making a decodable code configuration is known. Further, since such a code can read the encoded data from the reverse direction, it can also be used for reverse reproduction in a storage medium such as a disk memory for storing the encoded data. 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.
[0006]
An example of a reversible code is described in, for example, “Reversible Variable Length Coding Method” of Japanese Patent Laid-Open No. 5-300027. The reversible code of this known example is such that each codeword has a longer code length as shown in FIG. 73 at the end of the codeword of the Huffman code, which is a variable length code that can be decoded from the forward direction shown in FIG. This is a variable length code that can be decoded in the reverse direction by adding bits under conditions that do not match the end of other codewords. However, since this reversible code adds bits to the end of the codeword of a variable-length code that can be decoded only in the forward direction, the number of wasted bits increases and the average code length increases. As a result, the encoding efficiency is greatly reduced as compared with a variable-length code that can be decoded only in the forward direction.
[0007]
Further, the conventional reversible code has a problem that backward decoding cannot be performed if the synchronization interval is set in units of a certain interval. For example, ITU-T H.I. In H.263 (1996), the synchronization code is aligned every 8 bits (= 1 byte), that is, the position where the synchronization code can be inserted can be set to a position of 1 byte unit. In order to realize such synchronization interval alignment, a stuffing code as shown in FIG. 34 is inserted before the synchronization code. In such a case, the conventional reversible code has a problem that backward decoding cannot be performed due to the stuffing code.
[0008]
Furthermore, when simply decoding a reversible code, it requires twice the circuit scale and the amount of calculation as much as decoding in the reverse direction, compared to a variable length code decoding apparatus that can decode only in the normal forward direction. There was a problem of doing.
[0009]
Another problem with the conventional reversible code is that there is a case where decoding in the reverse direction is impossible due to the syntax of the input information. For example, in the case of an information symbol having the syntax of FIG. 75 (a), the code of symbol B is determined by symbol A. Since encoded data obtained by encoding an information symbol having such a syntax cannot decode B unless A can be decoded first as shown in FIG. 75B, it cannot be decoded from the reverse direction.
[0010]
As an encoding method applied when the number of information symbols is large, there is a method using an escape code. This method using an escape code has a code word table for a small number of information symbols with high appearance frequency as a code word table, and encodes the majority of information symbols with low appearance frequency with a combination of escape codes and fixed-length codes. It is. Also in the method using the escape code, a method has been proposed in which escape codes are added to the beginning and the end of a fixed-length code, as in the case of a variable-length code that can be decoded in both the forward and backward directions.
[0011]
In a conventional encoding / decoding method using an escape code, in order to distinguish between a codeword existing in the codeword table and a codeword encoded using the escape code, the codeword is stored in the codeword table by some method. There was a need to search for the existence.
[0012]
[Problems to be solved by the invention]
An object of the present invention is to provide a variable-length encoding / decoding device capable of efficient encoding / decoding with a small calculation amount and storage amount and capable of decoding in both forward and backward directions. .
[0013]
That is, as described above, the reversible code according to the prior art, that is, the variable length code that can be decoded from the forward direction or the reverse direction, adds a bit to the end of the code word of the variable length code that can be decoded only from the forward direction. As a result, a reversible code is formed, which increases the number of useless bit patterns, lengthens the average code length, and significantly reduces the coding efficiency compared to a variable-length code that can be decoded only in the forward direction. In addition, if the synchronization interval is set in units of a fixed interval using stuffing code, there is a problem that reverse decoding of the reversible code cannot be performed due to the stuffing code, and furthermore, when reversible code is simply decoded. Compared with a variable length code decoding device capable of decoding only in the normal forward direction, the circuit is doubled for decoding in the reverse direction. It requires diagrammatic and calculation amount, also depending on the syntax of information symbols input there is a problem that there are cases it is impossible to decode from the opposite direction.
[0014]
The present invention improves the coding efficiency by reducing useless bit patterns, and is a variable-length code that can be decoded in both the forward and reverse directions even when the synchronization interval is set in units of a fixed interval using a stuffing code. An object is to provide an encoding / decoding device.
[0015]
In addition, the present invention reduces useless bit patterns to increase coding efficiency, and can perform decoding efficiently by reducing the circuit scale and the amount of computation by sequentially performing decoding processing. It is another object of the present invention to provide a variable-length encoding / decoding device that can also decode.
[0016]
It is another object of the present invention to provide a variable-length encoding / decoding device that can decode both forward and backward directions regardless of the syntax of an input information symbol and is more resistant to errors.
[0017]
[Means for Solving the Problems]
The variable length coding apparatus according to the present invention assigns a codeword having a code length corresponding to the occurrence probability of each information symbol to a plurality of information symbols, and codes a codeword corresponding to the input information symbol. In a variable-length coding apparatus that outputs data, hierarchization means for hierarchizing input information symbols according to importance, and can decode both forward and backward, and codewords are predetermined. A codeword table storing a plurality of codewords including codewords configured so as to identify codeword breaks according to the weights, corresponding to the information symbols, and hierarchized from the codeword table by the layering means A code word selection means for selecting a code word corresponding to the information symbol, and a code word selected for each hierarchy using a code word selected by the code word selection means. Together to create the data, and having a multiplexing means for multiplexing the encoded data of each hierarchical layer.
[0018]
Here, the “codeword weight” corresponds to the Hamming distance with respect to the minimum value or the maximum value of the codeword. When the code word is a binary code, the minimum value of the code word is all “0” and the maximum value is all “1”, so the weight of the code word is a number of “1” or “0”. It corresponds to. The position where the weight of the code word becomes a predetermined value indicates a code break in the variable length code.
[0019]
In this variable length coding apparatus, a code length, that is, a variable length code composed of a code word having a predetermined code length, is configured by a value that does not depend on the code word order relationship, that is, a code word weight. Therefore, since the variable length code can be recognized from both the forward direction and the reverse direction, the variable length code is a reversible code that can be decoded from both directions. Also, unlike a conventional reversible code that adds a bit to the end of a variable-length code that can be decoded only in the forward direction, a reversible code is constructed from the beginning without adding extra bits. A variable length code with few bit patterns and high coding efficiency can be obtained.
[0020]
Further, in this variable length coding apparatus, even when setting a synchronization interval in units of a certain interval, it is possible to decode a reversible code in the reverse direction by using a stuffing code that can be decoded in the reverse direction. That is, when the reversible code is reversely decoded, it is necessary to know the end of the reversible code (the head when viewed in the reverse direction). However, if a stuffing code that can be decoded in the reverse direction is used, the end of the reversible code is known. Therefore, reverse decoding of the reversible code can be realized.
[0021]
In this variable-length coding apparatus, the input information symbols are hierarchized, then variable-length coding is performed using the same coding table as before, and further, a synchronization interval is set for each layer. Therefore, it is possible to decode both forward and backward directions regardless of the syntax of the information symbol, and it is possible to perform variable-length coding that is more resistant to errors.
[0022]
In the variable length coding apparatus having the above configuration, among the plurality of codewords stored in the codeword table, the codeword can be decoded both in the forward direction and in the reverse direction, and the codeword is determined by a predetermined weight of the codeword. Codewords configured to be delimited are preferably decoded in the forward and backward directions, for example at least one of the beginning and end of the first codeword that can be decoded in both forward and backward directions. It is constructed by adding a possible second codeword, or at least one immediately before and immediately after each bit of the first codeword that can be decoded both in the forward direction and in the reverse direction. A second codeword that can also be decoded in the direction is added.
[0023]
By configuring the codeword in this way, it is possible to deal with a wider probability distribution of information symbols, so that the coding efficiency is improved and the code design with a high degree of freedom of the bit pattern of the codeword can be performed. Even when the synchronization interval is set using, the problem of pseudo-synchronization due to the coincidence of the synchronization code and the bit pattern of the codeword can be avoided.
[0024]
Moreover, in the variable length coding apparatus having the above configuration, among the plurality of codewords stored in the codeword table, decoding is possible both in the forward direction and in the backward direction, and the codeword is encoded with a predetermined weight of the codeword. Codewords that are configured to identify word breaks are codewords in which a fixed-length codeword is inserted between each bit of a codeword that can be decoded in both the forward and backward directions. There may be.
[0025]
In addition, among a plurality of code words stored in the code word table, the code word can be decoded both in the forward direction and in the reverse direction, and the code word delimiter can be identified by a predetermined weight of the code word. The code word is a code word in which a code word that can be decoded in both the second forward direction and the reverse direction is inserted between each bit of the code word that can be decoded in the first forward direction and the reverse direction. There may be.
[0026]
By configuring the codeword in this way, it is possible to deal with a wider probability distribution of information symbols, so that the coding efficiency is improved and the code design with a high degree of freedom of the bit pattern of the codeword can be performed. Even when the synchronization interval is set using, the problem of pseudo-synchronization due to the coincidence of the synchronization code and the bit pattern of the codeword can be avoided.
[0027]
A first variable length decoding device according to the present invention is a variable length decoding device corresponding to the first variable length coding device, which can decode both in the forward direction and in the reverse direction, and has a predetermined synchronization. In a variable-length decoding device that decodes encoded data composed of a variable-length code composed of codewords including a codeword in which a stuffing code that can be decoded in the reverse direction is inserted for each interval, a synchronization interval of encoded data is determined Sync period detecting means for detecting, forward decoding means for decoding the encoded data of the sync section detected by the sync section detecting means from the forward direction, and encoded data of the sync section detected by the sync section detecting means And a backward decoding means for decoding from the backward direction.
[0028]
The variable length decoding device may include a decoded value determining unit that determines a decoded value from the decoding results of the forward decoding unit and the backward decoding unit.
[0029]
Here, the synchronization interval detecting means detects the number of bits of the encoded data, for example, by decoding the stuffing code from the reverse direction.
[0030]
In addition, at least one of the forward decoding means and the backward decoding means may detect a codeword that is detected as an error when a codeword that does not exist in the codeword table of the variable-length code appears in the encoded data. An error is detected if a codeword that does not exist in the codeword table detects an error when it appears in the encoded data, or if the number of bits of the decoded encoded data does not match the number of bits of the transmitted encoded data To do.
[0031]
Further, at least one of the forward decoding means and the backward decoding means detects an error in the decoding process when the decoded value obtained by decoding the encoded data is inappropriate.
[0032]
On the other hand, the decoded value determining means determines that the decoding result of the forward decoding means and the backward decoding means is correct when an error is detected in at least one of the forward decoding means and the backward decoding means, for example. The estimated decoding result is used, and a portion that cannot be decoded by any decoding result is discarded.
[0033]
In particular,
(A) When the error is detected by both the forward decoding means and the backward decoding means and their error detection positions do not intersect, only the decoding result in which no error is detected is used as a decoded value. ,
(B) When the error is detected by both the forward decoding means and the backward decoding means, the errors are detected, and the positions where the errors are detected intersect, the forward decoding is performed. The decoding value for the codeword up to the position immediately before the position where the error was found by the converting means uses the forward decoding result, and the decoding value for the codeword thereafter uses the backward decoding result,
(C) If the error is detected by only one of the forward decoding means and the backward decoding means, the decoded value for the codeword up to immediately before the position where the error is detected is the forward value. Using the decoding result, the decoding value for the codeword after that uses the decoding result in the reverse direction,
(D) When the error is detected for the same codeword by the forward decoding means and the backward decoding means, the decoded value for the codeword at the position where the error is detected is discarded, and the subsequent The decoding value for the code word uses the decoding result in the reverse direction.
[0034]
The decoded value determining means may be configured to abandon all portions that may contain errors when an error is detected in at least one of the forward decoding means and the backward decoding means.
[0035]
In this variable length decoding device, when determining the decoding value from the decoding results of the forward decoding means and the backward decoding means having the error detection function of the code word of the variable length code, the forward decoding means and the backward direction By determining the decoded value of the encoded data according to the error detection result in the decoding means, the reversible code output from the variable length encoding device as described above is effectively decoded against the transmission path error. It becomes possible to do.
[0036]
In addition, since a code that can be decoded in the reverse direction is used as the stuffing code, the reverse decoding of the reversible code can be performed even when the synchronization interval is set for each fixed interval using the stuffing code.
[0037]
A second variable length decoding device according to the present invention is a code comprising a variable length code that can be decoded both in the forward direction and in the reverse direction, and a stuffing code that can be decoded in the reverse direction in each predetermined synchronization interval. In a variable length decoding device for decoding encoded data, a synchronization interval detecting means for detecting a synchronization interval of encoded data, and a forward direction and a backward direction for decoding encoded data in the synchronization interval detected by the synchronization interval detecting means And bi-directional decoding means capable of decoding in both directions.
[0038]
Here, the bidirectional decoding means detects an error in the decoding process when the decoded value obtained by decoding the encoded data is inappropriate in at least one of the forward decoding process and the backward decoding process. .
[0039]
As a decoding method of the bidirectional decoding means, the following method can be used.
[0040]
(A) After performing the forward decoding process, the backward decoding process is performed from the end of the encoded data.
[0041]
(B) When an error is detected in the forward decoding process, the forward decoding process is stopped, and the backward decoding process is performed from the end of the encoded data.
[0042]
(C) When an error is detected in the forward decoding process, the forward decoding process is restarted from a position separated by an arbitrary distance from the error position.
[0043]
(D) When an error is detected in the forward decoding process, the backward decoding process is performed from a position that is an arbitrary distance away from the error position to the error position.
[0044]
(E) In the forward decoding process, the backward decoding process is performed only when an error is detected at the end of the encoded data.
[0045]
This second variable length decoding device may also have a decoded value determining means for determining a decoded value from the decoding results of the forward decoding means and the backward decoding means.
[0046]
In the second variable length decoding device, when the decoding process is performed by the bidirectional decoding means having the error detection function of the code word of the variable length code, the encoding is performed according to the error detection result in the forward decoding process. By switching the data decoding process, it is possible to share the decoding processing means in the forward direction and the reverse direction, so that the reversible output from the variable length coding apparatus as described above can be performed without significantly increasing the circuit scale and the amount of calculation. It is possible to effectively decode the code against a transmission path error.
[0047]
A third variable length decoding apparatus according to the present invention is a variable length decoding apparatus corresponding to the third variable length encoding apparatus, and includes a codeword including a codeword that can be decoded both in the forward direction and in the reverse direction. In a variable-length decoding device that decodes encoded data that is created by a codeword corresponding to hierarchical information symbols and multiplexed, for each predetermined synchronization interval, Separating means for separating the encoded data into hierarchies, a synchronization section detecting means for detecting a synchronization section of the encoded data separated by the separating means, and a synchronization section detected by the synchronization section detecting means Forward decoding means for decoding the encoded data from the forward direction, reverse decoding means for decoding the encoded data of the synchronization interval detected by the synchronization interval detection means from the reverse direction, these forward decoding means, and And having a synthesizing means for synthesizing the decoding results obtained for each hierarchy by the direction decoding means.
[0048]
This third variable length decoding device may also have a decoded value determining means for determining a decoded value from the decoding results of the forward decoding means and the backward decoding means.
[0049]
By using this third variable length decoding apparatus together with the third variable length encoding apparatus, it is possible to decode in the forward direction and the reverse direction regardless of the syntax of the information symbol, and is more resistant to errors. A variable-length encoding / decoding device can be realized.
[0050]
Further, in the recording medium on which variable length encoded data that can be input / output by the first variable encoding / decoding device according to the present invention is recorded, it can be decoded both in the forward direction and in the reverse direction. Coded data including a codeword configured so that a delimiter of a codeword can be recognized by a predetermined weight, and data obtained by inserting a stuffing code that can be decoded in the reverse direction for each predetermined synchronization interval into the coded data. It is characterized by being recorded and readable.
[0051]
Furthermore, in a recording medium recording transform coefficient data that can be generated by performing orthogonal transform in units of blocks in an image encoding / decoding device to which the variable length encoding / decoding device according to the present invention is applied,
The transform coefficient data includes orthogonal transform coefficients other than the last of the block after a plurality of codes that can be decoded in both the forward and reverse directions for each of a plurality of coding modes of the image encoding / decoding device. Of these, the data corresponding to the one with the highest appearance frequency and the plurality of encoding modes of the image encoding / decoding device are provided in common and can be decoded both in the forward direction and in the reverse direction. In the fixed orthogonal codes, the data corresponding to the most frequently occurring one of the last orthogonal transform coefficients of the block and the transform coefficient data having a low appearance frequency are described in a fixed-length code. It is readable by recording data with a codeword that can be decoded in the forward or backward direction at the end and data in which a stuffing code that can be decoded in the reverse direction is inserted into the encoded data for each predetermined synchronization section. That thing And it features.
[0052]
In addition, a recording medium on which variable length encoded data that can be input / output by the variable encoding / decoding device according to the present invention can be decoded both in the forward direction and in the reverse direction. Recorded encoded data including codewords configured to recognize codeword breaks by weights, and data in which stuffing codes that can be decoded in the reverse direction are inserted into the encoded data for each predetermined synchronization interval. It is characterized by doing.
[0053]
Furthermore, in the recording medium on which transform coefficient data that can be generated by performing orthogonal transform in units of blocks in the image encoding / decoding apparatus according to the present invention is recorded, the transform coefficient data is included in the image encoding / decoding apparatus. A plurality of codewords that can be decoded in both the forward and backward directions for each of a plurality of encoding modes, respectively, corresponding to a high-frequency occurrence of orthogonal transform coefficients other than the last block A plurality of codewords that are provided in common for a plurality of encoding modes of the image encoding / decoding device and can be decoded in both forward and backward directions, among the last orthogonal transform coefficients of the block Describe the data corresponding to those with high appearance frequency and transform coefficient data with low appearance frequency with fixed-length codes, and add codewords that can be decoded in the forward and backward directions at the beginning and end Day When, it is characterized in that for recording, and data Suffingu inserting the code decodable in the opposite direction for each predetermined synchronization interval on the coded data.
[0054]
Also, a variable-length coding apparatus that assigns a code word having a code length corresponding to the occurrence probability of the information symbol to a plurality of information symbols, and outputs a code word corresponding to the input information symbol as coded data The recording medium on which the program used in the above is recorded is capable of decoding both in the forward direction and in the reverse direction, and includes a plurality of codewords configured so that the codeword breaks can be recognized by the predetermined weight of the codeword A code word table in which each code word is associated with an information symbol, a procedure for selecting a code word corresponding to the input information symbol from the code word table, and a procedure for selecting the code word Creating encoded data for each predetermined synchronization interval using the selected codeword and inserting a stuffing code that can be decoded in the reverse direction Ri is characterized by recording at least including programs, and procedures for setting the synchronization period to the codeword.
[0055]
Furthermore, the encoded data is composed of a variable-length code composed of codewords including codewords that can be decoded both in the forward direction and in the reverse direction, and a stuffing code that can be decoded in the reverse direction is inserted for each predetermined synchronization interval. A recording medium on which a program used in a variable-length decoding device that decodes is recorded is a procedure for detecting a synchronization interval of the encoded data, and decodes encoded data of the synchronization interval detected by the procedure from the forward direction. A program including at least a procedure and a procedure for decoding encoded data of the synchronization section detected by the procedure of detecting the synchronization section from the reverse direction is recorded.
[0056]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0057]
(First embodiment)
FIG. 1 is a block diagram showing a configuration of a variable length encoding / decoding device according to a first embodiment of the present invention.
[0058]
The variable-length encoding / decoding apparatus according to the first embodiment is roughly composed of a codeword table creation unit 101, an encoding unit 113, a transmission system or storage system 105, and a decoding unit 114. First, the functions of these units will be briefly described. The codeword table creation unit 101 creates a codeword table based on the occurrence probability of information symbols, and the codeword table 102 in the coding unit 113 and the decoding unit 114. Codewords are sent to the forward codeword table 111 and the backward codeword table 112.
[0059]
Encoding section 113 encodes the information symbol into a variable length code, and outputs the variable length code as encoded data to transmission system or storage system 105. Decoding section 114 decodes the encoded data input via transmission system or storage system 105 to reproduce the original information symbol.
[0060]
Next, the detailed configuration and operation of each part of the first embodiment will be described.
[0061]
In the encoding unit 113, the input information symbol is input to the encoder 103. The encoding unit 113 includes a codeword table 102, an encoder 103, and a synchronization interval setting unit 104. The codeword table 102 stores information symbols created in advance by the codeword table creation unit 101 in correspondence with codewords of variable length codes. The encoder 103 selects and outputs a code word corresponding to the input information symbol from the code words stored in the code word table 102. The synchronization interval setting unit 104 collects the codewords selected by the encoder 103 for each synchronization interval, and further inserts a stuffing code that can be decoded in both the forward and backward directions, and generates encoded data for each synchronization interval. Output. This encoded data is sent to the decoding unit 114 through the transmission system or the storage system 105.
[0062]
The decoding unit 114 includes a synchronization interval detection unit 106, a buffer 107, a forward decoder 108, a backward decoder 109, a decoded value determination unit 110, a forward decoding table 111, and a backward decoding table 112. Composed. In the decoding unit 114, the synchronization interval of the encoded data is detected by the synchronization interval detection unit 106 from the encoded data input from the transmission system or the storage system 105, and the encoded data is stored in the buffer 107. The forward decoder 108 starts decoding from the beginning of the encoded data stored in the buffer 107. The backward decoder 109 starts decoding from the end of the encoded data stored in the buffer 107.
[0063]
The forward decoder 108 detects an error when a bit pattern that does not exist in the forward codeword table 111 appears in the encoded data, or when encoded data having a bit number different from the bit number of the buffer 107 is decoded. Is determined. Similarly, in the reverse decoder 109, when a bit pattern that does not exist in the reverse codeword table 112 appears in the encoded data, and when encoded data having a bit number different from the bit number of the buffer 107 is decoded, Judged as error detection.
[0064]
The decoded value determination unit 110 obtains a decoded value from the decoding result (referred to as the forward decoding result) obtained by the forward decoder 108 and the decoding result (referred to as the backward decoder) obtained from the backward decoder 109. And the final decoding result is output. FIG. 2 is a block diagram showing the configuration of the codeword table creation unit 101. The code selection unit 21 receives information on the occurrence probability of an information symbol, selects a code system having the smallest average code length from selectable code systems, and sends the selection result to the codeword configuration unit 22. The code word configuration unit 22 configures the code word of the code selected by the code word selection unit 21.
[0065]
The codeword configured by the codeword configuration unit 22 is a variable-length code (hereinafter, reversible code) that can be decoded both in the forward direction and in the reverse direction so that the code delimiter can be identified by a predetermined weight of the codeword. For example, these are the codes described in Japanese Patent Application No. 7-87772 and Japanese Patent Application No. 7-260383.
[0066]
In the first embodiment, the following method is used as a codeword construction method in the codeword construction unit 22 in order to deal with a wider probability distribution and increase the degree of freedom of the bit pattern of the codeword.
[0067]
FIG. 3 shows a first configuration method of the codeword of the reversible code in the codeword configuration unit 22. First, as shown on the left side of FIG. 3, two binary sequences (in this case, the weight is 0) in which the weight of each sequence (in this case, the number of “1”) is constant and has different weights in ascending order of the code length. And 1). Next, as shown in the center of FIG. 3, after adding “1” to the beginning and the end of each binary sequence to invert the bits of the binary sequence, these two binary sequences are converted into those shown in FIG. Synthesize as shown on the right.
[0068]
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. 3, if the first is “0”, the code delimiter (code length) is known when two “0” appear, and if the first is “1”, the code It has a code configuration that allows the delimiters to be identified. Further, in the variable length code shown in FIG. 3, the codewords corresponding to all the information symbols A to J are also decoded in the reverse direction of FIG. 4B 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 understood that decoding is possible in both the forward and backward directions.
[0069]
FIG. 5 shows a second configuration method of the codeword of the reversible code in the codeword configuration unit 22. First, as shown on the left side of FIG. 5, a first reversible code and a second reversible code are prepared. Next, as shown in the center of FIG. 5, the first one codeword of the second reversible code is added to the end of all the codewords of the first reversible code. Similarly, after adding all the codewords of the second reversible code one by one to the end of all the codewords of the first reversible code, rearrangement is performed as shown on the right side of FIG. A new reversible code is constructed. By such a configuration method, the number A × B obtained by multiplying the number A of codewords of the first reversible code (A = 9 in this example) by the number of codewords B of the second reversible code (B = 3 in this example). (27 in this example) new reversible codes can be constructed.
[0070]
In decoding the reversible code by this configuration method, when decoding from the forward direction, the first reversible code is first decoded, and then the second reversible code is decoded. When decoding from the reverse direction, first, the second reversible code is decoded, and then the first reversible code is decoded. Therefore, it can be understood that decoding is possible both in the forward direction and in the reverse direction.
[0071]
In this example, the second reversible code is added at the end of the codeword of the first reversible code. However, the second reversible code may be added at the beginning of the first reversible code. A fixed-length code may be added to both the end and the beginning of the reversible code. In this example, the first reversible code and the second reversible code are different, but the same may be used. Furthermore, in the present embodiment, variable-length codes are used for both the first reversible code and the second reversible code, but either of them may be changed to a fixed-length code.
[0072]
FIG. 6 shows a third code configuration method of the reversible code in the codeword configuration unit 21. First, as shown on the left side of FIG. 6, a variable-length reversible code and a fixed-length reversible code are prepared. Next, as shown on the right side of FIG. 6, a fixed-length reversible code is added immediately after each bit of the code word of the reversible code. With this configuration method, when a K-bit fixed-length reversible code is used, the number of codewords can be increased by 2KH by setting the H-bit codeword to (K + 1) H bits. In this example, a fixed-length code is added immediately after each bit of a reversible codeword. However, a fixed-length code may be added immediately before each bit, and a fixed-length code may be added immediately before and after each bit. May be added.
[0073]
Next, a specific example of a method for setting a synchronization interval of encoded data in the synchronization interval setting unit 104 will be described with reference to FIG. FIG. 7A shows a method for setting a synchronization interval by inserting a synchronization code. In this case, the synchronization interval detecting unit 106 can detect the synchronization interval by detecting the first and last synchronization codes of the encoded data. Here, in order to set the insertable position of the synchronization code in a certain section unit (in this case, M bit unit), a 1 to M bit stuffing code is inserted at the end of the encoded data.
[0074]
FIG. 7B shows a method of describing the code amount of the synchronization section at the head of the encoded data, in other words, a method of inserting a pointer indicating the end position of the synchronization section. In this case, the synchronization interval detection unit 106 can detect the synchronization interval by first decoding the description of the code amount of the first synchronization interval of the encoded data. Since the description unit of the code amount is an M-bit unit, a 1-M bit stuffing code is inserted at the end of the encoded data.
[0075]
Here, the stuffing code used in FIGS. 7A and 7B is characterized in that it can be decoded at least in the reverse direction. FIG. 8 is a diagram showing a specific example of such a stuffing code, and this stuffing code is configured to be decodable both in the forward direction and in the reverse direction. In the case of this stuffing code, decoding is possible in both the forward and backward directions, so that when 1 bit appears, if “1” appears, it is delimited, otherwise “0” appears twice. It is a variable length code that can be decoded in the reverse direction from the end of the synchronization interval, and at the same time, the number of bits of the encoded data can be calculated. The calculation result of the number of bits of the encoded data is used for error detection described later.
[0076]
In this example, the stuffing code is inserted at the end of the encoded data. However, the stuffing code may be at the beginning of the encoded data or inside the encoded data. Good. The stuffing code may be a code that can be decoded only in the reverse direction as shown in FIG. In the case of this code, the code is such that it is delimited when “0” appears after decoding from the reverse direction.
[0077]
Next, a decoded value determination method in the decoded value determination unit 110 will be described with reference to FIG. As shown in FIG. 10 (a), when the position of the decoded word (error detection position) where an error is detected in the forward decoding result and the backward decoding result does not intersect, only the decoding result in which no error is detected is obtained. Used as a decoded value, the decoding results at the two error detection positions are not used as decoded values but are discarded. Also, as shown in FIG. 10B, when the error detection position of the forward decoding result and the backward decoding result intersect, the decoding value up to the error detection position of the forward decoding result uses the forward decoding result. The subsequent part uses the backward decoding result as a decoded value.
[0078]
Note that the backward decoding result is given priority, the backward decoding result is used as the decoded value up to the error detection position of the backward decoding result, and the forward decoding result is used as the decoded value for the previous part. Good.
[0079]
Also, as shown in FIG. 10C, when an error is detected only in the one-way decoding result of the forward decoding result and the backward decoding result (in this example, only the forward decoding result is detected). The forward decoding result is used as the decoding value up to the error detection position, and the backward decoding result is used as the decoding value for the subsequent portions. Furthermore, as shown in FIG. 10 (d), when an error is detected in both the forward decoding result and the backward decoding result for the same codeword, the decoded value for the codeword at the error detection position is discarded, and The backward decoding result is used as a decoded value for the subsequent codeword. It should be noted that when a bit pattern that does not exist as a code word is generated in the error determination in the forward decoder 108 and the backward decoder 109, the detection position is the place, and no error is detected by the above determination method. In some cases, if the number of bits decoded does not match the number of bits of encoded data in the synchronization interval, the first position of decoding is set as the error detection position.
[0080]
In the first embodiment, one example of the decoded value determination method based on the patterns of the four error detection positions has been shown. However, the decoded value determination unit performs an error in one or both of the forward decoding result and the backward decoding result. If it is detected, the forward decoding result or the backward decoding result estimated to be correct is used, and any part that cannot be decoded by any decoding result is abandoned. Nor.
[0081]
(Second Embodiment)
Next, an application example of the variable-length encoding / decoding device according to the present invention will be described as a second embodiment of the present invention. FIG. 11 is a conceptual diagram of a moving image encoding / decoding system in which a variable length encoding / decoding device according to a second embodiment of the present invention is incorporated. First, in the moving image encoder 709, the data encoded by the information source encoder 702 is subjected to variable length encoding and multiplexing by the moving image multiplexer 703 and smoothed by the transmission buffer 704. After being converted, the data is sent to the transmission system or storage system 705 as encoded data. The encoding control unit 701 controls the information source encoder 702 and the moving picture multiplexer 703 in consideration of the buffer amount of the transmission buffer 704.
[0082]
On the other hand, in the video decoder 710, the encoded data from the transmission system or the storage system 705 is stored in the reception buffer 706, and the video data demultiplexer 707 demultiplexes the encoded data and performs variable length decoding. Is sent to the information source decoder 708 to finally decode the moving picture information. Here, the variable length coding / decoding apparatus described in the first embodiment is applied to the moving picture multiplexer 703 and the moving picture demultiplexing separator 707.
[0083]
FIG. 12 shows the syntax of the moving image encoding method in the moving image multiplexer 703 and the moving image demultiplexer / separator 707 in the second embodiment. Reversible code in the lower layer, with the macroblock mode information, motion vector information and INTRA DC (DC component of DCT coefficients in intra-frame coding) information as the upper layer, DCT coefficient information other than INTRA DC as the lower layer Has been applied.
[0084]
FIGS. 13A and 13B are block diagrams showing configurations of the moving image multiplexer 703 and the moving image demultiplexer / separator 707 in the second embodiment.
[0085]
In the moving picture multiplexer 703 shown in FIG. 13A, information such as macroblock mode information, motion vector information, and INTRA DC among the data encoded by the information source encoder 702 in FIG. Is an upper layer, normal variable length coding is performed by the upper layer variable length encoder 901, and sent to the multiplexer 903. Of the data encoded by the information source encoder 702, DCT coefficients other than INTRA DC are encoded by the reversible code in the lower layer variable length encoder 903 and sent to the multiplexer 903. The multiplexer 903 multiplexes the upper layer encoded data and the lower layer encoded data, and sends the multiplexed data to the transmission buffer 704.
[0086]
On the other hand, in the moving picture decoder 707 shown in FIG. 13 (b), the upper layer encoded data and the lower layer encoded data are separated by the demultiplexing unit 904, and these are separated into the upper layer variable length decoder. Variable length decoding is performed by 905 and lower layer variable length decoder 906, respectively.
[0087]
FIGS. 14 to 16, FIGS. 17 to 18, and 19 are examples of codeword tables used in the lower layer variable length encoder 902. The code stored in this codeword table is a code in which a 2-bit fixed-length code is added to the end of the code created by the first codeword construction method of the reversible code in the codeword construction unit 22 described above.
[0088]
The information source encoder 702 scans each block of the quantized 8 × 8 DCT coefficients for each block, and performs LAST (0: non-zero coefficient not at the end of block, 1: last non-zero coefficient at the block) ), RUN (number of zero runs up to non-zero coefficient) and LEVEL (quantized value of coefficient) are obtained and sent to the moving picture multiplexing unit 703.
[0089]
The lower layer variable length encoder 902 in the moving picture multiplexing unit 703 is reversible to non-last coefficients, RUN, and LEVEL of INTRA (intraframe coding) and INTER (interframe coding) shown in FIGS. Code word table of non-LAST coefficients corresponding to code word (VLC_CODE) of code and reversible code code word (VLC_CODE) to INTRA and INTER LAST coefficients, RUN, and LEVEL shown in FIGS. It has a codeword table of the last coefficients that have been made.
[0090]
Based on the mode information, encoding is performed by selecting a codeword table of INTRA non-LAST coefficients and LAST coefficients for INTRA, and a codeword table of INTER non-LAST coefficients and LAST coefficients for INTER. “S” in the last bit of the code word represents the sign of LEVEL. When “s” is “0”, the sign of LEVEL is positive, and when “s” is “1”, the sign of LEVEL is negative. .
[0091]
As shown in FIG. 20, the coefficient that does not exist in this codeword table is a fixed length encoding of 1 bit of whether or not the LAST coefficient and the absolute value of RUN and LEVEL, and two escape codes at the head of this fixed length code part. Among them, “00001” is added, and an escape code is also added to the end. FIG. 19 is a codeword table of escape codes, where “s” of the last bit of VLC_CODE used as an escape (ESCAPE) code represents the code of LEVEL, and when “s” is “0”, LEVEL is positive, If “1”, LEVEL is negative.
[0092]
FIG. 21 shows a case where the zero run is maximized when this codeword table is used. Normally, a bit pattern that adds “1” after a zero run is selected as the synchronization code is selected. For example, ITU-TH. In H.263, a bit pattern in which “1” is added after 16 “0” is a synchronization code. In variable length coding of DCT coefficients, the zero run is maximized when the coefficient using the escape code is LEVEL is +64, and the next code using the escape code appears again, and 15 “0” s are consecutive. It is the greatest to do. Therefore, if a bit pattern having 16 consecutive “0” s is used as a synchronization code, there is no possibility that a pseudo synchronization code is generated.
[0093]
In the decoded value determination unit 110, a decoded value is obtained from the decoding result (referred to as the forward decoding result) obtained by the forward decoder 108 and the decoding result (referred to as the backward decoding result) obtained from the backward decoder 109. And the final decoding result is output.
[0094]
In the error determination in the forward decoder 108 and the backward decoder 109, when a bit pattern that does not exist as a code word is generated, and when an error is detected by a check bit or the like, the detection position is set as the location, If no error is detected by this determination method and the number of decoded bits does not match the number of bits of encoded data in the synchronization interval, the first position of decoding is set as the error detection position.
[0095]
FIG. 22 shows a decoded value determination method for the lower layer. First, as shown in FIG. 22A, no error is detected when the position (error detection position) of the macroblock (MB) where an error is detected does not intersect between the forward decoding result and the backward decoding result. Only the decoding result of the macroblock is used as a decoding value, the decoding result of the two error detection positions is not used as a decoding value, and the INTRA macroblock (intraframe coding is used based on the decoding result of the higher layer mode information. The decoding result of the higher layer is rewritten so that the previous frame is displayed as it is for the macroblock), and the motion compensation is displayed only for the INTER macroblock (macroblock that has been interframe coded) from the previous frame. .
[0096]
Also, as shown in FIG. 22B, when the error detection positions of the forward decoding result and the backward decoding result intersect, the decoded values up to the macroblock in which the error is detected in the forward decoding result are The forward decoding result is used, and the subsequent decoding result is used as the decoded value for the subsequent portions. In addition, the backward decoding result is prioritized, and the decoding value up to the macroblock in which an error is detected in the backward decoding result uses the backward decoding result, and the previous part decodes the forward decoding result. It may be used as a value.
[0097]
Further, as shown in FIG. 22C, when an error is detected only in the one-way decoding result of the forward decoding result and the backward decoding result (in this example, only the forward decoding result is detected). The decoding value for the macroblock after the error detection position uses the decoding result in the reverse direction. Furthermore, as shown in FIG. 22 (d), when an error is detected in both the forward decoding result and the backward decoding result in the same macroblock, the decoded value of the macroblock at the error detection position is discarded, Instead of using it as a decoded value, based on the decoding result of the higher layer mode information, the previous frame is displayed as it is for the INTRA macroblock, and the motion compensation from the previous frame is displayed only for the INTER macroblock. Furthermore, the decoding result of the upper layer is rewritten, and the decoding value for the subsequent macroblock uses the decoding result in the reverse direction.
[0098]
In the decoded value determination method of FIG. 22, the decoded value is determined in units of macroblocks, but may be determined in units of blocks or codewords. In the second embodiment, the present invention is applied to variable length coding of DCT coefficients. However, it goes without saying that other variable information symbols can be applied to variable length coding.
[0099]
(Third embodiment)
Next, a variable-length encoding / decoding device according to the third embodiment of the present invention will be described with reference to FIG.
[0100]
The variable length coding / decoding apparatus according to the third embodiment is roughly composed of a codeword table creation unit 101, a coding unit 113, a transmission system or storage system 105, and a decoding unit 121. First, the functions of these units will be briefly described. The codeword table creation unit 101 creates a codeword table based on the occurrence probability of information symbols, and the codeword table 102 in the coding unit 113 and the decoding unit 121. Codewords are sent to the forward codeword table 111 and the backward codeword table 112. Encoding section 113 encodes the information symbol into a variable length code, and outputs the variable length code as encoded data to transmission system or storage system 104. Decoding section 121 decodes encoded data input via transmission system or storage system 105 to reproduce the original information symbol.
[0101]
Next, the detailed configuration and operation of each part of the third embodiment will be described. The encoding unit 113 is the same as that of the first embodiment shown in FIG. That is, in the encoding unit 113, the input information symbol is input to the encoder 103. The codeword table 102 stores information symbols created in advance by the codeword table creation unit 101 in correspondence with codewords of variable length codes. The encoder 103 selects a code word corresponding to the input information symbol from the code words stored in the code word table 102. The synchronization interval setting unit 104 collects the codewords selected by the encoder 103 for each synchronization interval, and further inserts a stuffing code that can be decoded in both the forward and backward directions, and generates encoded data for each synchronization interval. Output. This encoded data is sent to the decoding unit 121 through the transmission system or the storage system 104.
[0102]
The decoding unit 121 includes a synchronization interval detection unit 106, a buffer 107, an encoded data switch 122, a decoder 124, a codeword table switch 125, a decoded value determination unit 110, a forward decoding table 111, and a backward decoding. The configuration table 112 is configured. The encoded data switch 122 and the codeword table switch 125 are switched under the control of the decoder 124.
[0103]
The decoding unit 121 inputs the encoded data to the decoder 124 while the synchronization interval detecting unit 106 checks the synchronization interval of the encoded data from the encoded data input from the transmission system or the storage system 105. At that time, the encoded data is also accumulated in the buffer 107. The decoder 124 starts decoding the input encoded data (referred to as forward decoding). Here, the decoder 124 detects an error when a bit pattern that does not exist in the forward codeword table 111 appears in the encoded data, or when encoded data having a bit number different from the bit number of the buffer 107 is decoded. Is determined.
[0104]
When it is determined that an error has been detected, the decoder 124 switches the codeword table from the forward codeword table 111 to the backward codeword table 112 by the codeword table switch 123 and simultaneously decodes by the encoded data switch 122. The input to the generator 124 is switched to the buffer 107 side. When the synchronization period detection unit 106 detects the next synchronization, the buffer 107 reads the accumulated encoded data from the end and outputs it to the decoder 124. The decoder 124 starts decoding the input encoded data (referred to as backward decoding). Here, similarly to the forward decoding, the decoder 124 encodes encoded data having a bit number different from the bit number of the buffer 107 when a bit pattern that does not exist in the backward codeword table 112 appears in the encoded data. Is decoded, it is determined that an error has been detected. The decoded value determination unit 110 determines a decoded value from a decoding result (referred to as a forward decoding result) obtained by forward decoding and a decoding result (referred to as a backward decoding result) obtained from backward decoding, The final decoding result is output.
[0105]
The code word table creation unit 101 in the third embodiment is basically the same as that in the first embodiment. As shown in FIG. 2, a code that can be selected by inputting information on the occurrence probability of an information symbol. A code selection unit 21 that selects the smallest average code length from the system and a codeword configuration unit 22 that configures a codeword of the code selected by the codeword selection unit 21 are included. However, in the present embodiment, the following method is used as a codeword construction method in the codeword construction unit 22 in order to deal with a wider probability distribution and increase the degree of freedom of the codeword bit pattern.
[0106]
FIG. 24 shows a first configuration method of a codeword of a reversible code in the codeword configuration unit 22. First, as shown on the left side of FIG. 24, a first reversible code is prepared. Next, as shown in the center of FIG. 24, for each codeword of the first reversible code, a (code length-1) -bit fixed length code surrounded by a broken line is prepared, and the right side of FIG. As shown in FIG. 5, a fixed-length code word is inserted bit by bit so as to be surrounded by a broken line between each bit of the first reversible code word. It can be seen that the variable-length code in FIG. 24 can be decoded in both the forward and reverse directions by decoding the fixed-length code for each bit while decoding the first reversible code. In the example of FIG. 24, one bit of a fixed-length code word is inserted between each bit of the code word of the first reversible code, but for each code word of the first reversible code, (code A fixed-length code of length-1) × n bits may be prepared, and a fixed-length code word may be added n bits between bits of the first reversible code.
[0107]
FIG. 25 illustrates a second configuration method of the codeword of the reversible code in the codeword configuration unit 22. As shown on the left side of FIG. 25, a first reversible code is prepared. Next, a second reversible code is prepared as shown surrounded by a broken line on the upper side of FIG. 25, and a broken line is inserted between each bit of the code word of the first reversible code as shown on the right side of FIG. A second reversible code is inserted as enclosed. It can be seen that the variable-length code in FIG. 25 can be decoded in both the forward and reverse directions by decoding the second reversible code for each bit while decoding the first reversible code. In the example of FIG. 25, the first reversible code and the second reversible code are shown as the same code, but different codes may be used.
[0108]
In the third embodiment, as shown in FIG. 26, a bidirectional codeword table 51 in which the forward codeword table 111 and the backward codeword table 112 in FIG. 23 are shared may be used. In this case, an identification signal 53 indicating the distinction between forward decoding and backward decoding is input from the decoder 124 in FIG. 23, and the address converter 52 is operated by this identification signal 53 to generate a bidirectional codeword. An address for reading the code word from the table 51 is generated. Then, the code value corresponding to this address is read from the bidirectional codeword table 51.
[0109]
In the third embodiment, an error detection function is added to the decoder 124 as shown in FIG. The error detection unit 62 connected to the decoder 61 monitors the internal state of the decoder 61, and outputs an error detection signal when this becomes abnormal. An abnormal internal state refers to the following state, for example.
[0110]
(1) When encoded data that does not exist in the codeword table is received.
[0111]
(2) When the length of the encoded data does not match the length of the data actually decoded by the decoder 61.
[0112]
(3) A decoded value can be obtained because a value exists in the codeword table, but the value is inappropriate. Specific examples of (3) include (3-1) when the decoded value exceeds the existing range, (3-2) when the number of data exceeds the upper limit, and (3-3) decoded before For example, a decoded value that does not match the decoded value is output.
[0113]
(4) When an error is detected by an error detection code or the like.
[0114]
Next, the decoding method in this 3rd Embodiment is demonstrated using FIG. In the above description, the forward and backward decoding processes in the decoder 124 are performed simultaneously in both the forward and backward directions as shown in FIG. 28 (a), and each detects an error. Until then, decryption was executed to obtain a decrypted value. The present embodiment is not limited to this, and decoding may be performed by a method as shown in FIGS. In FIGS. 28 (a), (b), (c), and (d), X represents an error detection point, an arrow pointing to the right side represents a forward decoding process, and an arrow shown on the left side represents a backward decoding process. Show.
[0115]
In the method shown in FIG. 28 (b), when a forward decoding process is performed and an error is detected, the forward decoding process is stopped and an error is detected in the backward direction from the end of the encoded data in the synchronization interval. Decoding processing is performed until is detected. In the method shown in FIG. 28C, when an error is detected in the forward decoding process, the forward decoding process is restarted from n bits ahead of the error detection position. This process is repeated until all the encoded data in the current synchronization interval is processed. At the end of the decoding process in the forward direction, if the number of encoded data in the synchronization interval does not match the number of data decoded by the decoding process, it is regarded as error detection, and the decoding process in the reverse direction from the end of the encoded data is performed. Repeat until an error is found. In the method shown in FIG. 28D, when an error is detected in the forward decoding process, the decoding process is performed once for n bits in the reverse direction from the n-bit ahead of the error detection position. Thereafter, the forward decoding process is performed from n bits ahead of the error detection position (the position where the backward decoding process is started). This process is repeated until all the encoded data in the current synchronization interval is processed. Finally, if the number of encoded data in the synchronization interval and the number of data decoded by the decoding process do not match, it is regarded as error detection, and the reverse decoding process is performed from the end of the encoded data until an error is found. . Next, the determination method of the decoded value in the decoded value determination part 111 in this 3rd Embodiment is demonstrated using FIG. It should be noted that the following method can also be used to select a decoded value to be finally used by the decoded value determination unit 111. The decoded value determination method shown in FIG. 29A is a method in which when an error is detected, decoding is not performed thereafter. That is, when an error is detected, subsequent decoding may be erroneously decoded. Therefore, a decoded value that may cause such erroneous decoding is not used, and only the decoded value up to the error detection position is used. Use.
[0116]
The decoded value determination method shown in FIG. 29B is a method in which decoding is continued as much as possible even if an error is detected, and all available decoded values are used. A variable-length code includes a code having a feature that synchronization is automatically recovered when decoding is continued even when synchronization is lost. This is called self-synchronization recovery. In the case of a codeword having high self-synchronization recovery capability, a correct decoded value can be obtained by continuing decoding as shown in FIG. 29B without stopping the decoding process after error detection as shown in FIG. 29A. You can get more. In this case, however, there is a possibility that the decoded value includes a value decoded in error. In a system that allows such a possibility of erroneous decoding, it is possible to use the decoded value determination method of FIG.
[0117]
(Fourth embodiment)
Next, a variable-length encoding / decoding device according to the fourth embodiment of the present invention will be described with reference to FIG.
[0118]
The variable length coding / decoding apparatus according to the fourth embodiment is roughly composed of a codeword table creation unit 201, a coding unit 213, a transmission system or storage system 205, and a decoding unit 214. First, the functions of these units will be briefly described. The codeword table creation unit 201 creates a codeword table based on the occurrence probability of information symbols, and the codeword table in the coding unit 213 and the codeword table in the decoding unit 214. Codewords are sent to the forward codeword table and the reverse codeword table.
[0119]
The encoding unit 213 hierarchizes the information symbol given as input data, encodes it into variable length codes for each layer, multiplexes these variable length codes, and outputs them as encoded data to the transmission system or storage system 205 To do. The decoding unit 214 multiplexes and separates the encoded data input via the transmission system or the storage system 205, performs variable length decoding for each layer, and synthesizes the decoding results for each layer to restore the original information Play the symbol and output the playback data.
[0120]
Next, the detailed configuration and operation of each part of the fourth embodiment will be described. In the encoding unit 213, the information symbols that are input data are separated into layers of 1 to n (n is a natural number of 2 or more) according to the importance by the data layering unit 202. The separated information symbols of each layer i (i = 1, 2,..., N) are input to the variable length encoding unit 203-i prepared for each layer i and encoded. The encoded data of each layer i obtained by the variable length encoding unit 203-i is multiplexed by the multiplexing unit 204 and sent to the decoding unit 214 through the transmission system or the storage system 205.
[0121]
In the decoding unit 214, the encoded data input from the transmission system or the storage system 205 is separated into encoded data of each layer i by the multiplexing / separating unit 206. The separated encoded data of each layer is input to the variable length decoding unit 207-i prepared for each layer i and decoded. The decoding results of each layer i obtained by the variable length decoding unit 207-i are combined by the data combining unit 208 and output as reproduction data.
[0122]
The configuration of the codeword table creation unit 201 is the same as that of the codeword table creation unit 101 shown in FIG. 2 used in the first embodiment, and a code system that can be selected based on information on the occurrence probability of information symbols. The code having the smallest average code length is selected from among the codes, and the code word of the selected code is configured. The code word is a variable-length code (reversible code) that can be decoded both in the forward direction and in the reverse direction so that the code break can be recognized by a predetermined weight of the code word.
[0123]
Next, the configuration of the variable length encoding unit 203-i of each hierarchy i in FIG. 30 is as shown in FIG. 31, and the codeword table 102 and the code are similar to the encoding unit 113 shown in FIG. And the synchronization interval setting unit 104. That is, the information symbol input from the data hierarchization unit 202 in FIG. 30 is input to the encoder 103. The codeword table 102 stores information symbols created in advance by the codeword table creation unit 201 in FIG. 30 and codewords of variable length codes in association with each other.
[0124]
The encoder 103 selects and outputs a codeword corresponding to the information symbol input from the data hierarchization unit 202 from the codewords stored in the codeword table 102. The synchronization interval setting unit 104 collects the codewords selected by the encoder 103 for each synchronization interval, and further inserts a stuffing code that can be decoded in the forward direction or the reverse direction as necessary. Output encoded data. This encoded data is sent to the multiplexing unit 204 in FIG.
[0125]
On the other hand, the configuration of the variable length decoding unit 207-i of each hierarchy i in FIG. 30 is as shown in FIG. 32, and, similar to the decoding unit 114 shown in FIG. 107, a forward decoder 108, a backward decoder 109, a decoded value determination unit 110, a forward decoding table 111, and a backward decoding table 112. That is, in the variable length decoding unit 207-i, the synchronization interval detection unit 106 detects the synchronization interval of the encoded data from the encoded data input from the transmission system or the storage system 205, and the encoded data is stored in the buffer 107. accumulate. The forward decoder 108 starts decoding from the beginning of the encoded data stored in the buffer 107. The backward decoder 109 starts decoding from the end of the encoded data stored in the buffer 107.
[0126]
The forward decoder 108 detects an error when a bit pattern that does not exist in the forward codeword table 111 appears in the encoded data, or when encoded data having a bit number different from the bit number of the buffer 107 is decoded. Is determined. Similarly, in the reverse decoder 109, when a bit pattern that does not exist in the reverse codeword table 112 appears in the encoded data, and when encoded data having a bit number different from the bit number of the buffer 107 is decoded, Judged as error detection. The decoded value determination unit 110 determines a decoded value from the decoding result (forward decoding result) obtained by the forward decoder 108 and the decoding result (reverse decoded value) obtained by the backward decoder 109. The final decoding result is output. The decoding result of each layer i is sent to the data synthesis unit 208.
[0127]
FIG. 33 shows an example of data hierarchization in the data hierarchization unit 202 and multiplexing in the multiplexing unit 204. If there is syntax input data (information symbol string) that can be divided into n hierarchies as shown in FIG. 33 (a), the data hierarchizing unit 202 sets each hierarchy i as shown in FIG. 33 (b). The syntax is changed so that the input data is repeated, and data hierarchization is performed, and information symbols for each hierarchy i are sent to the variable length coding unit 203-i. In the multiplexing unit 204, as shown in FIG. 33 (c), encoded data in which a variable length encoding unit 203-i performs variable length encoding for each layer i and a synchronization interval is set by adding the synchronization code i. Are multiplexed and output.
[0128]
FIG. 34 shows an example of a decoded value determination method in the decoded value determination unit 110 in FIG. The variable length decoding unit 207-i for each layer i performs bi-directional decoding. If there is an error in the encoded data input to the variable length decoding unit of a certain layer, the influence affects the decoded values of the higher layer and the lower layer. The decoded value determination unit 110 in the variable length decoding unit 207-i exchanges information to determine the final decoded value.
[0129]
In the example of FIG. 34, if there is an error in the upper layer and there is a portion that cannot be decoded, a portion that cannot be decoded by the lower layer encoded data associated therewith is formed. Also, if there is an error in the lower layer encoded data and there is a portion that cannot be decoded, the decoded value of the upper layer encoded data corresponding thereto is changed. FIG. 34 is merely an example of the decoded value determination method, and the decoded value determination unit 110 in the variable length decoding unit 207-i of each layer i uses the decoding results of the upper layer and the lower layer to perform forward decoding. If an error is detected in at least one of the result and the backward decoding result, the decoding result of the forward decoding result and the backward decoding result which is estimated to be correct is used, and the forward decoding and the backward decoding are performed. Needless to say, any method may be used for the portion that could not be decoded as long as the decoding result is abandoned. In the fourth embodiment, the reversible code is used in both the forward and backward directions in all layers. However, the reversible code may be used in only some layers.
[0130]
(Fifth embodiment)
Next, the variable length encoding / decoding device described in the fourth embodiment is applied to the moving image multiplexing unit 703 and the moving image demultiplexing unit 707 of the moving image encoding / decoding system shown in FIG. A fifth embodiment will be described. In this case, the basic configuration and operation of the moving image encoding / decoding system are the same as those in the second embodiment, and variable length encoding and variable in the moving image multiplexing unit 703 and the moving image demultiplexing unit 707 are performed. The difference is that the long decoding process is performed for each layer.
[0131]
FIG. 35, FIG. 36, FIG. 37, and FIG. 38 show various examples of the syntax of the moving picture encoding method in the moving picture multiplexing unit 703 in the fifth embodiment. First, the syntax shown in FIG. 35 will be described. In this syntax, input information symbols that are encoded data are hierarchized into two layers, an upper layer and a lower layer, and a synchronization section is set for each by using synchronization codes RM and MM. ST at the end of the lower layer syntax is a stuffing code that can be decoded in the reverse direction as shown in FIG.
[0132]
As shown in FIG. 35 (a), the upper layer includes header information, an encoding mode for each macroblock, information on whether to encode each block, and the value of INTRA DC as mode information. These are described in variable-length codes that can be normally decoded in the forward direction, and then the motion vector information is variable-length encoded into a reversible code using the encoding tables shown in FIGS. 39 to 46, “VECTOR DIFFERENCES” represents a motion vector prediction value (difference value), “BIT NUMBER” represents a variable length code length, and “VLC CODE” represents a variable length code. .
[0133]
Here, the motion vector is obtained by one-dimensional prediction as shown in FIG. 47, and the predicted value is represented by a difference value. The motion vector prediction direction is indicated by an arrow in FIG. As shown in FIG. 47, there is one motion vector in a macro block (indicated by a large square in FIG. 47) and one motion vector for each luminance block (indicated by a small square in FIG. 47). There are cases where there are four, but one-dimensional prediction is performed for these, and the predicted values are described in variable-length codes in accordance with the encoding tables shown in FIGS. For motion vectors that cannot be obtained by prediction, the values of the motion vectors themselves are described by variable length codes according to the encoding tables shown in FIGS. The motion vector information at the end of FIG. 35A corresponds to this. On the other hand, the lower layer is DCT coefficient information excluding INTRA DC as shown in FIG. 35B, and is described by, for example, the reversible code described in FIGS. 14 to 20 and Japanese Patent Application No. 7-260383.
[0134]
Next, the syntax shown in FIG. 36 will be described. In this syntax, as shown in FIG. 36 (a), the upper layer is a variable that enables normal forward decoding by consolidating header information and mode information 1 representing the number of motion vectors for each macro coding at the head side. A long code is described, followed by a variable length code for motion vector information. The variable length code of the motion vector information is the same as the syntax of FIG. In the lower layer, as shown in FIG. 36 (b), mode information 2 indicating whether or not there is a DCT coefficient of each block and the INTRA DC are consolidated at the head side, and these can be variable-length capable of normal forward decoding. After that, the DCT coefficient information excluding INTRA DC is described in a reversible code as in the syntax of FIG.
[0135]
Next, the syntax shown in FIG. 37 will be described. In this syntax, only variable length codes that can be forward decoded are used in the upper layer. That is, as shown in FIG. 37 (a), the upper layer describes header information, mode information, and motion vector information with variable-length codes that can be forward decoded, and the lower layer as shown in FIG. 37 (b). The DCT coefficient information is described by a reversible code as in the syntax of FIG.
[0136]
The syntax shown in FIG. 38 also uses only variable length codes that can be forward decoded in the upper layer. That is, as shown in FIG. 38A, the upper layer describes header information, mode information 1 representing the number of motion vectors for each macro coding, and motion vector information in a variable length code that can be forward decoded. As shown in FIG. 38 (b), the lower layer is a variable length in which mode information 2 indicating whether or not there is a DCT coefficient of each block and INTRA DC are consolidated at the head, and these can be subjected to normal forward decoding. After that, the DCT coefficient information other than INTRA DC is described in a reversible code as in the syntax of FIG.
[0137]
The basic configuration of the moving picture multiplexing unit 703 and moving picture multiplexing / separating unit 707 in the fifth embodiment is as shown in FIGS. 13A and 13B, but the upper layer variable length encoder 901, the lower layer variable. The configurations of the long encoder 903, the upper layer variable length decoder 905, and the lower layer variable length decoder 906 are different from those of the second embodiment. That is, of the data encoded by the information source encoder 702, for example, upper layer data indicated by the syntax in FIG. 35A or FIG. 36A is variable by the upper layer variable length encoder 901. Long-coded and sent to the multiplexing unit 903. In addition, among the data encoded by the information source encoder 702, the lower-layer data indicated by the syntax in FIG. 35B or FIG. 36B is variable-length encoded by the variable-length encoder 903. And sent to the multiplexing unit 903. The multiplexing unit 903 multiplexes the upper layer encoded data and the lower layer encoded data, and sends the multiplexed data to the transmission buffer 704.
[0138]
In the fifth embodiment, the decoded value judgment unit 110 shown in FIG. 32 in the upper layer variable length decoder 905 and the lower layer variable length decoder 906 is obtained by the forward decoder 108. The decoding value is determined from the forward decoding result, and the final decoding result is output. The error determination in the forward decoder 108 and the backward decoder 109 of each layer is performed when a bit pattern that does not exist as a code word appears, and when an error is detected by a check bit or the like, the detection position is If no error is detected by the above-described determination method and the number of bits decoded does not match the number of bits of encoded data in the synchronization interval, the first position of decoding is set as the error detection position.
[0139]
Next, a decoded value determination method in the fifth embodiment will be described. FIG. 48 illustrates a decoded value determination method when the syntax of the video encoding scheme in the video multiplexing unit 703 is the syntax illustrated in FIG. In the syntax of FIG. 35, since reversible codes are used for motion vector information in the upper layer and DCT coefficient information in the lower layer, bidirectional decoding is possible in both the upper layer and the lower layer.
[0140]
In the upper layer, first, header information and mode information are decoded. When an error is found in the header information and the mode information and all cannot be decoded, the decoded values of the macroblocks in the synchronization section where the error has occurred are all Not Coded, and the previous screen is displayed as it is. If all the header information and mode information can be decoded, then the motion vector information is bidirectionally decoded. The portion that cannot be decoded with the motion vector information is also set as Not Coded. In the lower layer, the DCT coefficient information of the lower layer is used only for the macroblock that has been decoded to the motion vector. A macroblock in which DCT coefficient information is discarded due to an error is assumed to be Not Coded.
[0141]
FIG. 49 illustrates a decoded value determination method in the case where the moving image encoding scheme of the moving image multiplexing unit 703 has the syntax shown in FIG. According to the syntax shown in FIG. 36, header information and mode information 1 are first decoded in the upper layer. If an error is found in the header information or mode information 1 and all cannot be decoded, the decoded values of the macroblocks in the synchronization section where the error has occurred are all Not Coded, and the previous screen is displayed as it is. If the header information and the mode information 1 are all decoded, then the motion vector information is bidirectionally decoded. The portion that cannot be decoded with this motion vector information is also set as Not Coded. In the lower layer, the DCT coefficient information in the lower layer is used only for the macroblock that has been decoded up to the motion vector. A macroblock in which DCT coefficient information is discarded due to an error is assumed to be Not Coded.
[0142]
In the decoding value determination method shown in FIGS. 48 and 49, the decoding value is determined in units of macroblocks, but the decoding value may be determined in units of blocks or codewords. In the fifth embodiment, the case where the present invention is applied to variable length coding of motion vector information and DCT coefficient information has been described. However, the present invention can also be applied to other information symbols subjected to variable length coding. Needless to say.
[0143]
(Sixth embodiment)
Next, a variable-length encoding / decoding device according to a sixth embodiment of the present invention will be described. The basic configuration of the sixth embodiment is the same as the block diagram of FIG. 1 showing the configuration of the first embodiment, and will be described with reference to FIG.
[0144]
In the encoding unit 113, the input information symbol is input to the encoder 103. The codeword table 102 stores information symbols created in advance by the codeword table creation unit 101 in correspondence with codewords of variable length codes. The encoder 103 selects a code word corresponding to the input information symbol from the code words stored in the code word table 102. The synchronization interval setting unit collects the codewords selected by the encoder for each synchronization interval and outputs them as encoded data. The encoded data is sent to the decoding unit 111 through the transmission system or the storage system 104.
[0145]
In the decoding unit 114, the synchronization interval of the encoded data is detected by the synchronization interval detection unit 106 from the encoded data input from the transmission system or the storage system 105, and the encoded data is stored in the buffer 107. The forward decoder 109 starts decoding from the beginning of the encoded data stored in the buffer, and the backward decoder 111 starts decoding from the end of the encoded data stored in the buffer.
[0146]
In the forward decoder, if a bit pattern that does not exist in the forward codeword table appears in the encoded data, or if encoded data with a bit number different from the bit number of the buffer is decoded, it is determined that the error is detected. To do. Similarly, the backward decoder also detects errors when a bit pattern that does not exist in the backward codeword table appears in the encoded data, or when encoded data having a bit number different from the bit number of the buffer is decoded. Is determined.
[0147]
The decoded value determination unit determines a decoded value from the decoding result (referred to as the forward decoding result) obtained by the forward decoder and the decoded result (referred to as the backward decoded value) obtained from the backward decoder. The final decoding result is output.
[0148]
FIG. 50 is a block diagram of the codeword table creation unit 101. The occurrence probability of the information symbol is input to the probability model creating unit 23, a probability model is created, and the probability model is input to the code selecting unit 21, and the one having the smallest average code length is selected from the selectable code systems and selected. The result is sent to the codeword construction unit 22. The code word configuration unit 22 configures the code word of the code selected by the code word selection unit 21.
[0149]
The design method of the probability model in the sixth embodiment is as follows. In the sixth embodiment, a method for designing a more general and more efficient coding model for a probability distribution of various information sources will be described.
[0150]
First, the notation is shown.
θi Information source (i = 1, ..., n)
X Information source information symbol X = (x1, x2,..., Xm)
Frequency distribution of P (X | θi) θi
As an example, a frequency distribution obtained by encoding a test image using a plurality of test images as an information source may be considered.
[0151]
Here, the probability model Q (X) to be designed is obtained by weighting and averaging frequency distributions obtained from a plurality of information sources.
[0152]
Figure 0003819638
At this time, the problem is how to obtain the weighting coefficient w (θi).
[0153]
The ideal code length L (X | θi) when the information source θi is encoded with Q (X) is:
Figure 0003819638
It becomes. To minimize the ideal code length L (X | θi) on average for each information source
Figure 0003819638
[0154]
This function is minimized when U (X) = Q (X).
w (θ1) = ... = w (θn) = 1 / n
It becomes.
[0155]
As another method for designing the probability model Q (X), a method for designing the probability model Q (X) assuming the worst information source will be described.
[0156]
The redundancy R (X | θi) when the information source θi is encoded by Q (X) is
Figure 0003819638
It becomes. The weighted average S (X) for each information source of this redundancy is
Figure 0003819638
Thus, the function indicates the mutual information amount of the event X and the event θ. To find the maximum value of this function,
S. Arimoto, "An algorithm for computing the capacity of arbitrary discrete memoryless channels," IEEE Trans. Inform. Theory, Vol. IT-18, pp. 14-20, 1972.
REBlahut, "Computation of channel capacity and rate-distortion functions," IEEE Trans. Inform. Theory, Vol. IT-18, pp. 460-473, 1972.
The Arimoto-Blahut algorithm shown in FIG. 2 is known, and w (θi) (i = 1,... N) in the worst case can be obtained by maximizing S (X) by these algorithms.
[0157]
As a design method of the probabilistic model Q (X), the method of minimizing the ideal code length on average and the method of assuming the worst on average are shown, but the two methods are combined to group information sources. A method may be applied in which several probability models are created by the former method and the latter method is used for the probability model.
[0158]
In the code selection unit 21 shown in FIG. 50, the probability model Q (X) created by the probability model creation unit 23 creates Q (Y) in which the information symbols X are sorted in descending order of probability, while the code construction unit 22 F (Z) is created by sorting the reversible codes created in step 1 in ascending order.
Figure 0003819638
Is calculated and the one with the smallest value is selected, and a codeword table is created by associating information symbols with codewords.
[0159]
The code constructed by the codeword constructing unit 22 is reverse to the forward direction using the codeword weights shown in, for example, Japanese Patent Application Nos. 7-87777 and 7-260383 and the first and third embodiments. A variable length code that can also be decoded in the direction is used.
[0160]
(Seventh embodiment)
Next, a seventh embodiment of the present invention will be described. FIG. 51 is a conceptual diagram of a moving picture encoding / decoding apparatus incorporating a variable length encoding / decoding apparatus according to a seventh embodiment of the present invention. In the moving image encoder 709, the data encoded by the information source encoder 702 is subjected to variable length encoding, multiplexing, and the like in the moving image multiplexing unit 703, and smoothed in the transmission buffer 704. Then, it is sent to the transmission system or storage system 705 as encoded data. The encoding control unit 701 controls the information source encoder 702 and the moving image multiplexing unit 703 in consideration of the buffer amount of the transmission buffer 704. On the other hand, the moving image decoder 710 stores the encoded data from the transmission system or storage system 705 in the reception buffer 706, and then the moving image multiplexing / separating unit 707 demultiplexes the encoded data and performs variable length decoding. Is sent to the information source decoder 708, and finally the moving image is decoded.
[0161]
The syntax added in 7th Embodiment is demonstrated. FIG. 53 shows the syntax of the moving image encoding method in the moving image multiplexing unit 703 and the moving image demultiplexing / separating unit 707 in the seventh embodiment. The encoded data is hierarchized into an upper layer and a lower layer, and a synchronization section is set by using synchronization codes RM and MM, respectively. Further, ST in the lower hierarchy is a stuffing code that can be decoded from the reverse direction as shown in FIG. As shown in FIG. 63, the intra-frame encoded frame includes AC-DCT coefficient information including a part of mode information of macroblocks and INTRA DC as an upper layer, a part of mode information and AC-DCT coefficient information as a lower layer. A reversible code is applied. As shown in FIG. 64, the inter-frame encoded frame has a part of macro block mode information and motion vector information as an upper layer, a part of mode information, INTRA DC, and AC-DCT coefficient information as a lower layer. -A reversible code is applied to the DCT coefficient information.
[0162]
The upper layer and lower layer encoding and decoding shown in FIG. 53 are performed by the moving picture multiplexing unit shown in FIG. These configurations are substantially the same as those of the encoding device / decoding device according to the fifth embodiment. That is, the basic configuration of the moving picture multiplexing unit 703 and moving picture multiplexing / separating unit 707 in FIG. 51 is as shown in FIGS. 53 (a) and 53 (b), but the upper layer variable length encoder 801, lower layer The configurations of the variable length encoder 803, the upper layer variable length decoder 805, and the lower layer variable length decoder 806 are different from those of the second embodiment. That is, among the data encoded by the information source encoder 702, for example, the upper layer data indicated by the syntax in FIG. 53A is variable length encoded by the upper layer variable length encoder 801, and multiplexed. Sent to the conversion unit 803. In addition, among the data encoded by the information source encoder 702, lower-layer data indicated by the syntax in FIG. 53B is variable-length encoded by the variable-length encoder 803, and the multiplexing unit 803 Sent to. The multiplexing unit 803 multiplexes the upper layer encoded data and the lower layer encoded data, and sends the multiplexed data to the transmission buffer 704.
[0163]
In the seventh embodiment, the decoded value judgment unit 110 shown in FIG. 32 in the upper layer variable length decoder 805 and the lower layer variable length decoder 806 is obtained by the forward decoder 108. The decoding value is determined from the forward decoding result, and the final decoding result is output. The error determination in the forward decoder 108 and the backward decoder 109 of each layer is performed when a bit pattern that does not exist as a code word appears, and when an error is detected by a check bit or the like, the detection position is If no error is detected by the above-described determination method and the number of decoded bits does not match the number of bits of encoded data in the synchronization interval, the most processing position for decoding is set as the error detection position.
[0164]
(Eighth embodiment)
54 and 55 respectively show an example of the information source encoder 702 and the information source decoder 708 in the encoding / decoding device according to the eighth embodiment of the present invention. First, in FIG. 54, the input image signal is divided into macro blocks by the blocking circuit 401. The input image signal divided into macroblocks is input to the subtractor 402, and a difference from the predicted image signal is taken to generate a predicted residual signal. Either one of the prediction residual signal and the input image signal from the blocking circuit 401 is selected by the mode selection switch 403 and subjected to discrete cosine transform by a DCT (discrete cosine transform) circuit 404. The DCT coefficient data obtained by the DCT circuit is quantized by the quantization circuit 405. The quantized data is branched into two, and one is sent to the moving picture multiplexer 703 as DCT coefficient information. The other is that the inverse quantization circuit 406 and IDCT (Inverse Discrete Cosine Transform) circuit 407 sequentially perform the reverse processing of the quantization circuit 405 and DCT circuit 406, and then the adder 408 passes through the switch 410. A local decoded signal is generated by being added to the input predicted image signal. This local decoded signal is stored in the frame memory and input to the motion compensation circuit 411. The motion compensation circuit A010 performs motion compensation between the input image signal and the local decoded signal, obtains a motion vector, and generates a predicted image signal. The motion vector information obtained at this time is sent to the moving picture multiplexer 703. Based on the information from the motion compensation circuit 410, the mode selection circuit 412 determines what prediction method is used to encode each macroblock, and the result is the video multiplexing as the mode information together with the quantization parameter and the like. Sent to the container 703. In FIG. 54, the output encoded data is data in which three DCT encoding coefficients, motion vector information, and mode information are combined into one.
[0165]
Next, the configuration of the information source decoder 708 for decoding the data encoded by FIG. 54 will be described with reference to FIG. FIG. 55 shows an example of the information source decoder 708 corresponding to FIG. In FIG. 55, the information source decoder 708 receives the mode information, the motion vector information, the DCT coefficient information, etc. separated by the moving picture multiplexing / separating circuit 707.
[0166]
In the mode determination circuit 504 to which the mode information is input, if the mode information is INTRA, the mode changeover switch 505 is selected to be off, the DCT coefficient information is inversely quantized by the inverse quantization circuit 501, and the IDCT circuit 502 is inverted. A reproduced image signal is generated by performing a discrete cosine transform process. The reproduced image signal is stored as a reference image in the frame memory 506 and is output as a reproduced image signal. If the mode information is INTER, the mode changeover switch 505 is selected to be turned off, the DCT coefficient information is inversely quantized by the inverse quantization circuit 501, and the inverse discrete cosine transform processing is performed by the IDCT circuit 502, based on the motion vector information. Thus, the frame memory 504 compensates the motion of the reference image, and the adder 503 adds them to generate a reproduced image signal. The reproduced image signal is stored as a reference image in the frame memory 504 and is output as a reproduced image signal.
[0167]
(Ninth embodiment)
Next, as an application example of the present invention, an embodiment of an image transmitting / receiving apparatus to which the moving image encoding / decoding system according to the ninth embodiment in which the variable-length encoding / decoding apparatus of the present invention is incorporated is illustrated. 56 will be described. An image signal input from a camera 1002 provided in a personal computer (PC) 1001 is encoded by a moving image encoder 709 incorporated in the PC 1001. The encoded data output from the moving image encoder 709 is multiplexed with other audio and data information, transmitted wirelessly from 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 and audio data of an image signal. Among these, the encoded data of the image signal is decoded by the moving image decoder 710 incorporated in the workstation (EWS) 1005 and displayed on the display of the EWS 1005.
[0168]
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 moving image encoder 709 incorporated in the EWS 1005. The encoded data is multiplexed with other voice and data information, transmitted wirelessly by the wireless device 1004, and received by the wireless device 1003. A signal received by the wireless device 1003 is decomposed into encoded data of an image signal and information of voice and data. Among these, the encoded data of the image signal is decoded by the moving image decoder 710 incorporated in the PC 1001 and displayed on the display of the PC 1001.
[0169]
(10th Embodiment)
The video encoding / decoding devices according to the first to ninth embodiments described above have taken the invention as a configuration as hardware, but the present invention has been developed to each of the above embodiments. It can also be understood as a recording medium for recording data or programs used in such an encoding / decoding device. Hereinafter, a recording medium on which data or a program according to the tenth embodiment is recorded will be described.
[0170]
In the information source encoder 702 shown in FIG. 51, a block-less scan is performed on a block of 8 × 8 DCT coefficients of a quantized word, and LAST (0: non-zero coefficient not the end of block, 1: end of block) RUN (the number of zero runs up to the non-zero coefficient) and LEVEL (quantized value of the coefficient) are obtained and sent to the moving picture multiplexing unit 703.
[0171]
The lower layer variable length encoder 802 in the moving picture multiplexing unit 703 supports the INDEX of the reversible code code word (VLC_CODE) to the RUN and LEVEL of the non-last coefficient of INTRA (intraframe coding) shown in FIG. 62, the INDEX table in which the RUN and LEVEL of the INTER (interframe coding) non-LAST coefficient shown in FIG. 61 are associated with the INDEX of the reversible codeword (VLC_CODE), and the INTRA shown in FIG. INDEX table that associates RUN and LEVEL of LAST coefficients common to INTER and INDEX of reversible code codeword (VLC-CODE), and codeword table that associates INDEX values and codewords shown in FIGS. 63 and 64 have.
[0172]
The operation of the lower layer variable length encoder 802 will be described with reference to the flowchart of FIG. First, based on the mode information, an INTRA non-LAST coefficient and a LAST coefficient codeword table are selected for INTER, and an INTER non-LAST coefficient and an LAST coefficient INDEX table are selected for INTER. (S101)
Next, when encoding using the codeword table, (RUN, LEVEL) is compared with the RUN maximum value R_max and the LEVEL maximum value L_max in the INDEX table to check whether they exist in the INDEX table. (S102)
If it exists, the INDEX table of FIGS. 60 to 62 is drawn to check whether the INDEX value is 0 (S104). If not, the INDEX code word of the code word table of FIG. 12 is output. To do. The last bit “s” of the codeword in the codeword table represents the LEVEL code. When “s” is “0”, the LEVEL code is positive, and when “s” is “1”, LEVEL. The sign of is negative (S105). When the INDEX value is 0 or out of the range, a coefficient that does not exist in the codeword table is continued with the ESCAPE code as shown in FIG. 66, the absolute values of RUN and LEVEL are fixed-length encoded, "00001" of two escapes is added to the head of this fixed-length encoding unit, and an escape code is also added to the end. The code word having the INDEX value of 0 in FIGS. 63 and 64 is an escape code, and the last bit “s” of VLC_CODE used as an escape (ESCAPE) code represents a LEVEL code, and “s” is “0”. LEVEL is positive, and if “1”, LEVEL is negative (S106).
[0173]
As described above, by using the INDEX table, even when the ESCAPE code is used, a code word can be output efficiently without searching. The lower layer variable length decoder 802 includes the decoded value table shown in FIGS. 68 and 69, and operates based on the INDEX value obtained as a result of decoding the variable length code.
[0174]
Next, the operation of the lower layer variable length decoder will be described with reference to the flowcharts of FIGS. FIG. 58 shows a decoding operation in the forward direction. First, variable length decoding is forward-decoded (S201). Next, it is checked whether or not the INDEX value obtained by decoding is 0 (S202). If it is other than 0, INTRA and INTER in the decoded value table of FIG. 68 are selected based on the mode information of the upper layer. Thus, the decoded values of LAST, RUN, and LEVEL are obtained (S203). If the INDEX value is 0, it is an ESAPE code, so the next fixed-length code is decoded to obtain the decoded values of LAST, RUN, and LEVEL (S204). Subsequently, the last ESCAPE code is decoded (S205). The sign of LEVEL is positive if the last bit of the code word is “0”, and negative if it is “1” (S206).
[0175]
FIG. 59 shows the decoding operation in the reverse direction. First, the sign of LEVEL is determined by the first bit of the code word. If it is “0”, it is positive, and if it is “1”, it is negative (S301). Next, the variable length code is reversely decoded (S302). It is checked whether the INDEX value obtained by backward decoding is 0 (S303). If it is other than 0, INTRA and INTER in the decoded value table of FIG. The decoded values of LAST, RUN, and LEVEL are obtained (S304). When the INDEX value is 0, since it is an ESCAPE code, the following fixed-length code is decoded to obtain decoded values of LEVEL, RUN, and LAST (S305). Subsequently, the head ESCAPE code is decoded (S306). As described above, by using the decoded value table, the storage amount can be saved even when the ESCAPE code is used, and the bidirectional decoding can be efficiently performed.
[0176]
A reinforcement example of the decoding process in the tenth embodiment will be described. That is, a decoding value determination method in the case where the syntax of the moving image encoding scheme in the moving image multiplexing unit 703 is the syntax shown in FIG.
[0177]
In the intra-coded frame, first, the mode information 1 and INTRADC of the upper layer are decoded. If an error is found and not all can be decoded, the decoded values of the macroblocks in the synchronization interval where the error has occurred are all Not Coded. If encoding is the first frame and there is no previous frame in time, the macroblock is filled with gray or a specific color.
[0178]
In the lower layer, when the mode information 2 cannot be decoded due to an error, all the encoded data in the lower layer is abandoned, and the decoded value in the upper layer is rewritten to be Not Coded or displayed only by INTRA DC. In addition, a macroblock in which the DCT coefficient is abandoned due to an error is displayed as Not Coded or displayed only by INTRA DC.
[0179]
Also, if there is a macroblock for which the AC-DCT coefficient is predicted in the INTRA mode macroblock, the variable length code can be decoded, but since the prediction is performed from the surrounding macroblock, the surrounding macroblock If the block cannot be decoded because it cannot be decoded, it is set to Not Coded.
[0180]
In the inter-frame coded frame, first, the mode information 1 and the motion vector of the upper layer are decoded. If an error is found and not all can be decoded, the decoded values of the macroblocks in the synchronization section where the error has occurred are all Not Coded. If all can be decoded, it is confirmed that the synchronization code MM exists. If not, all the decoded values of the macroblocks in the synchronization section are set to Not Coded.
[0181]
In the lower layer, when decoding is not performed due to an error in the mode information 2 and INTRA DC, the encoded data in the lower layer is discarded and displayed as Not Coded or displayed only with motion compensation from the previous frame (MC Not Coded) is rewritten with the decoded value of the upper layer. In addition, a macro block in which the DCT coefficient is abandoned due to an error is assumed to be MC Not Coded.
[0182]
Also, if there is a macroblock for which the AC-DCT coefficient is predicted in the INTRA mode macroblock, the variable length code can be decoded, but since the prediction is performed from the surrounding macroblock, the surrounding macroblock If the block cannot be decoded because it cannot be decoded, it is set to Not Coded.
[0183]
FIG. 70 shows a detailed decoded value determination method of the AC-DCT coefficient part of the inter-frame encoded frame.
[0184]
First, as shown in FIG. 70 (a), when the position of the macroblock in which an error is detected (error detection position) does not intersect between the forward decoding result and the backward decoding result, the macroblock in which no error is detected is detected. Only the decoding result is used as the decoding value, the decoding result at the two error detection positions is not used as the decoding value, and the previous frame is displayed as it is for the INTRA macroblock based on the decoding result of the higher layer mode information. Thus, for the INTRA macroblock, the decoding result of the upper layer is rewritten so that it is displayed with only motion compensation from the previous frame.
[0185]
Also, as shown in FIG. 70 (b), when the error detection positions of the forward decoding result and the backward decoding result intersect, the decoding values up to the macroblock in which the error is detected in the forward decoding result are The forward decoding result is used, and the subsequent decoding part uses the backward decoding result as a decoded value.
[0186]
In addition, the backward decoding result is prioritized, and the decoding value up to the macroblock in which an error is detected in the backward decoding result uses the backward decoding result, and the previous part decodes the forward decoding result. It may be used as a value.
[0187]
Furthermore, when an error is detected in both the forward decoding result and the backward decoding result in the same macroblock as shown in FIG. 70 (c), the decoded value of the macroblock at the error detection position is discarded and decoding is performed. Without being used as a value, based on the decoding result of the higher layer mode information, the previous frame is displayed as it is for the INTRA macroblock, and the motion compensation from the previous frame is displayed for the INTER macroblock. As described above, the decoding result of the upper layer is rewritten, and the decoding value for the subsequent macroblock uses the decoding result in the reverse direction.
[0188]
Also, as shown in FIG. 70 (d), when an error is detected by a stuffing code and decoding is not possible in the reverse direction, only forward decoding is performed. When an error is detected, macroblocks after the error detection position are Based on the decoding result of the higher layer mode information, for the INTRA macroblock, the previous frame is displayed as it is, and for the INTER macroblock, only the motion compensation from the previous frame is displayed. The decoding result is rewritten, and the decoding value for the subsequent macroblock uses the decoding result in the reverse direction.
[0189]
In the decoded value determination method of FIG. 70, the decoded value is determined in units of macroblocks. However, the determination may be performed in units of blocks or codewords.
[0190]
As described above, the variable-length encoding / decoding apparatus of the present invention requires a smaller calculation amount and storage amount than the conventional one, and is efficient.
[0191]
Specifically, the present invention can be applied to a moving image encoding / decoding device, and an efficient moving image encoding / decoding device can be provided with a smaller calculation amount and storage amount.
[0192]
【The invention's effect】
As described above, according to the present invention, variable length encoding / decoding capable of efficient encoding / decoding with less calculation amount and storage amount and decoding in both forward and backward directions is possible. An apparatus can be provided.
[0193]
In addition, according to the present invention, it is possible to reduce the useless bit pattern and increase the encoding efficiency, and also to decode in the forward direction and the reverse direction even when the synchronization interval is set in units of a fixed interval using the stuffing code. A variable-length encoding / decoding device can be provided.
[0194]
Further, according to the codeword construction method of the present invention, it is possible to deal with a wider probability distribution of information symbols, and it can be applied to coding with a large number of information symbols that could not be applied conventionally. Become. Specifically, the present invention can be applied to a moving image encoding / decoding system, and a moving image encoding / decoding system that is resistant to errors can be provided.
[0195]
Moreover, according to this codeword configuration method, coding efficiency is improved and code design with a high degree of freedom in the bit pattern of the codeword can be performed. Therefore, even when a synchronization interval is set using a synchronization code, The problem of pseudo-synchronization due to the coincidence of the bit pattern of the code and the code word can be avoided.
[0196]
Furthermore, according to the present invention, when determining the decoded value from the forward and backward decoding results, the decoded value of the encoded data is determined according to the error detection result when performing the forward and backward decoding. Thus, it is possible to effectively decode the reversible code against the transmission path error.
[0197]
In addition, according to the present invention, when decoding processing is performed by a bidirectional decoding means having an error detection function for a codeword of a variable length code, decoding processing of encoded data according to an error detection result in the forward decoding processing By switching between, it is possible to share the decoding processing in the forward direction and the backward direction, so that it is possible to effectively perform the decoding with respect to the transmission path error without significantly increasing the circuit scale and the calculation amount.
[0198]
Furthermore, according to the present invention, variable length coding is performed after the information symbol is hierarchized according to the importance on the encoding side, and encoded data for each layer is created for each synchronization interval, and the code for each layer is generated. By multiplexing the coded data, it is possible to perform decoding in both the forward and backward directions regardless of the information symbol syntax, and it is possible to perform variable-length coding / decoding that is more resistant to errors.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a variable-length encoding / decoding device according to a first embodiment of the present invention.
FIG. 2 is a block diagram showing a code word table creation unit in FIG. 1;
3 is a diagram for explaining a first code word configuration method in a code word configuration unit in FIG. 2; FIG.
FIG. 4 is a diagram illustrating forward and backward decoding trees created from codewords configured by the first code configuration method;
FIG. 5 is a diagram for explaining a second codeword configuration method in the codeword configuration unit in FIG. 2;
6 is a diagram for explaining a third code word construction method in the code word construction unit in FIG. 2; FIG.
7 is a diagram for explaining a synchronization interval setting method in a synchronization interval setting unit in FIG. 2;
FIG. 8 is a diagram showing a first example of a stuffing code.
FIG. 9 is a diagram illustrating a second example of the stuffing code.
10 is a diagram for explaining the operation of a decoded value determination unit in FIG. 2;
FIG. 11 is a block diagram showing a schematic configuration of a moving image encoding / decoding system according to a second embodiment of the present invention.
FIG. 12 is a diagram showing the syntax of encoded data in the moving image encoding / decoding system according to the second embodiment.
13 is a block diagram showing a configuration of a moving image multiplexing unit and a moving image multiplexing / separating unit in FIG.
FIG. 14 is a diagram showing a part of a codeword table of INTRA and INTER non-LAST coefficients in the second embodiment.
FIG. 15 is a diagram showing another part of a codeword table of INTRA and INTER non-LAST coefficients in the second embodiment.
FIG. 16 is a diagram showing still another part of a codeword table of INTRA and INTER non-LAST coefficients in the second embodiment.
FIG. 17 is a diagram showing a part of a codeword table of INTRA and INTER last coefficients in the second embodiment.
FIG. 18 is a diagram showing another part of a codeword table of INTRA and INTER last coefficients in the second embodiment;
FIG. 19 is a diagram showing a codeword table of escape codes in the second embodiment.
FIG. 20 is a diagram showing a coding method for codewords not in the codeword table in the second embodiment.
FIG. 21 is a diagram showing a case of a maximum zero run in the second embodiment.
FIG. 22 is a diagram for explaining the operation of a decoded value determination unit in the second embodiment.
FIG. 23 is a block diagram showing a configuration of a variable-length encoding / decoding device according to a third embodiment of the present invention.
24 is a diagram for explaining a first code word configuration method in the code word configuration unit in FIG. 23;
FIG. 25 is a diagram for explaining a second code word configuration method in the code word configuration unit in FIG. 23;
FIG. 26 is a diagram showing a configuration of a bidirectional codeword table in which a forward codeword table and a backward codeword table are shared.
FIG. 27 is a block diagram showing a configuration when an error detection unit is added to the decoder.
FIG. 28 is a diagram illustrating a decoding method according to the third embodiment.
FIG. 29 is a diagram for explaining a decoded value determination method of a decoded value determination unit in the third embodiment.
FIG. 30 is a block diagram showing a configuration of a variable-length encoding / decoding device according to a fourth embodiment of the present invention.
31 is a block diagram showing a configuration of a variable length encoding unit of one layer in FIG. 30. FIG.
32 is a block diagram showing a configuration of a variable length decoding unit of one layer in FIG. 30. FIG.
33 is a diagram showing an example of data hierarchization and multiplexing in the data hierarchization unit and the multiplexing unit in FIG. 30;
34 is a diagram showing an example of a decoded value determination method of a decoded value determination unit in FIG. 32. FIG.
35 is a moving picture multiplexing section and a moving picture multiplexing / demultiplexing section when the variable length encoding / decoding apparatus according to the fourth embodiment is incorporated in the moving picture encoding / decoding system of FIG. The figure which shows the 1st example of the syntax of an image coding system.
36 is a moving picture multiplexing unit and a moving picture demultiplexing / separating unit when the variable-length encoding / decoding device according to the fourth embodiment is incorporated in the moving image encoding / decoding system of FIG. The figure which shows the 2nd example of the syntax of an image coding system.
FIG. 37 shows moving images in the moving image multiplexing unit and the moving image demultiplexing unit when the variable length encoding / decoding device according to the fourth embodiment is incorporated in the moving image encoding / decoding system in FIG. The figure which shows the 3rd example of the syntax of an image coding system.
38 is a moving picture multiplexing section and moving picture multiplexing / demultiplexing section when the variable length coding / decoding apparatus according to the fourth embodiment is incorporated in the moving picture coding / decoding system of FIG. The figure which shows the 4th example of the syntax of an image coding system.
FIG. 39 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 40 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 41 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 42 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 43 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 44 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 45 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 46 is a diagram showing a motion vector encoding table according to the fourth embodiment;
FIG. 47 is a diagram for explaining one-dimensional prediction of a motion vector in the fourth embodiment.
48 is a diagram for explaining a decoded value determination method in the case of the syntax in FIG. 35;
49 is a view for explaining a decoded value determination method in the case of the syntax in FIG. 36;
50 is a block diagram showing a detailed configuration of a codeword table creation unit in FIG. 1, which is an encoding / decoding device according to a sixth embodiment of the present invention.
FIG. 51 is a block diagram showing a schematic configuration of a moving image encoding / decoding system according to a seventh embodiment of the present invention.
52 is a block diagram showing a configuration of a moving image multiplexing unit and a moving image multiplexing / separating unit in FIG. 50. FIG.
FIG. 53 is a diagram illustrating an example of syntax of a moving image encoding scheme in a moving image multiplexing unit and a moving image demultiplexing unit according to the seventh embodiment.
FIG. 54 is a block diagram showing an example of an information source encoder according to the eighth embodiment of the present invention.
FIG. 55 is a block diagram showing an example of an information source decoder according to the eighth embodiment of the present invention.
FIG. 56 is a diagram showing an example of a system in which a variable-length encoding / decoding device according to a ninth embodiment of the present invention is incorporated.
FIG. 57 is a flowchart showing the operation of the variable length encoder of the tenth embodiment of the present invention.
FIG. 58 is a flowchart showing the operation of the forward variable length decoder according to the tenth embodiment.
FIG. 59 is a flowchart showing the operation of the backward variable length decoder according to the tenth embodiment.
FIG. 60 is a diagram showing an INDEX table of INTRA coefficients.
FIG. 61 is a diagram showing an INDEX table of INTER coefficients.
FIG. 62 is a diagram showing an INDEX table of LASR coefficients.
FIG. 63 shows a codeword table in the tenth embodiment.
FIG. 64 shows a codeword table in the tenth embodiment.
FIG. 65 is a diagram showing a RUN fixed-length codeword table in the tenth embodiment;
FIG. 66 is a diagram showing a LEVEL fixed-length codeword table according to the tenth embodiment;
Fig. 67 is a diagram showing a coding method for codewords not in the codeword table;
FIG. 68 is a decoded value table in the tenth embodiment.
FIG. 69 is a decoded value table in the tenth embodiment.
FIG. 70 is a diagram for explaining the operation of a decoded value determination unit;
Fig. 71 is a diagram illustrating a general decoding method of a reversible code.
FIG. 72 is an explanatory diagram of a normal variable length code.
FIG. 73 is an explanatory diagram of a conventional reversible code.
FIG. 74 is a diagram showing a conventional stuffing code.
FIG. 75 is a diagram for explaining the syntax of information symbols that cannot be subjected to conventional inverse decoding;
[Explanation of symbols]
51 Bidirectional codeword table
52 Address converter
53 Identification signal
61 Error detector
101 Codeword table creation unit
102 codeword table
103 Encoder
104 Synchronization section setting section
105, 205, 705 Transmission system or storage system
106 Synchronous section detector
107 buffers
108 Forward decoder
109 Reverse decoder
110 Decoded value determination unit
111 Forward codeword table
112 Reverse codeword table
113, 213 encoding unit
114, 121, 214 Decoding unit
122 Encoded data switcher
123 codeword table switcher
124,62 Decoder
201 Coding table creation unit
202 Data hierarchies
203 Variable length coding unit by layer
204 Multiplexer
206 Demultiplexer
207 Hierarchical decoding unit
208 Data composition part
401 Blocking circuit
402 Subtractor
403 Mode selection switch
404 DCT circuit
405 Quantization circuit
406 Inverse quantization circuit
407 IDCT circuit
408 Adder
409 frame memory
410 Motion Compensation Circuit
411 switch
412 Mode selection circuit
501 Inverse quantization circuit
502 IDCT circuit
503 Adder
504 Mode determination circuit
505 Mode selector switch
506 frame memory
701 Coding control unit
702 Information source encoder
703 video multiplexer
704 Transmission buffer
706 Receive buffer
707 Video demultiplexer
708 Information source decoder
709 video encoder
710 video decoder
901 Upper layer variable length encoder
902 Lower layer variable length encoder
903 Multiplexer
904 Demultiplexer
905 Upper layer variable length decoder
906 Lower layer variable length decoder
1001 Personal computer
1002 Workstation
1003, 1004 radio
1005, 1006 camera

Claims (6)

複数の情報シンボルに対して該情報シンボルの生起確率に応じた符号長を有する符号語をそれぞれ割り当て、入力された情報シンボルに対応した符号語を符号化データとして出力する可変長符号化装置において、
入力された情報シンボルを重要度に応じて階層化する階層化手段と、
順方向にも逆方向にも復号可能で、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語を含む複数の符号語であって、順方向にも逆方向にも復号可能な第1の符号語の先頭および末尾の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成された符号語を情報シンボルにそれぞれ対応させて格納した符号語テーブルと、
前記符号語テーブルから前記階層化手段により階層化された情報シンボルに対応する符号語を選択する符号語選択手段と、
前記符号語選択手段により選択された符号語を用いて所定の同期区間毎に階層毎の符号化データを作成すると共に、該階層毎の符号化データを多重化する多重化手段と、
を有することを特徴とする可変長符号化装置。
In a variable-length coding apparatus that assigns codewords having code lengths corresponding to the occurrence probability of information symbols to a plurality of information symbols, respectively, and outputs codewords corresponding to the input information symbols as coded data,
A hierarchization means for hierarchizing the input information symbols according to importance,
A plurality of codewords including codewords that can be decoded in both forward and reverse directions and that can be delimited by a predetermined weight of the codeword, both forward and backward In addition, a codeword formed by adding a second codeword decodable in both the forward and reverse directions to at least one of the beginning and end of the decodable first codeword corresponds to each information symbol. Codeword table stored and
Codeword selection means for selecting codewords corresponding to information symbols hierarchized by the hierarchization means from the codeword table;
Using the codeword selected by the codeword selection means to create encoded data for each layer for each predetermined synchronization interval, and multiplexing means for multiplexing the encoded data for each layer;
A variable-length coding apparatus comprising:
複数の情報シンボルに対して該情報シンボルの生起確率に応じた符号長を有する符号語をそれぞれ割り当て、入力された情報シンボルに対応した符号語を符号化データとして出力する可変長符号化装置において、
入力された情報シンボルを重要度に応じて階層化する階層化手段と、
順方向にも逆方向にも復号可能で、符号語の予め定められた重みによって符号語の区切りが分かるように構成された符号語を含む複数の符号語であって、順方向にも逆方向にも復号可能な第1の符号語の各ビットの直前および直後の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成された符号語を情報シンボルにそれぞれ対応させて格納した符号語テーブルと、
前記符号語テーブルから前記階層化手段により階層化された情報シンボルに対応する符号語を選択する符号語選択手段と、
前記符号語選択手段により選択された符号語を用いて所定の同期区間毎に階層毎の符号化データを作成すると共に、該階層毎の符号化データを多重化する多重化手段と、
を有することを特徴とする可変長符号化装置。
In a variable-length coding apparatus that assigns codewords having code lengths corresponding to the occurrence probability of information symbols to a plurality of information symbols, respectively, and outputs codewords corresponding to the input information symbols as coded data,
A hierarchization means for hierarchizing the input information symbols according to importance,
A plurality of codewords including codewords that can be decoded in both forward and reverse directions and that can be delimited by a predetermined weight of the codeword, both forward and backward In addition, a codeword formed by adding a second codeword that can be decoded both in the forward direction and in the backward direction to at least one immediately before and after each bit of the first codeword that can also be decoded is an information symbol. Codeword tables stored corresponding to each of
Codeword selection means for selecting codewords corresponding to information symbols hierarchized by the hierarchization means from the codeword table;
Using the codeword selected by the codeword selection means to create encoded data for each layer for each predetermined synchronization interval, and multiplexing means for multiplexing the encoded data for each layer;
A variable-length coding apparatus comprising:
前記第1の符号語の先頭および末尾の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成される符号語は、前記第1の符号語の先頭および末尾の少なくとも一方に、前記第2の符号語としての固定長符号の符号語が所定ビットずつ挿入された符号語であることを特徴とする請求項1に記載の可変長符号化装置。A code word configured by adding a second code word that can be decoded in both the forward and backward directions to at least one of the head and the tail of the first code word is the head of the first code word. and at least one of the end, the variable length coding apparatus according to claim 1 in which the codeword of fixed length codes as the second code word is characterized by a code word that is inserted by a predetermined bit. 前記第1の符号語の先頭および末尾の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成される符号語は、前記第1の符号語の先頭および末尾の少なくとも一方に、前記第2の符号語としての順方向にも逆方向にも復号可能な符号語が所定ビットずつ挿入された符号語であることを特徴とする請求項1に記載の可変長符号化装置。A code word configured by adding a second code word that can be decoded in both the forward and backward directions to at least one of the head and the tail of the first code word is the head of the first code word. and at least one of the end, according to claim 1, wherein the second decodable codewords both backwards in the forward direction of the code word, characterized in that a code word that is inserted by a predetermined bit Variable length coding device. 前記第1の符号語の各ビットの直前および直後の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成される符号語は、前記第1の符号語の各ビットの間に、前記第2の符号語としての固定長符号の符号語が所定ビットずつ挿入された符号語であることを特徴とする請求項2に記載の可変長符号化装置。A codeword configured by adding a second codeword that can be decoded both in the forward direction and in the reverse direction to at least one of the first codeword immediately before and after each bit is the first codeword. The variable-length coding apparatus according to claim 2, wherein a code word of a fixed-length code as the second code word is inserted between each bit of the word by a predetermined number of bits. 前記第1の符号語の各ビットの直前および直後の少なくとも一方に、順方向にも逆方向にも復号可能な第2の符号語を付加して構成される符号語は、前記第1の符号語の各ビットの間に、前記第2の符号語としての順方向にも逆方向にも復号可能な符号語が所定ビットずつ挿入された符号語であることを特徴とする請求項2に記載の可変長符号化装置。  A codeword configured by adding a second codeword that can be decoded both in the forward direction and in the reverse direction to at least one of the first codeword immediately before and after each bit is the first codeword. 3. The code word according to claim 2, wherein a code word that is decodable in both the forward and backward directions as the second code word is inserted between each bit of the word. Variable-length encoding device.
JP19633299A 1996-09-06 1999-07-09 Variable length coding device Expired - Lifetime JP3819638B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19633299A JP3819638B2 (en) 1996-09-06 1999-07-09 Variable length coding device

Applications Claiming Priority (7)

Application Number Priority Date Filing Date Title
JP8-236779 1996-09-06
JP23677996 1996-09-06
JP29877996 1996-11-11
JP8-298779 1996-11-11
JP8161497 1997-03-31
JP9-81614 1997-03-31
JP19633299A JP3819638B2 (en) 1996-09-06 1999-07-09 Variable length coding device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP24151497A Division JP3011680B2 (en) 1996-09-06 1997-09-05 Variable length coding apparatus and method

Related Child Applications (2)

Application Number Title Priority Date Filing Date
JP2006022122A Division JP4199240B2 (en) 1996-09-06 2006-01-31 Variable length decoding device and recording medium recording data or program used in this device
JP2006022647A Division JP4131977B2 (en) 1996-09-06 2006-01-31 Variable length decoding device

Publications (2)

Publication Number Publication Date
JP2000036758A JP2000036758A (en) 2000-02-02
JP3819638B2 true JP3819638B2 (en) 2006-09-13

Family

ID=27466597

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19633299A Expired - Lifetime JP3819638B2 (en) 1996-09-06 1999-07-09 Variable length coding device

Country Status (1)

Country Link
JP (1) JP3819638B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5149454B1 (en) * 2012-07-28 2013-02-20 義尚 神山 Recording medium on which YKM format compression program is recorded

Also Published As

Publication number Publication date
JP2000036758A (en) 2000-02-02

Similar Documents

Publication Publication Date Title
US6104754A (en) Moving picture coding and/or decoding systems, and variable-length coding and/or decoding system
JP3762392B2 (en) Video coding method and apparatus
JP3657971B2 (en) Decoding method and apparatus
JPH08111867A (en) Coding method and decoding method for dynamic image
JP3262761B2 (en) Error tolerant mode video codec method and apparatus
JPH09182073A (en) Moving image encoding and decoding device
JP4131977B2 (en) Variable length decoding device
JP3819638B2 (en) Variable length coding device
JP3011680B2 (en) Variable length coding apparatus and method
US20040071450A1 (en) Moving picture coding and/or decoding systems, and variable-length coding and/or decoding sysatm
JP4199240B2 (en) Variable length decoding device and recording medium recording data or program used in this device
JP3275003B2 (en) Computer-readable recording medium for recording data relating to variable-length codes
JP2002009626A (en) Recording medium for recording program used for variable length coding/decoding device
JP3030028B2 (en) Variable length decoding apparatus and method
JP3217771B2 (en) Computer-readable recording medium recording a program relating to variable-length codes
JP3905938B2 (en) Image coding apparatus and image decoding apparatus
JP3612315B2 (en) Variable length decoding method and apparatus
JP2003289539A (en) Moving image coding equipment and moving image coding method
JP2003250158A (en) Moving picture decoding apparatus and method
JP2003299094A (en) Moving image decoding apparatus and method therefor
JP2006141044A (en) Moving picture coding apparatus and method
JP2006141045A (en) Moving picture decoding apparatus and method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040906

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

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060131

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060214

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060412

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060428

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060525

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060615

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

Free format text: PAYMENT UNTIL: 20090623

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110623

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120623

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120623

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130623

Year of fee payment: 7

EXPY Cancellation because of completion of term