JP2011139128A - Variable-length code decoding device - Google Patents

Variable-length code decoding device Download PDF

Info

Publication number
JP2011139128A
JP2011139128A JP2009295944A JP2009295944A JP2011139128A JP 2011139128 A JP2011139128 A JP 2011139128A JP 2009295944 A JP2009295944 A JP 2009295944A JP 2009295944 A JP2009295944 A JP 2009295944A JP 2011139128 A JP2011139128 A JP 2011139128A
Authority
JP
Japan
Prior art keywords
code
length
data
bit
variable
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
JP2009295944A
Other languages
Japanese (ja)
Inventor
Minoru Otani
稔 大谷
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.)
Samsung Electronics Co Ltd
Original Assignee
Samsung Electronics 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 Samsung Electronics Co Ltd filed Critical Samsung Electronics Co Ltd
Priority to JP2009295944A priority Critical patent/JP2011139128A/en
Publication of JP2011139128A publication Critical patent/JP2011139128A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provided a variable-length code decoding device capable of decoding two variable-length codes within one clock cycle, and increasing processing speed in signal processing. <P>SOLUTION: The variable-length code decoding device includes an input buffer 102 into which first data composed of a Huffman code and a variable-length code comprising an additional bit are input, a code length table 104 for storing the total bit length of the variable-length code for all of patterns of the variable-length code, a first Huffman code detection unit 112 for referring to the code-length table, detecting the first variable-length code from the first data, and outputting the entire bit length of the first variable-length code, a first shift buffer 114 for shifting the first data left by the entire bit length to output second data, a second Huffman code detection unit 122 for referring to the code length table, detecting a second variable-length code from the second data and outputting the entire bit length of the second variable-length code, and a second shift buffer 124 for shifting the second data left by the entire bit length to output third data to the input buffer. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、可変長符号復号装置に関する。   The present invention relates to a variable-length code decoding apparatus.

JPEGの圧縮データは、連続するゼロの個数を表すゼロランレングスと、それに後続する非ゼロ係数を一対として、可変長符号化が行われたデータである。符号化の際、ゼロランレングスと非ゼロ係数の組み合わせを用いてハフマン符号が求められる。また、非ゼロ係数の大きさ、即ちAC成分の大きさを特定するための付加ビットが決定される。そして、一つの可変長符号は、図3に示すように、ハフマン符号+付加ビットの組み合わせで構成される。図3は、JPEGの可変長符号を示す説明図である。   JPEG compressed data is data that has been subjected to variable length coding with a pair of a zero run length representing the number of consecutive zeros and a subsequent non-zero coefficient. At the time of encoding, a Huffman code is obtained using a combination of zero run length and non-zero coefficient. Further, an additional bit for specifying the magnitude of the non-zero coefficient, that is, the magnitude of the AC component is determined. As shown in FIG. 3, one variable length code is composed of a combination of a Huffman code and additional bits. FIG. 3 is an explanatory diagram showing a JPEG variable-length code.

ハフマン符号は、ゼロランレングスと付加ビットのビット長の組み合わせに対して、出現頻度の高い順に短いビット長の符号を割り当てた符号である。付加ビットは、ゼロランレングスに後続する非ゼロ係数の±(正又は負)と振幅を復元するために必要なビット列である。   The Huffman code is a code in which a code having a short bit length is assigned to the combination of the zero run length and the bit length of the additional bits in descending order of appearance frequency. The additional bits are a bit string necessary for restoring ± (positive or negative) and amplitude of the non-zero coefficient following the zero run length.

上記のように符号化された可変長符号の復号は、まず、1)可変長符号の中からハフマン符号を検出する。そして、2)検出されたハフマン符号がハフマン符号テーブルの先頭のコードから何番目のコードであるかを表すインデックスを導出する。次に、3)ゼロランレングス+付加ビットのビット長(符号長)の組み合わせのテーブル(R/Sテーブル)を参照して、該当するインデックスのゼロランレングスと付加ビットのビット長を取得する。その後、4)ハフマン符号に続くビット列から付加ビットのビット長を有するビット列(付加ビット)を切り出し、連続するゼロに後続する非ゼロ係数を算出する。   The decoding of the variable length code encoded as described above is as follows: 1) A Huffman code is detected from the variable length code. 2) An index representing the number of the detected Huffman code from the head code of the Huffman code table is derived. Next, 3) Referring to a table (R / S table) of combinations of zero run length + bit length (code length) of additional bits, the zero run length of the corresponding index and the bit length of additional bits are obtained. Thereafter, 4) a bit string (additional bits) having a bit length of additional bits is cut out from the bit string following the Huffman code, and a non-zero coefficient subsequent to consecutive zeros is calculated.

可変長符号の復号に関する上記1)〜4)の一連の動作を、従来技術と同じ性能(1データ/1クロック以上の復号)を持ち、特定コード用に別回路を持たない構成について、図4を参照して説明する。図4は、従来の可変長符号復号装置10の構成を示すブロック図である。   The series of operations 1) to 4) relating to the decoding of the variable-length code has the same performance (decoding of one data / one clock or more) as that of the prior art, and has no separate circuit for a specific code. Will be described with reference to FIG. FIG. 4 is a block diagram showing a configuration of a conventional variable length code decoding apparatus 10.

ハフマン符号検出部14は、入力バッファ12から可変長符号で構成される圧縮データが入力されて、先頭符号テーブル24を参照して、ハフマン符号を検出する。先頭符号テーブル24は、ハフマン符号の各ビット長の先頭のコードと、各ビット長の先頭のコードがハフマン符号テーブルの先頭のコードから何番目の位置であるかという情報を記憶したテーブルである。ハフマン符号が検出されると、検出されたハフマン符号がハフマン符号テーブルの先頭のコードから何番目のコードであるかを表すインデックス(R/Sインデックス)と、検出されたハフマン符号のビット長(符号長)が得られる。   The Huffman code detector 14 receives compressed data composed of variable length codes from the input buffer 12 and refers to the head code table 24 to detect a Huffman code. The head code table 24 is a table that stores information on the head code of each bit length of the Huffman code and information on the position of the head code of each bit length from the head code of the Huffman code table. When the Huffman code is detected, an index (R / S index) indicating the number of the detected Huffman code from the head code of the Huffman code table and the bit length (code) of the detected Huffman code Long).

そして、ハフマン符号検出部14は、検出されたハフマン符号のR/Sインデックスと、検出されたハフマン符号のビット長を、R/Sデコーダ18へ出力する。DC成分の場合は、ハフマン符号が検出されると付加ビットのビット長(符号長)が確定するので、ハフマン符号検出部14は、付加ビットのビット長をR/Sデコーダ18へ出力する。   Then, the Huffman code detector 14 outputs the R / S index of the detected Huffman code and the bit length of the detected Huffman code to the R / S decoder 18. In the case of the DC component, since the bit length (code length) of the additional bits is determined when the Huffman code is detected, the Huffman code detection unit 14 outputs the bit length of the additional bits to the R / S decoder 18.

第1シフトバッファ16は、入力バッファ12から出力された可変長符号を、ハフマン符号検出部14で検出されたハフマン符号のビット長分だけ左シフトして、付加ビットの先頭を切り出し、生成したデータをR/Sデコーダ18と第2シフトバッファ22に出力する。   The first shift buffer 16 shifts the variable length code output from the input buffer 12 to the left by the bit length of the Huffman code detected by the Huffman code detection unit 14, cuts out the beginning of the additional bits, and generates the generated data Are output to the R / S decoder 18 and the second shift buffer 22.

R/Sデコーダ18が参照するR/Sテーブル26は、ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶しているテーブルである。R/Sテーブル26では、ハフマン符号がハフマン符号の生成順に配置されている。   The R / S table 26 referred to by the R / S decoder 18 is a table that stores a combination of the zero run length and the bit length of the subsequent additional bits as a pair of information. In the R / S table 26, Huffman codes are arranged in the order in which Huffman codes are generated.

R/Sデコーダ18は、入力されたR/Sインデックスと、R/Sテーブル26に基づいて、R/Sインデックスに対応するゼロランレングスと付加ビットのビット長の情報を得ることができる。そして、R/Sデコーダ18は、ゼロランレングスに後続する非ゼロ係数を算出し、非ゼロ係数をゼロランレングスと共に逆量子化部(図示せず。)へ出力する。   Based on the input R / S index and the R / S table 26, the R / S decoder 18 can obtain information on the zero run length corresponding to the R / S index and the bit length of the additional bits. Then, the R / S decoder 18 calculates a non-zero coefficient following the zero run length, and outputs the non-zero coefficient together with the zero run length to an inverse quantization unit (not shown).

第2シフトバッファ22は、第1シフトバッファ16から出力されたデータを、R/Sデコーダ18で得られた付加ビットのビット長分だけ左シフトして、生成したデータを入力バッファ12に出力する。   The second shift buffer 22 shifts the data output from the first shift buffer 16 to the left by the bit length of the additional bits obtained by the R / S decoder 18 and outputs the generated data to the input buffer 12. .

入力バッファ12は、第2シフトバッファ22から出力されるデータの最後尾と、可変長符号復号装置10に入力される可変長符号の先頭が、連続するビット列になるように連結する。そして、入力バッファ12は、次のクロックサイクルで連結したビット列を出力し、一つの可変長符号の復号を実施する。   The input buffer 12 connects the end of the data output from the second shift buffer 22 and the beginning of the variable length code input to the variable length code decoding device 10 so as to form a continuous bit string. Then, the input buffer 12 outputs a bit string concatenated in the next clock cycle, and decodes one variable length code.

以上の動作により、1クロックサイクルで一つの可変長符号を復号し、1データ/1クロック以上の復号処理が可能となる。   With the above operation, one variable length code is decoded in one clock cycle, and decoding processing of one data / one clock or more becomes possible.

特開2002-43949号公報JP 2002-43949 A

近年、デジタルスチルカメラ等の撮像装置では、記録済みのJPEGデータをディスプレイ部に表示するのにかかる時間を短縮する等の目的のため、可変長符号復号装置に対して、より高速な処理速度が求められている。   In recent years, an imaging apparatus such as a digital still camera has a higher processing speed than a variable-length code decoding apparatus for the purpose of shortening the time taken to display recorded JPEG data on a display unit. It has been demanded.

JPEGの圧縮データは、ゼロランレングスと、それに後続する非ゼロ係数を一対として、一つの可変長符号として符号化したものであるから、ゼロランレングスが一つ以上である可変長符号の場合、復号によって得られる係数データは2個以上になる。従って、1個の可変長符号の復号が1クロックサイクルで終了することができれば、2倍速以上での復号が可能となる。   Since the compressed data of JPEG is encoded as one variable length code with a pair of zero run length and the following non-zero coefficient, in the case of a variable length code having one or more zero run length, The coefficient data obtained by decoding is two or more. Therefore, if decoding of one variable length code can be completed in one clock cycle, decoding at double speed or higher is possible.

ところが、ゼロランレングスが0である可変長符号の場合は、特許文献1(特開2002-43949号公報)のように特定符号のみ、その復号が1クロックサイクルで処理できても、復号によって得られる係数データは1個でしかない。そのため、等倍速での復号にしかならない。   However, in the case of a variable length code whose zero run length is 0, even if only a specific code can be processed in one clock cycle as in Patent Document 1 (Japanese Patent Laid-Open No. 2002-43949), it can be obtained by decoding. Only one coefficient data can be obtained. Therefore, it can only be decoded at the same speed.

また、図4の構成で更に、ハフマンコード検出部14とR/Sデコーダ18を従属に2組接続する構成とすれば、1クロックサイクル内に2個の符号を処理することはできる。しかし、シフトバッファ16、22が4段従属接続となるため、動作クロック周波数の低下を招き、単位時間あたりの処理能力は大差ないものとなってしまう。   Further, in the configuration of FIG. 4, if two sets of the Huffman code detection unit 14 and the R / S decoder 18 are connected in a subordinate manner, two codes can be processed within one clock cycle. However, since the shift buffers 16 and 22 are connected in four stages, the operation clock frequency is lowered and the processing capability per unit time is not much different.

そこで、本発明は、上記問題に鑑みてなされたものであり、本発明の目的とするところは、1クロックサイクル内に2個の可変長符号を復号することができ、信号処理の処理速度を向上させることが可能な、新規かつ改良された可変長符号復号装置を提供することにある。   Therefore, the present invention has been made in view of the above problems, and an object of the present invention is to decode two variable length codes within one clock cycle, thereby increasing the processing speed of signal processing. It is an object of the present invention to provide a new and improved variable length code decoding device that can be improved.

上記課題を解決するために、本発明のある観点によれば、ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力される入力バッファと、可変長符号の全てのパターンについて、可変長符号のビット長さである全ビット長を記憶する符号長テーブルと、第1データが入力されて、符号長テーブルを参照して、第1データから第1可変長符号を検出し、検出された第1可変長符号の全ビット長を出力する第1ハフマン符号検出部と、第1データが入力されて、第1データを全ビット長分だけ左シフトし、生成した第2データを出力する第1シフトバッファと、第2データが入力されて、符号長テーブルを参照して、第2データから第2可変長符号を検出し、検出された第2可変長符号の全ビット長を出力する第2ハフマン符号検出部と、第2データが入力されて、第2データを全ビット長分だけ左シフトし、生成した第3データを入力バッファに出力する第2シフトバッファとを備える、可変長符号復号装置が提供される。   In order to solve the above problems, according to an aspect of the present invention, an input buffer to which first data composed of a variable length code composed of a combination of a Huffman code and additional bits is input, and all of the variable length codes For the pattern, a code length table that stores all the bit lengths of the variable length code and the first data are input, and the first variable length code is detected from the first data by referring to the code length table A first Huffman code detection unit that outputs the entire bit length of the detected first variable length code, and the first data is input, the first data is shifted to the left by the entire bit length, and the generated second A first shift buffer that outputs data, and second data is input, a second variable length code is detected from the second data with reference to the code length table, and all bits of the detected second variable length code are detected Output length A variable length code comprising: a 2 Huffman code detection unit; and a second shift buffer that receives the second data, shifts the second data to the left by the entire bit length, and outputs the generated third data to the input buffer A decoding device is provided.

この構成により、入力バッファに、ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力され、第1ハフマン符号検出部において、第1データが入力されて、符号長テーブルが参照されて、第1データから第1可変長符号が検出され、検出された第1可変長符号の全ビット長が出力される。そして、第1シフトバッファにおいて、第1データが入力されて、第1データが全ビット長分だけ左シフトされ、生成された第2データが出力される。次に、第2ハフマン符号検出部において、第2データが入力されて、符号長テーブルが参照されて、第2データから第2可変長符号が検出され、検出された第2可変長符号の全ビット長が出力される。そして、第2シフトバッファにおいて、第2データが入力されて、第2データが全ビット長分だけ左シフトされ、生成された第3データが入力バッファに出力される。ここで、符号長テーブルは、可変長符号の全てのパターンについて、可変長符号のビット長さである全ビット長を記憶したテーブルである。   With this configuration, the first data composed of the variable length code composed of the combination of the Huffman code and the additional bits is input to the input buffer, and the first data is input to the code length table in the first Huffman code detection unit. , The first variable length code is detected from the first data, and the entire bit length of the detected first variable length code is output. In the first shift buffer, the first data is input, the first data is shifted to the left by the entire bit length, and the generated second data is output. Next, in the second Huffman code detector, the second data is input, the code length table is referred to, the second variable length code is detected from the second data, and all of the detected second variable length codes are detected. The bit length is output. Then, the second data is input to the second shift buffer, the second data is shifted to the left by the entire bit length, and the generated third data is output to the input buffer. Here, the code length table is a table that stores all the bit lengths that are the bit lengths of the variable length codes for all the patterns of the variable length codes.

上記第1ハフマン符号検出部は、符号長テーブルを参照して、ハフマン符号の第1ビット長と、第1R/Sインデックスを生成して出力し、第2ハフマン符号検出部は、符号長テーブルを参照して、ハフマン符号の第2ビット長と、第2R/Sインデックスを生成して出力し、ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶するR/Sテーブルと、第1データが入力されて、第1データをハフマン符号の第1ビット長分だけ左シフトし、生成した第4データを出力する第3シフトバッファと、第4データが入力されて、第1R/Sインデックスと、R/Sテーブルを参照して、第4データから第1ゼロランレングスと第1ゼロランレングスに後続する第1非ゼロ係数を算出する第1R/Sデコーダと、第2データが入力されて、第2データをハフマン符号の第2ビット長分だけ左シフトし、生成した第5データを出力する第4シフトバッファと、第5データが入力されて、第2R/Sインデックスと、R/Sテーブルを参照して、第5データから第2ゼロランレングスと第2ゼロランレングスに後続する第2非ゼロ係数を算出する第2R/Sデコーダとを更に備える。   The first Huffman code detector generates and outputs the first bit length of the Huffman code and the first R / S index with reference to the code length table, and the second Huffman code detector generates the code length table. Referring to the R / S table for generating and outputting the second bit length of the Huffman code and the second R / S index, and storing the combination of the zero run length and the bit length of the additional bits following the zero run length as a pair of information, The first data is input, the first data is shifted to the left by the first bit length of the Huffman code, the generated fourth data is output, the fourth data is input, and the first R The first R / S decoder that calculates the first zero run length and the first non-zero coefficient following the first zero run length from the fourth data with reference to the / S index and the R / S table The second data is input, the second data is shifted to the left by the second bit length of the Huffman code, the fourth data is output, and the fifth data is input to the second R A second R / S decoder that calculates a second non-zero coefficient following the second zero run length and the second zero run length from the fifth data with reference to the / S index and the R / S table is further provided.

この構成により、第1ハフマン符号検出部において、符号長テーブルが参照されて、ハフマン符号の第1ビット長と、第1R/Sインデックスが生成されて出力され、第2ハフマン符号検出部において、符号長テーブルが参照されて、ハフマン符号の第2ビット長と、第2R/Sインデックスが生成されて出力される。第3シフトバッファにおいて、第1データが入力されて、第1データがハフマン符号の第1ビット長分だけ左シフトされ、生成された第4データが出力され、第1R/Sデコーダにおいて、第4データが入力されて、第1R/Sインデックスと、R/Sテーブルが参照されて、第4データから第1ゼロランレングスと第1ゼロランレングスに後続する第1非ゼロ係数が算出される。また、第4シフトバッファにおいて、第2データが入力されて、第2データがハフマン符号の第2ビット長分だけ左シフトされ、生成された第5データが出力され、第2R/Sデコーダにおいて、第5データが入力されて、第2R/Sインデックスと、R/Sテーブルが参照されて、第5データから第2ゼロランレングスと第2ゼロランレングスに後続する第2非ゼロ係数が算出される。   With this configuration, the first Huffman code detection unit refers to the code length table, generates and outputs the first bit length of the Huffman code and the first R / S index, and the second Huffman code detection unit With reference to the length table, the second bit length of the Huffman code and the second R / S index are generated and output. In the third shift buffer, the first data is input, the first data is shifted to the left by the first bit length of the Huffman code, and the generated fourth data is output. In the first R / S decoder, the fourth data The data is input, the first R / S index and the R / S table are referred to, and the first zero run length and the first non-zero coefficient following the first zero run length are calculated from the fourth data. Further, in the fourth shift buffer, the second data is input, the second data is shifted to the left by the second bit length of the Huffman code, and the generated fifth data is output. In the second R / S decoder, The fifth data is input, the second R / S index and the R / S table are referenced, and the second zero run length and the second non-zero coefficient following the second zero run length are calculated from the fifth data. The

上記課題を解決するために、本発明の別の観点によれば、ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力される入力バッファと、ゼロランレングスが0となる可変長符号について、可変長符号のビット長さである全ビット長を記憶する特定符号テーブルと、第1データが入力されて、特定符号テーブルを参照して、第1データから第1可変長符号を検出し、検出された第1可変長符号の全ビット長を出力する第1特定符号検出部と、ハフマン符号の各ビット長における先頭コードのインデックスが記憶された先頭符号テーブルと、第1データが入力されて、先頭符号テーブルを参照して、第1データからハフマン符号を検出し、検出されたハフマン符号の第1ビット長と、第1R/Sインデックスを出力する第1ハフマン符号検出部と、ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶するR/Sテーブルと、第1データが入力されて、第1R/Sインデックスと、R/Sテーブルを参照して、第1データから第1ゼロランレングスと第1ゼロランレングスに後続する第1非ゼロ係数を算出する第1R/Sデコーダと、第1データが入力されて、特定符号テーブルが参照されたとき、第1データを第1可変長符号の全ビット長分だけ左シフトし、先頭符号テーブルが参照されたとき、第1データをハフマン符号の第1ビット長分だけ左シフトし、第1データの先頭が付加ビットであったとき、第1データを付加ビットのビット長分だけ左シフトし、生成した第2データを出力する第1シフトバッファと、第2データが入力されて、特定符号テーブルを参照して、第2データから第2可変長符号を検出し、検出された第2可変長符号の全ビット長を出力する第2特定符号検出部と、第2データが入力されて、先頭符号テーブルを参照して、第2データからハフマン符号を検出し、検出されたハフマン符号の第2ビット長と、第2R/Sインデックスを出力する第2ハフマン符号検出部と、第2データが入力されて、第2R/Sインデックスと、R/Sテーブルを参照して、第2データから第2ゼロランレングスと第2ゼロランレングスに後続する第2非ゼロ係数を算出する第2R/Sデコーダと、第2データが入力されて、特定符号テーブルが参照されたとき、第2データを第2可変長符号の全ビット長分だけ左シフトし、先頭符号テーブルが参照されたとき、第2データをハフマン符号の第2ビット長分だけ左シフトし、第2データの先頭が付加ビットであったとき、第2データを付加ビットのビット長分だけ左シフトし、生成した第3データを出力する第2シフトバッファとを備える、可変長符号復号装置が提供される。   In order to solve the above problems, according to another aspect of the present invention, an input buffer to which first data composed of a variable length code composed of a combination of a Huffman code and additional bits is input, and a zero run length is 0. For the variable length code, the specific code table for storing all the bit lengths that are the bit length of the variable length code and the first data are input, and the first variable is referred to the first variable by referring to the specific code table. A first specific code detection unit that detects a long code and outputs the entire bit length of the detected first variable length code; a head code table that stores an index of a head code in each bit length of the Huffman code; 1 data is input, the Huffman code is detected from the first data with reference to the head code table, the first bit length of the detected Huffman code, and the first R / S index A first Huffman code detector for output, an R / S table for storing a combination of zero run length and the bit length of the subsequent additional bits as a pair of information, first data is input, and the first R / S index , Referring to the R / S table, the first R / S decoder for calculating the first zero run length and the first non-zero coefficient following the first zero run length from the first data, and the first data are input. When the specific code table is referenced, the first data is shifted to the left by the entire bit length of the first variable length code, and when the head code table is referenced, the first data is shifted by the first bit length of the Huffman code. When the first data is shifted to the left by an additional bit, the first data is shifted to the left by the bit length of the additional bit and the generated second data is output. And the second data is input, the second variable length code is detected from the second data with reference to the specific code table, and the entire bit length of the detected second variable length code is output. The code detector and the second data are input, the Huffman code is detected from the second data with reference to the head code table, and the second bit length of the detected Huffman code and the second R / S index are output. The second Huffman code detecting unit, the second data is input, the second R / S index and the R / S table are referred to, and the second data is followed by the second zero run length and the second zero run length. When the second data is input and the specific code table is referred to, the second data is shifted to the left by the entire bit length of the second variable length code. And leading sign table When the second data is referenced, the second data is shifted left by the second bit length of the Huffman code. When the head of the second data is an additional bit, the second data is shifted left by the bit length of the additional bit. And a variable-length code decoding device including a second shift buffer that outputs the generated third data.

この構成により、入力バッファに、ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力され、第1特定符号検出部において、第1データが入力されて、特定符号テーブルが参照されて、第1データから第1可変長符号が検出され、検出された第1可変長符号の全ビット長が出力される。ここで、特定符号テーブルは、ゼロランレングスが0となる可変長符号について、可変長符号のビット長さである全ビット長を記憶したテーブルである。また、ハフマン符号検出部において、第1データが入力されて、先頭符号テーブルが参照されて、第1データからハフマン符号が検出され、検出されたハフマン符号の第1ビット長、第1R/Sインデックスが出力される。ここで、先頭符号テーブルは、ハフマン符号の各ビット長における先頭コードのインデックスが記憶されたテーブルである。更に、第1R/Sデコーダにおいて、第1データが入力されて、第1R/Sインデックスと、R/Sテーブルが参照されて、第1データから第1ゼロランレングスと第1ゼロランレングスに後続する第1非ゼロ係数が算出される。ここで、R/Sテーブルは、ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶するテーブルである。そして、第1シフトバッファにおいて、第1データが入力されて、特定符号テーブルが参照されたとき、第1データが全ビット長分だけ左シフトされ、先頭符号テーブルが参照されたとき、第1データがハフマン符号の符号長分だけ左シフトされ、第1データの先頭が付加ビットであったとき、第1データが付加ビットのビット長分だけ左シフトされ、生成された第2データが出力される。
また、第2特定符号検出部において、第2データが入力されて、特定符号テーブルが参照されて、第2データから第2可変長符号が検出され、検出された第2可変長符号の全ビット長が出力される。また更に、第2ハフマン符号検出部において、第2データが入力されて、先頭符号テーブルが参照されて、第2データからハフマン符号が検出され、検出されたハフマン符号の第2ビット長と、第2R/Sインデックスが出力される。また、第2R/Sデコーダにおいて、第2データが入力されて、第2R/Sインデックスと、R/Sテーブルが参照されて、第2データから第2ゼロランレングスと第2ゼロランレングスに後続する第2非ゼロ係数が算出される。そして、第2シフトバッファにおいて、第2データが入力されて、特定符号テーブルが参照されたとき、第2データが第2可変長符号の全ビット長分だけ左シフトされ、先頭符号テーブルが参照されたとき、第2データがハフマン符号の第2ビット長分だけ左シフトされ、第2データの先頭が付加ビットであったとき、第2データが付加ビットのビット長分だけ左シフトされ、生成された第3データを出力される。
With this configuration, first data composed of a variable-length code composed of a combination of a Huffman code and additional bits is input to the input buffer, and the first data is input to the specific code table in the first specific code detection unit. , The first variable length code is detected from the first data, and the entire bit length of the detected first variable length code is output. Here, the specific code table is a table that stores all the bit lengths that are the bit lengths of the variable length codes for the variable length codes having zero run length of zero. Further, in the Huffman code detector, the first data is input, the head code table is referenced, the Huffman code is detected from the first data, and the first bit length and the first R / S index of the detected Huffman code Is output. Here, the head code table is a table in which the index of the head code in each bit length of the Huffman code is stored. Further, in the first R / S decoder, the first data is input, the first R / S index and the R / S table are referenced, and the first zero run length and the first zero run length follow from the first data. A first non-zero coefficient is calculated. Here, the R / S table is a table that stores a combination of the zero run length and the bit length of the subsequent additional bits as a pair of information. In the first shift buffer, when the first data is input and the specific code table is referred to, the first data is shifted to the left by the entire bit length, and when the first code table is referred to, the first data is referred to. Is shifted to the left by the code length of the Huffman code, and when the top of the first data is an additional bit, the first data is shifted to the left by the bit length of the additional bit, and the generated second data is output. .
In the second specific code detector, the second data is input, the specific code table is referred to, the second variable length code is detected from the second data, and all the bits of the detected second variable length code are detected. The length is output. Furthermore, in the second Huffman code detection unit, the second data is input, the head code table is referenced, the Huffman code is detected from the second data, the second bit length of the detected Huffman code, A 2R / S index is output. In the second R / S decoder, the second data is input, the second R / S index and the R / S table are referenced, and the second data is followed by the second zero run length and the second zero run length. A second non-zero coefficient is calculated. When the second data is input and the specific code table is referred to in the second shift buffer, the second data is shifted to the left by the entire bit length of the second variable length code, and the head code table is referred to. When the second data is shifted to the left by the second bit length of the Huffman code, and the top of the second data is an additional bit, the second data is shifted to the left by the bit length of the additional bit and generated. The third data is output.

