JP3579412B2 - Variable length decoding method and apparatus - Google Patents

Variable length decoding method and apparatus Download PDF

Info

Publication number
JP3579412B2
JP3579412B2 JP2002294314A JP2002294314A JP3579412B2 JP 3579412 B2 JP3579412 B2 JP 3579412B2 JP 2002294314 A JP2002294314 A JP 2002294314A JP 2002294314 A JP2002294314 A JP 2002294314A JP 3579412 B2 JP3579412 B2 JP 3579412B2
Authority
JP
Japan
Prior art keywords
code
decoding
decoded
length
value
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
JP2002294314A
Other languages
Japanese (ja)
Other versions
JP2003158458A (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 JP2002294314A priority Critical patent/JP3579412B2/en
Publication of JP2003158458A publication Critical patent/JP2003158458A/en
Application granted granted Critical
Publication of JP3579412B2 publication Critical patent/JP3579412B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
この発明は、可変長復号化方法及び装置に関する。
【0002】
【従来の技術】
可変長符号は、シンボルの発生頻度に基づいて、頻繁に出現するシンボルは短い符号長の符号、希にしか出現しないシンボルは長い符号長の符号を割り当てることにより、平均的に短い符号長となるようにした符号系である。従って、可変長符号を用いると、符号化前のデータと比較して、データ量を大幅に圧縮することができる。このような可変長符号の構成方法としては、無記憶情報源で最適なハフマンのアルゴリズムが知られている。
【0003】
可変長符号の一般的な問題として、符号化データに伝送路誤りその他の理由で誤りが混入した場合に、誤りが混入した以後のデータについては、その影響が伝搬することにより復号化装置で正しく復号することができなくなってしまうという点が挙げられる。そのため、伝送路において誤りが生じる可能性がある場合には、ある間隔で周期的に同期符号を挿入し、誤りの伝搬を防止する方法がとられるのが一般的である。同期符号には、可変長符号の組み合わせでは出現しないようなビットパターンが割り当てられる。この方法によれば、符号化データに誤りが生じ、復号できなくなったとしても、次の同期符号を見つけることにより、誤りの伝搬を防止し、正しく復号を行うことができる。しかし、このように同期符号を用いた場合でも、図39(a)に示すように誤りが生じて正しく復号できない地点から、次の同期符号が見つかる地点までの間の符号化データについては、復号を行うことができない。
【0004】
そこで、可変長符号を図40に示す通常の構成から図41に示すように変更して、図39(b)に示すように通常の順方向から復号可能な性質だけでなく、逆方向からも復号可能な符号の構成にする方法が知られている。また、このような符号は符号化データを逆方向からも読めることから、符号化データを蓄積するディスクメモリなどの蓄積媒体において逆転再生に用いることもできる。このような順方向のみならず逆方向からも復号可能な可変長符号のことを、ここではリバーシブル符号と呼ぶこととする。リバーシブル符号の一例は、例えば特開平5−300027号公報「可逆可変長符号化方式」に記載されている。この公知例のリバーシブル符号は、図40に示した順方向から復号可能な可変長符号であるハフマン符号の符号語の末尾に、図41に示すようにそれぞれの符号語がそれより符号長の長い他の符号語の末尾と一致しない条件でビットを追加することによって、逆方向からも復号可能とした可変長符号である。
【0005】
しかし、このリバーシブル符号は順方向からのみ復号可能な可変長符号の符号語の末尾にビットを付加するために、無駄なビットが多くなって平均符号長が長くなる。この結果、順方向からのみ復号可能な可変長符号と比較して符号化効率が大きく低下してしまう。
【0006】
また、従来のリバーシブル符号のもう一つの問題点として、情報シンボル数が大きい場合には、可変長符号化/復号化装置で必要とされる記憶量が多くなるために、実用に適さないという点があった。情報シンボル数が大きい場合の例としては、動画像や静止画像の画像符号化でよく用いられるDCT係数の符号化がある。通常、画像符号化では8×8のDCT(離散コサイン変換)を行い、これにより得られたDCT係数と呼ばれる直交変換係数について8ビットの線形量子化を行う。さらに、量子化されたDCT変換係数について低域からジグザクスキャンを行い、零ランと非零の係数を組にして可変長符号化を行っている。
【0007】
例えば、ITU−T DRAFT Recommendation H.263(1995)では、量子化インデックス値は−127〜+127(インデックス値0はランなので、インデックス数は253)、零ラン数は最大63であり、またブロックの最後のDCT係数が非零の係数かどうかの区別をするような符号化を採用しているので、情報シンボル数は253×64×2=32384と非常に大きな数になっている。そこで、H.263では出現確率の高いDCT係数については可変長符号で符号化するが、出現確率の低いDCT係数についてはブロックの最後の非零係数かどうかの区別を示す符号に1ビットの符号、零ランに6ビットの符号、量子化インデックスに8ビットの符号の計15ビットの符号で固定長符号化を行い、この固定長符号の先頭にエスケープ符号と呼ばれる符号を付加する構成となっている。
【0008】
全ての符号語を符号語テーブルとして持っていても符号化/復号化は可能であるが、上記のような符号構成になっていると、15ビットの固定長符号の部分は可変長符号とは別個に符号化/復号化が可能であるため、出現確率の高いDCT係数とエスケープ符号の符号語テーブルを用意するだけでよい。従って、可変長符号の符号語テーブルを削減して記憶容量を低減することが可能となる。
【0009】
しかし、従来のリバーシブル符号は前述したように順方向からのみ復号可能な可変長符号の符号語の末尾にビットを付加する必要があるために、エスケープ符号を付加することができない。従って、情報シンボル数が多い場合にも全ての情報シンボルに対応した符号語を用意する必要があり、記憶量が莫大なものとなってしまう。
【0010】
【発明が解決しようとする課題】
上述したように、従来技術によるリバーシブル符号、すなわち順方向からも逆方向からも復号可能な可変長符号は、順方向からのみ復号可能な可変長符号の符号語の末尾にビットを付加することによってリバーシブル符号を構成するため、無駄なビットパターンが多くなって平均符号長が長くなり、順方向からのみ復号可能な可変長符号と比較して符号化効率の低下が著しくなるという問題があり、またこのようなリバーシブル符号を用いる可変長符号化/復号化装置では、何らかの形で全ての情報シンボルに対応した符号語を有する符号語テーブルを用意する必要があり、画像符号化のように情報シンボルの数が大きい場合、大きな記憶量を必要とするという問題があるため、いずれにしても実用に適さないという問題があった。
【0011】
本発明は、順方向にも逆方向にも復号可能であって、実用性に富んだ可変長復号化方法及び装置を提供することを目的とする。
【0012】
より具体的には、順方向にも逆方向にも復号可能であって、しかも情報シンボルの数が多い場合にも大きな記憶量を必要としない可変長復号化方法及び装置を提供することを目的とする。
【0013】
【課題を解決するための手段】
上記の課題を解決するため、本発明は順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する際、順方向にも逆方向にも復号可能であって、符号語の予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成された複数の符号語を異なる情報シンボルにそれぞれ対応させて格納した符号語テーブルを構成し、この符号語テーブルを用いて符号化データを復号することを特徴とする。
【0014】
また、本発明は順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する際、前記可変長符号の符号長を符号語の予め定められた“1”または“0”の数によって求め、パスカルの三角形によって決まる値を節点の値とし、各節点から次の節点に至る矢を符号語の“1”および“0”に対応させた有向グラフを用いて同一符号長の異なる符号語についての順序値を求めると共に、この順序値と該有向グラフを用いて復号値を計算することを特徴とする。これにより、情報シンボル数が大きな場合にも少ない記憶量で可変長符号の復号を行うことができる。
【0015】
【発明の実施の形態】
以下、図面を参照して本発明の実施形態を説明する。
図1は、本発明の一実施形態に係る可変長符号化/復号化装置の構成を示すブロック図である。本実施形態の可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部101、符号化部114、伝送系または蓄積系104および復号化部115からなる。まず、これら各部の機能について簡単に説明すると、符号語テーブル作成部101は情報シンボルの生起確率に基づいて符号語テーブルを作成し、符号化部114内の符号化テーブル102と、復号化部115内の順方向符号語テーブル110および逆方向符号語テーブル112に送る。符号化部114は、情報シンボルを可変長符号に符号化し、その可変長符号を符号化データとして伝送系または蓄積系104へ出力する。復号化部115は、伝送系または蓄積系104を介して入力されてきた符号化データを復号して元の情報シンボルを再生する。
【0016】
次に、本実施形態の各部の詳細な構成と動作を説明する。符号化部114において、入力された情報シンボルは符号化器103に入力される。一方、符号語テーブル102は、符号語テーブル作成部101によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。符号化器103は符号語テーブル102に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択して符号化データとして出力する。この符号化データは、伝送系または蓄積系104を通して復号化部115に送られる。この際、符号化データには一定周期毎に同期コードが挿入される。
【0017】
復号化部115では、伝送系または蓄積系104より入力された符号化データから同期コード検出部105で同期コードを検出し、同期コードと同期コードの間の符号化データをバッファ106に蓄積する。順方向復号化器110では、順方向復号木作成部111からの順方向復号木に基づいて、バッファ106に蓄積された符号化データの先頭から復号を開始し、逆方向復号化器108では、逆方向復号木作成部113からの逆方向復号木に基づいて、バッファ106に蓄積された符号化データの末尾から復号を開始する。
【0018】
復号値判定部109では、順方向復号化器107によって得られた復号結果(順方向復号値という)と、逆方向復号化器108によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。すなわち、復号値判定部109では符号化データに誤りがあると、復号木に出現しないビットパターンが生じることから誤りの存在が分かるので、順方向復号結果と逆方向復号結果から図2に示すように復号値を判定する。図2は、同期コードと同期コードとの間の復号値判定方法を示している。
【0019】
まず、図2(a)に示すように順方向復号結果と逆方向復号結果で誤りが検出される符号語の位置(誤り検出位置)が交差しない場合は、誤りが検出されなかった復号結果のみを復号値として使用し、二つの誤り検出位置の復号結果は復号値として使用せず、放棄する。
【0020】
また、図2(b)に示すように順方向復号結果と逆方向復号結果の誤り検出位置が交差する場合は、両方で誤りが検出されなかった復号結果を復号結果値として使用する。また、この場合には二つの誤り検出位置の符号語の間の復号結果は復号値として使用せず、放棄する。
【0021】
また、図2(c)に示すように順方向復号結果および逆方向復号結果のうち片方向の復号結果にしか誤りが検出されない場合(この例では、順方向復号結果にのみ誤りが検出されている)は、誤り検出位置の符号語に対する復号値を放棄し、それ以後の符号語に対する復号値は逆方向の復号結果を使用する。
【0022】
さらに、図2(d)に示すように同一の符号語について順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、図2(c)と同様に誤り検出位置の符号語に対する復号値は放棄し、それ以後の符号語に対する復号値としては逆方向の復号結果を使用する。
【0023】
符号語テーブル作成部101では、情報シンボルの生起確率に基づいて順方向にも逆方向にも復号可能な符号の符号語テーブルを作成する。符号語テーブル作成部101によって作成された符号語テーブルは、符号化部114内の符号語テーブル102と、復号化部115内の順方向符号語テーブル110および逆方向符号語テーブル112に送られる。順方向復号木作成部111では、順方向符号語テーブル110から順方向復号木を作成する。また、逆方向復号木作成部113では、逆方向符号語テーブル112から逆方向復号木を作成する。
【0024】
図3は、符号語テーブル作成部101の構成を示すブロック図である。符号選択部21は、情報シンボルの生起確率の情報を入力として、この情報に基づいて選択可能な符号系の中から最も平均符号長の小さいものを選択し、選択結果を符号語構成部22に送る。符号語構成部22では、符号語選択部21で選択された符号の符号語を構成して、符号語テーブルを作成する。符号語構成部22で作成された符号語テーブルは、符号化部114内の符号語テーブル102および復号化部115内の順方向符号語テーブル110に送られる。復号化部115内の逆方向符号語テーブル112には、順方向とは逆向きに記述された符号語テーブルが送られる。
【0025】
符号選択部21では、入力された情報シンボルを生起確率が大きい順に並べ替えてS={S1 ,S2 ,…,Sn }とし、これらの情報シンボルSの生起確率P={p1 ,p2 ,…,pn }に基づいて、構成可能な符号の集合Cの中から、
【数1】

Figure 0003579412
を満足する符号cを選択する。ここで、Liは符号語構成部22より与えられる符号語の重みによって計算することができる符号長である。この場合の符号語の重みとは、符号語における“1”または“0”の数をいう。
【0026】
以下、符号語構成部22における符号語の構成方法について述べる。
【0027】
図4は、本実施形態による可変長符号の基となる重みが一定の2進符号系列の作り方の例を示している。図4(a)に示すように、start地点からend地点に至る格子状の有向グラフを形成する。この有向グラフについてstart地点からend地点までの経路をたどる際、左側の経路を選択した時は“0”、右側の経路を選択した時は“1”をそれぞれ対応させることにより、図4(b)に示す2進符号系列を生成する。この例では、符号長が5ビットで、重み(“1”の数)が2の2進符号系列を生成している。一般に、符号長がnビットで重みがwの2進符号系列は、n個からw個を選択する組み合わせの数だけ存在する。ここでは、5個から2個を選択する組み合わせの数=10個の2進符号系列が存在することになる。
【0028】
図5は、符号語構成部22における順方向にも逆方向にも復号可能な可変長符号(以下、リバーシブル符号という)の符号語の第1の構成方法を示している。まず、図5の左側に示すように、符号長が短い順に(情報シンボル−1)個(この場合は、9個)だけ、図4の方法によって重み(“1”の数)が一定(この場合は、1個)の2進符号系列を作成する。次に、図5の右側に示すように、この2進符号系列のそれぞれの先頭と末尾に“1”を追加し、最も短い符号には0”を割り当てることによって、リバーシブル符号の符号語を構成する。このリバーシブル符号は、情報シンボルAに対しては符号“0”、それ以外の情報シンボルB〜Jに対しては符号が“1”から必ず始まり、“1”が全部で3個出現したら符号が終わる符号構成、つまり符号の区切り(符号長)が分かる構成となっている。
【0029】
可変長符号がリバーシブル符号、すなわち順方向にも逆方向にも復号可能な符号であるための必要十分条件は、全ての符号語が順方向の復号木の葉と逆方向の復号木の葉に割り当てられることである。復号木の葉とは、復号木の末端、つまりそれより先には何も無い個所をいう。例えば、図5の可変長符号は、全ての情報シンボルA〜Jに対応する符号語が図6(a)に示す順方向の復号木の葉にも、図6(b)の逆方向の復号木の葉にも割り当てられることから、順方向にも逆方向にも復号可能であることが分かる。
【0030】
図5の可変長符号の符号語構成方法のパラメータは、符号語中の“1”の数を重みとし、重みを2以上の自然数wとすることにより、様々な情報シンボルの生起確率に対応することができる。もちろん、ビットを反転させて、“0”の数を重みと考えて議論しても同様である。
【0031】
図7は、符号語構成部22におけるリバーシブル符号の符号語の第2の構成方法を示している。まず、図7の左側に示すように、符号長が短い順に(情報シンボル/2)個だけ、図4の方法によって重み(“1”の数)が一定(この場合は、1個)の2進符号系列を作成する。次に、図7の中央に示すように、この2進符号系列のそれぞれの先頭と末尾に“1”を追加し、さらに図7の右側に示すように、各符号語をビット反転させた符号語を追加する。
【0032】
この可変長符号では、各符号の最初にあるシンボルの個数をカウントすることによって符号長が分かる。図7の例では、各符号の最初にあるシンボルが4つ出現したら符号が終わる符号構成、つまり符号の区切り(符号長)が分かる符号構成となっている。
【0033】
この図7の可変長符号は、全ての情報シンボルA〜Jに対応する符号語が図8(a)に示す順方向の復号木の葉にも、図8(b)の逆方向の復号木の葉にも割り当てられることから、順方向にも逆方向にも復号可能であることが分かる。
【0034】
図9は、符号語構成部22におけるリバーシブル符号の符号語の第3の構成方法を示している。このリバーシブル符号は、“0”と“1”の数が同じ数になることで、符号語の符号長が分かるような符号構成となっている。すなわち、図9(a)に示す格子状の有向グラフを考え、この有向グラフについてstart地点から出発して左側の経路を選択した時は“0”、右側の経路を選択した時は “1”をそれぞれ対応させ、start地点を通る対角線上の黒丸の点に到達する経路を符号語として生成する。
【0035】
この場合、全ての情報シンボルA〜Jに対応する符号語が図10(a)に示す順方向の復号木の葉にも、図10(b)の逆方向の復号木の葉にも割り当てられることから、順方向にも逆方向にも復号可能であることが分かる。
【0036】
次に、本発明に係るリバーシブル符号の短縮化方法について説明する。情報シンボルの数、つまり可変長符号の符号数は有限であるため、可変長符号の一部の符号を短縮化することが可能である。ここで、短縮化とは他の符号の符号長を増やすことなく、一部の符号の符号長を縮めることをいう。図11は、リバーシブル符号の短縮化方法の一例を示している。
【0037】
例えば、図7に示したリバーシブル符号は情報シンボルG,H,I,Jに対応する符号語の末尾の1ビットを削除しても、順方向および逆方向のいずれの方向からも復号可能である。これを利用して、図11では情報シンボルG,H,I,Jに対応する4つの符号語の符号長を短縮化している。
【0038】
そして、この図11に示す可変長符号は、全ての情報シンボルA〜Jに対応する符号語が図12(a)に示す順方向の復号木の葉にも、図12(b)の逆方向の復号木の葉にも割り当てられることから、順方向にも逆方向にも復号可能であることが分かる。
【0039】
次に、図13を参照して本発明に係るリバーシブル符号の拡張化方法について説明する。リバーシブル符号の拡張化は、各符号の先頭および末尾の少なくとも一方に等長符号を付加して、同一の符号長の符号語数を拡大することで実現することができる。図13の例では、左側に示すリバーシブル符号のそれぞれの末尾に2ビットの等長符号を付加している。この場合、リバーシブル符号の各符号は全体的に符号長が2ビット増加しているが、同じ符号長の符号語の数は4倍に拡大されている。一般に、nビットの等長符号を付加した場合、符号長は全体的にnビット増加するが、同じ符号長の符号語の数を2倍にすることができる。等長符号は、明らかにリバーシブル符号なので、等長符号をリバーシブル符号の先頭や末尾に付加しても、やはりリバーシブル符号である。
【0040】
図14は、英語のアルファベットである情報シンボルに対して本発明により可変長符号化を行って得られたリバーシブル符号を公知例(特開平5−300027号公報)に開示されているリバーシブル符号と比較して示したものである。図14中に示される本発明に基づくリバーシブル符号は、図5で示した方法において符号語の重みを0とした時の符号を末尾に2ビットの等長符号を付加することによって拡張化した符号である。
【0041】
この本発明に基づくリバーシブル符号は、順方向のみ復号可能な可変長符号の最適符号であるハフマン符号には劣るものの、公知例に開示されたリバーシブル符号と比較して平均符号長が短く、優れた性能を持っていることが分かる。これは、公知例のリバーシブル符号は順方向にのみ復号可能な可変長符号であるハフマン符号の末尾にビットを付加したものであるのに対して、本発明では余分なビットを付加することなく、初めからリバーシブル符号を構成するので、無駄なビットパターンが少ないことによる。
【0042】
次に、本発明の他の実施形態を説明する。
図15は、本発明の他の実施形態に係る可変長符号化/復号化装置の構成を示すブロック図である。本実施形態の可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部201、符号化部213、伝送系または蓄積系205および復号化部214からなる。
【0043】
これら各部の機能について簡単に説明すると、符号語テーブル作成部201は情報シンボルの生起確率に基づき符号語テーブルを作成して、符号化部213内の符号語テーブル202に送り、さらに作成した符号語テーブルの符号語のパラメータを復号化部214内の復号グラフ・復号値テーブル作成部208に送る。符号化部213は、情報シンボルを可変長符号に符号化し、その可変長符号を符号化データとして伝送系また蓄積系205へ出力する。復号化部214は、伝送系または蓄積系205を介して入力されてきた符号化データを復号して元の情報シンボルを再生する。
【0044】
次に、本実施形態の各部の詳細な構成と動作を説明する。
符号化部213において、入力された情報シンボルは符号化器203に入力される。符号語テーブル202は、符号語テーブル作成部201によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。但し、符号語テーブル202には入力され得る情報シンボルの全てに対応する符号語が格納されているわけではなく、比較的出現頻度の高い一部の情報シンボルに対応した符号語のみが格納されているものとする。符号化器203は符号語テーブル202に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択して符号化データとして出力する。
【0045】
一方、符号化部213に符号語テーブル202に対応する符号語が存在しない情報シンボル、つまり出現頻度の比較的低い情報シンボルが入力されたときは、その情報シンボルに対応した固定長符号を固定長符号符号化部204で作成し、さらに符号語テーブル202中のエスケープ符号を固定長符号の先頭と末尾に付加して符号語とし、これを符号化データとして出力する。
【0046】
こうして符号化部213内の符号化器203から出力された符号化データは、伝送系または蓄積系205を通して復号化部214に送られる。この際、符号化データには一定周期毎に同期コードが挿入される。
【0047】
復号化部214は、同期コード検出部206、バッファ207、復号グラフ・復号値テーブル作成部208、順方向復号化器209、固定長復号化部210、逆方向復号化器211および復号値判定部212からなり、まず伝送系または蓄積系205より入力された符号化データから同期コード検出部206で同期コードを検出し、同期コードと同期コードの間の符号化データをバッファ207に蓄積する。順方向復号化器209では、バッファ207に蓄積された符号化データの先頭から復号を開始し、逆方向復号化器211では、バッファ207に蓄積された符号化データの末尾から復号を開始する。復号値判定部212では、順方向復号化器209によって得られた復号結果(順方向復号値という)と、逆方向復号化器211によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。
【0048】
図16は、図15中の符号語テーブル作成部201において、固定長符号の先頭と末尾にエスケープ符号を付加して符号語を構成する方法を示した図である。図16(a)に示すように、符号語テーブル作成部201が作成する符号語は、情報シンボルが“A”以外のときは、“1”の数が3つ出現することで符号の区切りがわかるリバーシブル符号を基本としている。このリバーシブル符号を符号(1)と呼ぶこととする。
【0049】
一方、図16(b)に示す符号(2)は、符号(1)の情報シンボル“C”に対応する符号語“1011”を固定長符号の先頭と末尾を示すためのエスケープ符号として、3ビットの固定長符号の先頭と末尾に付加することにより構成された符号語を符号(1)に新たに加えたものとなっている。但し、符号(2)のうち符号(1)に相当するリバーシブル符号の部分は、符号(2)でエスケープ符号として用いた符号語“1011”は使用せず、符号(1)により1個少ない情報シンボルA〜Iに対応した符号語のみを用いている。図16(a)(b)を比較して明らかなように、符号(2)は符号化できる情報シンボルの数が符号(1)の「10」から「17」に増えている。
【0050】
このような符号(2)を復号するためには、図16(a)(b)から分かるように順方向から復号する場合も逆方向から復号する場合も、必ず符号(1)を一度復号することになり、また固定長符号は順方向からも逆方向からも復号可能であるため、符号(1)が順方向からも逆方向からも復号可能ならば、符号(2)も順方向からも逆方向からも復号可能となる。
【0051】
従来のリバーシブル符号の場合は、入力され得る情報シンボルに対応する符号語を全て符号語テーブルとして符号化部213および復号化部214において用意しておく必要があった。これに対し、符号(2)によると、固定長符号の部分については、3ビットの2進符号として別途に固定長符号符号化部204および固定長符号復号化部210として用意できるので、符号語テーブル202には符号(1)の符号語だけを格納しておけばよい。したがって、従来のリバーシブル符号と比較して、可変長符号化/復号化装置の記憶量を大幅に削減することが可能となる。
【0052】
復号グラフ・復号値テーブル作成部208は、Shalkwijkのアルゴリズムを基にした復号グラフと、復号値テーブルを作成し、順方向復号化器209および逆方向復号化器211は、これらの復号グラフおよび復号値テーブルに基づいて復号化を行う。
【0053】
図17は、重み一定の2進符号系列の数え上げの方法を示している。重み一定の2進符号系列の数え上げを行うアルゴリズムとしては、J.P.M.Shalkwijk:“An algorithm for source coding”,IEEE Trans.Infrom Theory,vol.IT−18,no.3,pp.395−399,May 1972.がShalkwijkのアルゴリズムとしてよく知られている。Shalkwijkのアルゴリズムでは、図17(a)に示すように「パスカルの三角形」を基本とした、START地点からEND地点に至る格子状の有向グラフを形成する。各節点に数字で示された値は、START地点の節点の値を1として、各節点に入ってくる2つの矢の起点にある節点の値の合計値となっている。すなわち、各節点の値はパスカルの三角形によって決定される。
【0054】
そして、図17(a)の有向グラフについて、入力される情報シンボルに従ってSTART地点からEND地点までの経路をたどる際に、左側の経路(矢)を選択したときには符号語の“0”、右側の経路(矢)を選択したときには符号語の“1”をそれぞれ対応させることにより、重み2の2進符号系列を生成することができる。ここで、“0”を選択したときに矢の終点にある節点の値から矢の起点にある節点の値を引いた値を合計した値が、その2進符号系列の同一符号長の符号語についての順序値となる。例えば入力される情報シンボルが“01001”であれば、3つある“0”に対して節点の値の差分の合計である(1−1)+(3−2)+(4−3)=2が順序値となる。ここで、順次値とは同一符号長の異なる符号語を順序付けるための値である。図17(b)は、この場合の情報シンボルと順序値との関係を示している。
【0055】
このShalkwijkのアルゴリズムを符号化に適用した例は公知であり、その場合は上記の順序値に相当する値を2進符号に変換することによって符号化を行う。これに対し、本実施形態ではこのアルゴリズムを以下に説明するように復号化に用いる。
【0056】
すなわち、復号グラフ・復号値テーブル作成部208では、上述したShalkwijkのアルゴリズムを基にして有向グラフを復号グラフとして作成する。すなわち、この復号グラフはパスカルの三角形によって決まる値を節点の値とし、符号語の“1”および“0”を矢とした有向グラフであり、その一例を図18(a)に示す。図18(b)は、この復号グラフを用いた順方向復号化器208および逆方向復号化器211における復号値の計算方法の一例を示している。
【0057】
図16(a)に示した符号(1)は、先頭が“0”以外のときは“1”が3つ出現した地点で区切りが分かるリバーシブル符号である。この符号(1)のリバーシブル符号の復号値を計算する際には、順方向についてはリバーシブル符号の先頭が“0”ならば復号値を0とし、それ以外のときは先頭と末端の“1”を削除した後、Shalkwijkのアルゴリズムによって順序値を計算する。今、復号しようとしている符号語より符号長の短い符号語の数は、図18(a)におけるEND地点の右斜めの節点の値の合計+1となるので、その値を順序値に足したものが復号値となる。
【0058】
一方、逆方向については上述の順方向の場合と同様に、まずリバーシブル符号の先頭が“0”ならば復号値を0とし、それ以外のときは先頭と末端の“1”を削除し、さらに残りの部分を反転させた後、Shalkwijkのアルゴリズムで順序値を計算する。そして、この順序値にEND地点の右斜め上にある節点の合計+1を足したものを復号値とする。
【0059】
図18(a)(b)を参照して具体的に説明すると、例えばリバーシブル符号の復号対象の符号語が“10101”ならば、まず先頭と末端の“1”を削除して“010”とする。この“010”に対してShalkwijkのアルゴリズムで順序値を求めると、2つある“0”に対して、(1−1)+(3−2)=1となる。この場合のEND地点の斜め右上にある節点の値の合計は1+2=3なので、この値+1(=4)を順序値(=1)に加えて、復号値が5として求まることになる。
【0060】
このような復号グラフを用いて復号化を行うと、記憶量を大きく低減することができる。図19(a)(b)は、従来の復号木を用いる復号化方法と、本実施形態による復号グラフを用いる復号化方法で必要な記憶量の違いを示した図である。両者を節点の数で比較すると、各節点から出る矢の数は共に2つで同じであるが、各節点に入ってくる矢は図19(a)の復号木の場合、必ず1つである。これに対して、図19(b)の復号グラフの場合は、各節点に2つの矢が入ってくるので、その分だけ同じ符号語で必要とする節点の総数が少なくなる。この例では、図19(a)の復号木が15個の節点を必要としているのに対し、図19(b)の復号グラフでは8個の節点で済む。従って、復号グラフを用いる本実施形態の復号化方法は、従来の復号木を用いる方法よりも必要な記憶量が少なくなるという利点がある。
【0061】
また、本実施形態では図16(b)に示したエスケープ符号を付加した符号 (2)を復号するために、図20(a)に示す符号(1)の復号値テーブルと、図20(b)に示す固定長符号の復号値テーブルの2つを用意し、符号(1)の復号値テーブルでエスケープ符号が復号されたときは、固定長符号の復号値テーブルを読みに行く。例えば、符号語が“10110011011”の場合、先頭の“1011”、すなわちエスケープ符号が復号されたら、次の3ビット“001”は固定長符号であると見なして固定長符号復号化部210で復号を行う。この場合、“001”の復号値として1が得られるので、図20(a)の固定長符号の復号値テーブルから、復号結果は情報シンボル“K”となる。
【0062】
次に、本発明を動画像符号化/復号化器に適用した一実施形態について説明する。図21は、上述した可変長符号化/復号化装置が組み込まれた動画像符号化/復号化器の概略的構成を示すブロック図である。
【0063】
図21(a)に示す動画像符号化器709において、情報源符号化器702で符号化されたデータは、動画像多重化部703で可変長符号化、通信路符号化および多重化等が行われ、さらに伝送バッファ704で伝送速度の平滑化がなされた後に、符号化データとして伝送系または蓄積系705に送り出される。符号化制御部701は、伝送バッファ704のバッファ量を考慮して、情報源符号化器702および動画像多重化部703の制御を行う。
【0064】
一方、図21(b)に示す動画像復号化器710においては、伝送系または蓄積系705からの符号化データが受信バッファ706に一旦溜められ、動画像多重化分離部707で符号化データの多重化分離、通信路符号復号化および可変長符号復号化が行われた後、情報源復号化器708に送られ、最終的に動画像が復号化される。
【0065】
図22は、図21における動画像符号化器709および動画像多重化分離部707での動画像符号化方式のシンタックスを示している。図22(a)に示すピクチャ階層のうち、上位階層にはマクロブロックのモード情報や動きベクトル情報やINTRA DCなどのDCT係数以外の情報を配し、下位階層にはDCT係数情報を配しており、下位階層部分に本発明によるリバーシブル符号を適用している。
【0066】
図23(a)(b)は、図21における動画像多重化部703および動画像多重化分離部707のより詳しい構成を示すブロック図である。図23(a)に示す動画像多重化部703においては、図21の情報源符号化器702からの符号化データのうち、マクロブロックのモード情報や動きベクトル情報やINTRADCなどの、DCT係数以外の情報は上位階層として、上位階層可変長符号化器901で通常の可変長符号化が行われた後、さらに上位階層通信路符号化器902で冗長度は大きいが訂正能力の高い誤り訂正検出符号により通信路符号化され、多重化部905に送られる。
【0067】
一方、情報源符号化器702からの符号化データのうち、DCT係数は下位階層可変長符号化器903でリバーシブル符号に符号化され、さらに下位階層通信路符号化器904で冗長度の少ない誤り訂正検出符号により通信路符号化された後、多重化部905に送られる。多重化部905では、上位階層の符号化データと下位階層の符号化データを多重化し、伝送バッファ704に送る。
【0068】
図23(b)に示す動画像多重化分離部707においては、まず受信バッファ706からの符号化データが多重化分離部906で上位階層と下位階層に分離される。上位階層の符号化データは上位階層通信路復号化器907で復号され、その復号結果は上位階層可変長復号化器909に送られる。下位階層の符号化データは下位階層通信路復号化器908で復号され、その復号結果は下位階層可変長復号化器910に送られる。
【0069】
下位階層可変長復号化器910はリバーシブル符号の復号を行い、復号結果を情報源復号化器708および上位階層可変長復号化器909に送る。上位階層可変長復号化器909は、上位階層の符号化データである可変長符号の復号を行うと共に、下位階層可変長復号化器910の復号結果を基に符号化結果の書き換えを行う。
【0070】
ここで、図23(a)中の下位階層可変長符号化器903は図15中の符号化部213に、図23(b)中の下位階層可変長復号化器910は図15中の復号化部214にそれぞれ対応している。
【0071】
本実施形態の動画像符号化/復号化器に見られるように、符号化方式に図22に示したようなシンタックスがある場合には、可変長符号そのものを両方向から復号できるのみでなく、シンタックス的にも両方向から復号できるようにする必要がある。本実施形態では、以下に説明する符号語テーブルを用いることによって、この要求を実現している。
【0072】
図24〜図28は、下位階層可変長符号化器903で用いるDCT係数の可変長符号の符号語テーブルの一例を示している。また、図29はエスケープ符号の符号語テーブルを示している。
【0073】
情報源符号化器702では、量子化後の8×8のDCT係数のブロックについてはブロック内のスキャンを行って、LAST(0:ブロックの最後でない非零係数、1:ブロックの最後の非零係数)、RUN(非零係数までの零ランの数)およびLEVEL(係数の絶対値)を求め、動画像符号化器709に送る。
【0074】
動画像符号化器709内の下位階層可変長符号化器903は、図24〜図25に示すINTRAおよびINTERの非LAST係数、RUN、LEVELにリバーシブル符号(VLC_CODE)を対応させた非LAST係数の符号語テーブル(第1の符号語テーブル)と、図26〜図27に示すINTRAおよびINTERのLAST係数、RUN、LEVELにリバーシブル符号(VLC_CODE)を対応させたLAST係数の符号語テーブル(第2の符号語テーブル)を持っている。そして、モード情報に基づいてINTRAのときはINTRAの非LAST係数とLAST係数の符号語テーブル、INTERのときはINTERの非LAST係数とLAST係数の符号語テーブルをそれぞれ選択して符号化を行う。なお、図26〜図27においてVLC_CODEの最終ビットの“S”はLEVELの符号を表し、“S”が“0”のときLEVELの符号は正、“1”のとき負である。
【0075】
また、この符号語テーブルに存在しない係数は、図29に示すようにRUNとLEVELの絶対値を固定長符号に符号化し、この固定長符号の先頭と末端にエスケープ符号を付加し、エスケープ符号の最終ビットでLAST係数とLEVELの正負を区別できるように符号化する。図28は、このエスケープ符号の符号語テーブルであり、エスケープ符号として用いられているVLC_CODEの最終ビットの“t”は、固定長符号の先頭に付加されたときはLAST係数か否かを表し、これが“0”のときは非LAST係数、“1”のときはLAST係数である。また、“t”は固定長符号の末尾に付加されたときはLEVELの符号を表し、これが“0”のときLEVELの符号は正、“1”のときは負である。
【0076】
図30は、本実施形態における符号化データの例を示している。同図に示されるように、下位階層において順方向から復号を行うときは、8×8画素のDCT係数のブロックの末尾に必ずLAST係数の符号が存在するため、ブロックの末尾を判定することができる。一方、逆方向から復号を行うときは、1つアドレスが前のブロックのLAST係数の符号が出現することにより、ブロックの先頭を判定できる。この符号は、LAST係数がINTRAモードとINTERモードで共通化されているため、マククロブロック毎にモードが存在していてもブロックの先頭を判定することができる。
【0077】
下位階層の最初のブロックについては、予め下位階層可変長符号化器903で下位階層の先頭にダミーのLAST係数を符号化しておくか、あるいは、下位階層可変長復号化器910で、次のフレームの同期符号までのビット数から予め下位階層のビット数を計算しておき、これを復号したビット数と比較するか、あるいは、下位階層可変長復号化器910内のバッファで下位階層の先頭にダミーのLAST係数を挿入する方法をとることにより、逆方向に復号したときに下位階層の先頭を判定することができる。
【0078】
図24〜図27に示した符号語テーブルに格納されたリバーシブル符号は、順方向の場合、先頭の1ビットが“0”ならば、“0”が2つ出現するまで読み、“1”ならば、“1”が2つ出現するまで読み、その次の1ビットがLEVELの正負を表す最終ビットとなることが分かる。逆方向の場合は、最初の1ビットがLEVELの正負を表しており、次の1ビットが“0”ならば、“0”が2つ出現するまで読み、“1”ならば、“1”が2つ出現するまで読めばよい。
【0079】
図31は、本実施形態における下位階層可変長符号化器903で用いるDCT係数の可変長符号に適用したリバーシブル符号を復号するための復号グラフを示している。順方向からみて符号語の先頭ビットと末尾の2ビットを除いた符号化データについて、この復号グラフによって復号値を計算することができる。
【0080】
この復号グラフは、先頭のビットが“0”ならば、“0”が現れれば右の矢を進み、“1”が現れれば左の矢を進むこととする。先頭のビットが“1”ならば、“1”が現れれば右の矢を進み、“0”が現れれば左の矢を進むこととする。
【0081】
同一の符号長の2進符号系列についての順序値を求めるには、先に説明したShalkwijkのアルゴリズムに従って、左側の矢を選択したときに矢の終点の節点の値から起点の節点の値を引いた値の合計値をその符号長での順序値とすればよい。
【0082】
一方、復号値を求めるには、先頭のビットが“0”ならば、終端の節点の右斜め上の節点の値の合計値の2倍を順序値に足した値を復号値とすればよい。先頭ビットが“1”ならば、終端の節点の右斜め上の節点の値の合計値の2倍+終端の節点の値に順序値を足した値を復号値とればよい。
【0083】
例えば、復号対象の符号列が“0110101”ならば、まず順方向からみて先頭の1ビットと末尾の2ビットを除いて、“1101”とする。先頭ビットが“0”なので、復号グラフで“0”が現れれば右の矢を進み、“1”が現れれば左の印を進むことになる。この場合、左の矢を進んだときの節点の差分は(1−1)+(1−1)+(4−3)=1なので、順序値は1である。最上位ビットが“0”なので、終端の節点の右斜め上にある節点の合計の2倍(1+2+3)×2=12に順序1を加えると13となり、この符号語の復号値は13として求められることになる。
【0084】
図32〜図34は、下位階層可変長復号化器910で用いる復号値テーブルの一例であり、図32〜図33はINTRAおよびINTERの非LAST係数、RUN、LEVELに復号値を対応させた非LAST係数の復号値テーブルであり、図34(a)(b)はINTRAおよびINTERのLAST係数、RUN、LEVELに復号値を対応させたLAST係数の復号値テーブルである。また、図35はエスケープ符号の復号値テーブルである。
【0085】
この例では、例えば復号値13は図34(a)で分かるように、LAST係数で、RUN数は3、LEVELの絶対値が1であることが分かり、また最下位ビットが“1”であることから、LEVELは負であることが分かる。さらに、図35で分かるように、復号値41が復号された場合は、エスケープ符号が復号されたと判定する。このエスケープ符号の最後のビットでLAST係数か非LAST係数かの判定を行い、その後の13ビットについて固定長符号復号化部210でRUNとLEVELの絶対値を復号した後、再びエスケープ符号を復号し、最後のビットでLEVELの正負を決定する。
【0086】
一例として、符号化対象の符号列が“110000010000111000101111000010”の場合を考える。この場合、先頭のエスケープ符号“11000010”の最終ビットが“0”なので、非LAST係数であり、その後の13ビットの固定長符号を計算する。この13ビットのうち上位6ビットがRUNを表すので、“000111”でRUNは7、下位7ビットがLEVELの絶対値を表すので、“0001011”でLEVELの絶対値は12、末尾のエスケープ符号“11000010”の最終ビットが“0”なのでLEVELは正、というように復号を行うことができる。
【0087】
復号値判定部212では、このようにして順方向復号化器209によって得られた復号結果(順方向復号結果という)と、逆方向復号化器211によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。すなわち、復号値判定部212では符号化データに誤りがあると、下位階層通信路復号化器908の復号結果、あるいは、符号語として存在しなかったビットパターンが生じることから、誤りの存在が分かるので、これらの順方向復号結果と逆方向復号結果から、図36に示すようにして復号値を判定する。なお、図36は下位階層の復号値判定方法を示している。
【0088】
まず、図36(a)に示すように順方向復号結果と逆方向復号結果で誤りが検出されるマクロブロックの位置(誤り検出位置)が交差しない場合は、誤りが検出されなかったマクロブロックの復号結果のみを復号値として使用し、二つの誤り検出位置の復号結果は復号値として使用しない。そして、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては前フレームをそのまま表示するように、INTERマクロブロックについては前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換える。
【0089】
また、図36(b)に示すように順方向復号結果と逆方向復号結果で誤りが検出位置が交差する場合は、両方で誤りが検出されなかった復号結果を復号結果値として使用する。また、この場合には二つの誤り検出位置の符号語の間の復号結果は復号値として使用せず、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては前フレームをそのまま表示するように、INTERマクロブロックについては前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換える。
【0090】
また、図36(c)に示すように順方向復号結果および逆方向復号結果のうち、片方向の復号結果にしか誤りが検出されない場合(この例では、順方向復号結果のみ誤りが検出されている)は、誤り検出位置のマクロブロックは復号値として使用せず、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては前フレームをそのまま表示するように、INTERマクロブロックについては前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換える。それ以後のマクロブロックに対する復号値は、逆方向の復号結果を使用する。
【0091】
さらに、図36(d)に示すように同一のマクロブロックで順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、誤り検出位置のマクロブロックの復号値は放棄して復号値として使用せず、上位階層のモード情報の復号結果に基づいて、INTRAマクロブロックについては前フレームをそのまま表示するように、INTERマクロブロックについては前フレームより動き補償のみで表示するように、上位階層の復号結果を書き換え、それ以後のマクロブロックに対する復号値は逆方向の復号結果を使用する。
【0092】
マクロブロックの符号化/復号化の順序については、上記実施形態以外の方法でもよく、例えば誤りがあったときに、復号画像のうちより重要な画面中央部が救済されるように、図37に示すような順序とする方法でもよい。すなわち、両方向から復号することを前提とすると、同期符号と同期符号の間の符号化データのうち、最初の方の部分と最後の方の部分が正しく復号される確率が高いので、これの部分が中央部にくるように順序を決めるのである。
【0093】
なお、上記実施形態ではDCT係数の可変長符号化に本発明を適用したが、他の情報シンボルについても同様の可変長符号化を適用できることは、言うまでもない。
また、上記実施形態では2元符号のみの議論を示したが、多元符号にも拡張することが容易であり、同様な効果を得ることができる。
【0094】
最後に、本発明の応用例として、本発明による可変長符号化/復号化装置を適用した画像送受信装置の実施形態を図38を用いて説明する。パーソナルコンピュータ(PC)1001に備えら付けられたカメラ1002より入力された画像信号は、PC1001に組み込まれた可変長符号化装置によって符号化される。この場合の情報シンボルは、これに限るものではないが、例えば入力画像信号または入力画像信号と予測画像信号との差である予測誤差信号をDCT回路によって離散コサイン変換し、さらに量子化回路により量子化して得られたDCT係数データなどである。可変長符号化装置から出力される符号化データは、他の音声やデータの情報と多重化された後、無線機1003により無線で送信され、他の無線機1004によって受信される。無線機1004で受信された信号は、画像信号の符号化データおよび音声やデータの情報に分解される。これらのうち、画像信号の符号化データはワークステーション(EWS)1005に組み込まれた可変長符号復号化装置によって復号され、EWS1005のディスプレイに表示される。
【0095】
一方、EWS1005に備え付けられたカメラ1006より入力された画像信号は、EWS1006に組み込まれた可変長符号化装置を用いて上記と同様に符号化される。符号化データは、他の音声やデータの情報と多重化され、無線機1004により無線で送信され、無線機1003によって受信される。無線機1003によって受信された信号は、画像信号の符号化データおよび音声やデータの情報に分解される。これらのうち、画像信号の符号化データはPC1001に組み込まれた可変長符号復号化装置によって復号され、PC1001のディスプレイに表示される。
【0096】
本発明の可変長符号化/復号化装置は、情報シンボルの出現頻度に応じた符号長を有し、従来と比較して無駄なビットパターンが少なくて効率がよく、しかも順方向にも逆方向にも復号が可能なリバーシブルの可変長符号を構成することができるので、図38に示した無線伝送路のような誤りが多い伝送路を用いた送受信装置において特に有効である。
【0097】
以上実施形態で説明したように、本発明の可変長符号化/復号化装置は、従来と比較して、少ない記憶量で復号することができ、従来適用することのできなかったような情報シンボル数が大きな符号化に対しても適用することができる。
【0098】
具体的には、動画像符号化/復号化装置にも適用することが可能であり、誤りに強い動画像符号化/復号化装置を提供することができる。
【0099】
【発明の効果】
以上説明したように、本発明によれば順方向にも逆方向にも復号可能で、しかも符号化効率や装置に必要な記憶量などの点で実用性に富んだ可変長復号化方法及び装置を提供することができる。
【0100】
すなわち、順方向にも逆方向にも復号可能で、符号語の“1”または“0”の数によって符号の区切りが分かるように構成された複数の符号語を情報シンボルに対応させて格納した符号語テーブルを構成し、この符号語テーブルを用いて無駄なビットパターンが少なく符号化効率のよい可変長符号を復号できる。
【0101】
また、符号語の“1”または“0”の数によって符号長を定めることができ、順方向からも逆方向からも復号可能な符号語によって構成される可変長符号語を対象として、パスカルの三角形によって決まる値を節点の値とし、各節点から次の節点に至る矢を符号語の“1”および“0”に対応させた有向グラフ(復号グラフ)によって復号値を計算することによって、情報シンボル数が大きな場合にも少ない記憶量で可変長符号の復号を行うことができる。
【図面の簡単な説明】
【図1】本発明の一実施形態に係る可変長符号化/復号化装置の構成を示すブロック図
【図2】図1における復号値判定部の動作を説明するための図
【図3】図1における符号語テーブル作成部のブロック図
【図4】本発明に係る可変長符号の基となる重み一定の2進符号系列の作成方法を示す図
【図5】図3における符号語構成部での第1の符号語構成方法を示す図
【図6】第1の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図
【図7】図3における符号語構成部での第2の符号語構成方法を示す図
【図8】第2の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図
【図9】図3における符号語構成部での第3の符号構成方法を示す図
【図10】第3の符号構成方法で構成した符号語から作成した順方向および逆方向の復号木を示す図
【図11】図3における符号語構成部での符号短縮化方法を示す図
【図12】符号短縮化方法で短縮化した符号語から作成した順方向および逆方向の復号木を示す図
【図13】図3における符号語構成部での符号拡大化方法を示す図
【図14】本実施形態で構成された可変長符号と公知例の可変長符号の特性を比較して示す図
【図15】本発明の他の実施形態に係る可変長符号化/復号化装置の構成を示すブロック図
【図16】図15における符号語構成部での符号構成方法を示す図
【図17】重み一定の2進系列を数え上げる方法を示す図
【図18】図15における順方向復号化器および逆方向復号化器の動作を示す図
【図19】従来の復号木と本実施形態における復号グラフを比較して示す図
【図20】本実施形態における復号値テーブルを説明するための図
【図21】本発明による可変長符号化/復号化装置が組み込まれた動画像符号化/復号化器の概略構成を示すブロック図
【図22】同実施形態に係る動画像符号化/復号化器における符号化データのシンタックスを示す図
【図23】図21における動画像多重化部および動画像多重化分離部の構成を示すブロック図
【図24】同実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの一部を示す図
【図25】同実施形態におけるINTRAおよびINTERの非LAST係数の符号語テーブルの他の一部を示す図
【図26】同実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの一部を示す図
【図27】同実施形態におけるINTRAおよびINTERのLAST係数の符号語テーブルの他の一部を示す図
【図28】同実施形態におけるエスケープ符号の符号語テーブルを示す図
【図29】同実施形態における符号語テーブルにない符号語の符号化方法を示す図
【図30】同実施形態における符号化データの例を示す図
【図31】同実施形態における復号グラフを示す図
【図32】同実施形態におけるINTRAおよびINTERの非LAST係数の復号値テーブルの一部を示す図
【図33】同実施形態におけるINTRAおよびINTERの非LAST係数の復号値テーブルの他の一部を示す図
【図34】同実施形態におけるINTRAおよびINTERのLAST係数の復号値テーブルを示す図
【図35】同実施形態におけるエスケープ符号の復号値テーブルを示す図
【図36】図15における復号値判定部の動作を説明するための図
【図37】同実施形態におけるマクロブロックの符号化/復号化順序を示す図
【図38】本発明による可変長符号化/復号化装置が組み込まれる装置の一例を示す図
【図39】リバーシブル符号の一般的な復号方法を示す図
【図40】通常の可変長符号の説明図
【図41】従来のリバーシブル符号の説明図
【符号の説明】
101…符号語テーブル作成部
102…符号語テーブル
103…符号化器
104…伝送系または蓄積系
105…同期コード検出部
106…バッファ
107…順方向復号化器
108…逆方向復号化器
109…復号値判定部
110…順方向復号語テーブル
111…順方向復号木作成部
112…逆方向符号語テーブル
113…逆方向復号木作成部
114…符号化部
115…復号化部
21…符号選択部
22…符号語構成部
201…符号語テーブル作成部
202…符号語テーブル
203…符号化器
204…固定長符号符号化部
205…伝送系または蓄積系
206…同期コード検出部
207…バッファ
208…復号グラフ・復号値テーブル作成部
209…順方向復号化器
220…固定長符号復号化部
211…逆方向復号化器
212…復号値判定部
213…符号化部
214…復号化部
701…符号化制御部
702…情報源符号化器
703…動画像多重化部
704…伝送バッファ
705…伝送系または蓄積系
706…受信バッファ
707…動画像多重化分離部
708…情報源復号化器
709…動画像符号化器
710…動画像復号化器
901…下位階層可変長復号化器
902…上位階層通信路符号化器
903…下位階層可変長符号化器
904…下位階層通信路符号化器
905…多重化部
906…多重化分離部
907…上位階層通信路復号化器
908…下位階層通信路復号化器
909…上位階層可変長復号化器
910…下位階層可変長復号化器
1001…パーソナルコンピュータ
1002…ワークステーション
1003…無線機
1004…無線機
1005…カメラ
1006…カメラ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a variable length decoding method and apparatus.
[0002]
[Prior art]
The variable-length code has a short code length on average by assigning a frequently occurring symbol to a short code length code and a rarely occurring symbol to a long code length code based on the frequency of occurrence of the symbol. The coding system is as described above. Therefore, when the variable length code is used, the data amount can be significantly reduced as compared with the data before encoding. As a method of configuring such a variable length code, Huffman's algorithm that is optimal for a memoryless information source is known.
[0003]
As a general problem of the variable length code, when an error is mixed in the coded data due to a transmission line error or other reasons, the effect of the data after the error is mixed is propagated correctly by the decoding device. The point is that decoding cannot be performed. Therefore, when there is a possibility that an error may occur in the transmission path, a method is generally adopted in which a synchronization code is periodically inserted at certain intervals to prevent the propagation of the error. A bit pattern that does not appear in a combination of variable length codes is assigned to the synchronization code. According to this method, even if an error occurs in the encoded data and decoding becomes impossible, by finding the next synchronization code, error propagation can be prevented and decoding can be performed correctly. However, even when the synchronous code is used, as shown in FIG. 39 (a), the encoded data from the point where an error occurs and cannot be decoded correctly to the point where the next synchronous code is found can be decoded. Can not do.
[0004]
Therefore, the variable length code is changed from the normal configuration shown in FIG. 40 to that shown in FIG. 41, so that not only the characteristic that can be decoded from the normal forward direction but also the reverse direction as shown in FIG. There is known a method of forming a code that can be decoded. In addition, since such a code can read encoded data in the reverse direction, it can be used for reverse reproduction on a storage medium such as a disk memory for storing encoded data. Such a variable length code that can be decoded not only in the forward direction but also in the reverse direction is referred to as a reversible code here. An example of the reversible code is described in, for example, Japanese Patent Application Laid-Open No. 5-300027 "Reversible Variable Length Coding". In the reversible code of this known example, as shown in FIG. 41, each code word has a longer code length at the end of the code word of the Huffman code which is a variable length code decodable from the forward direction as shown in FIG. This is a variable length code that can be decoded even in the reverse direction by adding bits under conditions that do not match the end of another codeword.
[0005]
However, this reversible code adds bits to the end of a codeword of a variable-length code that can be decoded only in the forward direction, so that useless bits increase and the average code length increases. As a result, the coding efficiency is greatly reduced as compared with a variable length code that can be decoded only in the forward direction.
[0006]
Another problem of the conventional reversible code is that when the number of information symbols is large, the amount of storage required by the variable-length encoding / decoding device increases, which is not suitable for practical use. was there. An example of a case where the number of information symbols is large is DCT coefficient encoding which is often used in image encoding of a moving image or a still image. Normally, in image coding, DCT (discrete cosine transform) of 8 × 8 is performed, and 8-bit linear quantization is performed on orthogonal transform coefficients obtained as DCT coefficients. Further, zigzag scanning is performed on the quantized DCT transform coefficients from a low frequency band, and variable length coding is performed using a set of zero-run and non-zero coefficients.
[0007]
For example, ITU-T DRAFT Recommendation H. In H.263 (1995), the quantization index value is -127 to +127 (the index value 0 is a run, so the number of indexes is 253), the number of zero runs is up to 63, and the last DCT coefficient of the block is a non-zero coefficient. Since the coding for discriminating whether or not is adopted, the number of information symbols is a very large number of 253 × 64 × 2 = 32384. Then, H. In H.263, the DCT coefficient with a high appearance probability is coded with a variable length code, but the DCT coefficient with a low appearance probability is a 1-bit code and a zero run as a code indicating whether the block is the last non-zero coefficient. The fixed-length coding is performed using a total of 15-bit codes including a 6-bit code and an 8-bit code as a quantization index, and a code called an escape code is added to the head of the fixed-length code.
[0008]
Encoding / decoding is possible even if all codewords are stored as a codeword table, but with the above-described code configuration, a fixed-length 15-bit code is not a variable-length code. Since encoding / decoding can be performed separately, it is only necessary to prepare a codeword table of DCT coefficients and escape codes having a high appearance probability. Therefore, it is possible to reduce the storage capacity by reducing the codeword table of the variable length code.
[0009]
However, as described above, the conventional reversible code cannot add an escape code because it is necessary to add a bit to the end of a variable-length code word that can be decoded only in the forward direction. Therefore, even when the number of information symbols is large, it is necessary to prepare code words corresponding to all information symbols, and the storage amount becomes enormous.
[0010]
[Problems to be solved by the invention]
As described above, a reversible code according to the related art, that is, a variable-length code that can be decoded from both the forward direction and the reverse direction is obtained by adding a bit to the end of a code word of a variable-length code that can be decoded only from the forward direction. Since a reversible code is configured, the number of useless bit patterns increases, the average code length increases, and there is a problem that the coding efficiency is significantly reduced as compared with a variable length code that can be decoded only in the forward direction. In such a variable-length encoding / decoding device using a reversible code, it is necessary to prepare a codeword table having codewords corresponding to all information symbols in some form. When the number is large, there is a problem that a large storage amount is required, and there is a problem that it is not suitable for practical use in any case.
[0011]
SUMMARY OF THE INVENTION An object of the present invention is to provide a variable length decoding method and apparatus that can be decoded in both the forward and reverse directions and have high practicality.
[0012]
More specifically, an object of the present invention is to provide a variable length decoding method and apparatus which can be decoded in both the forward and reverse directions and do not require a large storage amount even when the number of information symbols is large. And
[0013]
[Means for Solving the Problems]
In order to solve the above problem, the present invention is capable of decoding in both the forward and reverse directions when decoding encoded data composed of a variable length code that can be decoded in both the forward and reverse directions. A codeword table is formed in which a plurality of codewords configured so that the delimiters of the codewords can be recognized by the predetermined number of words “1” or “0” are stored corresponding to different information symbols, respectively. It is characterized in that encoded data is decoded using a codeword table.
[0014]
Further, according to the present invention, when decoding encoded data composed of a variable-length code that can be decoded in both the forward and reverse directions, the code length of the variable-length code is set to a predetermined “1” or “0” of a code word. , The value determined by the Pascal's triangle is taken as the value of the node, and the arrow from each node to the next node has the same code length using a directed graph corresponding to the code words “1” and “0”. The method is characterized in that order values for different codewords are obtained, and a decoded value is calculated using the order values and the directed graph. Thus, even when the number of information symbols is large, decoding of the variable length code can be performed with a small storage amount.
[0015]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram illustrating a configuration of a variable-length encoding / decoding device according to an embodiment of the present invention. The variable-length encoding / decoding device according to the present embodiment is roughly divided into a codeword table creation unit 101, an encoding unit 114, a transmission or accumulation system 104, and a decoding unit 115. First, the function of each of these units will be briefly described. The codeword table creation unit 101 creates a codeword table based on the occurrence probabilities of information symbols, and encodes the encoding table 102 in the encoding unit 114 and the decoding unit 115. To the forward codeword table 110 and the backward codeword table 112. Encoding section 114 encodes the information symbol into a variable length code, and outputs the variable length code to transmission system or storage system 104 as encoded data. Decoding section 115 decodes the coded data input via transmission system or storage system 104 to reproduce the original information symbols.
[0016]
Next, a detailed configuration and operation of each unit of the present embodiment will be described. In the encoding unit 114, the input information symbols are input to the encoder 103. On the other hand, the codeword table 102 stores information symbols created in advance by the codeword table creation unit 101 and codewords of variable-length codes in association with each other. The encoder 103 selects a codeword corresponding to the input information symbol from the codewords stored in the codeword table 102, and outputs the selected codeword as encoded data. This encoded data is sent to the decoding unit 115 through the transmission system or the storage system 104. At this time, a synchronization code is inserted into the encoded data at regular intervals.
[0017]
In the decoding unit 115, a synchronization code is detected by the synchronization code detection unit 105 from the encoded data input from the transmission system or the storage system 104, and the encoded data between the synchronization codes is stored in the buffer 106. The forward decoder 110 starts decoding from the head of the encoded data stored in the buffer 106 based on the forward decoding tree from the forward decoding tree creating unit 111, and the backward decoder 108 The decoding is started from the end of the encoded data stored in the buffer 106 based on the backward decoding tree from the backward decoding tree creating unit 113.
[0018]
The decoded value judging section 109 calculates a decoded value from a decoded result (referred to as a forward decoded value) obtained by the forward decoder 107 and a decoded result (referred to as a backward decoded value) obtained by the backward decoder 108. And outputs the final decoding result. That is, if there is an error in the encoded data, the decoded value determining unit 109 can detect the presence of the error because a bit pattern that does not appear in the decoding tree is generated. Therefore, as shown in FIG. To determine the decoded value. FIG. 2 shows a method of determining a decoded value between synchronization codes.
[0019]
First, as shown in FIG. 2 (a), when the position of a codeword where an error is detected in the forward decoding result and the backward decoding result (error detection position) does not intersect, only the decoding result in which no error is detected Are used as decoding values, and the decoding results at the two error detection positions are not used as decoding values, and are discarded.
[0020]
When the error detection positions of the forward decoding result and the backward decoding result intersect as shown in FIG. 2B, the decoding result in which no error is detected in both cases is used as the decoding result value. In this case, the decoding result between the codewords at the two error detection positions is not used as a decoded value and is discarded.
[0021]
Also, as shown in FIG. 2C, when an error is detected only in a one-way decoding result of the forward decoding result and the backward decoding result (in this example, an error is detected only in the forward decoding result. ) Discards the decoded value for the codeword at the error detection position, and uses the decoded result in the reverse direction for the decoded values for the subsequent codewords.
[0022]
Further, as shown in FIG. 2D, when an error is detected in both the forward decoding result and the backward decoding result for the same code word, the code word at the error detection position is similar to FIG. 2C. Are discarded, and the decoding results in the reverse direction are used as decoding values for the subsequent codewords.
[0023]
The codeword table creation unit 101 creates a codeword table of codes that can be decoded in both forward and reverse directions based on the occurrence probability of information symbols. The codeword table created by the codeword table creation unit 101 is sent to the codeword table 102 in the encoding unit 114 and to the forward codeword table 110 and the backward codeword table 112 in the decoding unit 115. The forward decoding tree creating unit 111 creates a forward decoding tree from the forward codeword table 110. Further, the backward decoding tree creating unit 113 creates a backward decoding tree from the backward codeword table 112.
[0024]
FIG. 3 is a block diagram illustrating a configuration of the codeword table creation unit 101. The code selection unit 21 receives information on the occurrence probabilities of the information symbols as input, selects a code system having the smallest average code length from among code systems that can be selected based on this information, and sends the selection result to the codeword configuration unit 22. send. The codeword configuration unit 22 configures the codeword of the code selected by the codeword selection unit 21 and creates a codeword table. The codeword table created by the codeword construction unit 22 is sent to the codeword table 102 in the encoding unit 114 and the forward codeword table 110 in the decoding unit 115. A codeword table described in a direction opposite to the forward direction is sent to the backward codeword table 112 in the decoding unit 115.
[0025]
The code selection unit 21 rearranges the input information symbols in descending order of the occurrence probabilities to be S = {S1, S2,..., Sn}, and the occurrence probabilities P of these information symbols S = {p1, p2,. pn}, based on a set C of configurable codes,
(Equation 1)
Figure 0003579412
Is selected. Here, Li is a code length that can be calculated by the weight of the code word given from the code word forming unit 22. The code word weight in this case refers to the number of “1” or “0” in the code word.
[0026]
Hereinafter, a method of forming a code word in the code word forming unit 22 will be described.
[0027]
FIG. 4 shows an example of how to create a binary code sequence having a constant weight serving as a basis for a variable length code according to the present embodiment. As shown in FIG. 4A, a grid-like directed graph from the start point to the end point is formed. When following the route from the start point to the end point in this directed graph, “0” is selected when the left route is selected, and “1” is selected when the right route is selected. Is generated. In this example, a binary code sequence having a code length of 5 bits and a weight (the number of “1”) of 2 is generated. In general, there are as many binary code sequences having a code length of n bits and a weight of w as the number of combinations that select w from n. Here, there will be 10 binary code sequences, the number of combinations of selecting two out of five.
[0028]
FIG. 5 shows a first method of forming a codeword of a variable length code (hereinafter, referred to as a reversible code) that can be decoded in the forward direction and the backward direction in the codeword forming unit 22. First, as shown on the left side of FIG. 5, the weight (the number of “1”) is constant (the number of “1”) by the method of FIG. In this case, one binary code sequence is created. Next, as shown on the right side of FIG. 5, a code word of the reversible code is formed by adding "1" to the beginning and end of each of the binary code sequences and assigning "0" to the shortest code. This reversible code always starts with the code “0” for the information symbol A and “1” for the other information symbols B to J, and when three “1” s appear in all three. This is a code configuration in which the code ends, that is, a configuration where the code delimiter (code length) is known.
[0029]
The necessary and sufficient condition for the variable-length code to be a reversible code, that is, a code that can be decoded in both the forward and reverse directions, is that all codewords are assigned to the leaves of the forward and backward decoding trees. is there. The leaf of the decoding tree is the end of the decoding tree, that is, a place where there is nothing earlier. For example, in the variable-length code of FIG. 5, the codewords corresponding to all the information symbols A to J are the leaves of the forward decoding tree shown in FIG. 6A and the leaves of the backward decoding tree of FIG. Is also assigned, it can be seen that decoding is possible in both the forward and reverse directions.
[0030]
The parameters of the variable length code codeword configuration method in FIG. 5 correspond to the occurrence probabilities of various information symbols by setting the number of “1” in the codeword as a weight and setting the weight to a natural number w of 2 or more. be able to. Of course, the same applies to the case where the bit is inverted and the number of “0” is considered as the weight and discussed.
[0031]
FIG. 7 shows a second method of forming a codeword of a reversible code in the codeword forming unit 22. First, as shown on the left side of FIG. 7, the weight (the number of “1”) is constant (one in this case) by the method of FIG. Create a hexadecimal code sequence. Next, as shown in the center of FIG. 7, "1" is added to the beginning and end of each of the binary code sequences, and further, as shown on the right side of FIG. Add words.
[0032]
In this variable length code, the code length can be determined by counting the number of symbols at the beginning of each code. In the example of FIG. 7, the code configuration ends when four symbols at the beginning of each code appear, that is, the code configuration in which a code segment (code length) is known.
[0033]
In the variable-length code of FIG. 7, the codewords corresponding to all the information symbols A to J may be the leaves of the forward decoding tree shown in FIG. 8A or the leaves of the backward decoding tree shown in FIG. It can be seen from the assignment that decoding is possible in both the forward and reverse directions.
[0034]
FIG. 9 shows a third method of forming a codeword of a reversible code in the codeword forming unit 22. The reversible code has a code configuration in which the number of “0” and “1” are the same, so that the code length of the code word can be known. That is, consider the lattice-like directed graph shown in FIG. 9A, and when starting from the start point and selecting the left-side route, consider "0" when selecting the right-side route and "1" when selecting the right-side route. Correspondingly, a route that reaches a diagonal black dot passing through the start point is generated as a codeword.
[0035]
In this case, the codewords corresponding to all the information symbols A to J are assigned to the leaves of the forward decoding tree shown in FIG. 10A and the leaves of the backward decoding tree shown in FIG. It can be seen that decoding is possible in both directions.
[0036]
Next, a method for shortening a reversible code according to the present invention will be described. Since the number of information symbols, that is, the number of codes of the variable length code is limited, it is possible to shorten a part of the variable length code. Here, shortening refers to reducing the code length of some codes without increasing the code length of other codes. FIG. 11 shows an example of a method for shortening a reversible code.
[0037]
For example, the reversible code shown in FIG. 7 can be decoded from either the forward direction or the reverse direction even if the last bit of the codeword corresponding to the information symbols G, H, I, and J is deleted. . By utilizing this, in FIG. 11, the code lengths of the four codewords corresponding to the information symbols G, H, I, and J are reduced.
[0038]
In the variable-length code shown in FIG. 11, the codewords corresponding to all the information symbols A to J also appear on the leaves of the forward decoding tree shown in FIG. Since it is also assigned to the leaves of the tree, it can be seen that decoding can be performed in both the forward and reverse directions.
[0039]
Next, a method of extending a reversible code according to the present invention will be described with reference to FIG. Extension of a reversible code can be realized by adding an equal-length code to at least one of the beginning and end of each code to increase the number of codewords having the same code length. In the example of FIG. 13, a 2-bit equal-length code is added to the end of each of the reversible codes shown on the left side. In this case, the code length of each code of the reversible code is increased by 2 bits as a whole, but the number of codewords having the same code length is quadrupled. Generally, when an n-bit equal-length code is added, the code length increases by n bits as a whole, but the number of codewords having the same code length can be increased by 2 n times. Since the isometric code is obviously a reversible code, even if the isometric code is added to the beginning or end of the reversible code, it is still a reversible code.
[0040]
FIG. 14 shows a comparison between a reversible code obtained by performing variable length coding on an information symbol, which is an English alphabet, according to the present invention, and a reversible code disclosed in a known example (Japanese Patent Laid-Open No. 5-300027). It is shown. The reversible code according to the present invention shown in FIG. 14 is a code obtained by expanding the code obtained by adding a 2-bit equal length code to the end of the code when the weight of the code word is set to 0 in the method shown in FIG. It is.
[0041]
Although the reversible code according to the present invention is inferior to the Huffman code, which is an optimal code of a variable length code that can be decoded only in the forward direction, the average code length is shorter and superior to the reversible code disclosed in the known example. You can see that it has performance. This is because the known reversible code is a variable-length code that can be decoded only in the forward direction with a bit added to the end of the Huffman code, whereas the present invention does not add an extra bit, This is because the reversible code is formed from the beginning, so that there is little useless bit pattern.
[0042]
Next, another embodiment of the present invention will be described.
FIG. 15 is a block diagram showing a configuration of a variable length encoding / decoding device according to another embodiment of the present invention. The variable-length encoding / decoding device according to the present embodiment is roughly divided into a codeword table creation unit 201, an encoding unit 213, a transmission or accumulation system 205, and a decoding unit 214.
[0043]
The function of each of these units will be briefly described. The codeword table creation unit 201 creates a codeword table based on the occurrence probabilities of information symbols, sends the codeword table to the codeword table 202 in the encoding unit 213, and further creates the codeword table. The parameters of the codewords in the table are sent to the decoded graph / decoded value table creation unit 208 in the decoding unit 214. The encoding unit 213 encodes the information symbol into a variable length code, and outputs the variable length code to the transmission system or the storage system 205 as encoded data. Decoding section 214 decodes the encoded data input via transmission system or storage system 205 to reproduce the original information symbols.
[0044]
Next, a detailed configuration and operation of each unit of the present embodiment will be described.
In the encoding unit 213, the input information symbols are input to the encoder 203. The codeword table 202 stores information symbols created in advance by the codeword table creation unit 201 and codewords of variable-length codes in association with each other. However, the codeword table 202 does not store codewords corresponding to all of the information symbols that can be input, and stores only codewords corresponding to some information symbols having a relatively high appearance frequency. It is assumed that The encoder 203 selects a codeword corresponding to the input information symbol from the codewords stored in the codeword table 202 and outputs the selected codeword as encoded data.
[0045]
On the other hand, when an information symbol for which no codeword corresponding to the codeword table 202 exists, that is, an information symbol having a relatively low appearance frequency, is input to the encoding unit 213, the fixed-length code corresponding to the information symbol is fixed-length. The code encoding unit 204 creates the code word by adding an escape code in the code word table 202 to the beginning and end of the fixed-length code, and outputs this as encoded data.
[0046]
The encoded data output from the encoder 203 in the encoding unit 213 in this way is sent to the decoding unit 214 through the transmission system or the storage system 205. At this time, a synchronization code is inserted into the encoded data at regular intervals.
[0047]
The decoding unit 214 includes a synchronization code detection unit 206, a buffer 207, a decoding graph / decoding value table creation unit 208, a forward decoding unit 209, a fixed length decoding unit 210, a backward decoding unit 211, and a decoding value determination unit. The synchronization code detecting unit 206 detects a synchronization code from encoded data input from the transmission system or the storage system 205, and stores the encoded data between the synchronization codes in the buffer 207. The forward decoder 209 starts decoding from the beginning of the encoded data stored in the buffer 207, and the backward decoder 211 starts decoding from the end of the encoded data stored in the buffer 207. The decoded value determination unit 212 calculates a decoded value from a decoded result (referred to as a forward decoded value) obtained by the forward decoder 209 and a decoded result (referred to as a backward decoded value) obtained by the backward decoder 211. And outputs the final decoding result.
[0048]
FIG. 16 is a diagram illustrating a method of forming a codeword by adding an escape code to the beginning and end of a fixed-length code in the codeword table creation unit 201 in FIG. As shown in FIG. 16A, when the information symbol is other than “A”, the code word created by the code word table creation unit 201 has a code delimiter by the appearance of three “1” s. It is based on reversible codes that can be understood. This reversible code is referred to as code (1).
[0049]
On the other hand, the code (2) shown in FIG. 16B is a code word “1011” corresponding to the information symbol “C” of the code (1) as an escape code for indicating the beginning and end of the fixed-length code. The code word formed by adding the bits to the beginning and end of the fixed length code is newly added to the code (1). However, in the reversible code portion corresponding to the code (1) in the code (2), the code word “1011” used as the escape code in the code (2) is not used, and information smaller by one by the code (1) is used. Only code words corresponding to symbols A to I are used. As is clear from comparison of FIGS. 16A and 16B, the number of information symbols that can be encoded for code (2) has increased from “10” of code (1) to “17”.
[0050]
In order to decode such a code (2), the code (1) is always decoded once, both in the case of decoding in the forward direction and in the case of decoding in the reverse direction, as can be seen from FIGS. That is, since the fixed-length code can be decoded in both the forward and reverse directions, if the code (1) can be decoded in both the forward and reverse directions, the code (2) is also decoded in the forward direction. Decoding is also possible from the opposite direction.
[0051]
In the case of a conventional reversible code, it is necessary to prepare all codewords corresponding to information symbols that can be input in the encoding unit 213 and the decoding unit 214 as a codeword table. On the other hand, according to the code (2), the fixed-length code portion can be separately prepared as a 3-bit binary code as the fixed-length code encoding unit 204 and the fixed-length code decoding unit 210. Only the codeword of code (1) needs to be stored in the table 202. Therefore, compared with the conventional reversible code, the storage amount of the variable length encoding / decoding device can be significantly reduced.
[0052]
The decoding graph / decoding value table creator 208 creates a decoding graph and a decoding value table based on the Sharkwijk algorithm, and the forward decoder 209 and the backward decoder 211 decode these decoding graph and decoding data. Perform decoding based on the value table.
[0053]
FIG. 17 shows a method of counting binary code sequences having a constant weight. An algorithm for counting binary code sequences having a constant weight is described in J. Amer. P. M. Sharkwijk: "An algorithm for source coding", IEEE Trans. Infrom Theory, vol. IT-18, no. 3, pp. 395-399, May 1972. Are well known as Sharkwijk's algorithm. In the Sharkwijk algorithm, as shown in FIG. 17A, a grid-like directed graph from a START point to an END point is formed based on a “Pascal triangle”. The value indicated by a numeral at each node is the sum of the values of the nodes at the starting points of the two arrows entering each node, with the value of the node at the START point being 1. That is, the value of each node is determined by the Pascal's triangle.
[0054]
Then, regarding the directed graph of FIG. 17A, when following the route from the START point to the END point according to the input information symbol, when the left-side route (arrow) is selected, the code word “0” is selected, and the right-side route is selected. When (arrow) is selected, a binary code sequence with a weight of 2 can be generated by associating each code word “1”. Here, the value obtained by subtracting the value of the node at the start of the arrow from the value of the node at the end of the arrow when “0” is selected is the code word of the same code length of the binary code sequence. Is the ordinal value of For example, if the input information symbol is “01001”, the sum of the differences of the node values for three “0” s is (1-1) + (3-2) + (4-3) = 2 is the order value. Here, the sequential value is a value for ordering different code words having the same code length. FIG. 17B shows the relationship between information symbols and order values in this case.
[0055]
An example in which the Sharkwijk algorithm is applied to encoding is known. In this case, encoding is performed by converting a value corresponding to the above-described order value into a binary code. In contrast, in the present embodiment, this algorithm is used for decoding as described below.
[0056]
That is, the decoding graph / decoding value table creation unit 208 creates a directed graph as a decoding graph based on the above-mentioned Sharkwijk algorithm. That is, this decoded graph is a directed graph in which values determined by Pascal's triangle are used as node values and codewords "1" and "0" are arrows, and an example is shown in FIG. FIG. 18B shows an example of a method of calculating a decoded value in the forward decoder 208 and the backward decoder 211 using the decoded graph.
[0057]
Code (1) shown in FIG. 16 (a) is a reversible code in which when the head is other than “0”, a break can be recognized at a point where three “1” appear. When calculating the decoded value of the reversible code of the code (1), if the head of the reversible code is “0” in the forward direction, the decoded value is set to 0; Is deleted, and the order value is calculated by the Sharkwijk algorithm. Since the number of codewords having a code length shorter than the codeword to be decoded is the sum of the values of the diagonal right nodes at the END point in FIG. 18A, the sum is added to the order value. Is the decoded value.
[0058]
On the other hand, in the reverse direction, as in the case of the above-described forward direction, first, if the head of the reversible code is "0", the decoded value is set to 0; otherwise, the leading and terminal "1" are deleted. After inverting the remaining part, the order value is calculated by the Sharkwijk algorithm. Then, the sum of the order value and the sum of the nodes on the upper right of the END point plus 1 is defined as a decoded value.
[0059]
More specifically, with reference to FIGS. 18A and 18B, for example, if the codeword to be decoded for the reversible code is “10101”, the leading and trailing “1” s are first deleted and “010” is added. I do. When an order value is obtained for this “010” by the Sharkwijk algorithm, (1-1) + (3-2) = 1 for two “0” s. In this case, since the sum of the values of the nodes at the diagonally upper right of the END point is 1 + 2 = 3, this value + 1 (= 4) is added to the order value (= 1), and the decoded value is obtained as 5.
[0060]
When decoding is performed using such a decoding graph, the amount of storage can be significantly reduced. FIGS. 19A and 19B are diagrams showing a difference in storage amount required between a conventional decoding method using a decoding tree and a decoding method using a decoding graph according to the present embodiment. Comparing the two with the number of nodes, the number of arrows coming out of each node is the same in both cases, but the number of arrows coming in each node is always one in the case of the decoding tree in FIG. . On the other hand, in the case of the decoded graph of FIG. 19B, since two arrows enter each node, the total number of nodes required by the same codeword decreases accordingly. In this example, the decoding tree of FIG. 19A requires 15 nodes, whereas the decoding graph of FIG. 19B requires only 8 nodes. Therefore, the decoding method of the present embodiment using the decoding graph has an advantage that the required storage amount is smaller than that of the conventional method using the decoding tree.
[0061]
In this embodiment, in order to decode the code (2) to which the escape code shown in FIG. 16B is added, the decoded value table of the code (1) shown in FIG. ) Are prepared, and when the escape code is decoded in the decoded value table of code (1), the decoded value table of the fixed length code is read. For example, when the codeword is “10110011011”, if the leading “1011”, that is, the escape code is decoded, the next three bits “001” are regarded as a fixed-length code and decoded by the fixed-length code decoding unit 210. I do. In this case, since 1 is obtained as the decoded value of “001”, the decoded result is the information symbol “K” from the fixed-length code decoded value table of FIG.
[0062]
Next, an embodiment in which the present invention is applied to a moving image encoder / decoder will be described. FIG. 21 is a block diagram showing a schematic configuration of a moving image encoder / decoder incorporating the above-described variable length encoding / decoding device.
[0063]
In the video encoder 709 shown in FIG. 21A, the data encoded by the information source encoder 702 is subjected to variable-length encoding, communication channel encoding, multiplexing, and the like by a video multiplexer 703. Then, after the transmission speed is smoothed by the transmission buffer 704, the data is sent to the transmission system or the storage system 705 as encoded data. The encoding control unit 701 controls the information source encoder 702 and the video multiplexing unit 703 in consideration of the buffer amount of the transmission buffer 704.
[0064]
On the other hand, in the moving picture decoder 710 shown in FIG. 21B, the coded data from the transmission system or the storage system 705 is temporarily stored in the reception buffer 706, and the moving picture multiplexing / demultiplexing unit 707 converts the coded data into After demultiplexing, channel coding, and variable-length code decoding are performed, the data is sent to an information source decoder 708, and a moving image is finally decoded.
[0065]
FIG. 22 shows the syntax of the moving picture coding method in the moving picture coder 709 and the moving picture multiplexing / demultiplexing unit 707 in FIG. Among the picture layers shown in FIG. 22A, information other than DCT coefficients such as macroblock mode information and motion vector information and INTRA DC is arranged in the upper layer, and DCT coefficient information is arranged in the lower layer. Thus, the reversible code according to the present invention is applied to the lower layer part.
[0066]
FIGS. 23A and 23B are block diagrams showing a more detailed configuration of the video multiplexing unit 703 and the video multiplexing / demultiplexing unit 707 in FIG. In the moving image multiplexing unit 703 shown in FIG. 23A, among the coded data from the information source coder 702 in FIG. 21, other than DCT coefficients such as macroblock mode information, motion vector information, and INTRADC. After the normal variable length coding is performed by the upper layer variable length encoder 901 as the upper layer, the upper layer communication path encoder 902 further performs error correction detection with a large redundancy but a high correction capability. The channel is coded by a code and sent to the multiplexing unit 905.
[0067]
On the other hand, among the encoded data from the information source encoder 702, the DCT coefficients are encoded into a reversible code by the lower layer variable length encoder 903, and the lower layer channel encoder 904 generates an error with less redundancy. After being channel-coded by the correction detection code, it is sent to the multiplexing unit 905. The multiplexing unit 905 multiplexes the encoded data of the upper layer and the encoded data of the lower layer, and sends the multiplexed data to the transmission buffer 704.
[0068]
In the moving image multiplex / separation unit 707 shown in FIG. 23B, first, the coded data from the reception buffer 706 is separated by the multiplex / separation unit 906 into an upper layer and a lower layer. The encoded data of the upper layer is decoded by the upper layer channel decoder 907, and the decoding result is sent to the upper layer variable length decoder 909. The lower layer encoded data is decoded by the lower layer channel decoder 908, and the decoding result is sent to the lower layer variable length decoder 910.
[0069]
Lower layer variable length decoder 910 decodes the reversible code, and sends the decoding result to information source decoder 708 and upper layer variable length decoder 909. The upper layer variable length decoder 909 decodes the variable length code which is the encoded data of the upper layer, and rewrites the encoding result based on the decoding result of the lower layer variable length decoder 910.
[0070]
Here, the lower layer variable length encoder 903 in FIG. 23A is used for the encoding unit 213 in FIG. 15, and the lower layer variable length decoder 910 in FIG. 23B is used for the decoding in FIG. Respectively corresponding to the conversion units 214.
[0071]
As seen in the video encoder / decoder of the present embodiment, when the encoding scheme has the syntax as shown in FIG. 22, not only can the variable length code itself be decoded from both directions, In terms of syntax, it is necessary to be able to decode from both directions. In the present embodiment, this request is realized by using a codeword table described below.
[0072]
FIGS. 24 to 28 show examples of codeword tables of variable length codes of DCT coefficients used in the lower layer variable length encoder 903. FIG. FIG. 29 shows a codeword table of escape codes.
[0073]
The information source encoder 702 scans the block of the 8 × 8 DCT coefficient after quantization and performs LAST (0: non-zero coefficient not at the end of the block, 1: 1: non-zero coefficient at the end of the block. A coefficient), RUN (the number of zero runs to a non-zero coefficient) and LEVEL (absolute value of the coefficient) are obtained and sent to the video encoder 709.
[0074]
The lower layer variable length encoder 903 in the video encoder 709 is a non-LAST coefficient of INTRA and INTER shown in FIG. 24 to FIG. 25, and a non-LAST coefficient of RUN and LEVEL corresponding to a reversible code (VLC_CODE). A code word table (first code word table) and a code word table (LAST code) of LAST coefficients in which LAST coefficients of INTRA and INTER shown in FIGS. 26 to 27 correspond to reversible codes (VLC_CODE) for RUN and LEVEL. Codeword table). Then, based on the mode information, the coding is performed by selecting the code word table of the non-LAST coefficient and the LAST coefficient of the INTRA at the time of INTRA and the code word table of the non-LAST coefficient and the LAST coefficient of the INTER at the time of INTER. In FIGS. 26 and 27, "S" of the last bit of VLC_CODE indicates the sign of LEVEL, and when "S" is "0", the sign of LEVEL is positive, and when "1", it is negative.
[0075]
For the coefficients that do not exist in this codeword table, the absolute values of RUN and LEVEL are encoded into fixed-length codes as shown in FIG. 29, and escape codes are added to the beginning and end of the fixed-length codes, and The last bit is encoded so that the LAST coefficient and the LEVEL can be distinguished from positive or negative. FIG. 28 is a codeword table of this escape code. The last bit “t” of VLC_CODE used as an escape code indicates whether or not it is a LAST coefficient when added to the beginning of a fixed-length code. When this is "0", it is a non-LAST coefficient, and when it is "1", it is a LAST coefficient. “T” represents the LEVEL code when added to the end of the fixed-length code. When this is “0”, the LEVEL code is positive, and when it is “1”, it is negative.
[0076]
FIG. 30 shows an example of encoded data in the present embodiment. As shown in the figure, when decoding is performed in the lower layer from the forward direction, since the code of the LAST coefficient always exists at the end of the block of the DCT coefficient of 8 × 8 pixels, the end of the block may be determined. it can. On the other hand, when decoding is performed in the reverse direction, the beginning of the block can be determined by the appearance of the code of the LAST coefficient of the block preceding by one address. Since this code has a LAST coefficient common to the INTRA mode and the INTER mode, the head of the block can be determined even if a mode exists for each macro block.
[0077]
For the first block of the lower layer, a dummy LAST coefficient is coded at the beginning of the lower layer in the lower layer variable length encoder 903, or the next frame is encoded in the lower layer variable length decoder 910. The number of bits in the lower layer is calculated in advance from the number of bits up to the synchronization code of the lower layer, and the calculated number is compared with the number of bits decoded. Alternatively, a buffer in the lower layer variable length decoder 910 adds By adopting a method of inserting a dummy LAST coefficient, it is possible to determine the head of the lower layer when decoding in the reverse direction.
[0078]
The reversible code stored in the code word tables shown in FIGS. 24 to 27 is read in the forward direction until the first one bit is “0”, until two “0” appear, and when it is “1”. For example, it is understood that two "1" s are read until the next one bit becomes the last bit indicating the positive or negative of LEVEL. In the reverse direction, the first one bit indicates the sign of LEVEL, and if the next one bit is “0”, it is read until two “0” appear, and if “1”, it is “1”. Please read until two appear.
[0079]
FIG. 31 shows a decoding graph for decoding a reversible code applied to the variable length code of the DCT coefficient used in the lower layer variable length encoder 903 in the present embodiment. A decoded value can be calculated from the decoded graph of the encoded data excluding the first two bits and the last two bits of the codeword when viewed from the forward direction.
[0080]
In this decoded graph, if the first bit is "0", the right arrow is advanced when "0" appears, and the left arrow is advanced if "1" appears. If the first bit is "1", the right arrow is advanced if "1" appears, and the left arrow is advanced if "0" appears.
[0081]
In order to obtain the order value for a binary code sequence having the same code length, the value of the starting node is subtracted from the value of the ending node of the arrow when the left arrow is selected, according to the Sharkwijk algorithm described above. The sum of the values may be used as the order value at the code length.
[0082]
On the other hand, in order to obtain the decoded value, if the leading bit is “0”, a value obtained by adding twice the sum of the values of the nodes at the upper right corner of the terminal node to the ordinal value may be used as the decoded value. . If the first bit is "1", the decoded value may be twice the sum of the values of the nodes diagonally to the upper right of the terminal node plus the order value to the value of the terminal node.
[0083]
For example, if the code string to be decoded is “0110101”, it is first set to “1101” except for the first one bit and the last two bits when viewed from the forward direction. Since the first bit is "0", if "0" appears in the decoding graph, the right arrow is advanced, and if "1" appears, the left arrow is advanced. In this case, since the difference between the nodes when the left arrow is advanced is (1-1) + (1-1) + (4-3) = 1, the order value is 1. Since the most significant bit is “0”, the order 1 is added to twice (1 + 2 + 3) × 2 = 12 of the total of the nodes diagonally right above the terminal node, and the result is 13; Will be done.
[0084]
FIGS. 32 to 34 show an example of a decoded value table used in the lower layer variable length decoder 910. FIGS. 32 to 33 show non-LAST coefficients of INTRA and INTER, and RUN and LEVEL in which decoded values are associated with decoded values. FIG. 34 (a) and (b) are decoded value tables of LAST coefficients in which LAST coefficients of INTRA and INTER are associated with decoded values of RUN and LEVEL, respectively. FIG. 35 is a decoded value table of the escape code.
[0085]
In this example, for example, as can be seen in FIG. 34A, the decoded value 13 is a LAST coefficient, the number of RUNs is 3, the absolute value of LEVEL is 1, and the least significant bit is “1”. This indicates that LEVEL is negative. Further, as can be seen from FIG. 35, when the decoded value 41 is decoded, it is determined that the escape code has been decoded. The last bit of this escape code is used to determine whether it is a LAST coefficient or a non-LAST coefficient, and the fixed bits decoding unit 210 decodes the absolute values of RUN and LEVEL for the subsequent 13 bits, and then decodes the escape code again. , The last bit determines the sign of LEVEL.
[0086]
As an example, consider a case where the code string to be coded is “110000010000111000101111000010”. In this case, since the last bit of the leading escape code “11000010” is “0”, it is a non-LAST coefficient, and the subsequent 13-bit fixed-length code is calculated. Of these 13 bits, the upper 6 bits represent RUN, so that "000111" represents RUN of 7, and the lower 7 bits represent the absolute value of LEVEL. Therefore, "0001011", the absolute value of LEVEL is 12, and the end escape code " Since the last bit of “11000010” is “0”, LEVEL can be decoded as positive.
[0087]
The decoded value determination unit 212 compares the decoded result obtained by the forward decoder 209 (referred to as a forward decoded result) with the decoded result obtained by the backward decoder 211 (referred to as a backward decoded value). ) To determine the decoded value and output the final decoded result. That is, if there is an error in the encoded data, the decoded value determination unit 212 recognizes the presence of the error because the decoding result of the lower layer channel decoder 908 or a bit pattern that did not exist as a codeword occurs. Therefore, a decoded value is determined from the forward decoding result and the backward decoding result as shown in FIG. FIG. 36 shows a method of determining a decoded value of a lower layer.
[0088]
First, as shown in FIG. 36 (a), when the position of a macroblock where an error is detected in the forward decoding result and the backward decoding result (error detection position) does not intersect, the macroblock in which no error is detected Only the decoding result is used as a decoding value, and the decoding results at two error detection positions are not used as decoding values. Then, based on the decoding result of the mode information of the upper layer, the decoding result of the upper layer is displayed such that the previous frame is displayed as it is for the INTRA macroblock and the motion compensation is displayed only for the INTER macroblock from the previous frame. Is rewritten.
[0089]
In addition, as shown in FIG. 36 (b), when an error detection position intersects between a forward decoding result and a backward decoding result, a decoding result in which no error is detected in both is used as a decoding result value. In this case, the decoding result between the codewords at the two error detection positions is not used as a decoding value, and the previous frame of the INTRA macroblock is displayed as it is based on the decoding result of the mode information of the upper layer. As described above, the decoding result of the upper layer is rewritten so that the INTER macroblock is displayed only by the motion compensation from the previous frame.
[0090]
In addition, as shown in FIG. 36 (c), when an error is detected only in a one-way decoding result out of a forward decoding result and a backward decoding result (in this example, only an error is detected in the forward decoding result. Does not use the macroblock at the error detection position as a decoded value, and displays the previous frame for the INTRA macroblock as it is based on the decoding result of the mode information of the upper layer. The decoding result of the upper layer is rewritten so as to display only the motion compensation from the frame. The decoding value for the subsequent macroblock uses the decoding result in the reverse direction.
[0091]
Further, when an error is detected in both the forward decoding result and the backward decoding result in the same macroblock as shown in FIG. 36 (d), the decoding value of the macroblock at the error detection position is discarded and decoded. It is not used as a value, and based on the decoding result of the mode information of the upper layer, the previous frame is displayed as it is for the INTRA macroblock, and the upper frame is displayed only for the motion compensation for the INTER macroblock from the previous frame. The decoding result of the hierarchy is rewritten, and the decoding value for the subsequent macroblock uses the decoding result in the reverse direction.
[0092]
The order of encoding / decoding of macroblocks may be a method other than the above-described embodiment. For example, when an error occurs, a more important central part of a decoded image is rescued in FIG. The order may be as shown. In other words, assuming that decoding is performed from both directions, the probability that the first part and the last part of the encoded data between the synchronization codes are correctly decoded is high. The order is determined so that is in the center.
[0093]
In the above embodiment, the present invention is applied to variable-length coding of DCT coefficients. However, it goes without saying that the same variable-length coding can be applied to other information symbols.
Further, in the above-described embodiment, only the binary code has been discussed, but it is easy to extend to a multiple code, and the same effect can be obtained.
[0094]
Finally, as an application example of the present invention, an embodiment of an image transmitting / receiving apparatus to which the variable length encoding / decoding apparatus according to the present invention is applied will be described with reference to FIG. An image signal input from a camera 1002 provided in a personal computer (PC) 1001 is encoded by a variable length encoding device incorporated in the PC 1001. The information symbol in this case is not limited to this. For example, the input image signal or a prediction error signal which is a difference between the input image signal and the prediction image signal is subjected to discrete cosine transform by a DCT circuit, and further quantized by a quantization circuit. DCT coefficient data obtained by the conversion. The coded data output from the variable-length coding device is multiplexed with other voice and data information, transmitted by radio by the wireless device 1003, and received by the other wireless device 1004. The signal received by the wireless device 1004 is decomposed into encoded data of an image signal and information of voice and data. Among these, the coded data of the image signal is decoded by the variable length code decoding device incorporated in the workstation (EWS) 1005, and is displayed on the display of the EWS 1005.
[0095]
On the other hand, the image signal input from the camera 1006 provided in the EWS 1005 is encoded in the same manner as described above using the variable length encoding device incorporated in the EWS 1006. The encoded data is multiplexed with other voice or data information, transmitted wirelessly by the wireless device 1004, and received by the wireless device 1003. The signal received by the wireless device 1003 is decomposed into coded data of an image signal and voice and data information. Among these, the coded data of the image signal is decoded by the variable length code decoding device incorporated in the PC 1001, and is displayed on the display of the PC 1001.
[0096]
The variable-length encoding / decoding device according to the present invention has a code length corresponding to the frequency of appearance of information symbols, has less wasteful bit patterns and is more efficient than in the past, and has a forward and a reverse direction. Since a reversible variable-length code that can be decoded can also be configured, the present invention is particularly effective in a transmission / reception apparatus using a transmission line having many errors, such as the wireless transmission line shown in FIG.
[0097]
As described in the above embodiment, the variable-length encoding / decoding device of the present invention can decode with a smaller storage amount as compared with the related art, and the information symbol that cannot be conventionally applied. It can be applied to coding with a large number.
[0098]
Specifically, the present invention can be applied to a video encoding / decoding device, and can provide a video encoding / decoding device that is resistant to errors.
[0099]
【The invention's effect】
As described above, according to the present invention, a variable-length decoding method and apparatus that can decode in both forward and backward directions and that are practical in terms of coding efficiency, storage amount required for the apparatus, and the like. Can be provided.
[0100]
That is, a plurality of codewords that can be decoded in the forward direction and the reverse direction and are configured so that code delimiters can be identified by the number of codewords “1” or “0” are stored in association with information symbols. A code word table is formed, and a variable length code with few unnecessary bit patterns and high coding efficiency can be decoded using the code word table.
[0101]
In addition, the code length can be determined by the number of code words “1” or “0”, and Pascal's variable-length code words composed of code words that can be decoded in both the forward and reverse directions are used as targets. A value determined by a triangle is set as a value of a node, and a decoded value is calculated by a directed graph (decoding graph) in which arrows from each node to the next node correspond to code words “1” and “0”, thereby obtaining an information symbol. Even when the number is large, decoding of the variable length code can be performed with a small storage amount.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration of a variable length encoding / decoding device according to an embodiment of the present invention. FIG. 2 is a diagram illustrating an operation of a decoded value determination unit in FIG. 1 is a block diagram of a codeword table creating unit in FIG. 1; FIG. 4 is a diagram showing a method of creating a constant weight binary code sequence based on a variable length code according to the present invention; FIG. FIG. 6 is a diagram showing a forward and backward decoding tree created from a code word constructed by the first code construction method. FIG. 7 is a diagram showing a code word configuration in FIG. FIG. 8 is a diagram showing a second codeword structuring method in the section. FIG. 8 is a diagram showing forward and backward decoding trees created from codewords formed by the second code structuring method. FIG. 9 is a code in FIG. FIG. 10 is a diagram showing a third code configuration method in a word configuration unit. FIG. 11 is a diagram showing a forward and backward decoding tree created from a codeword obtained by the coding. FIG. 11 is a diagram showing a code shortening method in a codeword constructing unit in FIG. 3. FIG. 12 is a code shortened by the code shortening method. FIG. 13 is a diagram showing a forward and backward decoding tree created from a word. FIG. 13 is a diagram showing a code enlarging method in a code word constructing unit in FIG. 3. FIG. 14 is a diagram showing a variable length code constructed in the present embodiment. FIG. 15 is a diagram showing characteristics of a variable length code of a known example in comparison. FIG. 15 is a block diagram showing a configuration of a variable length coding / decoding device according to another embodiment of the present invention. FIG. 16 is a codeword in FIG. FIG. 17 is a diagram illustrating a code configuration method in a configuration unit. FIG. 17 is a diagram illustrating a method of counting a binary sequence having a constant weight. FIG. 18 is a diagram illustrating operations of a forward decoder and a backward decoder in FIG. FIG. 19 shows a conventional decoding tree and a decoding graph in the present embodiment. FIG. 20 is a diagram illustrating a decoded value table in the present embodiment. FIG. 21 is a diagram of a moving image encoding / decoding device incorporating a variable length encoding / decoding device according to the present invention. FIG. 22 is a block diagram showing a schematic configuration. FIG. 22 is a diagram showing the syntax of encoded data in a video encoder / decoder according to the embodiment. FIG. 23 is a video multiplexing unit and video multiplexing in FIG. FIG. 24 is a diagram showing a part of a code word table of non-LAST coefficients of INTRA and INTER in the embodiment. FIG. 25 is a code of non-LAST coefficients of INTRA and INTER in the embodiment. FIG. 26 is a diagram showing another part of the word table. FIG. 26 is a diagram showing a part of a code word table of LAST coefficients of INTRA and INTER in the embodiment. FIG. 28 is a diagram showing another part of the code word table of the LAST coefficient of INTRA and INTER in the embodiment. FIG. 28 is a diagram showing the code word table of the escape code in the embodiment. FIG. 29 is a code word in the embodiment. FIG. 30 is a diagram showing an encoding method of a codeword not in a table. FIG. 30 is a diagram showing an example of encoded data in the embodiment. FIG. 31 is a diagram showing a decoding graph in the embodiment. FIG. 32 is an INTRA in the embodiment. FIG. 33 is a diagram showing a part of a decoded value table of non-LAST coefficients of INTER and INTER. FIG. 33 is a diagram showing another part of a decoded value table of non-LAST coefficients of INTRA and INTER in the same embodiment. FIG. 35 is a view showing a decoded value table of LAST coefficients of INTRA and INTER in FIG. 35. Escape in the embodiment FIG. 36 is a diagram illustrating a decoded value table of a symbol. FIG. 36 is a diagram illustrating the operation of a decoded value determination unit in FIG. 15. FIG. 37 is a diagram illustrating the encoding / decoding order of macroblocks in the embodiment. FIG. 39 is a diagram showing an example of a device in which the variable length coding / decoding device according to the present invention is incorporated. FIG. 39 is a diagram showing a general decoding method of a reversible code. FIG. 40 is an explanatory diagram of a normal variable length code. FIG. 41 is an explanatory view of a conventional reversible code.
101 codeword table creation unit 102 codeword table 103 encoder 104 transmission or storage system 105 synchronization code detector 106 buffer 107 forward decoder 108 backward decoder 109 decoding Value determination unit 110: forward decoded word table 111: forward decoding tree creating unit 112: backward codeword table 113 ... backward decoding tree creating unit 114: encoding unit 115: decoding unit 21: code selecting unit 22 ... Codeword configuration unit 201 Codeword table creation unit 202 Codeword table 203 Encoder 204 Fixed length code encoding unit 205 Transmission or storage system 206 Synchronization code detection unit 207 Buffer 208 Decoding graph Decoded value table creating unit 209 Forward decoder 220 Fixed length code decoding unit 211 Reverse decoder 212 Decoded value determination unit 213 Encoding unit 214 decoding unit 701 encoding control unit 702 information source encoder 703 moving image multiplexing unit 704 transmission buffer 705 transmission or storage system 706 reception buffer 707 moving image multiplexing / demultiplexing Unit 708 information source decoder 709 moving image encoder 710 moving image decoder 901 lower layer variable length decoder 902 upper layer channel encoder 903 lower layer variable length encoder 904 ... Lower layer channel encoder 905. Multiplexer 906. Demultiplexer 907. Upper layer channel decoder 908... Lower layer channel decoder 909. Upper layer variable length decoder 910. Variable length decoder 1001 Personal computer 1002 Workstation 1003 Wireless device 1004 Wireless device 1005 Camera 1006 Camera

Claims (4)

順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する可変長復号化方法において、
順方向にも逆方向にも復号可能であって、符号語の予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成された複数の符号語を異なる情報シンボルにそれぞれ対応させて格納した符号語テーブルを構成し、
この符号語テーブルを用いて前記符号化データを復号することを特徴とする可変長復号化方法。
In a variable length decoding method for decoding encoded data composed of a variable length code that can be decoded in both the forward direction and the reverse direction,
A plurality of codewords, which can be decoded in the forward direction and the reverse direction, and are configured such that the delimiter of the codeword can be identified by the predetermined number of “1” or “0” of the codeword, Constitute a codeword table stored in correspondence with
A variable length decoding method comprising decoding the encoded data using the codeword table.
順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する可変長復号化装置において、
順方向にも逆方向にも復号可能であって、符号語の予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成された複数の符号語を異なる情報シンボルにそれぞれ対応させて格納した符号語テーブルと、
この符号語テーブルを用いて前記符号化データを復号する手段
とを有することを特徴とする可変長復号化装置。
In a variable length decoding device that decodes encoded data composed of a variable length code that can be decoded in both the forward direction and the reverse direction,
A plurality of codewords, which can be decoded in the forward direction and the reverse direction, and are configured such that the delimiter of the codeword can be identified by the predetermined number of “1” or “0” of the codeword, A codeword table stored in correspondence with
Means for decoding the encoded data using the codeword table.
順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する可変長復号化方法において、
前記可変長符号の符号長を符号語の予め定められた“1”または“0”の数によって求め、パスカルの三角形によって決まる値を節点の値とし、各節点から次の節点に至る矢を符号語の“1”および“0”に対応させた有向グラフを用いて同一符号長の異なる符号語についての順序値を求めると共に、この順序値と該有向グラフを用いて復号値を計算することを特徴とする可変長復号化方法。
In a variable length decoding method for decoding encoded data composed of a variable length code that can be decoded in both the forward direction and the reverse direction,
The code length of the variable-length code is determined by a predetermined number of “1” or “0” of the code word, the value determined by the Pascal's triangle is set as the value of the node, and the arrow from each node to the next node is encoded. Using a directed graph corresponding to the words "1" and "0" to determine an order value for different codewords having the same code length, and calculating a decoded value using the order value and the directed graph. Variable length decoding method.
順方向にも逆方向にも復号可能な可変長符号からなる符号化データを復号する可変長復号化装置において、
前記可変長符号の符号長を符号語の予め定められた“1”または“0”の数によって求め、パスカルの三角形によって決まる値を節点の値とし、各節点から次の節点に至る矢を符号語の“1”および“0”に対応させた有向グラフを用いて同一符号長の異なる符号語についての順序値を求めると共に、この順序値と該有向グラフを用いて復号値を計算することを特徴とする可変長復号化装置。
In a variable length decoding device that decodes encoded data composed of a variable length code that can be decoded in both the forward direction and the reverse direction,
The code length of the variable-length code is determined by a predetermined number of “1” or “0” of the code word, the value determined by the Pascal's triangle is set as the value of the node, and the arrow from each node to the next node is encoded. Using a directed graph corresponding to the words "1" and "0" to determine an order value for different codewords having the same code length, and calculating a decoded value using the order value and the directed graph. Variable-length decoding device.
JP2002294314A 1995-04-14 2002-10-07 Variable length decoding method and apparatus Expired - Lifetime JP3579412B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002294314A JP3579412B2 (en) 1995-04-14 2002-10-07 Variable length decoding method and apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP7-89772 1995-04-14
JP8977295 1995-04-14
JP2002294314A JP3579412B2 (en) 1995-04-14 2002-10-07 Variable length decoding method and apparatus

Related Parent Applications (1)

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

Publications (2)

Publication Number Publication Date
JP2003158458A JP2003158458A (en) 2003-05-30
JP3579412B2 true JP3579412B2 (en) 2004-10-20

Family

ID=26431183

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002294314A Expired - Lifetime JP3579412B2 (en) 1995-04-14 2002-10-07 Variable length decoding method and apparatus

Country Status (1)

Country Link
JP (1) JP3579412B2 (en)

Also Published As

Publication number Publication date
JP2003158458A (en) 2003-05-30

Similar Documents

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

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040709

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040715

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

Free format text: PAYMENT UNTIL: 20080723

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090723

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090723

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100723

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110723

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120723

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130723

Year of fee payment: 9

EXPY Cancellation because of completion of term