JP3659196B2 - Huffman code decoding method and apparatus - Google Patents

Huffman code decoding method and apparatus Download PDF

Info

Publication number
JP3659196B2
JP3659196B2 JP2001183294A JP2001183294A JP3659196B2 JP 3659196 B2 JP3659196 B2 JP 3659196B2 JP 2001183294 A JP2001183294 A JP 2001183294A JP 2001183294 A JP2001183294 A JP 2001183294A JP 3659196 B2 JP3659196 B2 JP 3659196B2
Authority
JP
Japan
Prior art keywords
decoding
huffman code
data
encoded
binary tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2001183294A
Other languages
Japanese (ja)
Other versions
JP2002374173A (en
Inventor
直樹 仁田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yamaha Corp
Original Assignee
Yamaha Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yamaha Corp filed Critical Yamaha Corp
Priority to JP2001183294A priority Critical patent/JP3659196B2/en
Publication of JP2002374173A publication Critical patent/JP2002374173A/en
Application granted granted Critical
Publication of JP3659196B2 publication Critical patent/JP3659196B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
この発明は、限られたメモリで高速にハフマン符号を復号化する復号化方法および装置に関する。
【0002】
【従来の技術】
ハフマン符号を復号するための技術として、一般的には、バイナリツリー検索法、直接法などの手法がある。バイナリツリー検索法は、可変長のハフマン符号を先頭ビットから1ビットずつ順に検査して0/1で分岐してゆき、最後に到達したところで指定されている値を出力するものであり、主としてソフトウェア的に実現されるものである。また、直接法は、可変長符号の最大ビット長のアドレスを有するメモリエリアを確保し、各アドレスのうちハフマン符号が割り当てられているエリアにその値を書き込み、ハフマン符号をアドレスにしてこのメモリエリアをアクセスし、アクセスされたエリアの値を出力するものである。
【0003】
【発明が解決しようとする課題】
しかし、上記バイナリツリー検索法は、ハフマン符号を1ビットずつ検査してゆくものであるため、復号化に時間が掛かるという欠点があった。また、直接法は、ハフマン符号でメモリをアクセスすることによって直接その値を読み出すことができるため高速であるが、最大ビット長のアドレスを有するメモリエリアを確保しなければならないため、実際にハフマン符号が割り当てられているエリアよりもはるかに大きいエリアを有する復号テーブルが必要になるという欠点があった。
【0004】
特に、複数のハフマン符号表を持ち、場合に応じてそのいずれかが選択されるデータの場合、全てのハフマン符号表に対応する復号テーブルを設けることは非常に大きなメモリが必要になるため実現が困難で、このような形式のデータを復号化する装置では、バイナリツリー検索法が用いられることが一般的であった。しかし、上記したようにバイナリツリー検索法では復号化に時間が掛かるという問題点があった。
【0005】
この発明は、複数のハフマン符号表を用いるデータを、小さいメモリで高速に復号化できる復号化方法および装置を提供することを目的とする。
【0006】
【課題を解決するための手段】
この発明は、1曲が複数のフレームで構成されるとともに、複数のハフマン符号表をフレーム単位で適宜切り換え適用して符号化されたMP3規格等の時系列オーディオデータを復号する方法であって、前記時系列データの各フレーム毎に、該フレームがどのハフマン符号表を適用して符号化されているかを分析し、前記複数のハフマン符号表のうち最大符号長の短い一部のハフマン符号表を適用して符号化されたフレームについては復号テーブルを用いた直接法でデータを復号し、前記一部のハフマン符号表以外の大部分のハフマン符号表を適用して符号化されたフレームについてはバイナリツリー検索法でデータを復号することを特徴とする。
【0007】
この発明は、1曲が複数のフレームで構成されるとともに、複数のハフマン符号表をフレーム単位で適宜切り換え適用して符号化されたMP3規格等の時系列オーディオデータを復号する装置であって、前記複数のハフマン符号表のうち最大符号長の短い一部のハフマン符号表を適用して符号化されたフレームを復号テーブルを用いた直接法でデータを復号する直接法復号手段と、前記一部のハフマン符号表以外の大部分のハフマン符号表を適用して符号化されたフレームをバイナリツリー検索法でデータを復号するバイナリツリー復号手段と、前記符号化データがどのハフマン符号表を適用して符号化されているかを先頭から順次分析する分析手段と、分析部の分析結果に基づいて復号部を選択し、選択した復号部に符号化データを順次入力する選択手段と、を備えたことを特徴とする。
【0008】
この発明は、上記発明において、前記複数のハフマン符号表のうち、データを符号化するときに適用される頻度の高い符号表を前記所定のハフマン符号表とすることを特徴とする。
この発明は、上記発明において、前記複数のハフマン符号表のうち、最大符号長の短い符号表を前記所定のハフマン符号表とすることを特徴とする。
【0009】
この発明は、「短い符号はよく出現する。したがって、短い符号を持つ符号表はよく指定される。このよく指定される符号表に含まれる符号だけでも高速に復号できれば、全体の復号処理を高速化することができる。」という考えに基づいている。具体的には、基本的にはバイナリツリー検索法で復号するが、よく出現する(最大符号長の短い)符号表については直接法によって復号するようにする。これにより、小さい復号テーブルで復号処理をすることができ、且つ高速で復号することが可能になる。
【0010】
【発明の実施の形態】
図面を参照してこの発明の実施形態について説明する。MP3規格などのビットストリーム形式のデータでは、予め規格で定められた複数のハフマン符号表のうち最適なものをフレーム毎に選択して適用する。各フレームにどのハフマン符号表が適用されているかは、各フレームのヘッダに書き込まれている。復号装置では、ヘッダを参照して各フレーム毎にハフマン符号表を選択し、そのハフマン符号表を用いてデータを復号化する。MP3規格では、34のハフマン符号表が定められているが、以下は説明を簡略化するため、図2に示すような2つの符号表が定められている場合を例にあげて説明する。
【0011】
入力されるビットストリームは、図2に示す2つのハフマン符号表のいずれかを使用して符号化されたものとする。図1はこの発明の実施形態である復号装置のブロック図である。この復号装置では、上記ビットストリームを回路規模を大きくせずにできるだけ高速に復号化するため、最大符号長の小さな符号表#0が指定された場合は、直接法による復号を行い、最大符号長の大きな符号表#1が指定された場合にはバイナリツリー検索法で復号するようにしている。
【0012】
図1において、ビットストリームはRAM10に入力される。ハフマン符号表分析部11は、入力されたビットストリームの(各フレーム)のヘッダを分析してそのフレームがどのハフマン符号表を用いているかを分析する。この実施形態では、符号表#0、符号表#1のどちらを用いているかを分析する。分析結果は、復号方法選択部12、取得ビット数算出部13および2つの復号部15,16に入力される。2つの復号部は、それぞれ直接法復号部15およびバイナリツリー復号部16である。
【0013】
復号方法選択部12は、入力されたビットストリームが#0、#1どちらの符号表を用いているかに対応して復号部15,16のうちどちらの復号部を使用するかを選択し、データの流れを切り換える。取得ビット数算出部13は、符号表#0に直接法を適用する場合に1回に読み出すデータのビット数(3ビット)、および、符号表#1にバイナリツリー検索法を適用する場合に1回に読み出すデータのビット数(1ビット)を割り出して、ビット取り出し/巻き戻し部14に出力する。取得ビット算出部13には、図3に示すデータを記憶したメモリ(ROM)が設けられている。
【0014】
ビット取り出し/巻き戻し部14は、取得ビット数算出部13から入力されたビット数のデータをRAM10から読み出して復号方法選択部12で選択されている復号部に供給する。また、直接法復号部15から返信されたきた巻き戻しビット数を受信し、RAM10の読出ポインタを巻き戻しビット数だけ巻き戻す。なお、バイナリツリー検索法によるハフマン符号の復号の場合、1ビットずつ読み出されていずれかのハフマン符号にヒットしたとき復号が行われるため、巻き戻しビット数は常に0である。
【0015】
直接法復号部15は、復号テーブルを備え、最大符号長分のビットを入力して復号テーブルをアクセスし、対応する値(復号データ)を次段(図示せず)に出力する。また、この復号処理によって今回のハフマン符号の実際のビット数を割り出し、余分に読み出したビット数(最大符号長のビット数−実際のビット数)である巻き戻しビット数をビット取り出し/巻き戻し部14に出力する。
【0016】
また、バイナリツリー復号部16は、ビットストリームを1ビットずつ入力し、これで符号表#1を復号するためのバイナリツリーを検索してハフマン符号を復号する。復号データは次段に出力される。
【0017】
ビットストリームがRAM10に入力され、ハフマン符号表番号分析部11がそのデータに用いられている符号表を割り出すと、この符号表番号情報に基づいて、復号方法選択部12が復号部15,16のうち一方を選択し、取得ビット算出部13が取得すべきビット数を算出してビット取り出し/巻き戻し部14にそのビット数情報を入力する。
【0018】
ビット取り出し/巻き戻し部14は、そのビット数のデータをRAM10から読み出して、上記選択された復号部15または16に出力する。選択された復号部は、入力されるデータのハフマン符号を復号し、復号データを出力する。直接法復号部15でハフマン符号を復号処理した場合には、復号データとともに巻き戻しビット数が出力され、これがビット取り出し/巻き戻し部14に返信される。ビット取り出し/巻き戻し部14はこのビット数だけRAM10の読出ポインタを巻き戻し、巻き戻した位置から次の復号処理のためのデータを読み出す。
【0019】
上記の構成で、たとえば図4に示すようなビットストリームのフレームデータ(ハフマン符号列)が入力されたとする。フレームデータの先頭位置と用いられているハフマン符号表はハフマン符号表番号分析部11によって分析済である。ここで、2つ以上の処理方法を切り換えることで演算量が削減されることを見るために、(1)バイナリツリー検索法のみで復号化する場合の復号部アクセス回数と、(2)直接法とバイナリツリー検索法とを符号表番号で切り換えた場合の復号部アクセス回数を比較する。バイナリツリー検索法では1ビット毎にアクセスが発生するのに対し、直接法では1回のアクセスで1つのハフマン符号が復号可能である。
【0020】
よって、(1)では計14回、(2)では計11回のアクセスが発生する。このことは、直接法とバイナリツリー検索法とを表番号で切り換えることにより、アクセス回数が21%削減されたことを示す。
【0021】
また、バイナリツリー法で使用するテーブルは一般に2n−1ワードで構成され、1ワードには復号値とテーブル内アドレスが格納される。表番号#0の場合、n=4であるからテーブルのワード数は7である。この7ワードのテーブルにアクセスするためのアドレスフィールドはlog(2)7≒2.8ビット以上必要であり、ビット数は整数であるため、必要ビット数は3ビットとなる。復号値を表現するには2ビット必要であるから、このテーブルの1ワードは3+2=5ビットとなる。したがって、全ワードを表現するためには5×7=35ビットのメモリエリアが必要である。同様に表番号#1の場合も同様に、log(2)31≒4.95で必要ビット数は5ビットとなり、(5+4)×31=279ビットのメモリエリアが必要である。
【0022】
一方、直接法で使用するテーブルの1ワードには、復号値と符号長が格納される。また符号表に定義されている符号数をnとすると、それを実現するテーブルのワード数=2n ワードとなる。表番号#0の復号テーブルの場合、復号値を表現するために必要なビット数は2ビット、符号長を表現するために必要なビット数は2ビットであるから、1ワードは2+2=4ビットでよい。このワードが23 =8個必要なので、全ワードを表現するためには4×8=32ビットのメモリエリアが必要である。同様に表番号#1の復号テーブルの場合には、(4+4)×28 =2048ビットのメモリエリアが必要である。
【0023】
以上より、表番号#0、表番号#1ともにバイナリツリー法で復号する場合には35+279=314ビットのROMが必要である。これをすべて直接法に置き換えると32+2048=2080ビットのROMが必要になる。この場合、確かに演算量は劇的に少なくなるが、急激にメモリ量が増大しており、実際のアプリケーションでは現実的でなくなる。
【0024】
これに対して、表番号#0だけを直接法で置き換えた場合、必要なメモリは32+279=311ビットとなり、上述のとおり両方ともバイナリツリー法で復号する場合に比べて、若干のメモリ量が増大するのみで大幅に演算量を削減することができる。
【0025】
以下、図5、図6を参照して、実際のPCMオーディオデータをMP3エンコードした場合の実験結果を示す。
まず、実験には2種類のエンコーダ(Encoder1,Encoder2)を用いた。この2種類のエンコーダに2種類のPCMオーディオデータを入力して合計4種類のビットストリーム(ステレオ、128bps)を作成した。第1のPCMオーディオデータ(音楽ソースA)は全体に音量の大きいポップスの曲であり、第2のPCMオーディオデータ(音楽ソースB)は静かなピアノソロ曲である。これら4種類のビットストリームについてどの符号表が指定されているかを1符号語毎にカウントした。この結果を図5に示す。
【0026】
図5より、Encoder1,2の両方とも、ソースAでは番号の小さな符号表が多く選ばれ、Bでは番号の大きな符号表が多く選ばれる傾向がある。ただし、Encoder1ではソースBでもNo2の符号表が最も多く使用されている。また、符号表Quad(A),Quad(B)の利用頻度も高いが、これは各フレーム中のcount1領域ついては、符号表Quad(A)またはQuad(B)が二者択一で必ず使用されるためである。
【0027】
図5より、他の符号表に比べて選択回数の多い符号表はTable2,3,5,15,Quad(A),Quad(B)などになるが、直接法による復号を行う場合は実現のしやすさから、ここでは最長符号長が短いTable2,3,Quad(A),Quad(B)についてのみ直接法によって復号することとし、その他の符号表ではバイナリツリー検索法で復号するようにする。
【0028】
以上の方法でのハフマン復号処理に必要な演算量と、純粋にバイナリツリー検索法のみによるハフマン復号処理に必要な演算量を算出し、比較した。結果を図6に示す。
【0029】
図6は、1フレーム当たりのハフマン復号に必要な演算量を算出し、時間軸に並べたものであり、上で使用した4種類のビットストリームに対してそれぞれ(A−1)、(A−2)、(B−1)、(B−2)が対応する。この図においてBinがバイナリツリー検索法のみで復号化した場合のフレームあたりの処理ステップ数であり、DTLが本発明の方式で直接法とバイナリツリー検索法とを組み合わせて復号化した場合のフレームあたりの処理ステップ数である。
【0030】
なお、上記のようにTable2,3,Quad(A),Quad(B)を直接法で復号化した場合、音楽ソースAの演算量が大きく削減され、音楽ソースBの場合にはそれほどでもない。これは、上記の直接法で復号するハフマン符号表の選択が音楽ソースAによりよく適合していたことを示し、音楽ソースBをより効率的に復号化する(演算量を削減する)ためには、Table2,5,15,26などを直接法で復号化するようにすればよい。
【0031】
このように、復号装置において、よく復号(再生)するオーディオソースのジャンルに応じて直接法で復号する符号表を変えるようにしてもよい。
【0032】
【発明の効果】
以上のようにこの発明によれば、ハフマン符号表に応じて直接法とバイナリツリー法とを切り換えるようにしたことにより、小さい復号テーブルで復号処理をすることができ、且つ高速で復号することが可能になる。
【図面の簡単な説明】
【図1】この発明の実施形態であるハフマン符号復号装置のブロック図
【図2】同ハフマン符号復号装置で用いられるハフマン符号表を示す図
【図3】同ハフマン符号復号装置の取得ビット数算出部に内蔵されるROMの記憶内容を示す図
【図4】同ハフマン符号復号装置で復号される入力データの例を示す図
【図5】PCMオーディオデータをMP3データにエンコードした場合の各ハフマン符号表の使用頻度分布を示す図
【図6】上記MP3データをバイナリツリー検索法で復号化した場合と本願発明の方法で復号化した場合の復号に要する処理ステップ数を比較した図
【符号の説明】
10…RAM、11…ハフマン符号表番号分析部、12…復号方法選択部、13…取得ビット数算出部、14…ビット取り出し/巻き戻し部、15…直接法復号部、16…バイナリツリー復号部
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a decoding method and apparatus for decoding a Huffman code at a high speed with a limited memory.
[0002]
[Prior art]
As a technique for decoding the Huffman code, there are generally techniques such as a binary tree search method and a direct method. In the binary tree search method, a variable-length Huffman code is inspected one bit at a time from the first bit, branched at 0/1, and a specified value is output when the last is reached. Is realized. In the direct method, a memory area having an address with the maximum bit length of a variable-length code is secured, and the value is written in an area to which a Huffman code is assigned, and the memory area is set with the Huffman code as an address. And the value of the accessed area is output.
[0003]
[Problems to be solved by the invention]
However, since the binary tree search method inspects the Huffman code bit by bit, there is a drawback that it takes time to decode. The direct method is fast because the value can be read directly by accessing the memory with the Huffman code. However, since the memory area having the address with the maximum bit length must be secured, the Huffman code is actually used. There is a drawback that a decoding table having an area much larger than the area to which is assigned is required.
[0004]
In particular, in the case of data that has a plurality of Huffman code tables and any one of them is selected depending on the case, providing a decoding table corresponding to all the Huffman code tables is realized because a very large memory is required. It is difficult to use a binary tree search method in an apparatus that decodes data in such a format. However, as described above, the binary tree search method has a problem that it takes time to decode.
[0005]
An object of the present invention is to provide a decoding method and apparatus capable of decoding data using a plurality of Huffman code tables at high speed with a small memory.
[0006]
[Means for Solving the Problems]
The present invention is a method for decoding time-series audio data such as MP3 standard encoded by switching and applying a plurality of Huffman code tables as appropriate in units of frames while one song is composed of a plurality of frames , For each frame of the time-series data, analyze which Huffman code table is applied to which the frame is encoded, and select some Huffman code tables having a short maximum code length from the plurality of Huffman code tables. Data is decoded by a direct method using a decoding table for frames encoded by application, and binary for frames encoded by applying most Huffman code tables other than the part of the Huffman code tables. Data is decrypted by a tree search method.
[0007]
The present invention is an apparatus for decoding time-series audio data such as the MP3 standard that is encoded by appropriately switching and applying a plurality of Huffman code tables in units of frames while one song is composed of a plurality of frames , Direct method decoding means for decoding data by a direct method using a decoding table for a frame encoded by applying a part of the Huffman code table having a short maximum code length among the plurality of Huffman code tables; Binary tree decoding means for decoding data encoded by applying a binary tree search method to a frame encoded by applying most of the Huffman code table other than the Huffman code table, and which Huffman code table to which the encoded data is applied Analyzing means that sequentially analyzes whether it is encoded from the beginning, and selecting a decoding unit based on the analysis result of the analyzing unit, and sequentially entering the encoded data into the selected decoding unit And a selection means for operating.
[0008]
The present invention is characterized in that, in the above invention, a code table having a high frequency applied when data is encoded among the plurality of Huffman code tables is the predetermined Huffman code table.
The present invention is characterized in that, in the above invention, a code table having a short maximum code length among the plurality of Huffman code tables is used as the predetermined Huffman code table.
[0009]
According to the present invention, “short codes often appear. Therefore, a code table having short codes is often specified. If only a code included in this well-specified code table can be decoded at high speed, the entire decoding process can be performed at high speed. Is based on the idea that Specifically, decoding is basically performed by the binary tree search method, but a code table that frequently appears (short maximum code length) is decoded by the direct method. As a result, it is possible to perform decoding processing with a small decoding table and to perform decoding at high speed.
[0010]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described with reference to the drawings. For bit stream format data such as the MP3 standard, an optimum one of a plurality of Huffman code tables defined in the standard is selected and applied for each frame. Which Huffman code table is applied to each frame is written in the header of each frame. In the decoding apparatus, a Huffman code table is selected for each frame with reference to the header, and data is decoded using the Huffman code table. In the MP3 standard, 34 Huffman code tables are defined, but in the following, in order to simplify the description, a case where two code tables as shown in FIG. 2 are defined will be described as an example.
[0011]
Assume that the input bitstream is encoded using one of the two Huffman code tables shown in FIG. FIG. 1 is a block diagram of a decoding apparatus according to an embodiment of the present invention. In this decoding apparatus, in order to decode the bit stream as fast as possible without increasing the circuit scale, when code table # 0 having a small maximum code length is designated, decoding is performed by the direct method, and the maximum code length is determined. When a large code table # 1 is designated, the binary tree search method is used for decoding.
[0012]
In FIG. 1, the bit stream is input to the RAM 10. The Huffman code table analysis unit 11 analyzes the header of (each frame) of the input bit stream and analyzes which Huffman code table is used by the frame. In this embodiment, it is analyzed whether code table # 0 or code table # 1 is used. The analysis result is input to the decoding method selection unit 12, the acquired bit number calculation unit 13, and the two decoding units 15 and 16. The two decoding units are a direct method decoding unit 15 and a binary tree decoding unit 16, respectively.
[0013]
The decoding method selection unit 12 selects which decoding unit to use from the decoding units 15 and 16 corresponding to whether the input bitstream uses # 0 or # 1 code table, and the data Switch the flow. The obtained bit number calculation unit 13 is the number of bits (3 bits) of data read at a time when the direct method is applied to the code table # 0, and 1 when the binary tree search method is applied to the code table # 1. The number of bits (1 bit) of data to be read at one time is determined and output to the bit fetch / rewind unit 14. The acquisition bit calculation unit 13 is provided with a memory (ROM) that stores data shown in FIG.
[0014]
The bit extraction / rewinding unit 14 reads out the data of the number of bits input from the acquired bit number calculation unit 13 from the RAM 10 and supplies the data to the decoding unit selected by the decoding method selection unit 12. Further, it receives the rewind bit number returned from the direct decoding unit 15 and rewinds the read pointer of the RAM 10 by the rewind bit number. Note that in the case of decoding a Huffman code by the binary tree search method, decoding is performed when one bit is read out and hit any of the Huffman codes, so the number of rewind bits is always 0.
[0015]
The direct decoding unit 15 includes a decoding table, inputs bits for the maximum code length, accesses the decoding table, and outputs a corresponding value (decoded data) to the next stage (not shown). Also, the actual number of bits of the current Huffman code is determined by this decoding process, and the number of rewind bits, which is the number of extra bits read (the number of bits of the maximum code length−the actual number of bits), is extracted / rewinded. 14 for output.
[0016]
Further, the binary tree decoding unit 16 inputs the bit stream bit by bit, and searches the binary tree for decoding the code table # 1 to decode the Huffman code. The decoded data is output to the next stage.
[0017]
When the bit stream is input to the RAM 10 and the Huffman code table number analysis unit 11 determines the code table used for the data, the decoding method selection unit 12 uses the code table number information, and the decoding method selection unit 12 One of them is selected, and the number of bits to be acquired is calculated by the acquisition bit calculation unit 13 and the bit number information is input to the bit extraction / rewinding unit 14.
[0018]
The bit fetch / rewind unit 14 reads the data of the number of bits from the RAM 10 and outputs the data to the selected decoding unit 15 or 16. The selected decoding unit decodes the Huffman code of the input data and outputs decoded data. When the Huffman code is decoded by the direct method decoding unit 15, the number of rewind bits is output together with the decoded data, and this is returned to the bit extraction / rewind unit 14. The bit fetch / rewind unit 14 rewinds the read pointer of the RAM 10 by this number of bits, and reads data for the next decoding process from the rewind position.
[0019]
It is assumed that, for example, bit stream frame data (Huffman code string) as shown in FIG. The Huffman code table used as the head position of the frame data has been analyzed by the Huffman code table number analysis unit 11. Here, in order to see that the amount of calculation is reduced by switching between two or more processing methods, (1) the number of accesses to the decoding unit when decoding only with the binary tree search method, and (2) the direct method And the binary tree search method are compared by the code table number. In the binary tree search method, access occurs every bit, whereas in the direct method, one Huffman code can be decoded by one access.
[0020]
Therefore, a total of 14 accesses occur in (1) and a total of 11 accesses in (2). This indicates that the number of accesses has been reduced by 21% by switching between the direct method and the binary tree search method by the table number.
[0021]
A table used in the binary tree method is generally composed of 2n-1 words, and a decoded value and an in-table address are stored in one word. In the case of table number # 0, since n = 4, the number of words in the table is 7. The address field for accessing this 7-word table requires log (2) 7≈2.8 bits or more, and the number of bits is an integer, so the number of necessary bits is 3 bits. Since 2 bits are required to express the decoded value, one word of this table is 3 + 2 = 5 bits. Therefore, in order to express all the words, a memory area of 5 × 7 = 35 bits is required. Similarly, in the case of table number # 1, similarly, log (2) 31≈4.95 and the necessary number of bits is 5, and a memory area of (5 + 4) × 31 = 279 bits is required.
[0022]
On the other hand, a decoded value and a code length are stored in one word of the table used in the direct method. If the number of codes defined in the code table is n, the number of words in the table that realizes the number = 2n words. In the case of the decoding table of table number # 0, the number of bits necessary for expressing the decoded value is 2 bits, and the number of bits required for expressing the code length is 2 bits, so 1 word is 2 + 2 = 4 bits It's okay. Since 2 3 = 8 words are required, a memory area of 4 × 8 = 32 bits is required to represent all the words. Similarly, in the case of the decoding table of table number # 1, a memory area of (4 + 4) × 2 8 = 2048 bits is required.
[0023]
As described above, when both table number # 0 and table number # 1 are decoded by the binary tree method, a ROM of 35 + 279 = 314 bits is required. If this is all replaced by the direct method, a ROM of 32 + 2048 = 2080 bits is required. In this case, the amount of calculation is certainly drastically reduced, but the amount of memory is rapidly increasing, which is not practical in an actual application.
[0024]
On the other hand, when only the table number # 0 is replaced by the direct method, the required memory is 32 + 279 = 311 bits, and the amount of memory is slightly increased as compared with the case where both are decoded by the binary tree method as described above. It is possible to greatly reduce the amount of calculation simply by doing.
[0025]
Hereinafter, with reference to FIG. 5 and FIG. 6, experimental results when MP3 encoding of actual PCM audio data are shown.
First, two types of encoders (Encoder 1 and Encoder 2) were used in the experiment. Two types of PCM audio data were input to these two types of encoders to create a total of four types of bit streams (stereo, 128 bps). The first PCM audio data (music source A) is a pop song with a large volume as a whole, and the second PCM audio data (music source B) is a quiet piano solo song. Which code table is designated for these four types of bitstreams was counted for each codeword. The result is shown in FIG.
[0026]
From FIG. 5, in both Encoders 1 and 2, a code table with a small number tends to be selected for source A, and a code table with a large number tends to be selected for B. However, in Encoder 1, the code table of No. 2 is most frequently used in source B as well. The code tables Quad (A) and Quad (B) are also frequently used, but for the count1 area in each frame, the code table Quad (A) or Quad (B) is always used alternatively. Because.
[0027]
From FIG. 5, the code table having a larger number of selections compared to other code tables is Table 2, 3, 5, 15, Quad (A), Quad (B), etc., but this is realized when decoding by the direct method is performed. For ease of explanation, only Tables 2, 3, Quad (A), and Quad (B) having the shortest long code length are decoded by the direct method here, and the other code tables are decoded by the binary tree search method. .
[0028]
The amount of calculation required for the Huffman decoding process by the above method and the amount of calculation required for the Huffman decoding process purely by the binary tree search method were calculated and compared. The results are shown in FIG.
[0029]
FIG. 6 shows the calculation amount required for Huffman decoding per frame and arranged on the time axis. For the four types of bit streams used above, (A-1) and (A- 2), (B-1), and (B-2) correspond. In this figure, Bin is the number of processing steps per frame when decoding is performed only by the binary tree search method, and per frame when DTL is decoded by combining the direct method and the binary tree search method according to the method of the present invention. Is the number of processing steps.
[0030]
Note that when Table 2, 3, Quad (A), and Quad (B) are decoded by the direct method as described above, the calculation amount of the music source A is greatly reduced, and not so much in the case of the music source B. This indicates that the selection of the Huffman code table to be decoded by the direct method is more suitable for the music source A, and in order to decode the music source B more efficiently (reduce the amount of calculation). , Tables 2, 5, 15, and 26 may be decoded by a direct method.
[0031]
Thus, in the decoding apparatus, the code table to be decoded by the direct method may be changed according to the genre of the audio source that is often decoded (reproduced).
[0032]
【The invention's effect】
As described above, according to the present invention, since the direct method and the binary tree method are switched according to the Huffman code table, it is possible to perform decoding processing with a small decoding table and to perform decoding at high speed. It becomes possible.
[Brief description of the drawings]
FIG. 1 is a block diagram of a Huffman code decoding apparatus according to an embodiment of the present invention; FIG. 2 is a diagram showing a Huffman code table used in the Huffman code decoding apparatus; FIG. 4 is a diagram showing an example of input data decoded by the Huffman code decoding device. FIG. 5 is a diagram showing each Huffman code when PCM audio data is encoded into MP3 data. FIG. 6 is a diagram showing a distribution of frequency of use of the table. FIG. 6 is a diagram comparing the number of processing steps required for decoding when the MP3 data is decoded by the binary tree search method and the method of the present invention. ]
DESCRIPTION OF SYMBOLS 10 ... RAM, 11 ... Huffman code table number analysis part, 12 ... Decoding method selection part, 13 ... Acquired bit number calculation part, 14 ... Bit extraction / rewinding part, 15 ... Direct method decoding part, 16 ... Binary tree decoding part