以上説明したように本発明によれば、1クロックサイクル内に2個の可変長符号を復号することができ、信号処理の処理速度を向上させることができる。   As described above, according to the present invention, two variable length codes can be decoded within one clock cycle, and the processing speed of signal processing can be improved.

本発明の第1の実施形態に係る可変長符号復号装置100の構成を示すブロック図である。It is a block diagram which shows the structure of the variable-length code decoding apparatus 100 which concerns on the 1st Embodiment of this invention. 本発明の第2の実施形態に係る可変長符号復号装置200の構成を示すブロック図である。It is a block diagram which shows the structure of the variable-length code decoding apparatus 200 which concerns on the 2nd Embodiment of this invention. JPEGの可変長符号を示す説明図である。It is explanatory drawing which shows the variable length code | symbol of JPEG. 従来の可変長符号復号装置10の構成を示すブロック図である。It is a block diagram which shows the structure of the conventional variable length code decoding apparatus.

以下に添付図面を参照しながら、本発明の好適な実施の形態について詳細に説明する。なお、本明細書及び図面において、実質的に同一の機能構成を有する構成要素については、同一の符号を付することにより重複説明を省略する。   Exemplary embodiments of the present invention will be described below in detail with reference to the accompanying drawings. In addition, in this specification and drawing, about the component which has the substantially same function structure, duplication description is abbreviate | omitted by attaching | subjecting the same code | symbol.

(第1の実施形態)
図1を参照して、本発明の第1の実施形態に係る可変長符号復号装置100について説明する。図1は、本実施形態に係る可変長符号復号装置100の構成を示すブロック図である。
(First embodiment)
A variable-length code decoding apparatus 100 according to the first embodiment of the present invention will be described with reference to FIG. FIG. 1 is a block diagram showing a configuration of a variable-length code decoding apparatus 100 according to this embodiment.

可変長符号復号装置100は、第1ハフマン符号検出部112と、第2ハフマン符号検出部122と、第1シフトバッファ114と、第2シフトバッファ124と、第1R/Sデコーダ116と、第2R/Sデコーダ126と、第3シフトバッファ118、第4シフトバッファ128と、R/Sテーブル106と、符号長テーブル104などからなる。   The variable-length code decoding apparatus 100 includes a first Huffman code detection unit 112, a second Huffman code detection unit 122, a first shift buffer 114, a second shift buffer 124, a first R / S decoder 116, and a second R / S decoder 126, third shift buffer 118, fourth shift buffer 128, R / S table 106, code length table 104, and the like.

第1ハフマン符号検出部112と、第2ハフマン符号検出部122は、ハフマン符号を検出し、後段の処理に必要なパラメータを生成する。   The first Huffman code detection unit 112 and the second Huffman code detection unit 122 detect the Huffman code and generate parameters necessary for subsequent processing.

第1R/Sデコーダ116と、第2R/Sデコーダ126は、第1ハフマン符号検出部112と、第2ハフマン符号検出部122で生成されたパラメータと、R/Sテーブル106を参照して、ゼロランレングス(第1ゼロランレングス、第2ゼロランレングス)と非ゼロ係数(第1係数、第2係数)を算出し、出力する。   The first R / S decoder 116 and the second R / S decoder 126 refer to the parameters generated by the first Huffman code detection unit 112, the second Huffman code detection unit 122, and the R / S table 106, and zero. Run lengths (first zero run length, second zero run length) and non-zero coefficients (first coefficient, second coefficient) are calculated and output.

第1シフトバッファ114、第2シフトバッファ124は、データを、可変長符号(ハフマン符号+付加ビット)のビット長分(全ビット長分)だけ左シフトして、生成したデータを出力する。   The first shift buffer 114 and the second shift buffer 124 shift the data to the left by the bit length (all bit lengths) of the variable length code (Huffman code + additional bits) and output the generated data.

第3シフトバッファ118、第4シフトバッファ128は、データを、ハフマン符号のビット長分(ハフマン符号長分)だけ左シフトして出力する。   The third shift buffer 118 and the fourth shift buffer 128 shift the data to the left by the bit length of the Huffman code (Huffman code length) and output the data.

R/Sテーブル106では、ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶しているテーブルである。R/Sテーブル106では、ハフマン符号がハフマン符号の生成順に配置されている。   The R / S table 106 is a table that stores a combination of zero run lengths and bit lengths of additional bits following the zero run lengths as a pair of information. In the R / S table 106, Huffman codes are arranged in the order in which Huffman codes are generated.

符号長テーブル104は、ハフマン符号と付加ビットの組み合わせ(可変長符号)の全てのパターンについて、ビット長を記憶している。ここで、ハフマン符号と付加ビットの組み合わせ(可変長符号)のビット長を全ビット長ともいう。例えば、符号長テーブル104は、JPEGの輝度のAC成分、色差のAC成分の場合、それぞれ162のパターンについて、ビット長を記憶している。   The code length table 104 stores bit lengths for all patterns of combinations of Huffman codes and additional bits (variable length codes). Here, the bit length of the combination of Huffman code and additional bits (variable length code) is also referred to as the total bit length. For example, the code length table 104 stores a bit length for each of 162 patterns in the case of a JPEG luminance AC component and a color difference AC component.

次に、本実施形態に係る可変長符号復号装置100の動作について説明する。   Next, the operation of the variable length code decoding apparatus 100 according to this embodiment will be described.

第1ハフマン符号検出部112は、可変長符号(第1の可変長符号)を含む圧縮データが入力されると、符号長テーブル104を参照して、可変長符号を検出する。第1ハフマン符号検出部112は、符号長テーブル104を参照して、従来のハフマン符号検出と同様に、第1の可変長符号に含まれるハフマン符号のビット長と、R/Sインデックスと、DC成分の可変長符号の場合はDC成分の付加ビットのビット長を生成する。更に、本実施形態では、第1ハフマン符号検出部112は、符号長テーブル104を参照することで、可変長符号の全ビット長を生成できる。   When compressed data including a variable length code (first variable length code) is input, the first Huffman code detection unit 112 detects the variable length code with reference to the code length table 104. The first Huffman code detection unit 112 refers to the code length table 104, and similarly to the conventional Huffman code detection, the bit length of the Huffman code included in the first variable length code, the R / S index, and the DC In the case of the variable length code of the component, the bit length of the additional bit of the DC component is generated. Furthermore, in the present embodiment, the first Huffman code detection unit 112 can generate the entire bit length of the variable length code by referring to the code length table 104.

第1ハフマン符号検出部112は、全ビット長を第1シフトバッファ114に出力し、R/Sインデックスと、DC成分の付加ビットのビット長を第1R/Sデコーダ116に出力し、ハフマン符号のビット長を第3シフトバッファ118に出力する。   The first Huffman code detector 112 outputs the entire bit length to the first shift buffer 114, outputs the R / S index and the bit length of the additional bits of the DC component to the first R / S decoder 116, and outputs the Huffman code. The bit length is output to the third shift buffer 118.

第1シフトバッファ114は、入力バッファ102から出力された第1の可変長符号を、第1ハフマン符号検出部112で検出された可変長符号の全ビット長分だけ左シフトする。そして、第1シフトバッファ114は、生成したデータを、後半部の第2ハフマン符号検出部122と、第2シフトバッファ124と、第4シフトバッファ128に出力する。   The first shift buffer 114 shifts the first variable length code output from the input buffer 102 to the left by the entire bit length of the variable length code detected by the first Huffman code detector 112. Then, the first shift buffer 114 outputs the generated data to the second Huffman code detection unit 122, the second shift buffer 124, and the fourth shift buffer 128 in the latter half.

