JP2991767B2 - Quantization circuit - Google Patents
Quantization circuitInfo
- Publication number
- JP2991767B2 JP2991767B2 JP30709690A JP30709690A JP2991767B2 JP 2991767 B2 JP2991767 B2 JP 2991767B2 JP 30709690 A JP30709690 A JP 30709690A JP 30709690 A JP30709690 A JP 30709690A JP 2991767 B2 JP2991767 B2 JP 2991767B2
- Authority
- JP
- Japan
- Prior art keywords
- reciprocal
- quantization
- output
- value
- data
- 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
Links
Landscapes
- Facsimile Image Signal Circuits (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Image Processing (AREA)
Description
【発明の詳細な説明】 〔産業上の利用分野〕 この発明は入力画像データを圧縮符号化する際の量子
化回路に関し、特に自然画像に対する高能率圧縮符号化
技術に適用して好適なものである。Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a quantization circuit for compressing and encoding input image data, and more particularly to a quantization circuit suitable for applying to a high-efficiency compression encoding technique for natural images. is there.
自然画像(静止画)に対する高能率な圧縮符号化技術
として、直交変換に可変長符号を組み合わせた方式が有
効とされ、カラー静止画符号化方式の国際標準にも、こ
の方式が採用されることが決定している(画像電子学会
誌;Vol.18,No.6,P398〜P407参照)。As a high-efficiency compression coding technology for natural images (still images), a method combining orthogonal transform with variable-length code is considered to be effective, and this method will be adopted as an international standard for color still image coding. (See Journal of the Institute of Image Electronics Engineers of Japan; Vol. 18, No. 6, pp. 398-407).
第5図は国際標準化方式のうちの「ベースライン・シ
ステム」の処理手順を示す概略図である。このシステム
は入力画像データを1ブロックn×n画素、例えば、8
×8画素の複数ブロックに分割し、各ブロック毎に2次
元の離散コサイン変換(DCT:Discrete Cosine Transfor
m)を行い(処理P1)、得られるn×n個のDCT係数をn
×n個の閾値からなる量子化マトリクスの各閾値で除算
することで量子化を行う(処理P2)。第6図に量子化マ
トリクスの一例を示す。FIG. 5 is a schematic diagram showing the processing procedure of the “baseline system” of the international standardization system. This system converts input image data into n × n pixels of one block, for example, 8
It is divided into a plurality of blocks of × 8 pixels, and two-dimensional discrete cosine transform (DCT: Discrete Cosine Transfor
m) (Process P1), and obtain the obtained n × n DCT coefficients by n
Quantization is performed by dividing by each threshold of a quantization matrix composed of × n thresholds (process P2). FIG. 6 shows an example of the quantization matrix.
DCTは周波数領域における直交変換の一種で、変換係
数をFuv(u,v=0,1,…,n−1)、1ブロック分の入力画
像データをfij(i,j=0,1,…,n−1)とすると、 で定義される。得られる変換係数Fuvは1ブロック分の
入力画像データを空間周波数に分解した成分を表してお
り、係数F00は入力画像データfijの8×8画素の平均
値に比例した値(DC成分)を表し、変数u,vが大きくな
るにつれて空間周波数の高い成分(AC成分)を表す。DCT is a type of orthogonal transform in the frequency domain. The transform coefficient is Fuv (u, v = 0, 1,..., N−1), and the input image data for one block is fij (i, j = 0, 1,. , n-1), Is defined by The obtained transform coefficient Fuv represents a component obtained by decomposing one block of input image data into spatial frequencies, and the coefficient F00 represents a value (DC component) proportional to the average value of 8 × 8 pixels of the input image data fij. , The components (AC components) having higher spatial frequencies as the variables u and v increase.
量子化したDCT係数のうち直流(DC)成分は前のブロ
ックで量子化したDC成分と差分を取り(処理P3)、その
差分のビット数をハフマン符号化する(処理P4)。交流
(AC)成分はブロック内でジグザグスキャンを行って一
次元の数列に変換し、連続する無効係数(零)の個数を
ランレングス符号化して(処理P3)、そのランレングス
データと有効係数のビット数とで2次元のハフマン符号
化を行う(処理P4)。第7図にジグザグスキャンの一例
を示す。The DC component of the quantized DCT coefficients is different from the DC component quantized in the previous block (process P3), and the number of bits of the difference is Huffman-coded (process P4). The alternating current (AC) component is converted into a one-dimensional sequence by performing a zigzag scan within the block, and the number of consecutive invalid coefficients (zero) is run-length coded (process P3). Two-dimensional Huffman coding is performed with the number of bits (process P4). FIG. 7 shows an example of a zigzag scan.
なお、処理P2における量子化のときに、量子化マトリ
クスの各閾値に係数2S(S=0,±1,±2,…)を乗算した
のちDCT係数の除算を行う。係数2Sの巾Sはスケールフ
ァクタと称され、圧縮後の画質および圧縮率はこのスケ
ールファクタSによって調整することが出来る。At the time of quantization in the process P2, each threshold of the quantization matrix is multiplied by a coefficient 2 S (S = 0, ± 1, ± 2,...), And then DCT coefficient division is performed. Width S of the coefficient 2 S is referred to as scale factor, the image quality and compression rate after the compression can be adjusted by the scale factor S.
第8図は、量子化時の丸め処理の手順を示す概略図で
ある。この処理はDCT係数Fuvを量子化マトリクスの各閾
値Quvで除算する際に、DCT係数Fuvが正のときは「Quv/
2」を加算したのち除算し、負のときは「Quv/2」を減算
したのち除算し(処理P5)、小数点以下を切り捨てる
(処理P6)。このようにすれば、四捨五入を正負対称に
行うことができ、例えば、10進数で「+4.5」は「+
5」に、「−4.5」は「−5」にそれぞれ丸めることが
出来る。FIG. 8 is a schematic diagram showing a procedure of a rounding process at the time of quantization. In this processing, when the DCT coefficient Fuv is divided by each threshold value Quv of the quantization matrix, when the DCT coefficient Fuv is positive, “Quv /
When "2" is added, the division is performed, and when it is negative, "Quv / 2" is subtracted and then divided (processing P5), and the decimal part is truncated (processing P6). In this way, the rounding can be performed symmetrically with respect to positive and negative. For example, “+4.5” in decimal notation becomes “+
5 "and" -4.5 "can be rounded to" -5 ", respectively.
〔発明が解決しようとする課題〕 ところで、前述の「ベースライン・システム」は、コ
ンピュータ・シミュレーションによるアルゴリズムが検
討されている段階で、DSP(Digital Signal Processo
r)を用いてハードウェア化した例も報告されてはいる
が、処理に時間がかかり実用的ではない。[Problems to be Solved by the Invention] By the way, the above-mentioned “baseline system” is a DSP (Digital Signal Process
Although some examples of hardware implementation using r) have been reported, the processing is time-consuming and not practical.
この発明は、前述した量子化処理および丸め処理のハ
ードウェア化を図り、画像データの高速な量子化処理を
可能とする量子化回路を提供することを目的とする。SUMMARY OF THE INVENTION It is an object of the present invention to provide a quantization circuit which realizes high-speed quantization processing of image data by realizing hardware of the above-described quantization processing and rounding processing.
この発明による量子化回路は、入力データを所定の量
子化ステップ幅で量子化するための量子化テーブル値が
記憶されている量子化テーブルと、スケールファクタの
値によって上記量子化テーブル値をLSB側にビットシフ
トするための第1のバレルシフタと、上記量子化テーブ
ル値または上記第1のバレルシフタの出力の逆数を出力
する逆数テーブルと、上記スケールファクタの値によっ
て上記逆数テーブルの出力をLSB側にビットシフトする
ための第2のバレルシフタと、上記入力データに上記逆
数テーブルの出力または上記第2のバレルシフタの出力
を乗算して上記入力データを量子化する乗算器と、上記
乗算器の出力を丸め処理する丸め回路とを備え、上記ス
ケールファクタの値が負のときには、上記量子化テーブ
ル値を上記第1のバレルシフタでLSB側にビットシフト
したのち上記逆数テーブルで逆数に変換し、上記スケー
ルファクタの値が正のときには、上記量子化テーブル値
を上記逆数テーブルで逆数に変換したのち上記第2のバ
レルシフタでLSB側にビットシフトし、それぞれ上記乗
算器に入力するように構成されている。A quantization circuit according to the present invention includes a quantization table in which a quantization table value for quantizing input data at a predetermined quantization step width is stored. A first barrel shifter for bit-shifting, a reciprocal table for outputting the quantization table value or a reciprocal of the output of the first barrel shifter, and an output of the reciprocal table on the LSB side according to the scale factor value. A second barrel shifter for shifting, a multiplier for multiplying the input data by an output of the reciprocal table or an output of the second barrel shifter to quantize the input data, and rounding an output of the multiplier A rounding circuit for converting the quantization table value to the first barrel when the value of the scale factor is negative. After the bit is shifted to the LSB side by the lid, it is converted to the reciprocal by the reciprocal table. When the value of the scale factor is positive, the quantization table value is converted to the reciprocal by the reciprocal table, and the LSB is converted by the second barrel shifter. The bits are shifted to the side and input to the multipliers.
また、上記丸め回路は、上記乗算器の出力が負のとき
には下位nビットに対して、“01…1"のnビットパター
ンを加算し、前記乗算器の出力が正のときには“10…0"
のnビットパターンを加算し、それぞれ下位nビットを
切り捨てることにより正負対称に四捨五入するように構
成されている。The rounding circuit adds an n-bit pattern of “01... 1” to the lower n bits when the output of the multiplier is negative, and “10... 0” when the output of the multiplier is positive.
Are added and the lower n bits are rounded down to round off symmetrically.
この発明において、入力データの量子化は、量子化テ
ーブルに記憶されている量子化テーブル値の逆数を逆数
テーブルから読み出し、入力データにこの逆数を乗算す
ることで行う。また、量子化テーブル値に係数2Sを乗算
して量子化ステップ幅を変化させることにより量子化後
のデータ量を調整する。In the present invention, quantization of input data is performed by reading the reciprocal of the quantization table value stored in the quantization table from the reciprocal table and multiplying the input data by the reciprocal. Further, to adjust the data amount after quantization by changing the quantization step size by multiplying the coefficient 2 S to the quantization table value.
ディジタル(2値)データに係数2Sを乗算すること
は、Sが正のときはディジタルデータをMSB側に、Sが
負のときはLSB側にそれぞれSビットシフトすることに
相当する。従って、この発明では、第1および第2のバ
レルシフタによってディジタルデータ、すなわち量子化
テーブル値をビットシフトするようにしている。この場
合、スケールファクタSが負のときに量子化テーブル値
の逆数を取った後、この逆数をMSB側にシフトすると正
しい値が得られないので、量子化テーブル値をLSB側に
シフトしたのち逆数を取る必要がある。また、スケール
ファクタSが正の場合、量子化テーブル値をシフトした
のち逆数を取ると、逆数テーブルのアドレスビット数が
増大し、逆数テーブルに大容量のメモリを必要とするの
で、スケールファクタSが正の場合は量子化テーブル値
の逆数を取ったのちLSB側にシフトするようにしてい
る。Multiplying the coefficient 2 S into a digital (binary) data, S is the MSB side digital data is a positive case, S is when the negative equivalent to S bits respectively shifted to the LSB side. Therefore, in the present invention, digital data, that is, quantization table values are bit-shifted by the first and second barrel shifters. In this case, after taking the reciprocal of the quantization table value when the scale factor S is negative, if this reciprocal is shifted to the MSB side, a correct value cannot be obtained. Therefore, the reciprocal is calculated after shifting the quantization table value to the LSB side. Need to take. When the scale factor S is positive, if the reciprocal is obtained after shifting the quantization table value, the number of address bits of the reciprocal table increases and a large capacity memory is required for the reciprocal table. In the case of a positive value, the reciprocal of the quantization table value is calculated and then shifted to the LSB side.
従って、この発明では、スケールファクタSが負のと
きには量子化テーブル値を第1のバレルシフタでLSB側
にSビットシフトしたのち逆数テーブルで逆数を取り、
スケールファクタSが正のときには逆数テーブルで量子
化テーブル値の逆数を取ったのち第2のバレルシフタで
LSB側にSビットシフトするようにしている。Therefore, according to the present invention, when the scale factor S is negative, the quantization table value is shifted S bits to the LSB side by the first barrel shifter, and then the reciprocal is obtained by the reciprocal table.
When the scale factor S is positive, the reciprocal of the quantization table value is obtained by the reciprocal table, and then the second barrel shifter
An S-bit shift is performed to the LSB side.
また、乗算器の出力データ、すなわち量子化データの
丸め処理は、量子化のデータが正のときには1/2LSBを加
算して切り捨て、負のときには1/2LSBを減算して切り上
げることにより正負対称に四捨五入する。例えば、小数
点以下2ビットデータの場合、データが負のときは“0
…0.01"を加算したのち小数点以下2ビットを切り捨
て、正のときは“0…0.10"を加算したのち小数点以下
2ビットを切り捨てればよい。In addition, the rounding process of the output data of the multiplier, that is, the quantization data, is performed in a positive / negative symmetry by adding 1/2 LSB and rounding down when the quantization data is positive, and subtracting and rounding up 1/2 LSB when the quantization data is negative. Round off. For example, in the case of 2-bit data after the decimal point, if the data is negative, "0"
... 0.01 "are added and then two bits after the decimal point are rounded down. If positive," 0 .. 0.10 "is added and then two bits after the decimal point are rounded down.
第1図は、この発明による量子化回路の一実施例を示
すブロック図で、第5図における処理P2および第8図に
おける処理P5をハードウェア化したものである。FIG. 1 is a block diagram showing an embodiment of a quantization circuit according to the present invention, in which the processing P2 in FIG. 5 and the processing P5 in FIG. 8 are implemented in hardware.
この量子化回路は、量子化テーブル値としての8×8
個の量子化マトリクスの各閾値データ群が格納されてい
るROM構成の量子化テーブル1、この量子化テーブル1
から出力される各閾値データの逆数を取り、スケールフ
ァクタSによってビットシフトするビットシフト回路
2、DCT係数にビットシフト回路2の出力(閾値データ
の逆数)を乗算することによってDCT係数の量子化を行
う乗算器3、乗算器3の出力を丸め処理する丸め回路
4、丸め回路4の出力とDCT係数とを選択的切り換え出
力する切換回路5からなり、切換回路5はビットシフト
回路2から出力される切換信号SW1によって切換制御さ
れる。This quantization circuit uses 8 × 8 as a quantization table value.
ROM-based quantization table 1 in which each threshold data group of the quantization matrices is stored.
The bit shift circuit 2 takes the reciprocal of each of the threshold data output from, and performs bit shift by the scale factor S. The DCT coefficient is multiplied by the output (reciprocal of the threshold data) of the bit shift circuit 2 to quantize the DCT coefficient. A multiplier 3, a rounding circuit 4 for rounding the output of the multiplier 3, and a switching circuit 5 for selectively switching and outputting the output of the rounding circuit 4 and the DCT coefficient. The switching circuit 5 is output from the bit shift circuit 2. The switching is controlled by the switching signal SW1.
第2図は、ビットシフト回路2の一例を示すブロック
図で、量子化テーブル1から出力される量子化マトリク
スの各閾値データをLSB側にSビットシフトするバレル
シフタ20、量子化テーブル1から出力される閾値データ
とバレルシフタ20から出力されるデータとを選択的に切
り換えて出力する切換回路21、切換回路21で選択された
データの逆数を取る逆数テーブル22、この逆数テーブル
22の出力をLSB側にSビットシフトするバレルシフタ2
3、逆数テーブル22の出力とバレルシフタ23の出力とを
選択的に切り換えて出力する切換回路24とを備え、バレ
ルシフタ20はデコーダ25の出力によってシフト制御さ
れ、バレルシフタ23はデコーダ26の出力によってシフト
制御される。両デコーダ25および26には、スケールファ
クタSが入力される。また、切換回路21の出力には、検
出回路27が接続されている。この検出回路27はバレルシ
フタ20におけるシフト後の閾値データが“0"または“1"
になったときに、切換回路5を切換制御してDCT係数を
量子化せずにそのまま出力するためのものである。FIG. 2 is a block diagram showing an example of the bit shift circuit 2. The barrel shifter 20 shifts each threshold data of the quantization matrix output from the quantization table 1 to the LSB side by S bits, and is output from the quantization table 1. Circuit 21 for selectively switching and outputting threshold data and data output from barrel shifter 20, reciprocal table 22 for reciprocal of the data selected by switching circuit 21, and reciprocal table
Barrel shifter 2 that shifts the output of 22 to the LSB side by S bits
3, a switching circuit 24 for selectively switching and outputting between the output of the reciprocal table 22 and the output of the barrel shifter 23, wherein the barrel shifter 20 is shift-controlled by the output of the decoder 25, and the barrel shifter 23 is shift-controlled by the output of the decoder 26. Is done. A scale factor S is input to both decoders 25 and 26. A detection circuit 27 is connected to an output of the switching circuit 21. The detection circuit 27 determines whether the threshold data after the shift in the barrel shifter 20 is “0” or “1”.
In this case, the switching circuit 5 is switched and controlled to output the DCT coefficient without quantization.
第3図は、丸め回路4の一例を示すブロック図で、乗
算器3から出力される16ビットのデータの符号ビット
(MSB)と固定データ“10000"との排他的論理和(EXO
R)を取るEXOR回路30、16ビットのデータの下位5ビッ
トにEXOR回路30の出力を加算し、加算後の上位11ビット
を出力する加算器31、この加算器31の出力と正の最大値
データ“011…1"(11ビット)とを切り換える切換回路3
2、入力閾値データの符号ビットと加算器31から出力さ
れるデータの符号ビットとを比較して符号ビットが正か
ら負に反転したときに切換回路32から正の最大値データ
が出力されるように切換回路32を切り換える符号ビット
チェック回路33からなる。FIG. 3 is a block diagram showing an example of the rounding circuit 4. The exclusive OR (EXO) of the sign bit (MSB) of the 16-bit data output from the multiplier 3 and the fixed data "10000" is shown in FIG.
R) EXOR circuit 30, which takes R), an adder 31 that adds the output of the EXOR circuit 30 to the lower 5 bits of the 16-bit data and outputs the upper 11 bits after the addition, and the output of the adder 31 and the maximum positive value Switching circuit 3 for switching between data "011 ... 1" (11 bits)
2. Compare the sign bit of the input threshold value data with the sign bit of the data output from the adder 31, and when the sign bit is inverted from positive to negative, the switching circuit 32 outputs the maximum positive value data. And a sign bit check circuit 33 for switching the switching circuit 32.
この構成において、量子化テーブル1から出力される
量子化マトリクスの各閾値データは、ビットシフト回路
2で係数2Sが乗算され、その逆数が乗算器3に入力され
る。ディジタル回路における係数2Sの乗算は対象データ
をSビットシフトすることによって達成できる。ビット
シフト回路2では、スケールファクタSが負のときはバ
レルシフタ20で閾値データをLSB側にシフトし、スケー
ルファクタSが正のときは、逆数テーブルで逆数を求め
た後、バレルシフタ23でLSB側にシフトする。この場
合、デコーダ25では、「−1」から「−8」までのスケ
ールファクタ値に対応するため、5ビットのスケールフ
ァクタSの下位3ビットが「0」のときは「8」,
「1」のときは「7」,…,「6」のときは「2」,
「7」のときは「1」(いずれも10進表示)にそれぞれ
変換して出力する。In this configuration, each threshold data of the quantization matrix output from the quantization table 1 is multiplied by a coefficient 2 S in a bit shift circuit 2, and the reciprocal thereof is input to a multiplier 3. Multiplication factor 2 S in a digital circuit a target data can be achieved by S bit shift. In the bit shift circuit 2, when the scale factor S is negative, the threshold data is shifted to the LSB side by the barrel shifter 20, and when the scale factor S is positive, the reciprocal is obtained by a reciprocal table, and then the barrel shifter 23 shifts the threshold data to the LSB side. shift. In this case, in the decoder 25, when the lower three bits of the 5-bit scale factor S are “0”, “8”,
"1" is "7", ..., "6" is "2",
When it is "7", it is converted to "1" (both in decimal notation) and output.
そして、スケールファクタSが負のときは切換回路21
によってバレルシフタ20の出力を選択し、切換回路24に
よって逆数テーブル22の出力を選択する。また、スケー
ルファクタSが正のときは切換回路21によって入力閾値
データを選択し、切換回路24によってバレルシフタ23の
出力を選択する。従って、スケールファクタSが負のと
きは入力閾値データはバレルシフタ20でLSB側にシフト
され、逆数テーブル22で逆数に変換されて出力される。
また、スケールファクタSが正のときは入力閾値データ
は逆数テーブル22で逆数に変換され、バレルシフタ23で
LSB側にシフトされて出力される。このように、スケー
ルファクタSが正のときは閾値データの逆数を求めた後
でビットシフトすることによって逆数テーブル22の入力
(アドレス)ビット数の増加を防いでいる。また、スケ
ールファクタSが負のときにバレルシフタ20におけるシ
フト後の閾値データが“0"または“1"になったときは、
検出回路27でその状態を検出して切換回路5を制御し、
DCT係数を量子化せずにそのまま出力する。When the scale factor S is negative, the switching circuit 21
Selects the output of the barrel shifter 20 and the switching circuit 24 selects the output of the reciprocal table 22. When the scale factor S is positive, the switching circuit 21 selects the input threshold data, and the switching circuit 24 selects the output of the barrel shifter 23. Therefore, when the scale factor S is negative, the input threshold data is shifted to the LSB side by the barrel shifter 20, converted into an inverse by the reciprocal table 22, and output.
Also, when the scale factor S is positive, the input threshold data is converted into an inverse by the reciprocal table 22 and is converted by the barrel shifter 23.
It is shifted to the LSB side and output. As described above, when the scale factor S is positive, the reciprocal of the threshold data is obtained, and then the bit shift is performed, thereby preventing the number of input (address) bits of the reciprocal table 22 from increasing. When the shifted threshold data in the barrel shifter 20 becomes “0” or “1” when the scale factor S is negative,
The detection circuit 27 detects the state and controls the switching circuit 5,
Output the DCT coefficients without quantization.
ところで、量子化は除算であるから乗算器3を用いて
量子化する場合、逆数テーブル22によって逆数を求める
必要がある。そこで、最初から量子化テーブル1に閾値
データの逆数をテーブルとして持ち、逆数テーブル22を
省略することが考えられる。しかし、この場合には、バ
レルシフタ20によって閾値データを小さくする方向にシ
フトすると正しい量子化が行われないという不都合があ
る。例えば、閾値データ「11」(10進)をスケールファ
クター「−2」でビットシフトしたのち逆数を取ると、
「11」は2進数で“00001011"であるから、これをLSB側
に2ビットシフトすると“00000010"となり、10進数で
「2」となる。従って、この逆数は10進数で「0.5」と
なる。これに対して量子化テーブル値「11」(10進)の
逆数をスケールファクタ「−2」でビットシフトする
と、「11」の逆数は「1/11」であるから2進数で“0.00
010111010001"となり、これをMSB側に2ビットシフトす
ると“0.010111010001"となって10進数では「0.3636
…」となり、誤った結果となる。従って、この実施例で
は量子化テーブル1と逆数テーブル22とを別々に持つ構
成となっている。By the way, since the quantization is a division, when the quantization is performed using the multiplier 3, it is necessary to find the reciprocal using the reciprocal table 22. Therefore, it is conceivable to have the reciprocal of the threshold data as a table in the quantization table 1 from the beginning and omit the reciprocal table 22. However, in this case, if the threshold data is shifted by the barrel shifter 20 in a direction in which the threshold data is reduced, there is a disadvantage that correct quantization is not performed. For example, if the threshold value data “11” (decimal) is bit-shifted by the scale factor “−2” and then the reciprocal is obtained,
Since "11" is "00001011" in a binary number, if this is shifted by two bits to the LSB side, it becomes "00000010" and becomes "2" in a decimal number. Therefore, this reciprocal is “0.5” in decimal. On the other hand, when the reciprocal of the quantization table value “11” (decimal) is bit-shifted by the scale factor “−2”, the reciprocal of “11” is “1/11”, so that the binary number is “0.00”.
010111010001 ", which is shifted to the MSB side by 2 bits to be" 0.010111010001 ", which is" 0.3636 "in decimal.
… ”, With incorrect results. Therefore, in this embodiment, the quantization table 1 and the reciprocal table 22 are separately provided.
また、丸め回路4は量子化後の閾値データを正負対称
に四捨五入するために、乗算器3の出力が正のときは1/
2LSBを加算して切り捨て、負のときは1/2LSBを減算して
切り上げるようにしている。正の場合は“0…0.10"を
加算したのち小数点以下を無視すればよい。負の場合は
2の補数表示により“1…1.10"の加算になるが、切り
上げは小数点以下の全ビット内に1ビット以上“1"があ
れば、1LSBを加算すればよいので、“0…0.11"を加算
すると“0…0.01"(=“1−1.10"+“0…0.11")と
なり、“0…0.01"を加算したのち小数点以下を無視す
ればよい。第4図に小数点以下2ビットの全5ビットデ
ータを、正負対称に小数点以下を四捨五入する例をあげ
た。Also, the rounding circuit 4 rounds the quantized threshold data in a positive / negative symmetric manner, so that when the output of the multiplier 3 is positive, 1 /
2LSB is added and rounded down, and when negative, 1 / 2LSB is subtracted and rounded up. In the case of a positive value, “0... 0.10” may be added, and then the fractional part may be ignored. In the case of a negative value, “1... 1.10” is added in two's complement notation. However, if there is at least one bit “1” in all bits below the decimal point, 1 LSB may be added. When "0.11" is added, it becomes "0 ... 0.01" (= "1-1.10" + "0 ... 0.11"), and after adding "0 ... 0.01", the fractional part may be ignored. FIG. 4 shows an example in which all 5-bit data of 2 bits after the decimal point are rounded off to the right and negative symmetrically.
第3図の構成では、乗算器3から出力される16ビット
(下位5ビットは小数点以下のデータ)の量子化後のデ
ータを小数点以上の上位11ビットに丸めるために、量子
化後のデータが負のときはEXOR回路30で固定データ“10
000"を反転し、加算器31で量子化後のデータの小数点以
下5ビットに反転したデータ“01111"を加算し、量子化
後のデータが正のときは固定データ“10000"をそのまま
量子化後のデータの小数点以下5ビットに加算し、それ
ぞれ小数点以下を切り捨てて上位11ビットのみを出力す
るようにしている。また、量子化後のデータが正のとき
に加算器31における加算の結果、オーバーフローが発生
すると、MSBが“1"となり加算後の値が負になる。この
ため、符号ビットチェック回路33で加算前の符号ビット
と加算後の符号ビットとを比較し、符号ビットが正から
負に変化したときは切換信号SW2を出力し、切換回路32
を制御して正の最大値“011…1"を出力するようにして
いる。In the configuration of FIG. 3, in order to round the quantized data of 16 bits (the lower 5 bits are data after the decimal point) output from the multiplier 3 to the upper 11 bits after the decimal point, the quantized data is If the value is negative, the fixed data “10
000 "is inverted, and the adder 31 adds the inverted data" 01111 "to the 5 bits after the decimal point of the quantized data. If the quantized data is positive, the fixed data" 10000 "is quantized as it is. The data after the decimal point is added to 5 bits after the decimal point, each decimal point is rounded down, and only the upper 11 bits are output.When the quantized data is positive, the result of the addition in the adder 31 is: When an overflow occurs, the MSB becomes “1” and the value after addition becomes negative, so the sign bit check circuit 33 compares the sign bit before addition with the sign bit after addition, and determines that the sign bit is positive. When it changes to a negative value, the switching signal SW2 is output and the switching circuit 32
To output a positive maximum value “011... 1”.
この発明によれば、量子化テーブルと逆数テーブルと
を別々に持ち、スケールファクタによって閾値データを
LSB側にシフトするときは、ビットシフトした後に逆数
を求めるようにしているので、正しい量子化処理を行う
ことができ、また、スケールファクタによって閾値デー
タをMSB側にシフトするときは、逆数を求めた後にビッ
トシフトするので、逆数テーブルの入力ビット数を減少
でき、逆数テーブルのメモリ容量を小さくすることが出
来る。According to the present invention, the quantization table and the reciprocal table are separately provided, and the threshold data is set according to the scale factor.
When shifting to the LSB side, the reciprocal is calculated after bit shifting, so that correct quantization processing can be performed.When the threshold data is shifted to the MSB side by the scale factor, the reciprocal is calculated. After the bit shift, the number of input bits of the reciprocal table can be reduced, and the memory capacity of the reciprocal table can be reduced.
また、量子化後の丸め処理において、丸めるべきデー
タが負のときはその下位nビットに対して“01…1"のビ
ットパターンを加算し、正のときは“10…0"のビットパ
ターンを加算してそれぞれ切り捨てているため、正負対
称に四捨五入することが出来る。In the rounding process after quantization, when data to be rounded is negative, a bit pattern of “01... 1” is added to the lower n bits, and when positive, a bit pattern of “10. Since each addition is rounded down, it can be rounded symmetrically.
第1図はこの発明による量子化回路の一実施例を示すブ
ロック図、 第2図は第1図におけるビットシフト回路のブロック
図、 第3図は第1図における丸め回路のブロック図、 第4図は丸め処理の一例を示す表、 第5図はベースライン・システムの処理手順を示す概略
図、 第6図は量子化マトリクスの一例を示す表、 第7図はジグザグスキャンの一例を示す表、 第8図は丸め処理の処理手順を示す概略図である。 1……量子化テーブル、2……ビットシフト回路、3…
…乗算器、4……丸め回路、20,23……バレルシフタ、2
2……逆数テーブル、31……加算器。FIG. 1 is a block diagram showing one embodiment of a quantization circuit according to the present invention, FIG. 2 is a block diagram of a bit shift circuit in FIG. 1, FIG. 3 is a block diagram of a rounding circuit in FIG. Fig. 5 is a table showing an example of a rounding process. Fig. 5 is a schematic diagram showing a processing procedure of a baseline system. Fig. 6 is a table showing an example of a quantization matrix. Fig. 7 is a table showing an example of a zigzag scan. FIG. 8 is a schematic diagram showing a processing procedure of the rounding processing. 1 ... quantization table, 2 ... bit shift circuit, 3 ...
... Multiplier, 4 ... Rounding circuit, 20,23 ... Barrel shifter, 2
2 ... Reciprocal table, 31 ... Adder.
───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.6,DB名) H03M 7/50 H03M 7/30 ──────────────────────────────────────────────────の Continued on front page (58) Field surveyed (Int.Cl. 6 , DB name) H03M 7/50 H03M 7/30
Claims (2)
子化するための量子化テーブル値が記憶されている量子
化テーブルと、 スケールファクタの値によって上記量子化テーブル値を
LSB側にビットシフトするための第1のバレルシフタ
と、 上記量子化テーブル値または上記第1のバレルシフタの
出力の逆数を出力する逆数テーブルと、 上記スケールファクタの値によって上記逆数テーブルの
出力をLSB側にビットシフトするための第2のバレルシ
フタと、 上記入力データに上記逆数テーブルの出力または上記第
2のバレルシフタの出力を乗算して上記入力データを量
子化する乗算器と、 上記乗算器の出力を丸め処理する丸め回路とを備え、 上記スケールファクタの値が負のときには、上記量子化
テーブル値を上記第1のバレルシフタでLSB側にビット
シフトしたのち上記逆数テーブルで逆数に変換し、上記
スケールファクタの値が正のときには、上記量子化テー
ブル値を上記逆数テーブルで逆数に変換したのち上記第
2のバレルシフタでLSB側にビットシフトし、それぞれ
上記乗算器に入力することを特徴とする量子化回路。1. A quantization table in which a quantization table value for quantizing input data at a predetermined quantization step width is stored, and the quantization table value is determined by a scale factor value.
A first barrel shifter for bit shifting to the LSB side, a reciprocal table for outputting the quantization table value or the reciprocal of the output of the first barrel shifter, and an output of the reciprocal table according to the scale factor value. A second barrel shifter for bit-shifting the input data; a multiplier for multiplying the input data by an output of the reciprocal table or an output of the second barrel shifter to quantize the input data; A rounding circuit for performing a rounding process. When the value of the scale factor is negative, the quantization table value is bit-shifted to the LSB side by the first barrel shifter, and then converted to the reciprocal by the reciprocal table. Is positive, the quantization table value is converted to the reciprocal by the reciprocal table, and then the second Bits shifted into the LSB side Rushifuta each quantization circuit, characterized in that the input to the multiplier.
ときには下位nビットに対して、“01…1"のnビットパ
ターンを加算し、前記乗算器の出力が正のときには“10
…0"のnビットパターンを加算し、それぞれ上記下位n
ビットを切り捨てることにより正負対称に四捨五入する
ことを特徴とする請求項1記載の量子化回路。2. The rounding circuit adds an n-bit pattern of "01... 1" to lower n bits when an output of the multiplier is negative, and adds "10" when an output of the multiplier is positive.
.. 0 "are added, and the lower n
2. The quantization circuit according to claim 1, wherein the bits are rounded off symmetrically by truncating the bits.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP30709690A JP2991767B2 (en) | 1990-11-15 | 1990-11-15 | Quantization circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP30709690A JP2991767B2 (en) | 1990-11-15 | 1990-11-15 | Quantization circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH04180357A JPH04180357A (en) | 1992-06-26 |
| JP2991767B2 true JP2991767B2 (en) | 1999-12-20 |
Family
ID=17964980
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP30709690A Expired - Fee Related JP2991767B2 (en) | 1990-11-15 | 1990-11-15 | Quantization circuit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2991767B2 (en) |
-
1990
- 1990-11-15 JP JP30709690A patent/JP2991767B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH04180357A (en) | 1992-06-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP0422404B1 (en) | Transform coding using coefficient prediction techniques | |
| US6950040B2 (en) | Coding apparatus, program and data processing method | |
| KR970002968B1 (en) | Bit rate reduction device | |
| JP2000125297A (en) | Method for coding and decoding consecutive image | |
| US20030016878A1 (en) | Dynamic image compression coding apparatus | |
| WO2000002381A1 (en) | Image processing circuit and method for modifying a pixel value | |
| JP3163880B2 (en) | Image compression coding device | |
| US7953285B2 (en) | Method and circuit of high performance variable length coding and decoding for image compression | |
| JP2991767B2 (en) | Quantization circuit | |
| JP4415651B2 (en) | Image encoding apparatus and image decoding apparatus | |
| JP3402212B2 (en) | Digital data compression method | |
| JP3722169B2 (en) | Image processing apparatus and image processing method | |
| JP3199786B2 (en) | Image processing device | |
| JP2753091B2 (en) | Image data expansion circuit | |
| JP3016805B2 (en) | Image data compression method | |
| JP2669278B2 (en) | Video signal processing device | |
| JPH06276101A (en) | Quantization circuit | |
| JP3044877B2 (en) | Encoding device | |
| JP3337699B2 (en) | Image processing apparatus and method | |
| JP2570794B2 (en) | High-efficiency encoder for television signals. | |
| JP2843397B2 (en) | Compressed data amount control method | |
| CN120343249A (en) | Device and method for encoding and decoding Bayer array image | |
| JP3200073B2 (en) | Image processing device | |
| JP3427659B2 (en) | Adaptive quantization for orthogonal transform coding | |
| JPH03181230A (en) | Image processing method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |