JP3612315B2 - Variable length decoding method and apparatus - Google Patents

Variable length decoding method and apparatus Download PDF

Info

Publication number
JP3612315B2
JP3612315B2 JP2002294319A JP2002294319A JP3612315B2 JP 3612315 B2 JP3612315 B2 JP 3612315B2 JP 2002294319 A JP2002294319 A JP 2002294319A JP 2002294319 A JP2002294319 A JP 2002294319A JP 3612315 B2 JP3612315 B2 JP 3612315B2
Authority
JP
Japan
Prior art keywords
code
decoding
variable length
encoded data
decoded
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
JP2002294319A
Other languages
Japanese (ja)
Other versions
JP2003179502A (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 JP2002294319A priority Critical patent/JP3612315B2/en
Publication of JP2003179502A publication Critical patent/JP2003179502A/en
Application granted granted Critical
Publication of JP3612315B2 publication Critical patent/JP3612315B2/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】
【課題を解決するための手段】
上記の課題を解決するため、本発明は動画像の符号化データを上位階層とこれに続く下位階層に分け、動画像の符号化データに含まれる少なくともマクロブロックのモード情報を可変長符号化して上位階層に、前記動画像の符号化データに含まれる量子化後のDCT係数を順方向にも逆方向にも復号可能な符号語として可変長符号化して下位階層にそれぞれ配して多重化した可変長符号化データを入力し、多重化された可変長符号化データから上位階層と下位階層を分離し、分離された上位階層及び下位階層の可変長符号化データをそれぞれ復号することを特徴とする。
【0014】
ここで、量子化後のDCT係数以外の情報は、例えばマクロブロックのモード情報と動きベクトル情報及びイントラDCの情報を含む。量子化後のDCT係数に対応する順方向にも逆方向にも復号可能な符号語は、例えば予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成される。
【0015】
また、本発明に係る可変長復号化装置は、動画像の符号化データを上位階層とこれに続く下位階層に分け、動画像の符号化データに含まれる少なくともマクロブロックのモード情報を可変長符号化して上位階層に、前記動画像の符号化データに含まれる量子化後のDCT係数を順方向にも逆方向にも復号可能な符号語として可変長符号化して下位階層にそれぞれ配して多重化した可変長符号化データを入力する手段と、多重化された可変長符号化データから上位階層と下位階層を分離する分離部と、分離された上位階層の可変長符号化データを復号する上位階層可変長復号化器と、分離された下位階層の可変長符号化データを復号する下位階層可変長復号化器とを具備することを特徴とする。
【0016】
【発明の実施の形態】
以下、図面を参照して本発明の実施形態を説明する。
図1は、本発明の一実施形態に係る可変長符号化/復号化装置の構成を示すブロック図である。本実施形態の可変長符号化/復号化装置は、大きく分けて符号語テーブル作成部101、符号化部114、伝送系または蓄積系104および復号化部115からなる。まず、これら各部の機能について簡単に説明すると、符号語テーブル作成部101は情報シンボルの生起確率に基づいて符号語テーブルを作成し、符号化部114内の符号化テーブル102と、復号化部115内の順方向符号語テーブル110および逆方向符号語テーブル112に送る。符号化部114は、情報シンボルを可変長符号に符号化し、その可変長符号を符号化データとして伝送系または蓄積系104へ出力する。復号化部115は、伝送系または蓄積系104を介して入力されてきた符号化データを復号して元の情報シンボルを再生する。
【0017】
次に、本実施形態の各部の詳細な構成と動作を説明する。符号化部114において、入力された情報シンボルは符号化器103に入力される。一方、符号語テーブル102は、符号語テーブル作成部101によって予め作成された情報シンボルと可変長符号の符号語とを対応させて格納している。符号化器103は符号語テーブル102に格納されている符号語の中から、入力された情報シンボルに対応した符号語を選択して符号化データとして出力する。この符号化データは、伝送系または蓄積系104を通して復号化部115に送られる。この際、符号化データには一定周期毎に同期コードが挿入される。
【0018】
復号化部115では、伝送系または蓄積系104より入力された符号化データから同期コード検出部105で同期コードを検出し、同期コードと同期コードの間の符号化データをバッファ106に蓄積する。順方向復号化器110では、順方向復号木作成部111からの順方向復号木に基づいて、バッファ106に蓄積された符号化データの先頭から復号を開始し、逆方向復号化器108では、逆方向復号木作成部113からの逆方向復号木に基づいて、バッファ106に蓄積された符号化データの末尾から復号を開始する。
【0019】
復号値判定部109では、順方向復号化器107によって得られた復号結果(順方向復号値という)と、逆方向復号化器108によって得られた復号結果(逆方向復号値という)から復号値を判定し、最終的な復号結果を出力する。すなわち、復号値判定部109では符号化データに誤りがあると、復号木に出現しないビットパターンが生じることから誤りの存在が分かるので、順方向復号結果と逆方向復号結果から図2に示すように復号値を判定する。図2は、同期コードと同期コードとの間の復号値判定方法を示している。
【0020】
まず、図2(a)に示すように順方向復号結果と逆方向復号結果で誤りが検出される符号語の位置(誤り検出位置)が交差しない場合は、誤りが検出されなかった復号結果のみを復号値として使用し、二つの誤り検出位置の復号結果は復号値として使用せず、放棄する。
【0021】
また、図2(b)に示すように順方向復号結果と逆方向復号結果の誤り検出位置が交差する場合は、両方で誤りが検出されなかった復号結果を復号結果値として使用する。また、この場合には二つの誤り検出位置の符号語の間の復号結果は復号値として使用せず、放棄する。
【0022】
また、図2(c)に示すように順方向復号結果および逆方向復号結果のうち片方向の復号結果にしか誤りが検出されない場合(この例では、順方向復号結果にのみ誤りが検出されている)は、誤り検出位置の符号語に対する復号値を放棄し、それ以後の符号語に対する復号値は逆方向の復号結果を使用する。
【0023】
さらに、図2(d)に示すように同一の符号語について順方向復号結果および逆方向復号結果の両方に誤りが検出される場合は、図2(c)と同様に誤り検出位置の符号語に対する復号値は放棄し、それ以後の符号語に対する復号値としては逆方向の復号結果を使用する。
【0024】
符号語テーブル作成部101では、情報シンボルの生起確率に基づいて順方向にも逆方向にも復号可能な符号の符号語テーブルを作成する。符号語テーブル作成部101によって作成された符号語テーブルは、符号化部114内の符号語テーブル102と、復号化部115内の順方向符号語テーブル110および逆方向符号語テーブル112に送られる。順方向復号木作成部111では、順方向符号語テーブル110から順方向復号木を作成する。また、逆方向復号木作成部113では、逆方向符号語テーブル112から逆方向復号木を作成する。
【0025】
図3は、符号語テーブル作成部101の構成を示すブロック図である。符号選択部21は、情報シンボルの生起確率の情報を入力として、この情報に基づいて選択可能な符号系の中から最も平均符号長の小さいものを選択し、選択結果を符号語構成部22に送る。符号語構成部22では、符号語選択部21で選択された符号の符号語を構成して、符号語テーブルを作成する。符号語構成部22で作成された符号語テーブルは、符号化部114内の符号語テーブル102および復号化部115内の順方向符号語テーブル110に送られる。復号化部115内の逆方向符号語テーブル112には、順方向とは逆向きに記述された符号語テーブルが送られる。
【0026】
符号選択部21では、入力された情報シンボルを生起確率が大きい順に並べ替えてS={S1 ,S2 ,…,Sn }とし、これらの情報シンボルSの生起確率P={p1 ,p2 ,…,pn }に基づいて、構成可能な符号の集合Cの中から、
【数1】

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

Claims (6)

動画像の符号化データを上位階層とこれに続く下位階層に分け、前記動画像の符号化データに含まれる少なくともマクロブロックのモード情報を可変長符号化して前記上位階層に、前記動画像の符号化データに含まれる量子化後のDCT係数を順方向にも逆方向にも復号可能な符号語として可変長符号化して前記下位階層にそれぞれ配して多重化した可変長符号化データを入力し、
前記多重化された可変長符号化データから前記上位階層と下位階層を分離し、
分離された上位階層及び下位階層の可変長符号化データをそれぞれ復号することを特徴とする可変長復号化方法。
Divided coded data of a moving image in the upper layer and the subsequent lower layer, the mode information for at least macro blocks included in the encoded data of the moving image to the variable length coding to the upper layer, the sign of the moving image the DCT coefficients after quantization are included in the data in the forward direction by the variable length coding as an inverted even decodable codeword type the variable length coded data obtained by multiplexing by disposing each of the lower layer ,
Separating the upper and lower layers from the multiplexed variable length encoded data;
A variable-length decoding method characterized by decoding the separated variable-length encoded data of an upper layer and a lower layer, respectively.
前記上位階層は、前記動画像の符号化データに含まれる動きベクトル情報及びイントラDCの情報を可変長符号化したデータが配されている請求項1記載の可変長復号化方法。2. The variable length decoding method according to claim 1, wherein the upper layer is provided with data obtained by variable length encoding motion vector information and intra DC information included in the encoded data of the moving image. 前記順方向にも逆方向にも復号可能な符号語は、予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成されることを特徴とする請求項1記載の可変長復号化方法。The codeword that can be decoded both in the forward direction and in the reverse direction is configured such that a delimiter of the codeword can be recognized by a predetermined number of "1" or "0". Variable length decoding method. 動画像の符号化データを上位階層とこれに続く下位階層に分け、前記動画像の符号化データに含まれる少なくともマクロブロックのモード情報を可変長符号化して前記上位階層に、前記動画像の符号化データに含まれる量子化後のDCT係数を順方向にも逆方向にも復号可能な符号語として可変長符号化して前記下位階層にそれぞれ配して多重化した可変長符号化データを入力する手段と、
前記多重化された可変長符号化データから前記上位階層と下位階層を分離する分離部と、
分離された上位階層の可変長符号化データを復号する上位階層可変長復号化器と、
分離された下位階層の可変長符号化データを復号する下位階層可変長復号化器とを具備することを特徴とする可変長復号化装置。
Divided coded data of a moving image in the upper layer and the subsequent lower layer, the mode information for at least macro blocks included in the encoded data of the moving image to the variable length coding to the upper layer, the sign of the moving image inputting the variable length encoded data multiplexed with the variable length coding placed respectively in the lower layer of the DCT coefficients after quantization as decodable codewords in the opposite direction to the forward direction included in data Means,
A separator that separates the upper layer and the lower layer from the multiplexed variable-length encoded data;
An upper layer variable length decoder for decoding the separated upper layer variable length encoded data;
A variable length decoding apparatus comprising: a lower layer variable length decoder for decoding separated lower layer variable length encoded data.
前記上位階層は、前記動画像の符号化データに含まれる動きベクトル情報及びイントラDCの情報をさらに可変長符号化したデータが配されている請求項4記載の可変長復号化装置。5. The variable length decoding device according to claim 4, wherein the upper layer is provided with data obtained by further variable length coding the motion vector information and the intra DC information included in the encoded data of the moving image. 前記順方向にも逆方向にも復号可能な符号語は、予め定められた“1”または“0”の数によって符号語の区切りが分かるように構成されることを特徴とする請求項4記載の可変長復号化装置。5. The codeword that can be decoded both in the forward direction and in the reverse direction is configured such that a delimiter of the codeword can be recognized by a predetermined number of “1” or “0”. Variable length decoding device.
JP2002294319A 1995-04-14 2002-10-07 Variable length decoding method and apparatus Expired - Lifetime JP3612315B2 (en)

Priority Applications (1)

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

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8977295 1995-04-14
JP7-89772 1995-04-14
JP2002294319A JP3612315B2 (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
JP2003179502A JP2003179502A (en) 2003-06-27
JP3612315B2 true JP3612315B2 (en) 2005-01-19

Family

ID=26431186

Family Applications (1)

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

Country Status (1)

Country Link
JP (1) JP3612315B2 (en)

Also Published As

Publication number Publication date
JP2003179502A (en) 2003-06-27

Similar Documents

Publication Publication Date Title
EP0732855B1 (en) Moving picture variable length coding system and method
JP3431368B2 (en) Variable length encoding / decoding method and variable length encoding / decoding device
JP3609814B2 (en) Variable length decoding method and apparatus
JP3766426B2 (en) Variable length coding method and apparatus
JP3612315B2 (en) Variable length decoding method and apparatus
JP3612314B2 (en) Variable length coding method and apparatus
JP3944049B2 (en) Variable length decoding method and apparatus
JP3869342B2 (en) Variable length decoding method and apparatus
JP3764466B2 (en) Variable length decoding method and apparatus
JP3609813B2 (en) Variable length coding method and apparatus
JP3822630B2 (en) Variable length decoding method and apparatus
JP3866687B2 (en) Variable length coding method and apparatus
JP3748215B2 (en) Variable length coding method and apparatus
JP3822629B2 (en) Variable length coding 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
JP3579412B2 (en) Variable length decoding method and apparatus
JP3417933B2 (en) Variable length decoding method and apparatus
JP3233360B2 (en) Variable length decoding method and apparatus
JP3417934B2 (en) Variable length encoding method and apparatus
JP3164806B2 (en) Variable length encoding method and apparatus

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040709

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040713

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040913

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041022

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

Free format text: PAYMENT UNTIL: 20081029

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20081029

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091029

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20101029

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111029

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20111029

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20121029

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20131029

Year of fee payment: 9

EXPY Cancellation because of completion of term