第3シフトバッファ118は、入力バッファ102からの第1の可変長符号のデータの出力を、第1ハフマン符号検出部112で検出したハフマン符号のビット長分を左シフトして、第1R/Sデコーダ116へ出力する。   The third shift buffer 118 shifts the output of the first variable length code data from the input buffer 102 to the left by the bit length of the Huffman code detected by the first Huffman code detection unit 112, and outputs the first R / S Output to the decoder 116.

第1R/Sデコーダ116は、第1ハフマン符号検出部112が出力するR/Sインデックスと、R/Sテーブル106に基づいて、R/Sインデックスに対応するゼロランレングスと付加ビットのビット長の情報を得ることができる。   Based on the R / S index output from the first Huffman code detection unit 112 and the R / S table 106, the first R / S decoder 116 has a zero run length corresponding to the R / S index and the bit length of the additional bits. Information can be obtained.

そして、第1R/Sデコーダ116は、ゼロランレングスに後続する非ゼロ係数(第1係数)を算出し、第1ゼロランレングスと第1係数を逆量子化部(図示せず。)へ出力する。可変長符号がDC成分であった場合は、第1ハフマン符号検出部112が出力するDC付加ビットのビット長をもとに係数を算出し、ゼロランレングスを0にして出力する。   Then, the first R / S decoder 116 calculates a non-zero coefficient (first coefficient) subsequent to the zero run length, and outputs the first zero run length and the first coefficient to an inverse quantization unit (not shown). To do. When the variable-length code is a DC component, a coefficient is calculated based on the bit length of the DC additional bits output from the first Huffman code detection unit 112, and the zero-run length is set to 0 and output.

第1シフトバッファ114によって、第1の可変長符号分(全ビット長分)のビット列がシフトされるため、第2ハフマン符号検出部122に入力されるデータは、第2の可変長符号からになる。   Since the first shift buffer 114 shifts the bit string for the first variable length code (for all bit lengths), the data input to the second Huffman code detector 122 starts from the second variable length code. Become.

第2ハフマン符号検出部122は、第2の可変長符号を含む圧縮データが入力されると、符号長テーブル104を参照して、可変長符号を検出する。第2ハフマン符号検出部122は、符号長テーブル104を参照して、第2の可変長符号に含まれるハフマン符号長と、R/Sインデックスと、全ビット長を生成する。第2ハフマン符号検出部122は、全ビット長を第2シフトバッファ124に出力し、R/Sインデックスを第2R/Sデコーダ126に出力し、ハフマン符号長を第4シフトバッファ128に出力する。   When the compressed data including the second variable length code is input, the second Huffman code detection unit 122 refers to the code length table 104 and detects the variable length code. The second Huffman code detection unit 122 refers to the code length table 104 and generates a Huffman code length, an R / S index, and an entire bit length included in the second variable length code. The second Huffman code detector 122 outputs the entire bit length to the second shift buffer 124, outputs the R / S index to the second R / S decoder 126, and outputs the Huffman code length to the fourth shift buffer 128.

第2シフトバッファ124は、第1シフトバッファ114から出力された第2の可変長符号を、第2ハフマン符号検出部122で検出された可変長符号の全ビット長分だけ左シフトして、生成したデータを入力バッファ102に出力する。   The second shift buffer 124 shifts the second variable length code output from the first shift buffer 114 to the left by the entire bit length of the variable length code detected by the second Huffman code detector 122, and generates the second variable length code. The processed data is output to the input buffer 102.

第4シフトバッファ128は、第1シフトバッファ114から出力された第1の可変長符号を、第2ハフマン符号検出部122で検出されたハフマン符号のビット長分だけ左シフトして、生成したデータを第2R/Sデコーダ126へ出力する。   The fourth shift buffer 128 shifts the first variable length code output from the first shift buffer 114 to the left by the bit length of the Huffman code detected by the second Huffman code detector 122, and generates data Is output to the second R / S decoder 126.

第2R/Sデコーダ126は、第2ハフマン符号検出部122が出力するR/Sインデックスと、R/Sテーブル106に基づいて、R/Sインデックスに対応するゼロランレングスと付加ビットのビット長(符号長)の情報を得ることができる。   The second R / S decoder 126, based on the R / S index output from the second Huffman code detector 122 and the R / S table 106, the zero run length corresponding to the R / S index and the bit length of the additional bits ( Code length) information can be obtained.

そして、第2R/Sデコーダ126は、ゼロランレングスに後続する非ゼロ係数(第2係数)を算出し、第2ゼロランレングスと第2係数を逆量子化部(逆量子化部)へ出力する。   Then, the second R / S decoder 126 calculates a non-zero coefficient (second coefficient) subsequent to the zero run length, and outputs the second zero run length and the second coefficient to the inverse quantization unit (inverse quantization unit). To do.

入力バッファ102は、第2シフトバッファ124から出力される可変長符号の最後尾と、可変長符号復号装置100に入力される可変長符号の先頭が、連続するビット列になるように連結する。そして、入力バッファ102は、次のクロックサイクルでビット列を出力し、1クロックサイクルで二つの可変長符号の復号を実施する。   The input buffer 102 connects the tail of the variable length code output from the second shift buffer 124 and the beginning of the variable length code input to the variable length code decoding apparatus 100 so as to form a continuous bit string. The input buffer 102 outputs a bit string in the next clock cycle, and decodes two variable length codes in one clock cycle.

以上、本実施形態によれば、1クロックサイクルで二つの可変長符号の復号を実施することができ、最低でも2倍速の復号処理が実現可能となる。   As described above, according to the present embodiment, two variable length codes can be decoded in one clock cycle, and at least double speed decoding processing can be realized.

(第2の実施形態)
次に、図2を参照して、本発明の第2の実施形態に係る可変長符号復号装置200について説明する。上述した第1の実施形態に係る可変長符号復号装置100では、符号長テーブル104を、ハフマン符号と付加ビットの組み合わせ(可変長符号)の全てパターンについて用意する。そのため、回路規模が極めて大きくなってしまうという問題がある。一方、本発明の第2の実施形態によれば、処理能力は同等で、回路規模が現実的な大きさとなる。図2は、本実施形態に係る可変長符号復号装置200の構成を示すブロック図である。
(Second Embodiment)
Next, a variable-length code decoding apparatus 200 according to the second embodiment of the present invention will be described with reference to FIG. In the variable length code decoding apparatus 100 according to the first embodiment described above, the code length table 104 is prepared for all patterns of combinations of Huffman codes and additional bits (variable length codes). Therefore, there is a problem that the circuit scale becomes extremely large. On the other hand, according to the second embodiment of the present invention, the processing capability is the same, and the circuit scale is realistic. FIG. 2 is a block diagram showing a configuration of the variable length code decoding apparatus 200 according to the present embodiment.

本実施形態での特定符号テーブル204は、第1の実施形態の符号長テーブル104を特定の符号(ゼロランレングスが0)のみに対応するとしたものである。即ち、特定符号テーブル204は、ゼロランレングスが0となるハフマン符号と付加ビットの組み合わせ(可変長符号)のパターンについて、全ビット長を記憶している。   The specific code table 204 in this embodiment corresponds to the code length table 104 of the first embodiment corresponding to only a specific code (zero run length is 0). That is, the specific code table 204 stores all bit lengths for a pattern of a combination of Huffman codes and additional bits (variable length codes) in which the zero run length is 0.

また、本実施形態の可変長符号復号装置200は、第1の実施形態の構成に比べて、更に第1特定符号処理部212と、第2特定符号処理部232と、第1ビット長選択部224と、第2ビット長選択部244と、第1出力選択部226と、第2出力選択部246を備える。   Further, the variable length code decoding apparatus 200 of the present embodiment further includes a first specific code processing unit 212, a second specific code processing unit 232, and a first bit length selection unit as compared with the configuration of the first embodiment. 224, a second bit length selection unit 244, a first output selection unit 226, and a second output selection unit 246.

第1特定符号処理部212、第2特定符号処理部232は、特定符号を検出すると、特定符号(ハフマン符号+付加ビット)のビット長(全ビット長)を出力するとともに、対応するゼロランレングスと、ゼロランレングスに後続する付加ビットのビット長を、特定符号テーブル204を参照して取得する。また、第1特定符号処理部212、第2特定符号処理部232は、ゼロランレングスに後続する非ゼロ係数を算出し、ゼロランレングスと共に非ゼロ係数を出力する。更に、第1特定符号処理部212、第2特定符号処理部232は、特定符号を検出したことを示すフラグ(SHIT)を出力する。   When the first specific code processing unit 212 and the second specific code processing unit 232 detect the specific code, the first specific code processing unit 212 and the second specific code processing unit 232 output the bit length (all bit lengths) of the specific code (Huffman code + additional bits) and the corresponding zero run length. Then, the bit length of the additional bits following the zero run length is obtained by referring to the specific code table 204. In addition, the first specific code processing unit 212 and the second specific code processing unit 232 calculate a non-zero coefficient following the zero run length, and output the non-zero coefficient together with the zero run length. Furthermore, the first specific code processing unit 212 and the second specific code processing unit 232 output a flag (SHIT) indicating that the specific code has been detected.

第1ハフマン符号検出部214、第2ハフマン符号検出部234は、基本的に従来のハフマン符号検出部14と同じ動作をするが、特定符号以外の符号を検出したことを示すフラグ(NHIT)を出力する。第1R/Sデコーダ216、第2R/Sデコーダ236も、基本的に従来のR/Sデコーダ18と同じ動作をする。   The first Huffman code detection unit 214 and the second Huffman code detection unit 234 basically perform the same operation as the conventional Huffman code detection unit 14, but set a flag (NIT) indicating that a code other than the specific code has been detected. Output. The first R / S decoder 216 and the second R / S decoder 236 also basically perform the same operation as the conventional R / S decoder 18.

第1ビット長選択部224は、第1特定符号処理部212と、第1ハフマン符号検出部214と、第1R/Sデコーダ216が出力するビット長の中で有意なものを選択して、選択したビット長を第1シフトバッファ222に出力する。第1シフトバッファ222は、第1ビット長選択部224が出力するビット長に従い、入力された可変長符号のデータを左シフトして、生成したデータを出力する。第2ビット長選択部244、第2シフトバッファ242についても同様である。   The first bit length selection unit 224 selects and selects a significant bit length output from the first specific code processing unit 212, the first Huffman code detection unit 214, and the first R / S decoder 216. The obtained bit length is output to the first shift buffer 222. The first shift buffer 222 shifts the input variable length code data to the left according to the bit length output by the first bit length selection unit 224, and outputs the generated data. The same applies to the second bit length selection unit 244 and the second shift buffer 242.

第1出力選択部226は、第1特定符号処理部212と、第1R/Sデコーダ216が出力するゼロランレングスと非ゼロ係数の中で有意なものを選択して、選択したゼロランレングスと係数を逆量子化部(図示せず。)へ出力する。第2出力選択部246についても同様である。特定符号処理部、ハフマン符号検出部、R/Sデコーダの三つの処理回路を2組従属接続することで、所望の処理を行うことができる。   The first output selection unit 226 selects a significant zero run length and non-zero coefficient output from the first specific code processing unit 212 and the first R / S decoder 216, and selects the selected zero run length. The coefficient is output to an inverse quantization unit (not shown). The same applies to the second output selection unit 246. Desired processing can be performed by connecting two sets of the three processing circuits of the specific code processing unit, the Huffman code detection unit, and the R / S decoder.

次に、本実施形態に係る可変長符号復号装置200の動作について説明する。   Next, the operation of the variable length code decoding apparatus 200 according to this embodiment will be described.

まず、入力バッファ202から出力される可変長符号が特定符号だった場合について説明する。入力バッファ202から出力される可変長符号が特定符号だった場合、そのクロックサイクル内で、2個の可変長符号を処理することになる。   First, a case where the variable length code output from the input buffer 202 is a specific code will be described. When the variable length code output from the input buffer 202 is a specific code, two variable length codes are processed within the clock cycle.

特定符号である第1の可変長符号は、特定符号テーブル204を参照して、第1特定符号処理部212で処理される。そして、第1ビット長選択部224は、フラグ(SHIT)に基づいて、第1の可変長符号に基づく全ビット長を選択する。第1出力選択部226は、フラグ(SHIT)に基づいて、第1の可変長符号に基づくゼロランレングス、非ゼロ係数を選択する。その結果、第1の可変長符号に基づく全ビット長、ゼロランレングス、非ゼロ係数が出力される。   The first variable length code that is the specific code is processed by the first specific code processing unit 212 with reference to the specific code table 204. Then, the first bit length selection unit 224 selects the entire bit length based on the first variable length code based on the flag (SHIT). The first output selection unit 226 selects the zero run length and non-zero coefficient based on the first variable length code based on the flag (SHIT). As a result, the full bit length, zero run length, and non-zero coefficient based on the first variable length code are output.

第1シフトバッファ222は、入力バッファ202から出力された第1可変長符号を、第1特定符号処理部212で検出した第1の可変長符号の全ビット長分だけ左シフトする。そして、第1シフトバッファ222は、生成したデータを後半部の第2特定符号処理部232と、第2ハフマン符号検出部234と、第2R/Sデコーダ236と、第2シフトバッファ242へ出力する。   The first shift buffer 222 shifts the first variable length code output from the input buffer 202 to the left by the entire bit length of the first variable length code detected by the first specific code processing unit 212. Then, the first shift buffer 222 outputs the generated data to the second specific code processing unit 232, the second Huffman code detection unit 234, the second R / S decoder 236, and the second shift buffer 242 in the latter half. .

第1出力選択部226は、第1の可変長符号から復号されたゼロランレングスと非ゼロ係数を逆量子化部(図示せず。)へ出力し、第1の可変長符号の復号が終了する。   The first output selection unit 226 outputs the zero run length and non-zero coefficient decoded from the first variable length code to the inverse quantization unit (not shown), and the decoding of the first variable length code is completed. To do.

第1の可変長符号に続き、第2の可変長符号も特定符号であった場合、第2特定符号処理部232は、特定符号テーブル204を参照して、第1シフトバッファ222から出力された第2の可変長符号の復号を行う。復号して得られたゼロランレングス、非ゼロ係数は、フラグ(SHIT)に基づいて、第2出力選択部246から逆量子化部(図示せず。)へ出力される。第2シフトバッファ242は、フラグ(SHIT)に基づいて、第1シフトバッファ222から出力された第2の可変長符号を、第2特定符号処理部232で検出した第2の可変長符号の全ビット長分だけ左シフトする。そして、第2シフトバッファ242は、生成したデータを入力バッファ202に出力する。   When the second variable length code is also a specific code following the first variable length code, the second specific code processing unit 232 refers to the specific code table 204 and is output from the first shift buffer 222. The second variable length code is decoded. The zero run length and non-zero coefficient obtained by decoding are output from the second output selection unit 246 to an inverse quantization unit (not shown) based on the flag (SHIT). Based on the flag (SHIT), the second shift buffer 242 detects all the second variable length codes detected by the second specific code processing unit 232 from the second variable length code output from the first shift buffer 222. Shift left by the bit length. Then, the second shift buffer 242 outputs the generated data to the input buffer 202.

入力バッファ202は、第2シフトバッファ242から出力される可変長符号の最後尾と、可変長符号復号装置200に入力される可変長符号の先頭が、連続するビット列になるように連結する。そして、連結されて生成されたビット列は、次のクロックサイクルで入力バッファ202から出力される。   The input buffer 202 connects the tail of the variable length code output from the second shift buffer 242 and the beginning of the variable length code input to the variable length code decoding apparatus 200 so as to form a continuous bit string. The bit string generated by concatenation is output from the input buffer 202 in the next clock cycle.

第1の可変長符号に続く第2の可変長符号が特定符号以外であった場合、第2ハフマン符号検出部234は、先頭符号テーブル206を参照して、R/Sインデックスとハフマン符号のビット長を出力する。   When the second variable length code following the first variable length code is other than the specific code, the second Huffman code detection unit 234 refers to the head code table 206 and refers to the R / S index and the bits of the Huffman code. Print the length.

R/Sインデックスは、次のクロックサイクルで第1R/Sデコーダ216が復号を行うため、Dフリップフロップ(D−FF)252で1クロック遅延されて出力される。第2シフトバッファ242は、フラグ(NHIT)に基づいて、第1シフトバッファ222から出力された第2の可変長符号を、第2ハフマン符号検出部234で検出した第2可変長符号のハフマン符号長分だけ左シフトして、付加ビットの先頭を切り出し、入力バッファ202に出力する。そして、次のクロックサイクルで入力バッファ202から出力される。   The R / S index is output after being delayed by one clock in the D flip-flop (D-FF) 252 because the first R / S decoder 216 performs decoding in the next clock cycle. The second shift buffer 242 uses the second variable length code Huffman code detected by the second Huffman code detector 234 to detect the second variable length code output from the first shift buffer 222 based on the flag (NHIT). Shifting to the left by the length, the beginning of the additional bits is cut out and output to the input buffer 202. Then, it is output from the input buffer 202 in the next clock cycle.

そして、次のクロックサイクルでは、R/Sテーブル208が参照されて、第1R/Sデコーダ216でゼロランレングスと非ゼロ係数が復号され、フラグ(NHIT)に基づいて、第1出力選択部226から逆量子化部(図示せず。)へ出力される。このとき、第1出力選択部226に第1R/Sデコーダ216の出力を選択させるため、第2ハフマン符号検出部234からのNHITは、D−FF254で1クロック遅延されて出力される。   In the next clock cycle, the R / S table 208 is referred to, the first R / S decoder 216 decodes the zero run length and the non-zero coefficient, and the first output selection unit 226 based on the flag (NHIT). To the inverse quantization unit (not shown). At this time, the NHIT from the second Huffman code detector 234 is delayed by one clock in the D-FF 254 and output in order to cause the first output selector 226 to select the output of the first R / S decoder 216.

第1の可変長符号が特定符号でなかった場合、第1ハフマン符号検出部214は、検出したハフマン符号のR/Sインデックスとハフマン符号長を求める。そして、第1シフトバッファ222は、入力バッファ202から出力された可変長符号を、ハフマン符号のビット長分だけ左シフトする。このとき、第1出力選択部226からは何も出力されない。   When the first variable length code is not a specific code, the first Huffman code detection unit 214 obtains the R / S index and the Huffman code length of the detected Huffman code. Then, the first shift buffer 222 shifts the variable length code output from the input buffer 202 to the left by the bit length of the Huffman code. At this time, nothing is output from the first output selection unit 226.

R/Sテーブル208を参照して、第2R/Sデコーダ236は、R/Sインデックスと、第1シフトバッファ222から出力されたデータに基づいて、ゼロランレングスと非ゼロ係数を算出する。そして、第2出力選択部246から第2ゼロランレングスと第2係数が逆量子化部(図示せず。)へ出力される。第2シフトバッファ242は、第1シフトバッファ222から出力されたデータを、付加ビットのビット長分だけ左シフトして、生成したデータを入力バッファ202に出力する。入力バッファ202は、第2シフトバッファ242から出力されるデータの最後尾と、可変長符号復号装置100に入力される可変長符号のデータの先頭が、連続するビット列になるように連結する。そして、入力バッファ202は、次のクロックサイクルでビット列を出力し、一つの可変長符号の復号を実施する。   Referring to the R / S table 208, the second R / S decoder 236 calculates a zero run length and a non-zero coefficient based on the R / S index and the data output from the first shift buffer 222. Then, the second output selection unit 246 outputs the second zero run length and the second coefficient to the inverse quantization unit (not shown). The second shift buffer 242 shifts the data output from the first shift buffer 222 to the left by the bit length of the additional bits, and outputs the generated data to the input buffer 202. The input buffer 202 connects the end of the data output from the second shift buffer 242 and the beginning of the variable length code data input to the variable length code decoding apparatus 100 so as to form a continuous bit string. Then, the input buffer 202 outputs a bit string in the next clock cycle, and decodes one variable length code.

以上、本実施形態によれば、回路規模の増大を抑えるとともに、1クロックサイクル内に2個の可変長符号を復号することができ、即ち最低でも2倍速での復号処理を行うことが可能となる。   As described above, according to the present embodiment, an increase in circuit scale can be suppressed, and two variable length codes can be decoded within one clock cycle, that is, a decoding process can be performed at a double speed at least. Become.

以上、添付図面を参照しながら本発明の好適な実施形態について詳細に説明したが、本発明はかかる例に限定されない。本発明の属する技術の分野における通常の知識を有する者であれば、特許請求の範囲に記載された技術的思想の範疇内において、各種の変更例または修正例に想到し得ることは明らかであり、これらについても、当然に本発明の技術的範囲に属するものと了解される。   The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to such examples. It is obvious that a person having ordinary knowledge in the technical field to which the present invention pertains can come up with various changes or modifications within the scope of the technical idea described in the claims. Of course, it is understood that these also belong to the technical scope of the present invention.

10,100,200 可変長符号復号装置
12,102,202 入力バッファ
14 ハフマン符号検出部
16 第1シフトバッファ
18 R/Sデコーダ
22 第2シフトバッファ
24,206 先頭符号テーブル
26,208 R/Sテーブル
104 符号長テーブル
106 R/Sテーブル
112,214 第1ハフマン符号検出部
114,222 第1シフトバッファ
116,216 第1R/Sデコーダ
118 第3シフトバッファ
122,234 第2ハフマン符号検出部
124,242 第2シフトバッファ
126,236 第2R/Sデコーダ
128 第4シフトバッファ
204 特定符号テーブル
212 第1特定符号処理部
224 第1ビット長選択部
226 第1出力選択部
244 第2ビット長選択部
246 第2出力選択部
10, 100, 200 Variable length code decoding device 12, 102, 202 Input buffer 14 Huffman code detector 16 First shift buffer 18 R / S decoder 22 Second shift buffer 24, 206 First code table 26, 208 R / S table 104 Code length table 106 R / S table 112, 214 First Huffman code detector 114, 222 First shift buffer 116, 216 First R / S decoder 118 Third shift buffer 122, 234 Second Huffman code detector 124, 242 Second shift buffer 126, 236 Second R / S decoder 128 Fourth shift buffer 204 Specific code table 212 First specific code processing unit 224 First bit length selection unit 226 First output selection unit 244 Second bit length selection unit 246 First 2-output selector

Claims (3)

ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力される入力バッファと、
前記可変長符号の全てのパターンについて、前記可変長符号のビット長さである全ビット長を記憶する符号長テーブルと、
前記第1データが入力されて、前記符号長テーブルを参照して、前記第1データから第1可変長符号を検出し、検出された前記第1可変長符号の前記全ビット長を出力する第1ハフマン符号検出部と、
前記第1データが入力されて、前記第1データを前記全ビット長分だけ左シフトし、生成した第2データを出力する第1シフトバッファと、
前記第2データが入力されて、前記符号長テーブルを参照して、前記第2データから第2可変長符号を検出し、検出された前記第2可変長符号の前記全ビット長を出力する第2ハフマン符号検出部と、
前記第2データが入力されて、前記第2データを前記全ビット長分だけ左シフトし、生成した第3データを前記入力バッファに出力する第2シフトバッファと
を備える、可変長符号復号装置。
An input buffer to which first data composed of a variable length code composed of a combination of a Huffman code and additional bits is input;
A code length table that stores all bit lengths that are bit lengths of the variable length codes for all patterns of the variable length codes;
The first data is input, the first variable length code is detected from the first data with reference to the code length table, and the detected all bit lengths of the first variable length code are output. A 1 Huffman code detector;
A first shift buffer that receives the first data, shifts the first data to the left by the entire bit length, and outputs the generated second data;
The second data is input, the second variable length code is detected from the second data with reference to the code length table, and the detected total bit length of the second variable length code is output. A 2 Huffman code detector;
A variable-length code decoding apparatus comprising: a second shift buffer that receives the second data, shifts the second data to the left by the entire bit length, and outputs the generated third data to the input buffer.
前記第1ハフマン符号検出部は、前記符号長テーブルを参照して、前記ハフマン符号の第1ビット長と、第1R/Sインデックスを生成して出力し、
前記第2ハフマン符号検出部は、前記符号長テーブルを参照して、前記ハフマン符号の第2ビット長と、第2R/Sインデックスを生成して出力し、
ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶するR/Sテーブルと、
前記第1データが入力されて、前記第1データを前記ハフマン符号の第1ビット長分だけ左シフトし、生成した第4データを出力する第3シフトバッファと、
前記第4データが入力されて、前記第1R/Sインデックスと、前記R/Sテーブルを参照して、前記第4データから第1ゼロランレングスと前記第1ゼロランレングスに後続する第1非ゼロ係数を算出する第1R/Sデコーダと、
前記第2データが入力されて、前記第2データを前記ハフマン符号の第2ビット長分だけ左シフトし、生成した第5データを出力する第4シフトバッファと、
前記第5データが入力されて、前記第2R/Sインデックスと、前記R/Sテーブルを参照して、前記第5データから第2ゼロランレングスと前記第2ゼロランレングスに後続する第2非ゼロ係数を算出する第2R/Sデコーダと
を更に備える、請求項1に記載の可変長符号復号装置。
The first Huffman code detection unit generates and outputs a first bit length of the Huffman code and a first R / S index with reference to the code length table,
The second Huffman code detection unit generates and outputs a second bit length of the Huffman code and a second R / S index with reference to the code length table,
An R / S table that stores a combination of a zero run length and a bit length of the subsequent additional bits as a pair of information;
A third shift buffer that receives the first data, shifts the first data to the left by the first bit length of the Huffman code, and outputs the generated fourth data;
The fourth data is input, the first R / S index and the R / S table are referred to, and the first zero run length and the first non-zero length following the first zero run length are referred to from the fourth data. A first R / S decoder for calculating a zero coefficient;
A fourth shift buffer that receives the second data, shifts the second data to the left by the second bit length of the Huffman code, and outputs the generated fifth data;
When the fifth data is input and the second R / S index and the R / S table are referenced, the second zero run length and the second non-zero run length following the second zero run length are referred to from the fifth data. The variable length code decoding apparatus according to claim 1, further comprising a second R / S decoder that calculates a zero coefficient.
ハフマン符号と付加ビットの組み合わせからなる可変長符号で構成される第1データが入力される入力バッファと、
ゼロランレングスが0となる前記可変長符号について、前記可変長符号のビット長さである全ビット長を記憶する特定符号テーブルと、
前記第1データが入力されて、前記特定符号テーブルを参照して、前記第1データから第1可変長符号を検出し、検出された前記第1可変長符号の前記全ビット長を出力する第1特定符号検出部と、
前記ハフマン符号の各ビット長における先頭コードのインデックスが記憶された先頭符号テーブルと、
前記第1データが入力されて、前記先頭符号テーブルを参照して、前記第1データからハフマン符号を検出し、検出された前記ハフマン符号の第1ビット長と、第1R/Sインデックスを出力する第1ハフマン符号検出部と、
ゼロランレングスとそれに続く付加ビットのビット長の組み合わせを一対の情報として記憶するR/Sテーブルと、
前記第1データが入力されて、前記第1R/Sインデックスと、前記R/Sテーブルを参照して、前記第1データから第1ゼロランレングスと前記第1ゼロランレングスに後続する第1非ゼロ係数を算出する第1R/Sデコーダと、
前記第1データが入力されて、前記特定符号テーブルが参照されたとき、前記第1データを前記第1可変長符号の前記全ビット長分だけ左シフトし、前記先頭符号テーブルが参照されたとき、前記第1データを前記ハフマン符号の第1ビット長分だけ左シフトし、前記第1データの先頭が付加ビットであったとき、前記第1データを前記付加ビットのビット長分だけ左シフトし、生成した第2データを出力する第1シフトバッファと、
前記第2データが入力されて、前記特定符号テーブルを参照して、前記第2データから第2可変長符号を検出し、検出された前記第2可変長符号の前記全ビット長を出力する第2特定符号検出部と、
前記第2データが入力されて、前記先頭符号テーブルを参照して、前記第2データからハフマン符号を検出し、検出された前記ハフマン符号の第2ビット長と、第2R/Sインデックスを出力する第2ハフマン符号検出部と、
前記第2データが入力されて、前記第2R/Sインデックスと、前記R/Sテーブルを参照して、前記第2データから第2ゼロランレングスと前記第2ゼロランレングスに後続する第2非ゼロ係数を算出する第2R/Sデコーダと、
前記第2データが入力されて、前記特定符号テーブルが参照されたとき、前記第2データを前記第2可変長符号の前記全ビット長分だけ左シフトし、前記先頭符号テーブルが参照されたとき、前記第2データを前記ハフマン符号の第2ビット長分だけ左シフトし、前記第2データの先頭が付加ビットであったとき、前記第2データを前記付加ビットのビット長分だけ左シフトし、生成した第3データを出力する第2シフトバッファと
を備える、可変長符号復号装置。
An input buffer to which first data composed of a variable length code composed of a combination of a Huffman code and additional bits is input;
For the variable length code with zero run length of 0, a specific code table that stores all bit lengths that are the bit length of the variable length code;
The first data is input, the first variable length code is detected from the first data with reference to the specific code table, and the detected total bit length of the first variable length code is output. 1 specific code detector;
A head code table storing an index of the head code in each bit length of the Huffman code;
The first data is input, the Huffman code is detected from the first data with reference to the head code table, and the first bit length of the detected Huffman code and the first R / S index are output. A first Huffman code detector;
An R / S table that stores a combination of a zero run length and a bit length of subsequent additional bits as a pair of information;
The first data is input, the first R / S index and the R / S table are referred to, the first zero run length and the first non-zero length following the first zero run length from the first data. A first R / S decoder for calculating a zero coefficient;
When the first data is input and the specific code table is referred to, the first data is left-shifted by the entire bit length of the first variable length code, and the head code table is referenced The first data is shifted to the left by the first bit length of the Huffman code, and when the head of the first data is an additional bit, the first data is shifted to the left by the bit length of the additional bit. A first shift buffer for outputting the generated second data;
The second data is input, the second variable length code is detected from the second data with reference to the specific code table, and the detected total bit length of the second variable length code is output. Two specific code detectors;
The second data is input, the Huffman code is detected from the second data with reference to the head code table, and the second bit length of the detected Huffman code and the second R / S index are output. A second Huffman code detector;
The second data is input, the second R / S index and the R / S table are referred to, the second zero run length from the second data and the second non-run length following the second zero run length. A second R / S decoder for calculating a zero coefficient;
When the second data is input and the specific code table is referenced, the second data is left-shifted by the entire bit length of the second variable length code, and the head code table is referenced The second data is shifted to the left by the second bit length of the Huffman code, and when the top of the second data is an additional bit, the second data is shifted to the left by the bit length of the additional bit. A variable-length code decoding apparatus comprising: a second shift buffer that outputs the generated third data.
JP2009295944A 2009-12-25 2009-12-25 Variable-length code decoding device Pending JP2011139128A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009295944A JP2011139128A (en) 2009-12-25 2009-12-25 Variable-length code decoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009295944A JP2011139128A (en) 2009-12-25 2009-12-25 Variable-length code decoding device

Publications (1)

Publication Number Publication Date
JP2011139128A true JP2011139128A (en) 2011-07-14

Family

ID=44350159

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009295944A Pending JP2011139128A (en) 2009-12-25 2009-12-25 Variable-length code decoding device

Country Status (1)

Country Link
JP (1) JP2011139128A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06104767A (en) * 1992-09-24 1994-04-15 Sony Corp Variable length code decoder
JPH1022832A (en) * 1996-06-28 1998-01-23 Sanyo Electric Co Ltd Multistage variable length code decoder
JPH1065549A (en) * 1996-03-29 1998-03-06 Matsushita Electric Ind Co Ltd Device for determining length of variable length encoded data value, device for decoding data stream of variable length encoded data value, and method for determining length of variable length encoded data value
JPH11243342A (en) * 1998-02-26 1999-09-07 Kanebo Ltd Variable length code decoding device
JP2002016501A (en) * 2000-04-28 2002-01-18 Matsushita Electric Ind Co Ltd Variable length decoder
JP2002076908A (en) * 1999-06-09 2002-03-15 Matsushita Electric Ind Co Ltd Variable length coder and decoder, and digital broadcasting receiver, and dvd reproducing unit
JP2002261623A (en) * 2001-02-28 2002-09-13 Canon Inc Decoding device, decoding method, storage medium and program software
JP2003115767A (en) * 2001-10-05 2003-04-18 Canon Inc Decoding device and method therefor
JP2003174365A (en) * 2001-12-06 2003-06-20 Canon Inc Decoding device and its method
JP2006157157A (en) * 2004-11-25 2006-06-15 Canon Inc Variable length decoding apparatus and variable length decoding method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06104767A (en) * 1992-09-24 1994-04-15 Sony Corp Variable length code decoder
JPH1065549A (en) * 1996-03-29 1998-03-06 Matsushita Electric Ind Co Ltd Device for determining length of variable length encoded data value, device for decoding data stream of variable length encoded data value, and method for determining length of variable length encoded data value
JPH1022832A (en) * 1996-06-28 1998-01-23 Sanyo Electric Co Ltd Multistage variable length code decoder
JPH11243342A (en) * 1998-02-26 1999-09-07 Kanebo Ltd Variable length code decoding device
JP2002076908A (en) * 1999-06-09 2002-03-15 Matsushita Electric Ind Co Ltd Variable length coder and decoder, and digital broadcasting receiver, and dvd reproducing unit
JP2002016501A (en) * 2000-04-28 2002-01-18 Matsushita Electric Ind Co Ltd Variable length decoder
JP2002261623A (en) * 2001-02-28 2002-09-13 Canon Inc Decoding device, decoding method, storage medium and program software
JP2003115767A (en) * 2001-10-05 2003-04-18 Canon Inc Decoding device and method therefor
JP2003174365A (en) * 2001-12-06 2003-06-20 Canon Inc Decoding device and its method
JP2006157157A (en) * 2004-11-25 2006-06-15 Canon Inc Variable length decoding apparatus and variable length decoding method

Similar Documents

Publication Publication Date Title
JP6431487B2 (en) Data encoder, data decoder and method
JP2008067395A5 (en)
RU2017100690A (en) METHOD FOR CODING AND DECODING IMAGES, DEVICE FOR CODING AND DECODING, AND RELATED COMPUTER PROGRAMS
JP2006339990A (en) Data encoding device, method, and program
JP4098187B2 (en) Variable length code decoding apparatus and method
JP2007043595A (en) Variable length code decoding method and device and data decompression device
JP2006309910A (en) Encoder and decoder
JP6073506B2 (en) Entropy changer and method
JP2004056758A (en) Variable length coding apparatus and coding method therefor
JP4865509B2 (en) Decoding device and decoding method
US8456334B2 (en) Variable-length code decoding apparatus, decoding system, and variable-length code decoding method
JP2011139128A (en) Variable-length code decoding device
KR101667989B1 (en) Method and device for encoding an input bit sequence and corresponding decoding method and device
JP2008278075A (en) Variable length encoding/decoding device
EP2259432A1 (en) Variable-length code decoding apparatus and method
JP2003174365A (en) Decoding device and its method
KR20070075267A (en) Method for encoding and decoding video signal
JP2009017232A (en) Arithmetic encoding device and image encoding device
JP5230375B2 (en) Image coding apparatus and image coding method
JP4095454B2 (en) Data decoding apparatus and data decoding method
TW201006251A (en) Symbol-sharing differential pulse code modulator/demodulator, multiple differential pulse code modulator/demodulator, image encoding/decoding system and method thereof
JP2009246973A (en) Decoding accelerating apparatus for variable length code
JP5857978B2 (en) Encoding device, decoding device, encoding / decoding system, and program
JP5872804B2 (en) Encoding apparatus and encoding method
JP5075136B2 (en) Decoding device and control method thereof

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20121213

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131127

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131203

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140422