JP2004096692A - Apparatus and method for variable length coding by hash - Google Patents

Apparatus and method for variable length coding by hash Download PDF

Info

Publication number
JP2004096692A
JP2004096692A JP2002258938A JP2002258938A JP2004096692A JP 2004096692 A JP2004096692 A JP 2004096692A JP 2002258938 A JP2002258938 A JP 2002258938A JP 2002258938 A JP2002258938 A JP 2002258938A JP 2004096692 A JP2004096692 A JP 2004096692A
Authority
JP
Japan
Prior art keywords
hash
variable
length
key
code
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.)
Pending
Application number
JP2002258938A
Other languages
Japanese (ja)
Inventor
Yukio Takase
高瀬 行夫
Tsuyoshi Hagiwara
萩原 強
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2002258938A priority Critical patent/JP2004096692A/en
Publication of JP2004096692A publication Critical patent/JP2004096692A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To reduce the memory capacitance of a variable length code (VLC) hash table and to reduce computational complexity in variable length coding. <P>SOLUTION: A hash operating means 102 applies a first hash operation with a small computational complexity to key data (RUN, LEVEL and LAST) based on source data to directly find the address of a VLC hash table 103. The VLC hash table 103 is referred to by using the address to acquire table information, and the table information is separated by a table separating means to obtain a secondary key (KEY2). The KEY2 is compared with a secondary key calculated from the key data to judge whether the table information is corresponding to the key data. When the agreement is found, the variable length code and a code length are obtained. The secondary key is stored in the VLC hash table to reduce the memory capacitance of the table. The hash operation is used not to generate synonyms, such that measures to cope with synonyms are not required. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、ハッシュによる可変長符号化装置に関し、特に、画像圧縮処理などにおいて、可変長符号テーブルを用いてデータを可変長符号に変換するハッシュによる可変長符号化装置に関する。
【0002】
【従来の技術】
画像情報は、非常に情報量が多いので、大量の画像情報をリアルタイムに送信することは、非常に困難である。そのため、画像データを圧縮して送信し、受信側で伸長するという技術が用いられている。画像データの典型的な圧縮方法として、出現頻度の高いビットパターンに短い符号を割り当て、出現頻度の低いビットパターンには長い符号を割り当てるという可変長符号化方法がある。画像データを高能率に符号化する技術として、DCT(Discrete Cosine Transform:離散コサイン変換)と、可変長符号化を組み合わせた方式が標準化され、広く用いられている。画像圧縮化装置では、動き予測でデータそのものを平坦化し、さらにDCT処理および量子化処理によって、高周波成分を削減している。圧縮処理の対象となる画像信号には0が多く含まれるので、可変長符号テーブルを用いることにより、効率よく画像信号を圧縮できる。また、テーブルを参照してデータ変換するので、複雑な処理も不要で、高速な符号化処理ができる。
【0003】
画像データの圧縮方法を一般的に良く知られている動画像符号化標準であるMPEG−1(Moving Picture Experts Groupe)を例に取り、簡単に説明する。画像データを、離散コサイン変換して、周波数成分のデータに変換し、高周波成分を小さくする量子化処理を行う。量子化されたデータは、RUNデータとLEVELデータとに変換される。LEVELデータは、0でないデータのレベルを表す。RUNデータは、0でないデータの後に続く0のデータ数である。高周波成分には0が多く含まれるので、RUNレングス変換を用いて効率よく圧縮できる。RUNデータとLEVELデータは、(RUN,LEVEL)の形式に変換される。この(RUN,LEVEL)データを、可変長符号に変換する。すなわち、RUNデータおよびLEVELデータをアドレスとして、テーブルをアクセスすることにより、対応する可変長符号とその符号長データを読み出して、可変長符号を生成する。
【0004】
可変長符号テーブルには、アドレスに対応する可変長符号データが格納されている。可変長符号データの格納領域には、(RUN,LEVEL)の組合せに対応する可変長符号を格納する可変長符号領域(17ビット幅)と、可変長符号領域に格納されている可変長符号の長さを特定する情報を格納する5ビット幅の符号長領域とがある。可変長符号データをアクセスするためのアドレスは、6ビットのRUN領域と7ビットのLEVEL領域とからなる13ビットのアドレスである。RUNデータとLEVELデータからアドレスを生成し、そのアドレスで可変長符号テーブルメモリをアクセスすることにより、対応する可変長符号データを得る。
【0005】
アドレスのうち、RUNに6ビット、LEVELに7ビットが割り当てられているのは、画像符号化標準方式MPEG1(Moving Picture Experts Group 1)において、RUNの範囲が0〜63であり、LEVELの範囲が±41であり、これらを表現するためには、それぞれ6ビットおよび7ビットが必要なためである。可変長符号領域が17ビットで、符号長領域が5ビットなのは、可変長符号の最大長が17ビットであるためである。なお、符号長領域が必要なのは、可変長符号の扱いには符号長も必要であり、可変長符号と合わせて、その可変長符号の符号長も出力する必要があるためである。テーブルに記載されていないRUNとLEVELとの組合せは、可変長符号化器と異なる符号化器により別途処理される。
【0006】
可変長符号は、2ビット〜17ビットの範囲の符号長を有している。しかし、メモリの可変長符号領域の長さを、任意のビット長とすることは困難である。そのため、最大の符号長に合わせた固定長のフィールドを、一つの可変長符号データに割り付ける必要がある。したがって、1つの可変長符号の情報を格納するためには、22ビット(可変長符号17ビット+符号長データ5ビット)のデータ領域が必要である。この可変長符号テーブルをメモリ上に展開するためには、少なくとも8kワード((13ビットアドレスのアドレス空間)×(22ビット))のメモリが必要である。このように、可変長符号テーブルでは、処理されるRUNおよびLEVELの組合せは256種程度しかないのに対し、メモリ上にテーブルを展開する場合には、8kワードの空間を必要とする。したがって、メモリ空間をより効率的に使用して、より少ないメモリで可変長符号化処理を行う必要がある。
【0007】
前記MPEG−1は、(RUN,LEVEL)で可変長符号に変換するので、2次元ランレングス符号化と呼ばれている。次に、新しい動画像符号化標準のMPEG−4(Moving Picture Experts Groupe)を例に取り説明する。データを可変長符号化するために、RUNデータとLEVELデータとLASTデータにより、(RUN,LEVEL,LAST)で可変長符号(VLC: Variable Length Code)テーブルを参照して、3次元ランレングスにより可変長符号を生成する。RUNデータは、0でないデータの後ろに続く0のデータ数である。LEVELデータは、0でないデータのレベルである。LASTは、該当LEVELがデータの最後かどうかを識別するものである。可変長符号テーブル(VLCテーブル)を参照する方式としては、一般的には、図12に示すように、大きなメモリテーブルを用意し、RUN,LEVEL,LASTを並べて、VLCテーブルのアドレスを生成して、VLCテーブルを参照する。例えば、MPEG−4のINTRA VLCを例にとると、図15に示すように、RUNは0〜20の範囲の値を取るので、5bitで表現可能であり、LEVELは、1〜27の範囲の値を取るので、5bitで表現可能であり、LASTは、0〜1の範囲の値を取るので1bitで表現可能である。これを並べると、5bit+5bit+1bit=11bitのアドレス空間となる。MPEG−4の可変長符号は、2ビット〜12ビットの範囲の符号長を有しているので、1つの可変長符号の情報を格納するためには、16ビット(可変長符号12ビット+符号長データ5ビット)のデータ領域が必要である。この可変長符号テーブルをメモリ上に展開するためには、少なくとも2K×16ビットのメモリが必要である。このように、可変長符号テーブルでは、処理される(RUN,LEVEL,LAST)の組合せが102個程度しかないのに対して、メモリ上にテーブルを展開する場合には、2Kワードの空間を必要とし、メモリ空間をより効率的に使用して、より少ないメモリで可変長符号化処理を行う必要がある。
【0008】
可変長符号テーブルのサイズを削減する方法を説明する。可変長符号の符号語の上位ビットは、同じ符号の繰返しパターンが多いという特徴があることから、可変長符号化装置においては、可変長符号テーブルに格納する符号語を、同じビットが繰り返されるパターンの長さと、残りの符号で表現している。この表現によると、例えばMPEG1のDCT係数の符号を表すためには、繰返し回数の表現のために4ビット、残りのデータのために6ビット使用し、さらに、符号長を表現するために4ビット使用する。1符号あたりの全体の長さは、14ビットとなっている。テーブルサイズを削減する方法として、特許文献1に開示された「可変長符号テーブルおよび可変長符号化装置」や、特許文献2に開示された「可変長符号化装置」のように、データ(例えばLEVEL)の値の範囲によって、RUN,LEVELをクラスに分類し、クラスごとにVLCテーブルのアドレスを生成するbitの割付けを変える方法がある。
【0009】
係数の値(LEVEL)の範囲によって、4つのクラスに分類する。係数値0が続く数(RUN)とLEVELの組合せに対応する可変長符号テーブルのアドレスを、クラスにより識別されるフラグ領域と、RUNを表す領域と、LEVELを表す領域から構成される固定長の領域の数値とする。RUNとLEVELの領域の大きさは、それぞれのクラスに含まれる最大値を格納するのに必要な最小限の大きさに定めている。例えば、MPEG1のDCT係数の符号を表すためには、11ビット使用している。具体的には、アドレスは、クラスにより識別されるフラグ領域と、LASTを表す領域と、RUNを表す領域と、LEVELを表す領域により構成されている。全体として固定長でVLCテーブルのアドレスを生成することによって、テーブルサイズを小さくしている。MPEG−4のINTRA VLCを例にとると、図13に示すように、9種類のクラス(クラスA〜クラスI)に分類し、8bitのアドレス空間で表現し、256個のテーブルで実現可能である。
【0010】
特許文献1に開示された「可変長符号テーブルおよび可変長符号化装置」は、可変長符号メモリの容量を小さくするものである。MPEG1のDCT出力係数の可変長符号テーブルにおいて、RUNとLEVELとの組合せを、LEVELの絶対値の大きさによりクラス別に分類する。対応の可変長符号のアドレスを、LEVELの属するクラスにより、値と長さとがユニークに特定されるフラグ領域と、RUNデータ領域と、LEVELデータの領域とを含む固定長とする。RUNとLEVELとの領域長は、それぞれLEVELのクラスごとに、当該クラスに含まれる組合せのRUNデータの絶対値と、LEVELデータの絶対値との、それぞれの最大値を格納するのに必要な最小限の大きさに定める。可変長符号を、先頭から連続する0の個数と、残りの符号と、残りの符号の符号長とに分けて、テーブルに格納することもできる。
【0011】
特許文献2に開示された「可変長符号化装置」は、高速でハードウェア規模の小さい可変長符号化装置である。量子化DCT係数をメモリから順に読み出し、可変長符号化する場合には、可変長符号テーブルアドレスを出力し、固定長符号化する場合には、符号語と符号長を出力する。量子化DCT係数以外の情報についても、可変長符号化する場合には、可変長符号テーブルアドレスを出力し、固定長符号化する場合には、符号語と符号長を出力する。その際、可変長符号のアドレスを候補群から選択し、固定長符号の符号を候補群から選択する。固定長符号を遅延させ、可変長符号または固定長符号のいずれかを選択する。選択された符号を連ねて、符号列を形成する。
【0012】
テーブルサイズを削減する別の方法として、特許文献3に開示された「ハッシュテーブル検索方法および装置」のように、演算量が少なくシノニムの発生しないハッシュ演算で、直接VLCテーブルのアドレスを生成することによって、テーブルサイズを小さくする方法がある。特許文献4に開示された「ハッシュテーブル検索方法および装置」は、テーブルに格納したデータをキー項目により高速に検索し、かつテーブル容量を小さくするものである。キー取得部は、ハッシュ計算部のハッシュ値により、ハッシュ表格納部からキーを取得する。キー一致判定部により、検索キーと比較することにより、検索対象のキーであるかを判定する。不一致の場合は、テーブル未登録と判断する。一致した場合は、シノニムが発生しないので、目的のキーとなる。データ取得部によりデータを取得して、データ格納部に格納する。ハッシュ計算部の演算量が少なく、シノニム対策が不要であるため、検索を高速化できる。また、ハッシュ表格納部の空きエリアを利用して、データそのものを格納しているため、テーブルの容量を小さく抑えられる。
【0013】
検索キーをもとにテーブルを直接参照して検索する手法としては、検索キーをテーブルのアドレスに変換する写像であるハッシュ関数を利用する方法がある。ハッシュ関数は、検索キーの集合からアドレスの集合への多対1の写像である。検索の手順は、以下のようになる。検索キーKからH(K)を計算して、アドレスAを求める。アドレスAで示されるテーブル中のキー項目が、検索キーKに対応するものかをどうかを検証する。これは、複数の検索キーが同じアドレスに写像されるシノニムという衝突現象が発生するからである。シノニムが発生していない場合は、アドレスAで示されるデータ項目が、検索結果のデータとなる。シノニムが発生した場合は、2次検索を行い、目的の検索キーが格納されたアドレスを再び求める。ハッシュ関数において、シノニムの発生を減らすために、テーブルの大きさNを素数とする。2次検索の方法には、H(K)の値が同一のすべての項目をリストでつなぎ、そのリンクをたどって目的の検索キーに対応する項目を求める方法や、目的の検索キーに対応する項目が見つかるまで、アドレスに別のハッシュ値を加算する方法がある。
【0014】
ハッシュテーブルの検索を高速化する方法として、2分木構造でキー管理を行う方法(特許文献5)や、副次関数を用いて衝突管理を行う方法がある。ハッシュ表管理では、キーの衝突が多数発生しても検索効率が低下しないように、同一のハッシュ値に変換された複数の異なるキーを、2分木構造でチェーンさせてハッシュ表に登録して検索する方式を採っている。特許文献6に開示された「ハッシュ表管理装置」は、ハッシュ表に対する検索処理性能を低下させないようにするものである。ハッシュ表のエントリーに対し、2分木構造でキーを管理する。登録手段は、検索手段によってハッシュ表を検索する。検索手段は、ハッシュ表検索を行うと同時に、2分木検索経路記録手段を作成する。登録手段は、未登録キーの登録時に、2分木バランス手段によって、2分木をバランスさせる。2分木バランス手段は、2分木検索経路記録手段によって、節の入れ換え処理を行い、2分木をバランスさせる。これにより、データの登録順序に関係なく、バランスのとれた2分木を作成する。
【0015】
図14を参照しながら、ハッシュテーブルの具体的な検索処理手順を説明する。RUNとLEVELの範囲チェックを行い、LAST,RUN,LEVELをキーとしてハッシュ演算を行い、VLCハッシュテーブルのアドレスAを算出する。ハッシュ演算は、例えば、
A=(LEVEL*23+RUN*3+LAST*17)mod 256
というものである。アドレスAで、VLCハッシュテーブルを参照し、テーブルに格納されたキー部(LAST,RUN,LEVEL)を取得し、ハッシュ演算に用いたキーと比較する。不一致であれば、可変長符号に定義されていない無効なキーである。一致していれば該当のキーであるので、VLCコードと長さを取得する。シノニムが発生しないハッシュ演算であるので、該当キーは一意に定まる。VLCハッシュテーブルは、ハッシュ演算によりアドレスの生成範囲を256以内としているので、テーブルの個数は256個であり、LAST(1bit)+RUN(5bit)+LEVEL(5bit)+VLC(12bit)+コード長(4bit)の合計4byte×256エントリー=1024byteで実現可能である。
【0016】
【特許文献1】
特開平8−79091号公報
【特許文献2】
特開平10−191336号公報
【特許文献3】
特開2000−105770号公報
【特許文献4】
特開2000−105770号公報
【特許文献5】
特開平10−40255号公報
【特許文献6】
特開平10−40255号公報
【0017】
【発明が解決しようとする課題】
しかしながら、大きなメモリテーブルを用いる従来手法では、VLCテーブルが大きいため、回路で実現した場合は、高価な高速メモリを大量に必要とするという問題がある。また、DSPなどのプロセッサを用いてソフトウェアで実現する場合は、高速なオンチップのメモリ量が少なく、テーブルを格納することができず、低速なメモリに配置することになり、高速に可変長符号化することができないという問題がある。
【0018】
また、クラスに分類し、固定長のアドレスを生成する従来手法では、クラスに分類し、アドレスを生成する演算量が大きいため、回路で実現した場合は、回路規模の増大を招くという問題がある。また、DSPなどのプロセッサを用いてソフトウェアで実現した場合は、処理手順が増大し、高速に可変長符号化できないという問題がある。
【0019】
また、ハッシュを用いてアドレスを生成する従来手法では、アドレスを生成するハッシュ演算量は少ないが、VLCハッシュテーブルの削減が十分ではなく、回路で実現した場合は、高価な高速メモリを大量に必要とするという問題がある。また、DSPなどのプロセッサを用いてソフトウェアで実現した場合は、高速なオンチップのメモリ量が少なく、テーブルを格納することができず、低速なメモリに配置することになり、高速に可変長符号化することができないという問題がある。
【0020】
本発明は、上記の従来の問題を解決して、VLCテーブルのメモリ量を小さくするとともに、少ない演算量で可変長符号化することを目的とする。
【0021】
【課題を解決するための手段】
上記の課題を解決するために、本発明では、可変長符号ハッシュテーブルを参照してキーデータを可変長符号に変換する可変長符号化装置に、原データの0の連続数であるRUN値の範囲をチェックするRUN範囲チェック手段と、原データの0でない数値のレベルを表すLEVEL値の範囲をチェックするLEVEL範囲チェック手段と、原データの最後か否かを示す識別子であるLAST値とRUN値とLEVEL値との組であるキーデータに第1のハッシュ演算を施してテーブルアドレスを算出するハッシュ演算手段と、キーデータに第2のハッシュ演算を施して2次キーを算出する2次ハッシュ演算手段と、可変長符号部と2次キー部とを含むテーブル情報を格納した可変長符号ハッシュテーブルと、テーブル情報を個別の情報に分離するテーブル分離手段と、2次キーとテーブル情報中の2次キー部とを比較するキー比較手段とを具備する構成とした。このように構成したことにより、可変長符号ハッシュテーブルにキーデータそのものを格納しなくてよくなり、可変長符号ハッシュテーブルのメモリ量を小さくできる。
【0022】
また、RUN範囲チェック手段とLEVEL範囲チェック手段とハッシュ演算手段と2次ハッシュ演算手段とを2組備え、LAST値に応じて2組のいずれか1組を選択する切替手段とを備えた。このように構成したことにより、可変長符号ハッシュテーブルのアドレス生成範囲を小さくして、可変長符号ハッシュテーブルのメモリ量を小さくできる。
【0023】
また、ハッシュ演算手段に、第1のハッシュ演算の結果が所定の上限値以下であることをチェックする上限チェック手段を備え、可変長符号ハッシュテーブルのサイズを上限値に等しくした。このように構成したことにより、可変長符号ハッシュテーブルのアドレス生成範囲を小さくして、可変長符号ハッシュテーブルのメモリ量を小さくできる。
【0024】
また、制御ビット付可変長符号部と2次キー部とからなるテーブル情報を格納した可変長符号ハッシュテーブルと、制御ビット付可変長符号部からコード長を算出する可変長符号長算出手段とを備えた。このように構成したことにより、可変長符号ハッシュテーブル中のコード長データを不要とし、可変長符号ハッシュテーブルの1エントリーあたりの情報量を減らして、可変長符号ハッシュテーブルのメモリ量を小さくできる。
【0025】
【本発明の実施の形態】
以下、本発明の実施の形態について、図1〜図11を参照しながら詳細に説明する。
【0026】
(第1の実施の形態)
本発明の第1の実施の形態は、可変長符号の情報を格納したVLCハッシュテーブルに、キーデータに第2のハッシュ演算を施して求めた2次キー部を格納しておき、キーデータに第1のハッシュ演算を施して求めたテーブルアドレスで、VLCハッシュテーブルをアクセスして2次キー部を読み出し、キーデータに第2のハッシュ演算を施して求めたハッシュ値と比較して確認する可変長符号化装置である。
【0027】
図1は、本発明の第1の実施の形態における可変長符号化装置の機能ブロック図である。図1において、RUN範囲チェック手段100は、原データにおいてゼロが連続する数(RUN)の範囲をチェックする手段である。LEVEL範囲チェック手段101は、原データのゼロでない係数値(LEVEL)の範囲をチェックする手段である。ハッシュ演算手段102は、原データのキーデータ(RUN,LEVEL,LAST)に第1のハッシュ演算を施す手段である。VLCハッシュテーブル103は、可変長符号(VLC)の情報(2次キー部(KEY2)、VLC、コード長(LEN))を格納したテーブルである。テーブル分離手段104は、VLCハッシュテーブルから得た情報を、3つの個別のデータに分離する手段である。2次ハッシュ演算手段105は、キーデータ(RUN,LEVEL,LAST)に第2のハッシュ演算を施す手段である。キー比較手段106は、読み出した2次キー部(KEY2)と演算で求めた2次キーとの比較を行う手段である。可変長符号化装置は、RUN範囲チェック手段100と、LEVEL範囲チェック手段101と、ハッシュ演算手段102と、VLCハッシュテーブル103と、テーブル分離手段104と、2次ハッシュ演算手段105と、キー比較手段106とから構成されている。
【0028】
図2は、本発明の第1の実施の形態における可変長符号化装置で用いるハッシュ演算とVLCハッシュテーブルの説明図である。図3は、可変長符号化装置で用いる2次ハッシュ演算とVLCハッシュテーブルの説明図である。図4は、可変長符号化装置の動作手順を示すフロー図である。
【0029】
上記のように構成された本発明の第1の実施の形態における可変長符号化装置の動作を説明する。ここでは、MPEG−4のINTRA可変長符号化を例にして説明するが、H.261、H.263、MPEG−2、JPEGなどの画像符号化方式にも、本実施の形態で説明する可変長符号化方法を適用することができる。可変長符号化する対象の原データについて、ゼロの連続する数(RUN)と、ゼロでない係数値(LEVEL)と、最後のデータを識別するための識別子(LAST)の組合せを、図示していない前段の装置から入力して、その組合せに基づいてVLCハッシュテーブルを引き、可変長符号(VLC)を求める。RUNは0〜63の値をとり、LEVELは1〜2047の値をとり、LASTは0、1の値を取る。しかし、図15に示すように、RUNとLEVELとLASTの全ての組合せに対して、可変長符号が定義されているわけではない。高い頻度で出現する102個の組合せだけについて、可変長符号が定義されている。残りの組合せについては、可変長符号が定義されていない。それ以外のデータの場合は、図示していない手段において、3 mode escape codingにより、エスケープ符号付可変長符号か、エスケープ符号付固定長符号を生成する。
【0030】
図1を参照しながら、RUN,LEVEL,LASTの組合せから、可変長コード(VLC)とその長さ(LEN)と可変長コード生成結果(OK/NG)を求める動作を説明する。(RUN,LEVEL,LAST)の組合せを、キーデータと呼ぶことにする。RUN範囲チェック手段100で、RUNが定義されているデータ範囲(0〜20)に入っているか否かをチェックする。範囲内の場合はOKを出力し、範囲外の場合はNGを出力する。LEVEL範囲チェック手段101で、LEVELが定義されているデータ範囲(1〜27)に入っているか否かをチェックする。範囲内の場合はOKを出力し、範囲外の場合はNGを出力する。ハッシュ演算手段102で、キーデータ(RUN,LEVEL,LAST)に第1のハッシュ演算を施し、算出したハッシュ値を、VLCハッシュテーブル103のアドレスAとする。VLCハッシュテーブル103は、後述するハッシュテーブルの条件を満足するハッシュ演算式に基づいて生成される。生成した時と同じハッシュ演算式で第1のハッシュ演算を行う。2次ハッシュ演算手段105で、キーデータ(RUN,LEVEL,LAST)に第2のハッシュ演算を施し、2次キーを算出する。アドレスAによってVLCハッシュテーブル103を参照し、テーブル情報(KEY2,VLC,LEN)を得る。テーブル情報(KEY2,VLC,LEN)を、テーブル分離手段104で、3つの個別の情報KEY2,VLC,LENに分離する。
【0031】
キー比較手段106で、テーブル分離手段104で得られたKEY2と、2次ハッシュ演算手段105で得られた2次キーを比較し、不一致の場合はNGを出力する。RUN範囲チェック手段100と、LEVEL範囲チェック手段101と、キー比較手段106から出力されたNG信号は、論理和(OR)され、可変長コード生成結果(OK/NG)の出力信号となる。すなわち、いずれか1つでもNGが出力されると、可変長コード生成結果はNGとなる。可変長コード(VLC)と、その長さ(LEN)と、可変長コード生成結果(OK/NG)の出力は、入力の制御信号(CTL)に一定のDELAYを加えた信号に同期してラッチされて、出力される。ここでは、非同期回路を用いる例を説明したが、同期回路で実現しても良い。
【0032】
次に、ハッシュ演算手段102のハッシュ式について詳細に説明する。ハッシュ演算は、キーの集合から番地の集合への多対1の写像演算である。キーデータ(RUN,LEVEL,LAST)をKとし、VLCハッシュテーブルの大きさをNとすると、アドレスAを求めるハッシュ演算の式は、
A=Hash(K) mod N ・・・ (1)
となる。Hash()は、一般のハッシュ関数である。
【0033】
ハッシュ演算において、異なるキーのハッシュ値が同一になる(衝突する)シノニムの発生を抑えるために、一般的には、テーブルの大きさNを素数とする。しかし、本実施の形態では、演算量を減らすために、テーブルの大きさNを2のべき乗にする。すなわち、
A=Hash(K) and (N−1) ・・・ (2)
のように、Nの剰余を求める演算を、論理積によるマスク演算で代用し、演算量を低減している。Nが2のべき乗の場合は、式(1)と式(2)は等価である。andは、ビットごとの論理積である。
【0034】
しかし、テーブルの大きさNが素数でないので、ハッシュ効果が薄れて、シノニムの増大を招く。そこで、本実施の形態では、キーデータを構成するサブキー(RUN,LEVEL,LASTのそれぞれ)に対して、個別に演算するハッシュ関数を利用する。すなわち、
A=Hash(K1,K2,K3) and (N−1) ・・・ (3)
というように、3変数のハッシュ演算を行うことにより、ハッシュ効果の薄れを防いでいる。3変数のハッシュ関数としては、周知のハッシュ関数のうち、演算が簡単なものを適宜選択して利用すればよい。
【0035】
次に、図2を参照しながら、VLCハッシュテーブル103の構造について詳細に説明する。ハッシュ関数は、多対1の写像であるので、複数のキーのハッシュ値が同一となるシノニム現象が必ず発生する。例えば、RUN=0〜20、LEVEL=1〜27、LAST=0,1の範囲をとるキーの集合202を、テーブルサイズN=256のハッシュテーブルの集合203に写像する場合を考えると、1134種類から256種類への写像となり、シノニムが多発する。しかし、そのうち可変長符号として定義されているキーの集合201の位数(元の数)は僅か102である。102種類から256種類への写像において、シノニムを発生させないことは明らかに可能である。本実施の形態においては、可変長符号に定義されているキーの集合201に対して、シノニムの発生しないハッシュ関数を用いる。このハッシュ関数は必ず存在し、具体的な条件に応じて生成することは容易である。可変長符号に定義されていないキーに対しては、シノニムを許している。すなわち、キーAに対しハッシュ演算を施した結果のハッシュ値P1と、キーBに対しハッシュ演算を施した結果のハッシュ値P2は、必ず異なった値を持つ。しかし、キーCに対しハッシュ演算を施した結果のハッシュ値P3は、他のハッシュ値と一致してもよい。
【0036】
このようなハッシュ関数を用いることにより、シノニム発生時の対策を不要としている。すなわち、ハッシュ演算した結果のハッシュ値が目的のキーのハッシュ値と一致するかどうかを判断するだけで、可変長符号を得ることができる。一般的には、ハッシュテーブルを引いて得たエントリー中のキーと、ハッシュテーブルを引くために用いたキーが一致しているかで判断を行う。しかし、VLCハッシュテーブル中にキーデータを格納するには、最低でも11bit(RUN=5bit、LEVEL=5bit、LAST=1bit)必要となり、VLCハッシュテーブルが大きくなってしまう。そこで本実施の形態では、VLCハッシュテーブル中にキーデータそのものを格納するのではなく、2次キーを格納するようにして、VLCハッシュテーブルを小さくしている。
【0037】
次に、図3を参照しながら、2次ハッシュ演算手段105の第2のハッシュ演算について詳細に説明する。キーの集合302に対しハッシュ演算を行った結果、シノニムが発生して同一のハッシュ値となった各々のキーに対し、シノニムを発生させない第2のハッシュ演算を施す。VLCハッシュテーブルには、キーデータ自体の代わりに、可変長符号として定義されているキーデータの集合301に、第2のハッシュ演算を施した結果のハッシュ値を格納する。すなわち、キーBに対しハッシュ演算した結果のハッシュ値P2と、キーCに対しハッシュ演算した結果のハッシュ値P3が一致して、シノニムが発生している場合、キーBに対し第2のハッシュ演算を施した結果のハッシュ値XBと、キーCに対して第2のハッシュ演算を施した結果のハッシュ値XCは一致することはない。したがって、VLCハッシュテーブルに格納された2次キー部XBと、第2のハッシュ演算結果とを比較することにより、目的のキーかどうか判断できる。本実施の形態では、キーの集合302に対する第1のハッシュ演算によるシノニムの発生を、1テーブルあたり8個以内に制限しているので、2次キーは3bitで表現できる。第2のハッシュ演算によるシノニムの発生はないので、8個以内の2次キーはすべてユニークとなる。
【0038】
図4を参照しながら、ソフトウエアで可変長符号化処理を行う場合に、キーデータ(RUN,LEVEL,LAST)から可変長コード(VLC)と、その長さ(LEN)と、可変長コード生成結果(OK/NG)を求める手順を説明する。ステップS100で、RUNの範囲のチェックを行う。RUNが定義されているデータ範囲(0〜20)に入っていれば、OKを出力して、LEVELの範囲のチェックに進む。範囲外の場合はNGを出力して終了する。ステップS101で、LEVELの範囲のチェックを行う。LEVELが定義されているデータ範囲(1〜27)に入っていればOKを出力して、第1のハッシュ演算に進む。範囲外の場合はNGを出力して終了する。ステップS102で、キーデータ(RUN,LEVEL,LAST)に第1のハッシュ演算を施して、算出したハッシュ値をVLCハッシュテーブル103のアドレスAとする。ステップS105で、キーデータ(RUN,LEVEL,LAST)に第2のハッシュ演算を施して、2次キーKを算出する。ステップS103で、アドレスAでVLCハッシュテーブルを参照して、テーブル情報(KEY2,VLC,LEN)を取得する。ステップS104で、テーブル情報を、KEY2,VLC,LENに分離する。ステップS106で、テーブル情報中のKEY2と算出した2次キーKを比較する。一致すればOKを出力し、可変長コード(VLC)とその長さ(LEN)を出力する。不一致ならばNGを出力して終了する。この例は、ソフトウエアのみで実現する方法を示したものであるが、ソフトウエア処理に部分的にハードウエア処理を組み合わせて実行することも可能である。その場合、周知の方法で適宜組み合わせることにより実現できることは、当業者には明らかであろう。
【0039】
このようにして、従来の可変長符号化装置に比べて少ない演算量のハッシュ演算で、VLCテーブルのアドレスを直接算出することができる。また、第2のハッシュ演算手段を設けることにより、VLCハッシュテーブルへのキーそのものの格納を不要とし、VLCハッシュテーブルのメモリ量を小さくできる。従来、VLCハッシュテーブルでは、キー部(11bit)+VLCコード(12bit)+コード長(4bit)の合計4byte×256エントリー=1024byte必要だったものを、VLCハッシュテーブル中に必要なキー部(11bit)を2次キー部(3bit)に置き換えることができ、2次キー部(3bit)+VLCコード(12bit)+コード長(4bit)の合計3byte×256エントリー=768byteに縮小することができる。
【0040】
上記のように、本発明の第1の実施の形態では、可変長符号化装置を、可変長符号の情報を格納したVLCハッシュテーブルに、キーデータに第2のハッシュ演算を施して求めた2次キー部を格納しておき、キーデータに第1のハッシュ演算を施して求めたテーブルアドレスで、VLCハッシュテーブルをアクセスして2次キー部を読み出し、キーデータに第2のハッシュ演算を施して求めたハッシュ値と比較して確認する構成としたので、VLCハッシュテーブルにキーデータそのものを格納しなくてよくなり、VLCハッシュテーブルのメモリ量を小さくできる。
【0041】
(第2の実施の形態)
本発明の第2の実施の形態は、RUN範囲チェック手段と、LEVEL範囲チェック手段と、第1のハッシュ演算手段と、第2のハッシュ演算手段とを、2組設け、LAST値に応じていずれか1組を使用して、キーデータに対して異なるRUN値の範囲のチェックと異なるLEVEL値の範囲のチェックと異なる第1のハッシュ演算処理と異なる第2のハッシュ演算処理とを行うようにし、キーデータに第1のハッシュ演算を施して求めたテーブルアドレスで、VLCハッシュテーブルをアクセスして2次キー部を読み出し、キーデータに第2のハッシュ演算を施して求めたハッシュ値と比較して確認する可変長符号化装置である。
【0042】
図5は、本発明の第2の実施の形態における可変長符号化装置のブロック図である。図5において、RUN範囲チェック手段400は、原データにおいてゼロが連続する数(RUN)の範囲を、それぞれ異なる基準でチェックする2つのチェック手段である。LEVEL範囲チェック手段401は、原データのゼロでない係数値(LEVEL)の範囲を、それぞれ異なる基準でチェックする2つのチェック手段である。ハッシュ演算手段402は、キーデータ(RUN,LEVEL,LAST)に、それぞれ異なる第1のハッシュ演算を施す2つの演算手段である。VLCハッシュテーブル403は、可変長符号(VLC)の情報を格納したテーブルである。2次ハッシュ演算手段405は、キーデータ(RUN,LEVEL,LAST)に、それぞれ異なる第2のハッシュ演算を施す2つの演算手段である。その他の構成要素に関しては、図1と同じ符号を付与し、個々の説明は省略する。図6は、可変長符号化装置の可変長符号化手順を示すフロー図である。
【0043】
上記のように構成された本発明の第2の実施の形態における可変長符号化装置の動作を説明する。キーデータを、LAST=0のグループと、LAST=1のグループに分けて、それぞれ異なる範囲チェックとハッシュ演算を行う。すなわち、2つのRUN範囲チェック手段400で、それぞれ異なる基準でRUNの範囲をチェックする。2つのLEVEL範囲チェック手段401で、それぞれ異なる基準でLEVELの範囲をチェックする。2つのハッシュ演算手段402で、キーデータ(RUN,LEVEL,LAST)に異なる第1のハッシュ演算を施す。2つの2次ハッシュ演算手段405で、キーデータ(RUN,LEVEL,LAST)に異なる第2のハッシュ演算を施す。VLCハッシュテーブル403は、LAST=0とLAST=1にグループ分けしたキーデータに基づいて生成されている。
【0044】
図5を参照しながら、キーデータ(RUN,LEVEL,LAST)から、可変長コード(VLC)とその長さ(LEN)と可変長コード生成結果(OK/NG)を求める動作を説明する。LASTが0か1に応じて、2組備えたRUN範囲チェック手段400とLEVEL範囲チェック手段401のいずれか1組に、RUNとLEVELを入力する。1組目のRUN範囲チェック手段400(LAST=0用)は、RUNが定義されているデータ範囲(0〜14)をチェックする。2組目のRUN範囲チェック手段400(LAST=1用)は、RUNが定義されているデータ範囲(0〜20)をチェックする。範囲外の場合は、NGを出力する。1組目のLEVEL範囲チェック手段401(LAST=0用)は、LEVELが定義されているデータ範囲(1〜27)をチェックする。2組目のLEVEL範囲チェック手段401(LAST=1用)は、LEVELが定義されているデータ範囲(1〜8)をチェックする。範囲外の場合は、NGを出力する。
【0045】
1組目のハッシュ演算手段402(LAST=0用)は、RUNとLEVELに、式(4−0)のハッシュ演算を行い、VLCハッシュテーブル403のアドレスA1を算出する。他方の2組目(LAST=1用)は、RUNとLEVELに、式(4−1)のハッシュ演算を行い、VLCハッシュテーブル403のアドレスA2を算出する。1組目の2次ハッシュ演算手段405(LAST=0用)は、RUNとLEVELに、式(5−0)の第2のハッシュ演算を行い、2次キーを算出する。他方の2組目(LAST=1用)は、RUNとLEVELに、式(5−1)の第2のハッシュ演算を行い、2次キーを算出する。
【0046】
VLCハッシュテーブル403は、ハッシュテーブルの条件を満足するハッシュ関数により生成されており、生成した時と同じハッシュ関数でキーデータにハッシュ演算を行って、アクセスする。アドレスA1またはA2によって、VLCハッシュテーブル403を引き、テーブル情報を得て、テーブル情報を、テーブル分離手段104で、KEY2,VLC,LENに分離する。キー比較手段106で、テーブル分離手段104で得られたKEY2と、2次ハッシュ演算手段405で得られた2次キーを比較し、不一致の場合はNGを出力する。
【0047】
RUN範囲チェック手段400と、LEVEL範囲チェック手段401と、キー比較手段106のそれぞれから出力されたNG信号は、論理和(OR)され、可変長コード生成結果(OK/NG)として出力される。可変長コード(VLC)と、その長さ(LEN)と、可変長コード生成結果(OK/NG)の出力は、入力の制御信号(CTL)に同期して(但し、一定のDELAYを含む)ラッチされて、出力される。これらの回路を非同期回路で構成する例を説明したが、同期回路で実現しても良い。
【0048】
ハッシュ演算手段402とVLCハッシュテーブル403のテーブル構成について詳細に説明する。LAST=0の場合の可変長符号として定義されているキーの種類は、67種類であるので、
A1=(RUN+112+LEVEL*102)and(128−1) ・・・ (4−0)
というハッシュ演算式によりアドレスを算出して、大きさN=128のハッシュテーブルに詰め込むことが可能である。また、LAST=1の場合の可変長符号として定義されているキーの種類は、35種類であるので、
A2=(RUN+LEVEL*31−25)and(64−1) ・・・ (4−1)
というハッシュ演算式によりアドレスを算出して、大きさN=64のハッシュテーブルに詰め込むことが可能である。すなわち、両方を合わせて、VLCハッシュテーブルの大きさを、N=192とすることができる。なお、ここで示したハッシュ演算式は一例であり、この条件を満たすものであれば、どんなハッシュ演算式でも良い。
【0049】
次に、2次ハッシュ演算手段405のハッシュ演算式について詳細に説明する。LAST=0の場合は、
(RUN>>1)and(8−1) ・・・ (5−0)
[ただし、>>1は、1ビット右シフトを示す]という第2のハッシュ演算式により、最大8個のシノニムの中から該当のキーデータを特定することが可能である。また、LAST=1の場合は、
(LEVEL)and(8−1) ・・・ (5−1)
という第2のハッシュ演算式により、最大8個のシノニムの中から該当のキーデータを特定することが可能である。なお、ここで示した第2のハッシュ演算式は一例であり、この条件を満たすものであれば、どんなハッシュ演算式でも良い。
【0050】
図6を参照しながら、ソフトウエアで可変長符号化処理を行う場合に、キーデータ(RUN,LEVEL,LAST)から、可変長コード(VLC)とその長さ(LEN)と可変長コード生成結果(OK/NG)を求める手順を説明する。キーデータを、LAST=0のグループと、LAST=1のグループに分けて、別々に第1と第2のハッシュ演算を行う。ステップS999で、LAST=0またはLAST=1に応じて分岐を行う。以下、LAST=0の手順について説明する。LAST=1の場合も同様な手順である。ステップ200−1で、RUNの範囲のチェックを行う。RUNが定義されているデータ範囲(0〜14)内ならば、LEVELの範囲のチェックに進む。範囲外ならばNGとなり処理を終了する。ステップS201−1で、LEVELの範囲のチェックを行う。LEVELが定義されているデータ範囲(1〜27)内ならば、第1のハッシュ演算に進む、範囲外ならばNGとなり処理を終了する。ステップS202−1で、キーデータ(RUN,LEVEL)に、式(4−0)の第1のハッシュ演算を行い、VLCハッシュテーブルのアドレスA1を算出する。ステップS205−1で、キーデータ(RUN,LEVEL)に、式(5−0)の第2のハッシュ演算を行い、2次キーKを算出する。ステップS203−1で、アドレスA1でVLCハッシュテーブルを引いて、テーブル情報を得る。ステップS104で、テーブル情報をKEY2,VLC,LENに分離する。ステップS106で、テーブル中のKEY2と、算出した2次キーKを比較する。一致すればOKを出力し、可変長コード(VLC)とその長さ(LEN)を出力する。不一致ならばNGを出力して終了する。この例は、ソフトウエアのみで実現する方法を示したものであるが、ソフトウエア処理に部分的にハードウエア処理を組み合わせて実行することも可能である。その場合、周知の方法で適宜組み合わせることにより実現できることは、当業者には明らかであろう。
【0051】
このようにして、従来の可変長符号化装置に比べて少ない演算量のハッシュ演算でVLCハッシュテーブルのアドレスを直接算出することができる。また、2組のハッシュ演算手段および2次ハッシュ演算手段により、キーデータを複数のグループに分けて別々にハッシュ演算を行い、VLCハッシュテーブルのアドレス生成範囲を小さくして、VLCハッシュテーブルのメモリ量を小さくできる。従来、VLCハッシュテーブルに、キー部(11bit)+VLCコード(12bit)+コード長(4bit)の合計4byte×256エントリー=1024byte必要だったものを、192エリトリー(LAST=0に128エントリー、LAST=1に64エントリー)にすることができ、2次キー部(3bit)+VLCコード(12bit)+コード長(4bit)の合計3byte×192エントリー=576byteに縮小することができる。
【0052】
上記のように、本発明の第2の実施の形態では、可変長符号化装置に、RUN範囲チェック手段と、LEVEL範囲チェック手段と、第1のハッシュ演算手段と、第2のハッシュ演算手段とを、2組設け、LAST値に応じていずれか1組を使用して、キーデータに対して異なるRUN値の範囲のチェックと異なるLEVEL値の範囲のチェックと異なる第1のハッシュ演算処理と異なる第2のハッシュ演算処理とを行うようにし、キーデータに第1のハッシュ演算を施して求めたテーブルアドレスで、VLCハッシュテーブルをアクセスして2次キー部を読み出し、キーデータに第2のハッシュ演算を施して求めたハッシュ値と比較して確認する構成としたので、VLCハッシュテーブルのアドレス生成範囲を小さくして、VLCハッシュテーブルのメモリ量を小さくできる。
【0053】
(第3の実施の形態)
本発明の第3の実施の形態は、キーデータに第1のハッシュ演算を施した結果が所定の上限値以下であることをチェックし、上限値を超えていなければ、第1のハッシュ演算の結果をテーブルアドレスとして、上限値と同じサイズの可変長符号ハッシュテーブルを参照する可変長符号化装置である。
【0054】
図7は、本発明の第3の実施の形態における可変長符号化装置のブロック図である。図7において、上限チェック付ハッシュ演算手段502は、原データのキーデータ(RUN,LEVEL,LAST)に第1のハッシュ演算を施す手段であり、ハッシュ演算結果の上限をチェックする機能を追加したものである。VLCハッシュテーブル503は、可変長符号(VLC)の情報を格納した、上限値と同じサイズのテーブルである。その他の構成要素に関しては、図5と同じ符号を付与し、個々の説明は省略する。図8は、可変長符号化装置の動作手順を示すフロー図である。
【0055】
上記のように構成された本発明の第3の実施の形態における可変長符号化装置の動作を説明する。図7を参照しながら、ハッシュ演算でハッシュテーブルのアドレスを求める動作を説明する。その他、キーデータ(RUN,LEVEL,LAST)から可変長コード(VLC)と、その長さ(LEN)と、可変長コード生成結果(OK/NG)を求める動作は、第2の実施の形態と同様なので省略する。上限チェック付ハッシュ演算手段502の1組目(LAST=0用)は、ハッシュ演算結果のアドレスA1が113以上であれば、NGを出力する。他方の2組目(LAST=1用)は、ハッシュ演算結果のアドレスA2が44以上であれば、NGを出力する。
【0056】
上限チェック付ハッシュ演算手段502とVLCハッシュテーブル503のテーブル構成について詳細に説明する。図2で説明したように、ハッシュテーブルには、可変長符号として定義されている有効なキーと無効なキーが存在する。LAST=0の場合は、可変長符号として定義されている有効なキーの種類は67種類であり、ハッシュテーブルの大きさは128であるので、61種類は無効なキーである。また、LAST=1の場合は、可変長符号として定義されているキーの種類は35種類であり、ハッシュテーブルの大きさは64であるので、29種類は無効なキーである。そこで、テーブルの上部から有効なキーが詰まり、テーブルの下部には無効なキーがまとまるようなハッシュ演算式を用いることにより、ハッシュテーブルの下部を削除することができる。
【0057】
LAST=0の場合は、
A1=(RUN+112+LEVEL*102)and(128−1) ・・・ (6−0)
[但し、A1>113ならNG]というハッシュ演算により、テーブルの上部113以内に有効なキーを詰め込むことができる。また、LAST=1の場合は、
A2=(RUN+LEVEL*31−25)and(64−1) ・・・ (6−1)
[但し、A2>44ならNG]というハッシュ演算により、テーブルの上部44以内に有効なキーを詰め込むことができる。すなわち、両方を合わせて、ハッシュテーブルの大きさを、N=113+44=157とすることができる。なお、ここで示したハッシュ演算式は一例であり、この条件を満たすものであればどんなハッシュ演算式でも良い。
【0058】
図8を参照しながら、ソフトウエアで可変長符号化処理を行う場合に、ハッシュ演算でVLCハッシュテーブルのアドレスを求める動作を説明する。その他、キーデータ(RUN,LEVEL,LAST)から可変長コード(VLC)と、その長さ(LEN)と、可変長コード生成結果(OK/NG)を求める手順は、第2の実施の形態と同様なので、省略する。本実施の形態では、VLCハッシュテーブルの上部から有効なテーブル情報が埋まり、テーブルの下部に空き領域がまとまるハッシュ演算式を用いることにより、VLCハッシュテーブルの不要な領域を削減している。ステップS202−1で、RUN,LEVELに第1のハッシュ演算を行い、アドレスA1を算出する。ステップS310−1で、アドレスA1が上限を超えているかチェックする。上限を超えている場合は、NGとなる。
【0059】
このようにして、従来の可変長符号化装置に比べて少ない演算量のハッシュ演算でVLCテーブルのアドレスを直接算出することができる。また、ハッシュ演算手段で、有効なハッシュ演算結果がVLCハッシュテーブルの上部のアドレスとなり、下部に空き領域がまとまるようなハッシュ演算を用い、ハッシュ演算結果の上限チェックを行うことにより、VLCハッシュテーブルのアドレス生成範囲を小さくして、VLCハッシュテーブルのメモリ量を小さくできる。従来、VLCハッシュテーブルに、キー部(11bit)+VLCコード(12bit)+コード長(4bit)の合計4byte×256エントリー=1024byte必要だったものを、157エリトリー(LAST=0の113エントリーと、LAST=1の44エントリー)にすることができ、2次キー部(3bit)+VLCコード(12bit)+コード長(4bit)の合計3byte×157エントリー=471byteに縮小することができる。
【0060】
上記のように、本発明の第3の実施の形態では、可変長符号化装置を、キーデータに第1のハッシュ演算を施した結果が所定の上限値以下であることをチェックし、上限値を超えていなければ、第1のハッシュ演算の結果をテーブルアドレスとして、上限値と同じサイズの可変長符号ハッシュテーブルを参照する構成としたので、VLCハッシュテーブルのアドレス生成範囲を小さくして、VLCテーブルのメモリ量を小さくできる。
【0061】
(第4の実施の形態)
本発明の第4の実施の形態は、VLCハッシュテーブル中の可変長符号部に制御ビットを付加し、可変長符号部からコード長を算出する可変長符号化装置である。
【0062】
図9は、本発明の第4の実施の形態における可変長符号化装置のブロック図である。図9において、VLCハッシュテーブル603は、可変長符号(VLC)に制御ビットを付加することにより、可変長符号長(LEN)を不要としたハッシュテーブルである。コード長算出手段607は、可変長符号から符号長を算出する手段である。その他の構成要素に関しては、図7と同じ符号を付与し、個々の説明は省略する。図10は、可変長符号装置で用いる可変長符号の説明図である。図11は、可変長符号化装置の動作手順を示すフロー図である。
【0063】
上記のように構成された本発明の第4の実施の形態における可変長符号化装置の動作を説明する。図9と図10を参照しながら、コード長算出手段607とVLCハッシュテーブル603のテーブル構成について詳細に説明する。可変長符号(VLC)は最大12bitであり、可変長符号から一意に符号長を求めるために、可変長符号を13bitの中に右詰で格納し、可変長符号のMSB(最上位桁)に制御ビット‘1’を付加し、その上位に’0’を格納する。(例1)では、ビット位置10に制御ビット’1’を付加し、ビット位置13〜11は’0’を格納する。同様に(例2)では、ビット位置7に制御ビット’1’を付加し、ビット位置13〜8は’0’を格納する。可変長符号が12bitの場合も同様に、(例3)のように、ビット位置13に制御ビット’1’を付加する。
【0064】
コード長を求めるには、13bit目からビット’1’が初めて現れるまでのカウントをMとすると、符号長=12−Mで求めることができる。したがって、VLCハッシュテーブルには、コード長の4bitは必要なく、VLCコードに13bitあれば十分である。
【0065】
図11を参照しながら、ソフトウエアで可変長符号化処理を行う場合に、ハッシュ演算でVLCハッシュテーブルのアドレスを求める動作を説明する。ステップS999からS106までは、第3の実施の形態と同じである。図11に示すステップS410のCodeLen(VLC)は、可変長符号(VLC)に制御ビットを付加することにより、可変長符号長(LEN)を不要とした可変長符号から符号長を算出するものである。その他、キーデータ(RUN,LEVEL,LAST)から可変長コード(VLC)と、可変長コード生成結果(OK/NG)を求める手順は、第3の実施の形態と同様なので省略する。
【0066】
このようにして、従来の可変長符号化装置に比べて少ない演算量のハッシュ演算でVLCテーブルのアドレスを直接算出することができる。また、制御ビットを付加した可変長符号部からコード長を算出する可変長符号長算出手段を設けることにより、VLCハッシュテーブル中のコード長を不要とし、ハッシュテーブルの1エントリーあたりの情報量を減らして、VLCテーブルのメモリ量を小さくできる。従来、VLCハッシュテーブルに、キー部(11bit)+VLCコード(12bit)+コード長(4bit)の合計4byte×256エントリー=1024byte必要だったものを、VLCコードに1bit付加するだけでコード長データの格納を不要にすることができ、2次キー部(3bit)+VLCコード(13bit)の合計2byte×157エントリー=314byteに縮小することができる。
【0067】
上記のように、本発明の第4の実施の形態では、可変長符号化装置を、VLCハッシュテーブル中の可変長符号部に制御ビットを付加し、可変長符号部からコード長を算出する構成としたので、VLCハッシュテーブル中のコード長データを不要とし、ハッシュテーブルの1エントリーあたりの情報量を減らして、VLCテーブルのメモリ量を小さくできる。
【0068】
本発明は、プログラムによって実現することも可能である。そのソフトウェアを磁気ディスク等の記録媒体に記録して移送することにより、独立した他のコンピュータ・システムで、このソフトウェアを収めた記録媒体から読み出して、実施することができる。記録媒体としては、磁気ディスクの他に、光ディスク、光磁気ディクス等を用いても同様に行うことができる。また、記録媒体は、これらに限られず、ICカード、ROMカセット等、プログラムを記録できるものであれば、同様に実施することができる。
【0069】
【発明の効果】
以上の説明から明らかなように、本発明では、可変長符号化装置に、キーデータ(RUN,LEVEL,LAST)に第2のハッシュ演算を施して2次キーを算出する2次ハッシュ演算手段と、可変長符号部と2次キー部とを含むテーブル情報を格納した可変長符号ハッシュテーブルと、テーブル情報を個別の情報に分離するテーブル分離手段と、2次キーとテーブル情報中の2次キー部とを比較するキー比較手段とを具備する構成としたので、VLCハッシュテーブルにキーデータ(RUN,LEVEL,LAST)そのものを格納する必要がなくなり、VLCハッシュテーブルのメモリ量を小さくできるという効果が得られる。
【図面の簡単な説明】
【図1】本発明の第1の実施の形態における可変長符号化装置のブロック図、
【図2】本発明の第1の実施の形態における可変長符号化装置で用いるハッシュ演算とハッシュテーブルの説明図、
【図3】本発明の第1の実施の形態における可変長符号化装置で用いる2次ハッシュ演算とハッシュテーブルの説明図、
【図4】本発明の第1の実施の形態における可変長符号化装置の可変長符号化手順を示すフロー図、
【図5】本発明の第2の実施の形態における可変長符号装置のブロック図、
【図6】本発明の第2の実施の形態における可変長符号化装置の可変長符号化手順を示すフロー図、
【図7】本発明の第3の実施の形態における可変長符号装置のブロック図、
【図8】本発明の第3の実施の形態における可変長符号化装置の可変長符号化手順を示すフロー図、
【図9】本発明の第4の実施の形態における可変長符号装置のブロック図、
【図10】本発明の第4の実施の形態における可変長符号装置で用いる可変長符号の説明図、
【図11】本発明の第4の実施の形態における可変長符号化装置の可変長符号化手順を示すフロー図、
【図12】従来の可変長符号テーブルのアクセス方法の説明図、
【図13】従来のクラス分け可変長符号テーブルのアクセス方法の説明図、
【図14】従来のハッシュを用いた可変長符号テーブルのアクセス方法の説明図、
【図15】従来のMPEG−4のINTAR VLCの説明図である。
【符号の説明】
100 RUN範囲チェック手段
101 LEVEL範囲チェック手段
102 ハッシュ演算手段
103 VLCハッシュテーブル
104 テーブル分離手段
105 2次ハッシュ演算手段
106 キー比較手段
201 可変長符号として定義されているキー集合
202 キーの集合
203 VLCハッシュテーブル集合
301 可変長符号として定義されているキー集合
302 キーの集合
303 VLCハッシュテーブル集合
400 RUN範囲チェック手段
401 LEVEL範囲チェック手段
402 ハッシュ演算手段
403 VLCハッシュテーブル
405 2次ハッシュ演算手段
502 上限チェック付ハッシュ演算手段
503 VLCハッシュテーブル
603 VLCハッシュテーブル
607 コード長算出手段
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a variable-length coding device using a hash, and more particularly to a variable-length coding device using a hash that converts data into a variable-length code using a variable-length code table in image compression processing or the like.
[0002]
[Prior art]
Since image information has a very large amount of information, it is very difficult to transmit a large amount of image information in real time. Therefore, a technique of compressing and transmitting image data and decompressing the image data on a receiving side is used. As a typical compression method of image data, there is a variable-length encoding method in which a short code is assigned to a bit pattern with a high frequency of appearance and a long code is assigned to a bit pattern with a low frequency of appearance. As a technique for encoding image data with high efficiency, a method combining DCT (Discrete Cosine Transform) and variable-length coding has been standardized and widely used. In the image compression apparatus, data itself is flattened by motion prediction, and high-frequency components are reduced by DCT processing and quantization processing. Since the image signal to be subjected to the compression processing contains many 0s, the image signal can be efficiently compressed by using the variable length code table. In addition, since data conversion is performed with reference to the table, complicated processing is not required, and high-speed encoding processing can be performed.
[0003]
A method of compressing image data will be briefly described by taking MPEG-1 (Moving Picture Experts Group), which is a well-known moving picture coding standard, as an example. The image data is subjected to a discrete cosine transform, converted into frequency component data, and a quantization process for reducing high frequency components is performed. The quantized data is converted into RUN data and LEVEL data. The LEVEL data indicates a level of data other than 0. RUN data is the number of zero data following non-zero data. Since many high-frequency components contain 0, compression can be performed efficiently using RUN length transformation. The RUN data and the LEVEL data are converted into the format of (RUN, LEVEL). This (RUN, LEVEL) data is converted into a variable length code. That is, by accessing the table using the RUN data and the LEVEL data as addresses, the corresponding variable length code and its code length data are read, and the variable length code is generated.
[0004]
The variable length code table stores variable length code data corresponding to the address. The variable length code data storage area includes a variable length code area (17-bit width) for storing a variable length code corresponding to the combination of (RUN, LEVEL), and a variable length code area stored in the variable length code area. There is a 5-bit code length area for storing information for specifying the length. An address for accessing the variable-length code data is a 13-bit address including a 6-bit RUN area and a 7-bit LEVEL area. An address is generated from the RUN data and the LEVEL data, and the corresponding variable length code data is obtained by accessing the variable length code table memory with the address.
[0005]
Of the addresses, 6 bits are assigned to the RUN and 7 bits are assigned to the LEVEL, in the image coding standard MPEG1 (Moving Picture Experts Group 1), the range of RUN is 0 to 63, and the range of LEVEL is ± 41, because 6 bits and 7 bits are required to express these. The reason why the variable length code area is 17 bits and the code length area is 5 bits is that the maximum length of the variable length code is 17 bits. The reason why the code length area is required is that a variable length code requires a code length, and the code length of the variable length code needs to be output together with the variable length code. Combinations of RUN and LEVEL not described in the table are separately processed by an encoder different from the variable-length encoder.
[0006]
The variable length code has a code length ranging from 2 bits to 17 bits. However, it is difficult to make the length of the variable length code area of the memory an arbitrary bit length. Therefore, it is necessary to allocate a fixed-length field corresponding to the maximum code length to one variable-length code data. Therefore, in order to store information of one variable length code, a data area of 22 bits (17 bits of variable length code + 5 bits of code length data) is required. In order to develop this variable-length code table on a memory, a memory of at least 8 k words ((address space of 13-bit address) × (22 bits)) is required. As described above, in the variable-length code table, only about 256 combinations of RUN and LEVEL are processed. On the other hand, when the table is developed on the memory, a space of 8 k words is required. Therefore, it is necessary to use the memory space more efficiently and perform the variable length encoding process with less memory.
[0007]
MPEG-1 is called two-dimensional run-length encoding because it is converted into a variable length code by (RUN, LEVEL). Next, a new moving picture coding standard, MPEG-4 (Moving Picture Experts Group) will be described as an example. In order to perform variable-length encoding of data, the RUN data, the LEVEL data, and the LAST data are used to refer to a variable-length code (VLC: Variable Length Code) table in (RUN, LEVEL, LAST), and to change the data by a three-dimensional run length. Generate a long code. RUN data is the number of zero data following the non-zero data. LEVEL data is a level of data other than 0. The LAST identifies whether or not the LEVEL is the end of the data. As a method of referring to the variable length code table (VLC table), generally, as shown in FIG. 12, a large memory table is prepared, RUN, LEVEL, and LAST are arranged to generate an address of the VLC table. , VLC table. For example, taking INTRA VLC of MPEG-4 as an example, as shown in FIG. 15, RUN takes a value in the range of 0 to 20, so that it can be expressed by 5 bits, and LEVEL is in the range of 1 to 27. Since a value is taken, it can be represented by 5 bits, and a LAST can be represented by 1 bit since it takes a value in the range of 0-1. When these are arranged, an address space of 5 bits + 5 bits + 1 bit = 11 bits is obtained. Since the variable length code of MPEG-4 has a code length in the range of 2 bits to 12 bits, 16 bits (12 bits of variable length code + code) are required to store information of one variable length code. A data area of 5 bits long data is required. In order to develop this variable length code table on a memory, a memory of at least 2K × 16 bits is required. As described above, in the variable-length code table, only about 102 combinations of (RUN, LEVEL, LAST) are processed. On the other hand, when the table is developed on the memory, a space of 2K words is required. Therefore, it is necessary to use the memory space more efficiently and perform the variable length encoding process with less memory.
[0008]
A method for reducing the size of the variable length code table will be described. Since the high-order bits of the codeword of the variable-length code have a feature that there are many repetition patterns of the same code, the variable-length coding apparatus uses a codeword stored in the variable-length code table as a pattern in which the same bit is repeated. And the remaining code. According to this expression, for example, to represent the code of the DCT coefficient of MPEG1, 4 bits are used to represent the number of repetitions, 6 bits are used for the remaining data, and 4 bits are used to represent the code length. use. The total length per code is 14 bits. As a method of reducing the table size, data (for example, a variable-length code table and a variable-length coding device) disclosed in Patent Document 1 and a variable-length coding device There is a method in which RUN and LEVEL are classified into classes according to the value range of (LEVEL), and the assignment of bits for generating the address of the VLC table is changed for each class.
[0009]
They are classified into four classes according to the range of coefficient values (LEVEL). The address of the variable-length code table corresponding to the combination of the number (RUN) followed by the coefficient value 0 and LEVEL is set to a fixed-length area including a flag area identified by a class, an area representing RUN, and an area representing LEVEL. This is the numerical value of the area. The size of the RUN and LEVEL areas is set to the minimum size necessary to store the maximum value included in each class. For example, 11 bits are used to represent the sign of the MPEG1 DCT coefficient. Specifically, the address includes a flag area identified by a class, an area representing LAST, an area representing RUN, and an area representing LEVEL. By generating the address of the VLC table with a fixed length as a whole, the table size is reduced. Taking the INTRA VLC of MPEG-4 as an example, as shown in FIG. 13, it is classified into nine types of classes (Class A to Class I), expressed in an 8-bit address space, and can be realized with 256 tables. is there.
[0010]
The “variable-length code table and variable-length coding device” disclosed in Patent Literature 1 reduces the capacity of a variable-length code memory. In the variable length code table of the DCT output coefficients of MPEG1, the combination of RUN and LEVEL is classified by class according to the magnitude of the absolute value of LEVEL. The address of the corresponding variable-length code is a fixed length including a flag area whose value and length are uniquely specified by the class to which the LEVEL belongs, a RUN data area, and a LEVEL data area. The area length of RUN and LEVEL is, for each LEVEL class, the minimum length required to store the maximum value of the absolute value of the RUN data and the absolute value of LEVEL data of the combination included in the class. Determine the size of the limit. The variable-length code may be divided into the number of consecutive 0s from the beginning, the remaining codes, and the code lengths of the remaining codes, and stored in the table.
[0011]
The “variable-length coding device” disclosed in Patent Literature 2 is a high-speed variable-length coding device with a small hardware scale. The quantized DCT coefficients are sequentially read from the memory, and a variable length code table address is output when performing variable length coding, and a code word and a code length are output when performing fixed length coding. For information other than the quantized DCT coefficients, a variable length code table address is output when performing variable length coding, and a code word and a code length are output when performing fixed length coding. At this time, the address of the variable length code is selected from the candidate group, and the code of the fixed length code is selected from the candidate group. The fixed length code is delayed, and either the variable length code or the fixed length code is selected. A code string is formed by connecting the selected codes.
[0012]
Another method of reducing the table size is to directly generate the address of the VLC table by a hash operation with a small amount of operation and no generation of synonyms as in “a hash table search method and apparatus” disclosed in Patent Document 3. There is a method of reducing the table size depending on the situation. The “hash table search method and apparatus” disclosed in Patent Literature 4 searches data stored in a table at high speed by using key items and reduces the table capacity. The key acquisition unit acquires a key from the hash table storage unit based on the hash value of the hash calculation unit. The key match determination unit determines whether the key is a search target key by comparing the search key with the search key. If they do not match, it is determined that the table has not been registered. If they match, no synonym is generated, so it is the target key. Data is acquired by the data acquisition unit and stored in the data storage unit. Since the calculation amount of the hash calculation unit is small and no countermeasures against synonyms are required, the search can be speeded up. Further, since the data itself is stored using the free area of the hash table storage unit, the capacity of the table can be reduced.
[0013]
As a method of performing a search by directly referring to a table based on a search key, there is a method of using a hash function which is a mapping for converting the search key into a table address. A hash function is a many-to-one mapping from a set of search keys to a set of addresses. The search procedure is as follows. The address A is obtained by calculating H (K) from the search key K. It is verified whether the key item in the table indicated by the address A corresponds to the search key K. This is because a collision phenomenon called a synonym in which a plurality of search keys are mapped to the same address occurs. If no synonym has occurred, the data item indicated by address A is the data of the search result. If a synonym occurs, a secondary search is performed to find again the address where the target search key is stored. In the hash function, the size N of the table is a prime number in order to reduce the occurrence of synonyms. The secondary search method includes a method of connecting all items having the same value of H (K) in a list and following the link to obtain an item corresponding to the target search key, or a method corresponding to the target search key. There is a way to add another hash value to the address until the item is found.
[0014]
As a method for speeding up the hash table search, there are a method of performing key management using a binary tree structure (Patent Document 5) and a method of performing collision management using a sub-function. In hash table management, a plurality of different keys converted to the same hash value are chained in a binary tree structure and registered in the hash table so that the search efficiency does not decrease even if a large number of key collisions occur. The search method is adopted. The “hash table management device” disclosed in Patent Document 6 is intended to prevent the performance of a hash table from being degraded. Keys are managed in a binary tree structure for entries in the hash table. The registration unit searches the hash table by the search unit. The search means creates a binary tree search path recording means at the same time as performing the hash table search. The registering means balances the binary tree by the binary tree balancing means when the unregistered key is registered. The binary tree balance means performs node replacement processing by the binary tree search path recording means and balances the binary tree. Thus, a balanced binary tree is created regardless of the data registration order.
[0015]
With reference to FIG. 14, a specific search processing procedure of the hash table will be described. The range of RUN and LEVEL is checked, and a hash operation is performed using LAST, RUN, and LEVEL as keys, and the address A of the VLC hash table is calculated. The hash operation is, for example,
A = (LEVEL * 23 + RUN * 3 + LAST * 17) mod 256
That is. With reference to the VLC hash table at the address A, the key part (LAST, RUN, LEVEL) stored in the table is acquired and compared with the key used for the hash calculation. If they do not match, it is an invalid key not defined in the variable length code. If they match, it is the corresponding key, so the VLC code and length are obtained. Since the hash operation does not generate a synonym, the corresponding key is uniquely determined. In the VLC hash table, the address generation range is limited to 256 or less by the hash operation. Therefore, the number of tables is 256, and LAST (1 bit) + RUN (5 bits) + LEVEL (5 bits) + VLC (12 bits) + code length (4 bits) 4 bytes × 256 entries = 1024 bytes.
[0016]
[Patent Document 1]
JP-A-8-79091
[Patent Document 2]
JP-A-10-191336
[Patent Document 3]
JP 2000-105770 A
[Patent Document 4]
JP 2000-105770 A
[Patent Document 5]
JP-A-10-40255
[Patent Document 6]
JP-A-10-40255
[0017]
[Problems to be solved by the invention]
However, the conventional method using a large memory table has a problem that a large amount of expensive high-speed memory is required when implemented by a circuit because the VLC table is large. In the case of realizing by software using a processor such as a DSP, the amount of high-speed on-chip memory is small, a table cannot be stored, and the table is arranged in a low-speed memory. There is a problem that can not be converted.
[0018]
Further, in the conventional method of classifying into classes and generating fixed-length addresses, the amount of calculation for classifying and generating addresses is large, so that when it is realized by a circuit, there is a problem that the circuit scale is increased. . Further, when the processing is realized by software using a processor such as a DSP, there is a problem that a processing procedure is increased and variable-length coding cannot be performed at high speed.
[0019]
In the conventional method of generating an address using a hash, the amount of hash operation for generating the address is small, but the reduction of the VLC hash table is not sufficient, and when implemented by a circuit, a large amount of expensive high-speed memory is required. There is a problem that. Also, when the software is implemented using a processor such as a DSP, the amount of high-speed on-chip memory is small, the table cannot be stored, and the memory is arranged in a low-speed memory. There is a problem that can not be converted.
[0020]
SUMMARY OF THE INVENTION It is an object of the present invention to solve the above-mentioned conventional problems, reduce the amount of memory of a VLC table, and perform variable-length encoding with a small amount of calculation.
[0021]
[Means for Solving the Problems]
In order to solve the above-mentioned problem, in the present invention, a variable-length encoding device that converts key data into a variable-length code with reference to a variable-length code hash table is provided with a RUN value that is the number of consecutive 0s of the original data. RUN range checking means for checking the range, LEVEL range checking means for checking the range of LEVEL values representing the level of the non-zero numerical value of the original data, LAST value and RUN value as identifiers indicating whether or not the end of the original data Operation means for performing a first hash operation on key data, which is a pair of the key data and the LEVEL value, to calculate a table address, and a secondary hash operation for performing a second hash operation on the key data to calculate a secondary key Means, a variable-length code hash table storing table information including a variable-length code section and a secondary key section, and dividing the table information into individual pieces of information. A table separating means for, has a structure comprising a key comparison means for comparing a second key part in secondary key and table information. With this configuration, it is not necessary to store the key data itself in the variable-length code hash table, and the memory size of the variable-length code hash table can be reduced.
[0022]
Further, two sets of RUN range checking means, LEVEL range checking means, hash calculation means and secondary hash calculation means are provided, and switching means for selecting one of the two sets according to the LAST value is provided. With this configuration, the address generation range of the variable-length code hash table can be reduced, and the memory size of the variable-length code hash table can be reduced.
[0023]
Further, the hash calculation means includes an upper limit check means for checking that the result of the first hash calculation is equal to or less than a predetermined upper limit value, and the size of the variable length code hash table is made equal to the upper limit value. With this configuration, the address generation range of the variable-length code hash table can be reduced, and the memory size of the variable-length code hash table can be reduced.
[0024]
A variable length code hash table storing table information comprising a variable length code portion with control bits and a secondary key portion; and a variable length code length calculation means for calculating a code length from the variable length code portion with control bits. Equipped. With this configuration, the code length data in the variable-length code hash table is not required, the information amount per entry of the variable-length code hash table can be reduced, and the memory size of the variable-length code hash table can be reduced.
[0025]
[Embodiment of the present invention]
Hereinafter, embodiments of the present invention will be described in detail with reference to FIGS.
[0026]
(First Embodiment)
According to the first embodiment of the present invention, a secondary key portion obtained by performing a second hash operation on key data is stored in a VLC hash table storing information of a variable length code, and the key data is stored in the VLC hash table. The VLC hash table is accessed using the table address obtained by performing the first hash calculation, the secondary key portion is read, and the key data is compared with the hash value obtained by performing the second hash calculation to confirm the variable. It is a long encoding device.
[0027]
FIG. 1 is a functional block diagram of the variable length coding device according to the first embodiment of the present invention. In FIG. 1, a RUN range check unit 100 is a unit for checking a range of a number (RUN) in which zeros are consecutive in original data. The LEVEL range checking means 101 is a means for checking the range of the non-zero coefficient value (LEVEL) of the original data. The hash calculation means 102 is a means for performing a first hash calculation on the key data (RUN, LEVEL, LAST) of the original data. The VLC hash table 103 is a table storing variable length code (VLC) information (secondary key part (KEY2), VLC, code length (LEN)). The table separating unit 104 is a unit that separates information obtained from the VLC hash table into three individual data. The secondary hash calculation means 105 is means for performing a second hash calculation on the key data (RUN, LEVEL, LAST). The key comparing means 106 is means for comparing the read secondary key portion (KEY2) with the secondary key obtained by calculation. The variable length encoding device includes a RUN range check unit 100, a LEVEL range check unit 101, a hash calculation unit 102, a VLC hash table 103, a table separation unit 104, a secondary hash calculation unit 105, a key comparison unit 106.
[0028]
FIG. 2 is an explanatory diagram of a hash calculation and a VLC hash table used in the variable length coding device according to the first embodiment of the present invention. FIG. 3 is an explanatory diagram of a secondary hash calculation and a VLC hash table used in the variable length coding device. FIG. 4 is a flowchart showing an operation procedure of the variable length coding device.
[0029]
The operation of the variable length coding device according to the first embodiment of the present invention configured as described above will be described. Here, a description will be given by taking INTRA variable-length encoding of MPEG-4 as an example. 261, H .; The variable-length coding method described in the present embodiment can also be applied to image coding methods such as H.263, MPEG-2, and JPEG. A combination of a continuous number of zeros (RUN), a non-zero coefficient value (LEVEL), and an identifier (LAST) for identifying the last data is not shown for the original data to be subjected to variable length coding. A variable length code (VLC) is obtained by inputting data from the preceding device and drawing a VLC hash table based on the combination. RUN takes a value of 0 to 63, LEVEL takes a value of 1 to 2047, and LAST takes a value of 0 or 1. However, as shown in FIG. 15, variable length codes are not defined for all combinations of RUN, LEVEL, and LAST. Variable length codes are defined for only the 102 combinations that appear with high frequency. No variable length codes are defined for the remaining combinations. In the case of other data, a variable length code with an escape code or a fixed length code with an escape code is generated by means of 3 mode escape coding by means not shown.
[0030]
With reference to FIG. 1, an operation for obtaining a variable length code (VLC), its length (LEN), and a variable length code generation result (OK / NG) from a combination of RUN, LEVEL, and LAST will be described. The combination of (RUN, LEVEL, LAST) will be referred to as key data. The RUN range checking means 100 checks whether the RUN falls within a defined data range (0 to 20). If it is within the range, OK is output, and if it is out of the range, NG is output. The LEVEL range checking means 101 checks whether or not the LEVEL falls within the defined data range (1-27). If it is within the range, OK is output, and if it is out of the range, NG is output. The first hash calculation is performed on the key data (RUN, LEVEL, LAST) by the hash calculation means 102, and the calculated hash value is set as the address A of the VLC hash table 103. The VLC hash table 103 is generated based on a hash operation expression that satisfies a condition of a hash table described later. The first hash calculation is performed using the same hash calculation formula as when it was generated. The secondary hash calculation means 105 performs a second hash calculation on the key data (RUN, LEVEL, LAST) to calculate a secondary key. The VLC hash table 103 is referred to by the address A, and the table information (KEY2, VLC, LEN) is obtained. The table information (KEY2, VLC, LEN) is separated into three individual pieces of information KEY2, VLC, LEN by the table separating means 104.
[0031]
The key comparing means 106 compares KEY2 obtained by the table separating means 104 with the secondary key obtained by the secondary hash calculating means 105, and outputs NG if they do not match. The NG signals output from the RUN range check unit 100, the LEVEL range check unit 101, and the key comparison unit 106 are logically ORed (OR) and output as a variable length code generation result (OK / NG). That is, if any one of the NGs is output, the variable-length code generation result is NG. The output of the variable length code (VLC), its length (LEN), and the variable length code generation result (OK / NG) are latched in synchronization with a signal obtained by adding a fixed DELAY to the input control signal (CTL). Is output. Here, an example in which an asynchronous circuit is used has been described, but the present invention may be implemented with a synchronous circuit.
[0032]
Next, the hash expression of the hash calculation means 102 will be described in detail. The hash operation is a many-to-one mapping operation from a set of keys to a set of addresses. Assuming that the key data (RUN, LEVEL, LAST) is K and the size of the VLC hash table is N, a hash calculation formula for obtaining the address A is as follows.
A = Hash (K) mod N (1)
It becomes. Hash () is a general hash function.
[0033]
In the hash calculation, the size N of the table is generally set to a prime number in order to suppress the occurrence of a synonym in which hash values of different keys become identical (collide). However, in the present embodiment, the size N of the table is set to a power of 2 in order to reduce the amount of calculation. That is,
A = Hash (K) and (N-1) (2)
As described above, the operation for obtaining the remainder of N is substituted by a mask operation based on logical product to reduce the amount of operation. When N is a power of 2, equations (1) and (2) are equivalent. and is a logical product for each bit.
[0034]
However, since the size N of the table is not a prime number, the hash effect is weakened and the synonym is increased. Therefore, in the present embodiment, a hash function that individually calculates sub keys (RUN, LEVEL, and LAST) constituting key data is used. That is,
A = Hash (K1, K2, K3) and (N-1) (3)
As described above, the hash operation of three variables is performed to prevent the hash effect from weakening. As the three-variable hash function, a well-known hash function whose calculation is simple may be appropriately selected and used.
[0035]
Next, the structure of the VLC hash table 103 will be described in detail with reference to FIG. Since the hash function is a many-to-one mapping, a synonym phenomenon in which the hash values of a plurality of keys are the same always occurs. For example, considering a case where a key set 202 having a range of RUN = 0 to 20, LEVEL = 1 to 27, and LAST = 0, 1 is mapped to a hash table set 203 having a table size N = 256, 1134 types are considered. To 256 types, and many synonyms occur. However, the order (original number) of the key set 201 defined as the variable length code is only 102. It is clearly possible that no synonym is generated in the mapping from 102 types to 256 types. In the present embodiment, a hash function that does not generate a synonym is used for a key set 201 defined as a variable-length code. This hash function always exists, and it is easy to generate it according to specific conditions. Synonyms are allowed for keys that are not defined as variable length codes. That is, the hash value P1 obtained by performing the hash operation on the key A and the hash value P2 obtained by performing the hash operation on the key B always have different values. However, the hash value P3 obtained by performing the hash operation on the key C may match another hash value.
[0036]
By using such a hash function, it is not necessary to take measures when a synonym occurs. That is, a variable-length code can be obtained only by determining whether or not the hash value resulting from the hash operation matches the hash value of the target key. Generally, the determination is made based on whether the key in the entry obtained by looking up the hash table matches the key used to look up the hash table. However, storing the key data in the VLC hash table requires at least 11 bits (RUN = 5 bits, LEVEL = 5 bits, LAST = 1 bit), and the VLC hash table becomes large. Therefore, in the present embodiment, the key data itself is not stored in the VLC hash table, but a secondary key is stored, thereby reducing the size of the VLC hash table.
[0037]
Next, the second hash calculation of the secondary hash calculation means 105 will be described in detail with reference to FIG. As a result of performing a hash operation on the set of keys 302, a second hash operation that does not generate a synonym is performed on each key that has a synonym and has the same hash value. In the VLC hash table, instead of the key data itself, a hash value obtained by performing a second hash operation on a key data set 301 defined as a variable length code is stored. That is, if the hash value P2 of the result of the hash operation performed on the key B matches the hash value P3 of the result of the hash operation performed on the key C and a synonym occurs, the second hash operation is performed on the key B. And the hash value XC resulting from performing the second hash operation on the key C do not match. Therefore, by comparing the secondary key portion XB stored in the VLC hash table with the second hash calculation result, it can be determined whether the key is the target key. In the present embodiment, the number of synonyms generated by the first hash operation for the key set 302 is limited to eight per table, so that the secondary key can be represented by three bits. Since no synonym is generated by the second hash operation, all of the secondary keys within eight are unique.
[0038]
Referring to FIG. 4, when performing variable length coding processing by software, a variable length code (VLC) from key data (RUN, LEVEL, LAST), its length (LEN), and variable length code generation are performed. A procedure for obtaining the result (OK / NG) will be described. In step S100, the RUN range is checked. If RUN falls within the defined data range (0 to 20), OK is output, and the process proceeds to check the LEVEL range. If not, NG is output and the processing ends. In step S101, the LEVEL range is checked. If the LEVEL is within the defined data range (1-27), OK is output and the process proceeds to the first hash calculation. If not, NG is output and the processing ends. In step S102, the first hash calculation is performed on the key data (RUN, LEVEL, LAST), and the calculated hash value is set as the address A of the VLC hash table 103. In step S105, a second hash operation is performed on the key data (RUN, LEVEL, LAST) to calculate a secondary key K. In step S103, the table information (KEY2, VLC, LEN) is acquired by referring to the VLC hash table at the address A. In step S104, the table information is separated into KEY2, VLC, and LEN. In step S106, KEY2 in the table information is compared with the calculated secondary key K. If they match, OK is output, and the variable length code (VLC) and its length (LEN) are output. If they do not match, NG is output and the processing ends. This example shows a method of realizing only by software, but it is also possible to execute software by partially combining hardware processing with software processing. In that case, it will be apparent to those skilled in the art that the present invention can be realized by appropriately combining known methods.
[0039]
In this way, the address of the VLC table can be directly calculated with a hash operation with a smaller operation amount than that of the conventional variable-length coding device. Further, by providing the second hash calculation means, it is not necessary to store the key itself in the VLC hash table, and the amount of memory of the VLC hash table can be reduced. Conventionally, in the VLC hash table, a key part (11 bits) + VLC code (12 bits) + code length (4 bits), which is required in total of 4 bytes × 256 entries = 1024 bytes, is replaced with a necessary key part (11 bits) in the VLC hash table. It can be replaced with a secondary key part (3 bits) and can be reduced to a total of 3 bytes × 256 entries = 768 bytes of the secondary key part (3 bits) + VLC code (12 bits) + code length (4 bits).
[0040]
As described above, in the first embodiment of the present invention, the variable-length encoding device obtains the VLC hash table storing the information of the variable-length code by performing the second hash operation on the key data. The next key portion is stored, the VLC hash table is accessed with the table address obtained by performing the first hash operation on the key data, the secondary key portion is read, and the second hash operation is performed on the key data. Since the key value itself is not stored in the VLC hash table, the memory amount of the VLC hash table can be reduced.
[0041]
(Second embodiment)
According to the second embodiment of the present invention, two sets of a RUN range check unit, a LEVEL range check unit, a first hash operation unit, and a second hash operation unit are provided. Using the set, the key data is subjected to a different RUN value range check, a different LEVEL value range check, a different first hash calculation process, and a different second hash calculation process, The VLC hash table is accessed to read the secondary key portion using the table address obtained by performing the first hash operation on the key data, and is compared with the hash value obtained by performing the second hash operation on the key data. This is a variable length coding device to be confirmed.
[0042]
FIG. 5 is a block diagram of the variable length coding device according to the second embodiment of the present invention. In FIG. 5, RUN range checking means 400 is two checking means for checking the range of a number (RUN) of consecutive zeros in the original data using different standards. The LEVEL range checking means 401 is two checking means for checking the range of the non-zero coefficient value (LEVEL) of the original data using different standards. The hash calculation means 402 is two calculation means for performing different first hash calculations on the key data (RUN, LEVEL, LAST). The VLC hash table 403 is a table that stores information on variable length codes (VLC). The secondary hash calculator 405 is two calculators that perform different second hash calculations on the key data (RUN, LEVEL, and LAST). The other components are denoted by the same reference numerals as those in FIG. 1, and the description thereof is omitted. FIG. 6 is a flowchart showing a variable length coding procedure of the variable length coding device.
[0043]
The operation of the variable length coding device according to the second embodiment of the present invention configured as described above will be described. The key data is divided into a LAST = 0 group and a LAST = 1 group, and different range checks and hash calculations are performed. That is, the two RUN range checking units 400 check the RUN range based on different criteria. The two LEVEL range checking means 401 check the LEVEL range based on different standards. The two hash calculation units 402 perform different first hash calculations on the key data (RUN, LEVEL, LAST). The two secondary hash calculation means 405 perform different second hash calculations on the key data (RUN, LEVEL, LAST). The VLC hash table 403 is generated based on key data grouped into LAST = 0 and LAST = 1.
[0044]
With reference to FIG. 5, an operation of obtaining a variable length code (VLC), its length (LEN), and a variable length code generation result (OK / NG) from the key data (RUN, LEVEL, LAST) will be described. Depending on whether LAST is 0 or 1, RUN and LEVEL are input to one of the two sets of RUN range check means 400 and LEVEL range check means 401. The first set of RUN range checking means 400 (for LAST = 0) checks a data range (0 to 14) in which RUN is defined. The second set of RUN range checking means 400 (for LAST = 1) checks the data range (0 to 20) in which the RUN is defined. If the value is out of the range, NG is output. The first set of LEVEL range checking means 401 (for LAST = 0) checks the data range (1-27) in which LEVEL is defined. The second set of LEVEL range checking means 401 (for LAST = 1) checks the data range (1 to 8) in which LEVEL is defined. If the value is out of the range, NG is output.
[0045]
The first set of hash calculation means 402 (for LAST = 0) performs a hash calculation of Expression (4-0) on RUN and LEVEL to calculate an address A1 of the VLC hash table 403. The other second set (for LAST = 1) performs a hash operation of Expression (4-1) on RUN and LEVEL to calculate an address A2 of the VLC hash table 403. The first set of secondary hash calculation means 405 (for LAST = 0) performs a second hash calculation of Expression (5-0) on RUN and LEVEL to calculate a secondary key. The other second set (for LAST = 1) performs the second hash operation of Expression (5-1) on RUN and LEVEL to calculate a secondary key.
[0046]
The VLC hash table 403 is generated by a hash function that satisfies the conditions of the hash table. The VLC hash table 403 accesses the key data by performing a hash operation using the same hash function as when the key table was generated. Based on the address A1 or A2, the VLC hash table 403 is obtained to obtain table information, and the table information is separated into KEY2, VLC, and LEN by the table separation means 104. The key comparing means 106 compares KEY2 obtained by the table separating means 104 with the secondary key obtained by the secondary hash calculating means 405, and outputs NG if they do not match.
[0047]
NG signals output from each of the RUN range checking unit 400, the LEVEL range checking unit 401, and the key comparison unit 106 are ORed (OR) and output as a variable length code generation result (OK / NG). The output of the variable length code (VLC), its length (LEN), and the variable length code generation result (OK / NG) are synchronized with the input control signal (CTL) (including a constant DELAY). Latched and output. Although an example has been described in which these circuits are configured by asynchronous circuits, they may be realized by synchronous circuits.
[0048]
The table configuration of the hash calculator 402 and the VLC hash table 403 will be described in detail. Since there are 67 types of keys defined as variable-length codes when LAST = 0,
A1 = (RUN + 112 + LEVEL * 102) and (128-1) (4-0)
It is possible to calculate the address by the hash operation formula described above and pack it in a hash table of size N = 128. Also, since there are 35 types of keys defined as variable length codes when LAST = 1,
A2 = (RUN + LEVEL * 31-25) and (64-1) (4-1)
It is possible to calculate the address by the hash operation formula described above and pack it in a hash table of size N = 64. That is, the size of the VLC hash table can be set to N = 192 by combining both. Note that the hash calculation formula shown here is an example, and any hash calculation formula may be used as long as the condition is satisfied.
[0049]
Next, the hash calculation expression of the secondary hash calculation means 405 will be described in detail. If LAST = 0,
(RUN >> 1) and (8-1) (5-0)
The key data can be specified from a maximum of eight synonyms by the second hash calculation expression [where >> 1 indicates a one-bit right shift]. When LAST = 1,
(LEVEL) and (8-1) (5-1)
By using the second hash expression, it is possible to specify the corresponding key data from a maximum of eight synonyms. The second hash expression shown here is an example, and any hash expression that satisfies this condition may be used.
[0050]
Referring to FIG. 6, when performing variable length encoding processing by software, a variable length code (VLC), its length (LEN), and a variable length code generation result are obtained from key data (RUN, LEVEL, LAST). A procedure for obtaining (OK / NG) will be described. The key data is divided into a LAST = 0 group and a LAST = 1 group, and the first and second hash operations are separately performed. In step S999, branching is performed according to LAST = 0 or LAST = 1. Hereinafter, the procedure of LAST = 0 will be described. The same procedure applies when LAST = 1. In step 200-1, the range of the RUN is checked. If the RUN is within the defined data range (0 to 14), the process proceeds to the level range check. If it is out of the range, it becomes NG and the processing is terminated. In step S201-1, the LEVEL range is checked. If the LEVEL is within the defined data range (1 to 27), the process proceeds to the first hash calculation. In step S202-1, the first hash calculation of Expression (4-0) is performed on the key data (RUN, LEVEL) to calculate the address A1 of the VLC hash table. In step S205-1, the second hash calculation of the equation (5-0) is performed on the key data (RUN, LEVEL) to calculate a secondary key K. In step S203-1, the VLC hash table is looked up at the address A1 to obtain table information. In step S104, the table information is separated into KEY2, VLC, and LEN. In step S106, KEY2 in the table is compared with the calculated secondary key K. If they match, OK is output, and the variable length code (VLC) and its length (LEN) are output. If they do not match, NG is output and the processing ends. This example shows a method of realizing only by software, but it is also possible to execute software by partially combining hardware processing with software processing. In that case, it will be apparent to those skilled in the art that the present invention can be realized by appropriately combining known methods.
[0051]
In this way, it is possible to directly calculate the address of the VLC hash table with a hash operation with a smaller operation amount than the conventional variable length coding device. Also, the key data is divided into a plurality of groups and separately hashed by two sets of hashing means and secondary hashing means to reduce the address generation range of the VLC hash table and to reduce the memory capacity of the VLC hash table. Can be reduced. Conventionally, in the VLC hash table, the key part (11 bits) + VLC code (12 bits) + code length (4 bits), which is required for a total of 4 bytes × 256 entries = 1024 bytes, is changed to 192 entries (128 entries for LAST = 0, LAST = 1) 64 entries), and can be reduced to a total of 3 bytes × 192 entries = 576 bytes of secondary key part (3 bits) + VLC code (12 bits) + code length (4 bits).
[0052]
As described above, according to the second embodiment of the present invention, the variable length coding apparatus includes a RUN range check unit, a LEVEL range check unit, a first hash calculation unit, and a second hash calculation unit. Are provided in two sets, and using any one set according to the LAST value, the key data is different from the first hash calculation processing, which is different from the check of the different RUN value range and the different LEVEL value range. The second hash calculation process is performed, the VLC hash table is accessed using the table address obtained by performing the first hash calculation on the key data, the secondary key portion is read, and the second hash value is added to the key data. Since the configuration is such that the comparison is made with the hash value obtained by performing the operation, the address generation range of the VLC hash table is reduced, and the VLC hash Possible to reduce the amount of memory of Buru.
[0053]
(Third embodiment)
The third embodiment of the present invention checks that the result of performing the first hash operation on the key data is equal to or less than a predetermined upper limit, and if the result does not exceed the upper limit, the first hash operation This is a variable-length encoding device that refers to a variable-length code hash table having the same size as the upper limit value using the result as a table address.
[0054]
FIG. 7 is a block diagram of a variable length coding device according to the third embodiment of the present invention. In FIG. 7, a hash calculation unit with upper limit check 502 performs a first hash calculation on key data (RUN, LEVEL, LAST) of original data, and has a function of checking an upper limit of a hash calculation result. It is. The VLC hash table 503 is a table that stores information of a variable length code (VLC) and has the same size as the upper limit value. The other components are denoted by the same reference numerals as those in FIG. 5, and the description thereof is omitted. FIG. 8 is a flowchart showing an operation procedure of the variable length coding device.
[0055]
The operation of the variable length coding device according to the third embodiment of the present invention configured as described above will be described. The operation of obtaining the address of the hash table by the hash calculation will be described with reference to FIG. In addition, the operation of obtaining the variable length code (VLC), its length (LEN), and the variable length code generation result (OK / NG) from the key data (RUN, LEVEL, LAST) is the same as that of the second embodiment. The description is omitted because it is the same. The first set (for LAST = 0) of the hash calculation unit with upper limit check 502 outputs NG if the address A1 of the hash calculation result is 113 or more. The other second set (for LAST = 1) outputs NG if the address A2 of the hash operation result is 44 or more.
[0056]
The table configurations of the hash computation unit with upper limit check 502 and the VLC hash table 503 will be described in detail. As described with reference to FIG. 2, the hash table includes valid keys and invalid keys defined as variable-length codes. When LAST = 0, there are 67 types of valid keys defined as variable-length codes, and the hash table size is 128, so 61 types are invalid keys. When LAST = 1, there are 35 types of keys defined as variable-length codes, and the size of the hash table is 64, so 29 types of keys are invalid. Therefore, the lower part of the hash table can be deleted by using a hash operation expression in which valid keys are packed at the upper part of the table and invalid keys are collected at the lower part of the table.
[0057]
If LAST = 0,
A1 = (RUN + 112 + LEVEL * 102) and (128-1) (6-0)
A valid key can be packed in the upper part 113 of the table by the hash operation [however, if A1> 113 is NG]. When LAST = 1,
A2 = (RUN + LEVEL * 31-25) and (64-1) (6-1)
A valid key can be packed in the upper part 44 of the table by the hash operation [however, if A2> 44, NG]. That is, by combining both, the size of the hash table can be set to N = 113 + 44 = 157. Note that the hash calculation formula shown here is an example, and any hash calculation formula may be used as long as it satisfies this condition.
[0058]
With reference to FIG. 8, an operation for obtaining an address of a VLC hash table by a hash operation when performing variable length encoding processing by software will be described. In addition, the procedure for obtaining the variable length code (VLC), its length (LEN), and the variable length code generation result (OK / NG) from the key data (RUN, LEVEL, LAST) is the same as that of the second embodiment. The description is omitted because it is similar. In the present embodiment, unnecessary area of the VLC hash table is reduced by using a hash operation formula in which valid table information is filled from the top of the VLC hash table and free areas are collected at the bottom of the table. In step S202-1, a first hash calculation is performed on RUN and LEVEL to calculate an address A1. In step S310-1, it is checked whether the address A1 exceeds the upper limit. If the value exceeds the upper limit, the result is NG.
[0059]
In this way, it is possible to directly calculate the address of the VLC table with a hash operation with a smaller operation amount than the conventional variable length encoding device. Further, the hash calculation means uses a hash calculation in which a valid hash calculation result becomes an upper address of the VLC hash table and an empty area is gathered below, and performs an upper limit check of the hash calculation result. By reducing the address generation range, the memory amount of the VLC hash table can be reduced. Conventionally, in the VLC hash table, the key part (11 bits) + VLC code (12 bits) + code length (4 bits), which requires a total of 4 bytes × 256 entries = 1024 bytes, has been changed to 157 entries (113 entries of LAST = 0 and LAST = 1 (44 entries), and can be reduced to a total of 3 bytes × 157 entries = 471 bytes of secondary key part (3 bits) + VLC code (12 bits) + code length (4 bits).
[0060]
As described above, in the third embodiment of the present invention, the variable-length encoding device checks that the result of performing the first hash operation on the key data is equal to or less than a predetermined upper limit, If it does not exceed, the configuration is such that the result of the first hash operation is used as a table address to refer to a variable-length code hash table having the same size as the upper limit value. Table memory size can be reduced.
[0061]
(Fourth embodiment)
The fourth embodiment of the present invention is a variable-length coding device that adds a control bit to a variable-length code part in a VLC hash table and calculates a code length from the variable-length code part.
[0062]
FIG. 9 is a block diagram of a variable-length coding device according to the fourth embodiment of the present invention. In FIG. 9, a VLC hash table 603 is a hash table that does not require a variable length code length (LEN) by adding control bits to a variable length code (VLC). The code length calculation means 607 is a means for calculating a code length from a variable length code. The other components are denoted by the same reference numerals as in FIG. 7, and the description thereof is omitted. FIG. 10 is an explanatory diagram of a variable length code used in the variable length coding device. FIG. 11 is a flowchart showing an operation procedure of the variable length coding device.
[0063]
The operation of the variable length coding device according to the fourth embodiment of the present invention configured as described above will be described. The table configurations of the code length calculation means 607 and the VLC hash table 603 will be described in detail with reference to FIGS. The variable length code (VLC) has a maximum of 12 bits, and in order to uniquely determine the code length from the variable length code, the variable length code is stored right-justified in 13 bits, and is stored in the MSB (most significant digit) of the variable length code. A control bit '1' is added, and '0' is stored in the higher order. In (Example 1), control bit '1' is added to bit position 10, and bit positions 13 to 11 store '0'. Similarly, in (Example 2), control bit '1' is added to bit position 7, and bit positions 13 to 8 store '0'. Similarly, when the variable length code is 12 bits, the control bit '1' is added to the bit position 13 as in (Example 3).
[0064]
To determine the code length, assuming that the count from the 13th bit to the first appearance of the bit '1' is M, the code length can be determined by code length = 12−M. Therefore, the code length of 4 bits is not required for the VLC hash table, and 13 bits for the VLC code is sufficient.
[0065]
With reference to FIG. 11, an operation of obtaining an address of a VLC hash table by hash calculation when performing variable length encoding processing by software will be described. Steps S999 to S106 are the same as in the third embodiment. CodeLen (VLC) in step S410 shown in FIG. 11 calculates a code length from a variable length code that does not require a variable length code length (LEN) by adding a control bit to the variable length code (VLC). is there. In addition, the procedure for obtaining the variable length code (VLC) and the variable length code generation result (OK / NG) from the key data (RUN, LEVEL, LAST) is the same as that of the third embodiment, and thus the description thereof is omitted.
[0066]
In this way, it is possible to directly calculate the address of the VLC table with a hash operation with a smaller operation amount than the conventional variable length encoding device. Also, by providing a variable length code length calculating means for calculating a code length from a variable length code section to which control bits are added, the code length in the VLC hash table becomes unnecessary, and the information amount per entry of the hash table is reduced. Thus, the memory amount of the VLC table can be reduced. Conventionally, the VLC hash table requires a total of 4 bytes × 256 entries = 1024 bytes of a key part (11 bits) + VLC code (12 bits) + code length (4 bits), but stores code length data simply by adding 1 bit to the VLC code. Can be eliminated, and it can be reduced to a total of 2 bytes × 157 entries = 314 bytes of the secondary key part (3 bits) + VLC code (13 bits).
[0067]
As described above, in the fourth embodiment of the present invention, a configuration in which a variable-length encoding device adds a control bit to a variable-length encoding section in a VLC hash table and calculates a code length from the variable-length encoding section. Therefore, the code length data in the VLC hash table is not required, the amount of information per entry of the hash table can be reduced, and the memory amount of the VLC table can be reduced.
[0068]
The present invention can also be realized by a program. By recording and transferring the software on a recording medium such as a magnetic disk, the software can be read from a recording medium containing the software and executed by another independent computer system. As a recording medium, in addition to a magnetic disk, an optical disk, a magneto-optical disk, or the like can be used. Further, the recording medium is not limited to these, and any other recording medium such as an IC card, a ROM cassette, or the like can be used in the same manner.
[0069]
【The invention's effect】
As is apparent from the above description, according to the present invention, the variable-length encoding device performs a second hash operation on the key data (RUN, LEVEL, LAST) to calculate a secondary key, , A variable-length code hash table storing table information including a variable-length code section and a secondary key section, table separating means for separating table information into individual information, a secondary key and a secondary key in the table information Since the configuration is provided with the key comparing means for comparing the key data (RUN, LEVEL, LAST) itself with the configuration, it is possible to reduce the memory amount of the VLC hash table. can get.
[Brief description of the drawings]
FIG. 1 is a block diagram of a variable length coding device according to a first embodiment of the present invention;
FIG. 2 is an explanatory diagram of a hash operation and a hash table used in the variable length encoding device according to the first embodiment of the present invention;
FIG. 3 is an explanatory diagram of a secondary hash operation and a hash table used in the variable length encoding device according to the first embodiment of the present invention;
FIG. 4 is a flowchart showing a variable length coding procedure of the variable length coding device according to the first embodiment of the present invention;
FIG. 5 is a block diagram of a variable-length coding device according to a second embodiment of the present invention;
FIG. 6 is a flowchart showing a variable length coding procedure of the variable length coding device according to the second embodiment of the present invention;
FIG. 7 is a block diagram of a variable-length coding device according to a third embodiment of the present invention;
FIG. 8 is a flowchart showing a variable length coding procedure of the variable length coding device according to the third embodiment of the present invention;
FIG. 9 is a block diagram of a variable length coding device according to a fourth embodiment of the present invention;
FIG. 10 is an explanatory diagram of a variable length code used in a variable length code device according to a fourth embodiment of the present invention;
FIG. 11 is a flowchart showing a variable length coding procedure of the variable length coding device according to the fourth embodiment of the present invention;
FIG. 12 is an explanatory diagram of a conventional variable length code table access method;
FIG. 13 is an explanatory diagram of a conventional method for accessing a classification variable-length code table;
FIG. 14 is an explanatory diagram of a conventional method for accessing a variable-length code table using a hash,
FIG. 15 is an explanatory diagram of a conventional MPEG-4 INTAR VLC.
[Explanation of symbols]
100 RUN range check means
101 LEVEL range checking means
102 Hash operation means
103 VLC hash table
104 table separation means
105 Secondary hash calculation means
106 key comparison means
201 Key set defined as variable length code
Set of 202 keys
203 VLC hash table set
301 Key set defined as variable length code
Set of 302 keys
303 VLC hash table set
400 RUN range checking means
401 LEVEL range checking means
402 hash calculation means
403 VLC hash table
405 Secondary hash calculation means
502 Hash calculation means with upper limit check
503 VLC hash table
603 VLC hash table
607 Code length calculation means

Claims (10)

可変長符号ハッシュテーブルを参照してデータを可変長符号に変換する可変長符号化装置において、原データの0の連続数であるRUN値の範囲をチェックするRUN範囲チェック手段と、前記原データの0でない数値のレベルを表すLEVEL値の範囲をチェックするLEVEL範囲チェック手段と、前記原データの最後か否かを示す識別子であるLAST値とRUN値とLEVEL値との組であるキーデータに第1のハッシュ演算を施してテーブルアドレスを算出するハッシュ演算手段と、前記キーデータに第2のハッシュ演算を施して2次キーを算出する2次ハッシュ演算手段と、可変長符号部と2次キー部とを含むテーブル情報を格納した可変長符号ハッシュテーブルと、前記テーブル情報を個別の情報に分離するテーブル分離手段と、前記2次キーと前記テーブル情報中の2次キー部とを比較するキー比較手段とを具備することを特徴とする可変長符号化装置。In a variable-length encoding device that converts data into a variable-length code by referring to a variable-length code hash table, a RUN range check unit that checks a range of a RUN value that is a continuous number of 0s of the original data; LEVEL range checking means for checking a LEVEL value range indicating a level of a numerical value other than 0, and a key data which is a set of a LAST value, a RUN value, and a LEVEL value which is an identifier indicating whether or not the original data is at the end. Hash operation means for performing a hash operation of No. 1 to calculate a table address, secondary hash operation means for performing a second hash operation on the key data to calculate a secondary key, a variable-length code section and a secondary key Variable-length code hash table storing table information including a unit and table separating means for separating the table information into individual information Variable length coding apparatus characterized by comprising a key comparison means for comparing a second key part in the secondary key and the table information. 前記RUN範囲チェック手段と前記LEVEL範囲チェック手段と前記ハッシュ演算手段と前記2次ハッシュ演算手段とを2組備え、LAST値に応じて前記2組のいずれか1組を選択する切替手段とを備えたことを特徴とする請求項1に記載の可変長符号化装置。The RUN range checking unit, the LEVEL range checking unit, the hash calculation unit, and the secondary hash calculation unit are provided in two sets, and a switching unit that selects one of the two sets according to a LAST value is provided. The variable-length encoding device according to claim 1, wherein: 前記ハッシュ演算手段は、前記第1のハッシュ演算の結果が所定の上限値以下であることをチェックする上限チェック手段を備え、前記上限チェック手段の結果が上限値以下であるときは前記可変長符号ハッシュテーブルのサイズを前記上限値に等しくすることを特徴とする請求項1または2に記載の可変長符号化装置。The hash calculation means includes an upper limit check means for checking that a result of the first hash calculation is equal to or less than a predetermined upper limit value, and when the result of the upper limit check means is equal to or less than the upper limit value, the variable length code 3. The variable-length encoding device according to claim 1, wherein the size of the hash table is equal to the upper limit. 前記可変長符号ハッシュテーブルは制御ビット付可変長符号部と2次キー部とからなるテーブル情報を格納し、前記制御ビット付可変長符号部からコード長を算出する可変長符号長算出手段を備えたことを特徴とする請求項1〜3のいずれかに記載の可変長符号化装置。The variable-length code hash table includes table information including a variable-length code unit with control bits and a secondary key unit, and includes variable-length code length calculation means for calculating a code length from the variable-length code unit with control bits. The variable-length encoding device according to claim 1, wherein: 可変長符号ハッシュテーブルを参照してキーデータを可変長符号に変換する可変長符号化方法において、原データの0の連続数であるRUN値の範囲のチェックを行い、原データの0でない数値のレベルを表すLEVEL値の範囲のチェックを行い、原データの最後か否かを示す識別子であるLAST値とRUN値とLEVEL値との組であるキーデータに第1のハッシュ演算を施してテーブルアドレスを算出し、前記キーデータに第2のハッシュ演算を施して2次キーを算出し、可変長符号部と2次キー部とを含むテーブル情報を格納した可変長符号ハッシュテーブルを前記テーブルアドレスで参照し、前記テーブル情報を個別の情報に分離し、前記2次キーと前記テーブル情報中の2次キー部とを比較し、一致すれば前記可変長符号部を出力することを特徴とする可変長符号化方法。In a variable-length coding method for converting key data into a variable-length code by referring to a variable-length code hash table, a range of a RUN value, which is the number of consecutive 0s of the original data, is checked, and a non-zero numerical value of the original data is checked. A range of a LEVEL value indicating a level is checked, and a first hash operation is performed on key data which is a set of a LAST value, a RUN value, and a LEVEL value, which are identifiers indicating whether or not the end of the original data, and a table address is obtained. , A second hash operation is performed on the key data to calculate a secondary key, and a variable-length code hash table that stores table information including a variable-length code section and a secondary key section is calculated using the table address. Reference, the table information is separated into individual information, the secondary key is compared with a secondary key part in the table information, and if they match, the variable length code part is determined. Variable length coding method, characterized by force. 前記LAST値が0か1かに応じて、前記キーデータに対して異なるRUN値の範囲のチェックと異なるLEVEL値の範囲のチェックと異なる第1のハッシュ演算処理と異なる第2のハッシュ演算処理とを行うことを特徴とする請求項5に記載の可変長符号化方法。Checking different RUN value ranges, checking different LEVEL value ranges, different first hash calculation processes, different second hash calculation processes for the key data according to whether the LAST value is 0 or 1, The variable length encoding method according to claim 5, wherein 前記第1のハッシュ演算の結果が所定の上限値以下であることをチェックし、前記上限値を超えていなければ、第1のハッシュ演算の結果をテーブルアドレスとして、前記上限値と同じサイズの可変長符号ハッシュテーブルを参照することを特徴とする請求項5または6に記載の可変長符号化方法。Check that the result of the first hash calculation is equal to or less than a predetermined upper limit, and if the result does not exceed the upper limit, a variable having the same size as the upper limit is used as a table address using the result of the first hash calculation. 7. The variable length encoding method according to claim 5, wherein a long code hash table is referred to. 前記可変長符号部に制御ビットを付加して前記可変長符号ハッシュテーブルに格納しておき、制御ビットを付加した可変長符号部からコード長を算出することを特徴とする請求項5〜7のいずれかに記載の可変長符号化方法。8. The method according to claim 5, wherein a control bit is added to the variable-length code section, the variable-length code section is stored in the variable-length code hash table, and a code length is calculated from the variable-length code section to which the control bit is added. The variable length encoding method according to any one of the above. 請求項5〜8のいずれかに記載の可変長符号化方法をコンピュータによって実行するための手順を記述したことを特徴とするコンピュータプログラム。A computer program which describes a procedure for executing a variable length encoding method according to any one of claims 5 to 8 by a computer. 請求項9に記載のコンピュータプログラムを記録したことを特徴とする記録媒体。A recording medium on which the computer program according to claim 9 is recorded.
JP2002258938A 2002-09-04 2002-09-04 Apparatus and method for variable length coding by hash Pending JP2004096692A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002258938A JP2004096692A (en) 2002-09-04 2002-09-04 Apparatus and method for variable length coding by hash

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002258938A JP2004096692A (en) 2002-09-04 2002-09-04 Apparatus and method for variable length coding by hash

Publications (1)

Publication Number Publication Date
JP2004096692A true JP2004096692A (en) 2004-03-25

Family

ID=32063437

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002258938A Pending JP2004096692A (en) 2002-09-04 2002-09-04 Apparatus and method for variable length coding by hash

Country Status (1)

Country Link
JP (1) JP2004096692A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006067988A1 (en) * 2004-12-22 2006-06-29 Matsushita Electric Industrial Co., Ltd. Mpeg audio decoding method
WO2018037495A1 (en) * 2016-08-24 2018-03-01 株式会社日立製作所 Transfer device and network system
CN116056146A (en) * 2023-03-06 2023-05-02 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006067988A1 (en) * 2004-12-22 2006-06-29 Matsushita Electric Industrial Co., Ltd. Mpeg audio decoding method
WO2018037495A1 (en) * 2016-08-24 2018-03-01 株式会社日立製作所 Transfer device and network system
CN116056146A (en) * 2023-03-06 2023-05-02 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array
CN116056146B (en) * 2023-03-06 2023-07-04 至控科技(湖州)创新研究院有限公司 Wireless positioning signal buffer memory transmission method and system based on hash array

Similar Documents

Publication Publication Date Title
US10476520B2 (en) Methods, devices and systems for hybrid data compression and decompression
JP3332619B2 (en) Decoding device and method thereof
JP3900435B2 (en) Data packet routing method and routing apparatus
US5635932A (en) Lempel-ziv compression with expulsion of dictionary buffer matches
US20130249716A1 (en) System And Method Of Compression And Decompression
JP7031828B2 (en) Methods, devices, and systems for data compression and decompression of semantic values
JP3227292B2 (en) Encoding device, encoding method, decoding device, decoding method, encoding / decoding device, and encoding / decoding method
WO2019153700A1 (en) Encoding and decoding method, apparatus and encoding and decoding device
GB2305089A (en) Method and apparatus for compressing arbitrary data
JPH0869370A (en) Method and system for compression of data
JP2003023635A (en) Video frame compression/decompression hardware system
US7343542B2 (en) Methods and apparatuses for variable length encoding
JPH0879091A (en) Variable length code table and variable length coder
KR20100067053A (en) Apparatus and system for variable length decoding
CN109075798B (en) Variable size symbol entropy-based data compression
TW201021577A (en) Decoding method and apparatus
US20220086445A1 (en) Methods, apparatus, and articles of manufacture for multi-symbol equiprobable mode entropy coding
JP2004096692A (en) Apparatus and method for variable length coding by hash
US6947606B2 (en) Skim encoding method for compression of a two dimensional array of data
KR20050010918A (en) A method and a system for variable-length decoding, and a device for the localization of codewords
JP7074989B2 (en) Data compressor, data compression method, data compression program, data decompression device, data decompression method, data decompression program and data compression decompression system
JP2004254208A (en) 3-mode escape variable length coding apparatus and method
Bharathi et al. A plain-text incremental compression (pic) technique with fast lookup ability
Wang et al. Variants of Golomb Coding and the n-ary Versions
JP4447903B2 (en) Signal processing apparatus, signal processing method, recording medium, and program