Claims (2)

1曲が複数のフレームで構成されるとともに、複数のハフマン符号表をフレーム単位で適宜切り換え適用して符号化されたMP3規格等の時系列オーディオデータを復号する方法であって、
前記時系列データの各フレーム毎に、該フレームがどのハフマン符号表を適用して符号化されているかを分析し、
前記複数のハフマン符号表のうち最大符号長の短い一部のハフマン符号表を適用して符号化されたフレームについては復号テーブルを用いた直接法でデータを復号し、前記一部のハフマン符号表以外の大部分のハフマン符号表を適用して符号化されたフレームについてはバイナリツリー検索法でデータを復号するハフマン符号の復号方法。
A method of decoding time-series audio data such as MP3 standard encoded by switching and applying a plurality of Huffman code tables as appropriate in units of frames while one song is composed of a plurality of frames,
For each frame of the time-series data, analyze which Huffman code table is applied to which the frame is encoded,
For a frame encoded by applying a partial Huffman code table having a short maximum code length among the plurality of Huffman code tables, data is decoded by a direct method using a decoding table, and the partial Huffman code table is used. A method of decoding a Huffman code in which data is decoded by a binary tree search method for frames encoded by applying most of the Huffman code table.
1曲が複数のフレームで構成されるとともに、複数のハフマン符号表をフレーム単位で適宜切り換え適用して符号化されたMP3規格等の時系列オーディオデータを復号する装置であって、
前記複数のハフマン符号表のうち最大符号長の短い一部のハフマン符号表を適用して符号化されたフレームを復号テーブルを用いた直接法でデータを復号する直接法復号手段と、
前記一部のハフマン符号表以外の大部分のハフマン符号表を適用して符号化されたフレームをバイナリツリー検索法でデータを復号するバイナリツリー復号手段と、
前記符号化データがどのハフマン符号表を適用して符号化されているかを先頭から順次分析する分析手段と、
分析部の分析結果に基づいて復号部を選択し、選択した復号部に符号化データを順次入力する選択手段と、
を備えたハフマン符号復号装置。
An apparatus for decoding time-series audio data such as the MP3 standard, which is encoded by appropriately switching and applying a plurality of Huffman code tables in units of frames while one song is composed of a plurality of frames,
Direct method decoding means for decoding data by a direct method using a decoding table of a frame encoded by applying a partial Huffman code table having a short maximum code length among the plurality of Huffman code tables;
Binary tree decoding means for decoding data using a binary tree search method for frames encoded by applying most of the Huffman code tables other than the part of the Huffman code tables;
Analysis means for sequentially analyzing from the top which Huffman code table is applied to which the encoded data is encoded;
A selection unit that selects a decoding unit based on the analysis result of the analysis unit and sequentially inputs encoded data to the selected decoding unit;
A Huffman code decoding apparatus.
JP2001183294A 2001-06-18 2001-06-18 Huffman code decoding method and apparatus Expired - Fee Related JP3659196B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001183294A JP3659196B2 (en) 2001-06-18 2001-06-18 Huffman code decoding method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001183294A JP3659196B2 (en) 2001-06-18 2001-06-18 Huffman code decoding method and apparatus

Publications (2)

Publication Number Publication Date
JP2002374173A JP2002374173A (en) 2002-12-26
JP3659196B2 true JP3659196B2 (en) 2005-06-15

Family

ID=19023266

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001183294A Expired - Fee Related JP3659196B2 (en) 2001-06-18 2001-06-18 Huffman code decoding method and apparatus

Country Status (1)

Country Link
JP (1) JP3659196B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101725223B1 (en) 2011-03-25 2017-04-11 삼성전자 주식회사 Data compressing method of storage device

Also Published As

Publication number Publication date
JP2002374173A (en) 2002-12-26

Similar Documents

Publication Publication Date Title
JP4501288B2 (en) Huffman code decoding method, decoding apparatus, Huffman code decoding table, and method for creating the same
ES2297083T3 (en) ENTROPIC CODIFICATION BY ADAPTATION OF THE CODIFICATION BETWEEN MODES BY LENGTH OF EXECUTION AND BY LEVEL.
US6504496B1 (en) Systems and methods for decoding compressed data
US7970215B2 (en) Automatic generation of compact code tables
US9355644B2 (en) Method and apparatus for searching in a layered hierarchical bit stream followed by replay, said bit stream including a base layer and at least one enhancement layer
JP2005510102A (en) Method and apparatus for determining whether a data frame contains encoded additional data
EP2131590A1 (en) Method and apparatus for generating or cutting or changing a frame based bit stream format file including at least one header section, and a corresponding data structure
JP2007043595A (en) Variable length code decoding method and device and data decompression device
ES2248549T3 (en) EDITION OF AUDIO SIGNALS.
JP3659196B2 (en) Huffman code decoding method and apparatus
US20060187096A1 (en) Method of decoding variable length prefix codes
JP2000286717A (en) Decoding device
JPH11175098A (en) Voice and music encoding system
US6411226B1 (en) Huffman decoder with reduced memory size
JP2023007760A (en) Compression apparatus and expansion device
JP2008503766A (en) Audio encoding method
US6765513B2 (en) Decoding bit streams compressed with compression techniques employing variable length codes
US20080225173A1 (en) Signal processing apparatus
JP3419371B2 (en) Code length calculation device and coding device
Malvar Lossless and near-lossless audio compression using integer-reversible modulated lapped transforms
JP3565147B2 (en) Decryption device
JP3236758B2 (en) CRC arithmetic unit for variable length data
EP2412162A1 (en) Data embedding methods, embedded data extraction methods, truncation methods, data embedding devices, embedded data extraction devices and truncation devices
JP2005519489A5 (en)
KR100686354B1 (en) Huffman decoding method and device for using variable length tree

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040525

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040726

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20040817

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041018

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20041130

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050105

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050121

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050222

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050307

R150 Certificate of patent or registration of utility model

Ref document number: 3659196

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313532

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20090325

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090325

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100325

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110325

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110325

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120325

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130325

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20140325

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees