JP2009175959A - Divider, division method, and image encoding device using divider - Google Patents
Divider, division method, and image encoding device using divider Download PDFInfo
- Publication number
- JP2009175959A JP2009175959A JP2008012787A JP2008012787A JP2009175959A JP 2009175959 A JP2009175959 A JP 2009175959A JP 2008012787 A JP2008012787 A JP 2008012787A JP 2008012787 A JP2008012787 A JP 2008012787A JP 2009175959 A JP2009175959 A JP 2009175959A
- Authority
- JP
- Japan
- Prior art keywords
- divisor
- dividend
- divider
- bit
- quotient
- 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
Links
Images
Abstract
Description
本発明は、除算器、特に、画像符号化装置において実行される量子化処理のための除算演算を効率的に行なうことが可能な除算器に関する。 The present invention relates to a divider, and more particularly to a divider capable of efficiently performing a division operation for quantization processing executed in an image encoding device.
画像データの圧縮符号化方式であるJPEG(Joint Photographic Expert Group)やMPEG(Moving Picture Experts Group)による画像データの圧縮符号化では、二次元離散コサイン変換(二次元DCT)により得られたDCT係数を、量子化閾値で除算することにより、その商としての量子化係数を得る量子化処理が実行される。従って、画像データの圧縮符号化を実行する画像符号化装置には、量子化処理を実行する回路として除算演算を実行する除算器が備えられることになる。 In compression coding of image data by JPEG (Joint Photographic Expert Group) or MPEG (Moving Picture Experts Group) which are compression coding methods of image data, DCT coefficients obtained by two-dimensional discrete cosine transform (two-dimensional DCT) are used. Then, by dividing by the quantization threshold, a quantization process for obtaining a quantization coefficient as the quotient is executed. Therefore, an image encoding device that performs compression encoding of image data includes a divider that performs a division operation as a circuit that performs quantization processing.
ここで、除算演算を実行する除算器は、一般的に処理速度が遅いという問題がある。図6は、基本的な除算演算のアルゴリズムを示す説明図である。 Here, there is a problem that a divider that performs a division operation generally has a low processing speed. FIG. 6 is an explanatory diagram showing a basic algorithm for division operation.
まず、[N+1]ビットの被減数Mdの各ビットの値を“0”とするとともに、インデックスiの値を[M−1]とする(ステップS1010)。ここで、Mは被除数Ddのビット数を示し、Nは除数Dsのビット数を示す。 First, the value of each bit of the [N + 1] -bit reduced number Md is set to “0”, and the value of the index i is set to [M−1] (step S1010). Here, M indicates the number of bits of the dividend Dd, and N indicates the number of bits of the divisor Ds.
そして、被減数Mdに、インデックスiに対応するビットDd[i]の値を加算する(ステップS1020)。 Then, the value of the bit Dd [i] corresponding to the index i is added to the divisor Md (step S1020).
次に、被減数Mdが除数Ds以上の場合には(ステップS1030:YES)、被減数Mdから除数Dsを減算し(ステップS1040)、インデックスiに対応するビットの商Q[i]を“1”とする(ステップS1050)。一方、被減数Mdが除数Dsよりも小さい場合には(ステップS1030:NO)、商Q[i]を“0”とする(ステップS1060)。 Next, when the divisor Md is equal to or greater than the divisor Ds (step S1030: YES), the divisor Ds is subtracted from the divisor Md (step S1040), and the bit quotient Q [i] corresponding to the index i is set to “1”. (Step S1050). On the other hand, when the divisor Md is smaller than the divisor Ds (step S1030: NO), the quotient Q [i] is set to “0” (step S1060).
そして、インデックスiが“0”である場合には(ステップS1070:YES)、この除算演算を終了する。一方、インデックスiが“0”でない場合には(ステップS1070:NO)、インデックスiを“1”減算し(ステップS1080)、被減数Mdを1ビット左シフトして、最上位ビットの値を廃棄した値を新たな被減数Mdとした上で(ステップS1090)、ステップS1020に戻ってステップS1020〜ステップS1060の処理を実行する。すなわち、インデックスiが“0”となるまで、ステップS1020〜ステップS1090の処理を繰り返す。 If the index i is “0” (step S1070: YES), the division operation is terminated. On the other hand, if the index i is not “0” (step S1070: NO), the index i is decremented by “1” (step S1080), the subordinate Md is shifted left by 1 bit, and the value of the most significant bit is discarded. After setting the value as a new divisor Md (step S1090), the process returns to step S1020 to execute the processes of steps S1020 to S1060. That is, the processes in steps S1020 to S1090 are repeated until the index i becomes “0”.
以上のように、除算演算の基本的なアルゴリズムは、ステップS1020〜ステップS1090の処理を被除数の最上位ビット(i=[M−1])から最下位ビット(i=0)まで順に繰り返し実行することにより除算結果を得るものである。 As described above, the basic algorithm of the division operation repeatedly executes the processing in steps S1020 to S1090 in order from the most significant bit (i = [M−1]) to the least significant bit (i = 0) of the dividend. By doing so, the division result is obtained.
図7は、除算演算の基本的なアルゴリズムに従った除算器として、演算アルゴリズムにおける被除数Ddの各ビットについての処理を、基準クロックの1クロックの間に、1ビットの処理を実行する場合の構成を示すブロック図である。 FIG. 7 shows a configuration in which processing for each bit of the dividend Dd in the arithmetic algorithm is performed as a divider according to the basic algorithm of division operation, during one clock of the reference clock. FIG.
この除算器1000は、Mビットの被除数Ddを記憶する被除数レジスタ101と、Nビットの除数Dsを記憶する除数レジスタ102と、Mビットの商Qを記憶する商レジスタ103と、を備える。また、除算器1000は、Mビットの被除数Dd[M−1:0]から1ビットの被除数Dd[i]を選択して出力するセレクタ104と、1ビットの被除数Dd[i]を被減数Mdの最下位ビットとして記憶する[N+1]ビットの被減数レジスタ105と、を備える。さらに、また、除算器1000は、[N+1]ビットの被減数MdからNビットの除数Dsを減算し、そのNビットの減算結果(剰余)を出力する減算器106と、被減数Mdが除数Ds以上であるか否か比較し、その1ビットの比較結果を出力する比較器107と、[N+1]ビットの被減数Mdを1ビット左シフトし、Nビットの被減数Mdを出力する左シフト回路108と、減算器106の出力と左シフト回路108の出力のいずれか一方を選択して出力するセレクタ109と、比較器107の1ビットの出力をMビットの商レジスタ103のいずれのビットに書き込むかを決定するセレクタ110と、セレクタ104およびセレクタ110の動作を制御する制御回路111と、を備える。なお、比較器107の出力は、セレクタ109の制御信号としてセレクタ109にも入力される。
The
セレクタ104および被除数レジスタ105によって、図6のステップS1020の処理、すなわち、被減数Mdに、インデックスiに対応するビットの被除数Dd[i]の値を加算する処理が実行される。
The
減算器106、比較器107、および、セレクタ110によって、ステップS1030〜S1060の処理、すなわち、被減数Mdが除数Ds以上の場合には、被減数Mdら除数Dsを減算し、インデックスiに対応するビットの商Q[i]を“1”とし、被減数Mdが除数Dsよりも小さい場合には、商Q[i]を“0”とする、処理が実行される。
By the subtractor 106, the
制御回路111、左シフト回路108、および、セレクタ109によって、ステップS1070〜S1090の処理、すなわち、インデックスiを“1”減算し、被減数Mdを1ビット左シフトして、最上位ビットの値を廃棄した値を被減数Mdの上位Nビットの新たな値とする処理が実行される。
By the control circuit 111, the
図7のような構成とした場合には、被除数Ddのビット数Mに等しいクロック数に対応する時間が除算演算処理のために必要となる。例えば、被除数としてのDCT係数は11ビット(符号ナシ)で表され、除数としての量子化係数は8ビットで表されるが、基準クロックの1クロックで1ビットの処理を実行する場合には、11クロック分の時間が除算演算処理のために必要となる。 In the case of the configuration as shown in FIG. 7, a time corresponding to the number of clocks equal to the number of bits M of the dividend Dd is required for the division calculation process. For example, a DCT coefficient as a dividend is represented by 11 bits (sign pear), and a quantization coefficient as a divisor is represented by 8 bits. However, when 1-bit processing is performed with 1 reference clock, The time for 11 clocks is required for the division calculation process.
また、図8は、除算演算の基本的なアルゴリズムに従った除算器として、演算アルゴリズムにおける被除数Ddの各ビットについての処理を、基準クロックの1クロックの間に、3ビットの処理を実行する場合の構成を示すブロック図である。 FIG. 8 shows a case where the processing for each bit of the dividend Dd in the arithmetic algorithm is performed as a divider according to the basic algorithm of the division operation, and the processing of 3 bits is performed during one clock of the reference clock. It is a block diagram which shows the structure of these.
この除算器1000Aは、基準クロックの1クロックの間に3ビットの処理を実行するために、図7の除算器1000の減算器106、比較器107、左シフト回路108、および、セレクタ109に換えて、3ビット分の減算器106a〜106c、比較器107a〜107c、左シフト回路108a〜108c、および、セレクタ109a〜109cを3段に備える構成としたものである。また、この構成に対応するために、除算器1000のセレクタ104およびセレクタ110に換えて、Mビットの被除数Dd[M−1:0]から3ビットの被除数Dd[i],Dd[i−1],Dd[i−2]を選択し、減算器106a,106b,106cに入力する[N+1]ビットの被減数Mdのうちの最下位ビットとして出力するセレクタ104Aと、比較器107a〜107cの出力をMビットの商レジスタ103のいずれの3ビットに書き込むかを決定するセレクタ110Aと、を備える。さらに、制御回路111に換えて、セレクタ104Aおよびセレクタ110Aの動作を制御する制御回路111Aを備える。
The
図8のような構成とした場合には、図7の構成の場合に比べて、除算演算処理の時間は短くなる。例えば、11ビットのDCT係数を被除数とし、8ビットの量子化係数を除数とする場合、基準クロックの4クロック分の時間で除算演算処理が実行される。しかしながら、一度に処理できるビット数は回路の動作速度や回路を構成する半導体プロセスの種類等に依存するため、まとめて実行可能なビット数には制限がある。また、まとめて実行するビット数が増えるほど、回路規模もそれに比例して増大することになる。 In the case of the configuration shown in FIG. 8, the time required for the division calculation process is shorter than that in the configuration of FIG. For example, when an 11-bit DCT coefficient is used as a dividend and an 8-bit quantization coefficient is used as a divisor, the division calculation process is executed in a time corresponding to 4 clocks of the reference clock. However, since the number of bits that can be processed at one time depends on the operation speed of the circuit, the type of semiconductor process that constitutes the circuit, and the like, the number of bits that can be executed collectively is limited. Further, as the number of bits to be executed collectively increases, the circuit scale increases proportionally.
また、一連の処理をパイプライン処理化することで除算器のスループットを向上させることも可能であるが、この場合にも、やはりパイプライン段数分の演算処理回路が増加し、加えてパイプライン・レジスタも必要となるため、回路規模が増加する。 In addition, it is possible to improve the throughput of the divider by pipelining a series of processing, but in this case as well, the number of processing circuits for the number of pipeline stages is increased, and in addition, pipeline processing Since a register is also required, the circuit scale increases.
以上のような問題を解決する除算演算の手法を用いた除算器として、例えば、特許文献1,2に記載の例が提案されている。これらの除算演算の手法は、被除数としてのDCT係数と除数としての量子化閾値とを比較する。そして、DCT係数よりも量子化閾値の方が大きい場合には、被減数から除数を減算する処理を繰り返すことによって実行される除算演算処理を行なわずに、量子化係数としての商を“0”に設定することによって、実際の除算演算処理を省略し、全体としての演算処理時間の高速化を図るものである。
As a divider using a division calculation method for solving the above problems, for example, examples described in
しかしながら、上記除算演算の手法を用いた除算器では、被除数としてのDCT係数が除数としての量子化閾値よりも大きい場合には、結局、被除数としてのDCT係数の各ビットについて最上位ビットから最下位ビットまで順に、ステップS1020〜ステップS1090のような処理を繰り返すことになり、除算演算処理時間の短縮化を図ることができず、全体としての演算処理時間の高速化が不十分であった。 However, in the divider using the above division operation method, when the DCT coefficient as the dividend is larger than the quantization threshold as the divisor, the most significant bit to the least significant bit is eventually obtained for each bit of the DCT coefficient as the dividend. Processing such as step S1020 to step S1090 is repeated in order up to the bit, so that the division operation processing time cannot be shortened, and the speed of the operation processing time as a whole is insufficient.
本発明は、上記課題を解決するためになされたものであり、量子化処理のための除算演算処理の高速化を図ることが可能な技術を提供することを目的とする。 The present invention has been made to solve the above-described problems, and an object of the present invention is to provide a technique capable of increasing the speed of division operation processing for quantization processing.
本発明は、上述の課題の少なくとも一部を解決するためになされたものであり、以下の形態又は適用例として実現することが可能である。 SUMMARY An advantage of some aspects of the invention is to solve at least a part of the problems described above, and the invention can be implemented as the following forms or application examples.
[適用例1]
被除数を除数で除算した商を求める除算器であって、
前記除数が2のべき乗の数であるか否か判定するとともに、前記除数が2のべき乗の数である場合における被除数のシフト量を決定する2のべき乗判定手段と、
前記被除数を前記シフト量に応じてシフト演算するシフト演算手段と、
前記除数が2のべき乗の数である場合には、前記シフト演算手段から出力されるシフト演算結果に基づいて前記商を求める制御手段と、
を備えることを特徴とする除算器。
[Application Example 1]
A divider for obtaining a quotient obtained by dividing a dividend by a divisor,
Determining whether the divisor is a power of 2 and determining a power of 2 for determining a shift amount of the dividend when the divisor is a power of 2;
Shift computing means for computing the dividend according to the shift amount;
Control means for obtaining the quotient based on a shift calculation result output from the shift calculation means when the divisor is a power of 2;
A divider comprising:
適用例1記載の除算器では、除数が2のべき乗の数である場合には、シフト演算手段から出力されるシフト演算結果に基づいて前記商を求めて、実際に被除数を除数で除算する処理を省略することができるので、除算演算処理に要する時間を短縮化し、除算演算処理の高速化を図ることが可能である。 In the divider described in Application Example 1, when the divisor is a power of 2, the quotient is obtained based on the shift calculation result output from the shift calculation means, and the dividend is actually divided by the divisor Therefore, the time required for the division calculation process can be shortened, and the division calculation process can be speeded up.
[適用例2]
適用例1記載の除算器であって、
さらに、前記被除数が前記除数よりも小さいか否か比較判定するための比較手段を備え、
前記制御手段は、前記被除数が前記除数よりも小さい場合には、各ビットの商をゼロとすることにより、前記商を求める
ことを特徴とする除算器。
[Application Example 2]
A divider according to application example 1,
Furthermore, a comparison means for comparing and determining whether or not the dividend is smaller than the divisor,
The divider obtains the quotient by setting the quotient of each bit to zero when the dividend is smaller than the divisor.
適用例2記載の除算器では、被除数が除数よりも小さい場合には、各ビットの商をゼロとすることにより、被除数を除数で除算した商を求めて、実際に被除数を除数で除算する処理を省略することができるので、さらに、除算演算処理に要する時間を短縮化し、除算演算処理の高速化を図ることが可能である。 In the divider described in Application Example 2, when the dividend is smaller than the divisor, the quotient obtained by dividing the dividend by the divisor is obtained by setting the quotient of each bit to zero, and actually dividing the dividend by the divisor Therefore, it is possible to shorten the time required for the division calculation process and increase the speed of the division calculation process.
[適用例3]
適用例1または適用例2記載の除算器であって、
前記被除数は画像データを離散コサイン変換したDCT係数であり、前記除数は所定の量子化閾値である、
ことを特徴とする除算器。
[Application Example 3]
A divider according to application example 1 or application example 2,
The dividend is a DCT coefficient obtained by discrete cosine transform of image data, and the divisor is a predetermined quantization threshold.
A divider characterized by that.
適用例3に記載の除算器では、被除数としてのDCT係数を除数としての量子化閾値で除算して、その商としての量子化係数を得る除算演算処理としての量子化処理に要する時間を短縮化し、量子化処理の高速化を図ることが可能である。 In the divider described in Application Example 3, the time required for quantization processing as division operation processing for dividing a DCT coefficient as a dividend by a quantization threshold value as a divisor and obtaining a quantization coefficient as a quotient is shortened. It is possible to speed up the quantization process.
[適用例4]
適用例3記載の除算器を備え、
前記除算器に、前記被除数として前記DCT係数を入力し、前記除数として前記量子化閾値を入力することにより、前記DCT係数を前記量子化閾値で除算して求められる商を前記量子化係数として得ることを特徴とする画像符号化装置。
[Application Example 4]
Provided with a divider as described in Application Example 3,
The quotient obtained by dividing the DCT coefficient by the quantization threshold is obtained as the quantization coefficient by inputting the DCT coefficient as the dividend and inputting the quantization threshold as the divisor to the divider. An image encoding apparatus characterized by that.
適用例4に記載の画像符号化装置では、適用例3と同様の効果を奏することができる。 The image coding apparatus described in Application Example 4 can achieve the same effects as Application Example 3.
[適用例5]
被除数を除数で除算した商を求める除算方法であって、
前記除数が2のべき乗の数であるか否か判定するとともに、前記除数が2のべき乗の数である場合における被除数のシフト量を決定し、
前記被除数を前記シフト量に応じてシフト演算し、
前記除数が2のべき乗の数である場合には、前記シフト演算手段から出力されるシフト演算結果に基づいて前記商を求める、
ことを特徴とする除算方法。
[Application Example 5]
A division method for obtaining a quotient obtained by dividing a dividend by a divisor,
Determining whether the divisor is a power of 2 and determining a shift amount of the dividend when the divisor is a power of 2;
Shifting the dividend according to the shift amount,
When the divisor is a power of 2, the quotient is obtained based on a shift calculation result output from the shift calculation means.
A division method characterized by that.
適用例5に記載の除算方法によれば、適用例1と同様の効果を奏することができる。 According to the division method described in Application Example 5, the same effects as in Application Example 1 can be obtained.
A.画像符号化装置の構成:
B.除算器の構成:
B1.除算アルゴリズム:
B2.除算器の具体例:
C.変形例:
A. Configuration of image encoding device:
B. Divider configuration:
B1. Division algorithm:
B2. Specific examples of dividers:
C. Variations:
A.画像符号化装置の構成:
図1は、本発明の除算器を量子化部に適用した画像符号化装置の構成を示すブロック図である。図2は、画像符号化装置で実行される量子化処理について示す説明図である。
A. Configuration of image encoding device:
FIG. 1 is a block diagram showing a configuration of an image encoding apparatus in which a divider according to the present invention is applied to a quantization unit. FIG. 2 is an explanatory diagram illustrating quantization processing executed by the image encoding device.
画像符号化装置10は、DCT部20と、量子化部30と、量子化テーブル40と、ハフマン符号化部50と、ハフマンテーブル60と、を備える。
The
DCT部20は、図2(A)に示すような[8×8]画素のブロックに分割された各画像について、二次元離散コサイン変換を行なって、図2(B)に示すようなDCT係数を得る機能ブロックである。
The
量子化部30は、図2(C)に示すような量子化テーブル40に格納されている量子化閾値で各ブロックのDCT係数を除算することにより、図2(D)に示すように、その商としての量子化係数を得る機能ブロックである。
The
得られた量子化係数は、図2(D)に示すように、番号Q1〜Q64で表される量子化係数の走査順に取り出され、ハフマン符号化部50に入力される。
The obtained quantized coefficients are taken out in the scanning order of the quantized coefficients represented by the numbers Q1 to Q64 and input to the
ハフマン符号化部50は、入力された量子化係数をハフマンテーブル60に従って符号化する機能ブロックである。
The
以上のように、画像符号化装置10は、画像を表す画像データをDCT部20でDCT係数に変換し、除算器を用いた量子化部30で、得られたDCT係数を量子化閾値で除算処理することにより量子化し、得られた量子化係数をハフマン符号化部50で符号化することにより、画像データの表す画像を符号化した符号データを生成する装置である。
As described above, the
B.除算器の構成:
以下では、画像符号化装置10の量子化部30に用いられる一実施例としての除算器について説明する。
B. Divider configuration:
Below, the divider | division as one Example used for the
B1.除算アルゴリズム:
JPEG方式による画像圧縮符号化処理の場合には、量子化処理として、[DCT係数(符号ナシ11ビット)÷量子化閾値(符号ナシ8ビット)]で表される除算演算が実行され、その商としての量子化係数(符号ナシ11ビット)は、[0x000]〜[0x7FF]の範囲となる。
B1. Division algorithm:
In the case of JPEG image compression encoding processing, as a quantization processing, a division operation represented by [DCT coefficient (code no 11 bits) ÷ quantization threshold (code no 8 bits)] is executed, and the quotient The quantized coefficient (sign pear 11 bits) is in the range of [0x000] to [0x7FF].
ここで、実際の自然画像、例えば、デジタルカメラで撮像した5Mピクセルの写真を、高品質モードでJPEG方式による画像圧縮符号化処理を実行した場合の量子化係数について調べると、以下の特徴を有していることがわかった。 Here, when an actual natural image, for example, a 5M pixel photograph taken with a digital camera, is examined for a quantization coefficient when image compression encoding processing by the JPEG method is executed in the high quality mode, the following characteristics are obtained. I found out.
[a]自然画像は高周波成分をあまり含んでいないため、画像データをDCT変換することにより得られたDCT係数のうち、高周波成分のDCT係数については除去したとしても、画質の劣化は少ないと考えられる。そこで、量子化処理としての除算演算では、高周波成分を除去することによる画像データの圧縮を目的として、被除数としての量子化閾値のうち、高周波成分に対応する部分の量子化閾値に、除算演算の商である量子化係数がゼロとなるような大きな数値が用いられる。例えば、上記実際の自然画像では、65〜80%の量子化係数が[0x000]となっている。 [A] Since a natural image does not contain much high-frequency components, even if the DCT coefficients of high-frequency components are removed from DCT coefficients obtained by DCT conversion of image data, it is considered that there is little deterioration in image quality. It is done. Therefore, in the division operation as the quantization process, for the purpose of compressing the image data by removing the high frequency component, the division threshold is calculated by dividing the quantization threshold corresponding to the high frequency component out of the quantization threshold as the dividend. A large numerical value such that the quotient quantization coefficient is zero is used. For example, in the actual natural image, the quantization coefficient of 65 to 80% is [0x000].
[b]自然画像の低周波成分は画質の劣化に影響が大きい。そこで、除算演算による量子化処理では、画質の劣化の防止および画像データの圧縮を目的として、低周波成分に対応する部分の量子化閾値に比較的小さな数値([0x01]〜[0x20])が用いられる。このような比較的ちいさな数値は、そもそも2のべき乗の数である割合が高い。例えば、[0x01]〜[0x20]の範囲の32個の数値の内、2のべき乗の数は、[0x01],[0x02],[0x04],[0x08],[0x10],[0x20]の6個あり、約18%を占めている。また、デジタル処理の分野では、2のべき乗の数の演算処理は速度の高速化が可能であるため、処理対象のデータとして2のべき乗の数とする傾向にあり、量子化閾値も2のべき乗の数である頻度が比較的高い。例えば、上記実際の自然画像では、商としての量子化係数が[0x000]とならない部分(全体の35〜15%)の中で、10〜50%の除数としての量子化閾値が2のべき乗の数となっている。 [B] The low-frequency component of the natural image has a great influence on the deterioration of the image quality. Therefore, in the quantization processing by division operation, a relatively small numerical value ([0x01] to [0x20]) is used for the quantization threshold of the portion corresponding to the low frequency component for the purpose of preventing the deterioration of the image quality and compressing the image data. Used. Such a relatively small numerical value has a high ratio that is a power of 2 in the first place. For example, out of 32 numerical values in the range of [0x01] to [0x20], the powers of 2 are [0x01], [0x02], [0x04], [0x08], [0x10], [0x20]. There are six, accounting for about 18%. Also, in the field of digital processing, the arithmetic processing of the number of powers of 2 can increase the speed. Therefore, the data to be processed tends to be the number of powers of 2, and the quantization threshold is also a power of 2. The frequency is relatively high. For example, in the actual natural image, the quantization threshold as a divisor of 10 to 50% is a power of 2 in a portion (35 to 15% of the whole) where the quantization coefficient as a quotient is not [0x000]. It has become a number.
そこで、以上の点に着目すると、以下で説明するように、除算演算処理の高速化を図ることが可能であると考えられる。 Therefore, focusing on the above points, it is considered possible to increase the speed of the division calculation process as described below.
[1]量子化係数が[0x000]であることは、DCT係数(被除数)が量子化閾値(除数)よりも小さいことを示している。そこで、従来例でも説明したように、DCT係数と量子化閾値とを比較し、DCT係数<量子化閾値である場合には、除算演算の商としての量子化係数を[0x000]として、従来アルゴリズムで説明したDCT係数(被除数)のビットごとに実行する減算処理(図6のステップS1020〜S1090の処理参照)を省略する。これにより、例えば、上記実際の自然画像の量子化処理としての除算演算処理のうち、65〜80%の除算演算処理における処理時間の短縮化を図ることがで、全体として除算演算処理の高速化を図ることができる。 [1] A quantization coefficient of [0x000] indicates that the DCT coefficient (dividend) is smaller than the quantization threshold (divisor). Therefore, as described in the conventional example, the DCT coefficient is compared with the quantization threshold, and when DCT coefficient <quantization threshold, the quantization coefficient as the quotient of the division operation is set to [0x000] and the conventional algorithm is used. The subtraction process (see the processes in steps S1020 to S1090 in FIG. 6) executed for each bit of the DCT coefficient (dividend) described in the above is omitted. Accordingly, for example, among the division calculation processing as the actual natural image quantization processing, the processing time in the division calculation processing of 65 to 80% can be shortened, so that the division calculation processing is accelerated as a whole. Can be achieved.
[2]除数としての量子化閾値が2のべき乗である場合には、被除数としてのDCT係数をシフト演算することにより、除算演算の商としての量子化係数を求めて、従来アルゴリズムで説明したDCT係数(被除数)のビットごとに実行する減算処理(図6のステップS1020〜S1090の処理参照)を省略する。これにより、例えば、上記実際の自然画像の量子化処理としての除算演算処理のうち、量子化係数が[0x000]とならない部分(全体の35〜15%)の中の10〜50%の除算演算処理における処理時間の短縮化を図ることができ、全体として除算演算処理の高速化を図ることができる。 [2] When the quantization threshold as the divisor is a power of 2, the DCT coefficient as the dividend is shifted to obtain the quantization coefficient as the quotient of the division operation, and the DCT described in the conventional algorithm The subtraction process (see steps S1020 to S1090 in FIG. 6) executed for each bit of the coefficient (dividend) is omitted. Thereby, for example, in the division calculation process as the quantization process of the actual natural image, the division calculation of 10 to 50% in the part (35 to 15% of the whole) where the quantization coefficient is not [0x000]. The processing time in the processing can be shortened, and the division operation processing can be accelerated as a whole.
図3は、本発明の実施例としての除算演算のアルゴリズムを示す説明図である。 FIG. 3 is an explanatory diagram showing an algorithm of division operation as an embodiment of the present invention.
まず、Mビットの被除数DdがNビットの除数Ds以上であるか否か判断する(ステップS101)。被除数Ddが除数Dsよりも小さい場合には(ステップS101:NO)、Mビットの商Qの各ビットの商Q[M−1]〜Q[0]を“0”とし(ステップS102)、この除算演算を終了する。一方、被除数Ddが除数Ds以上である場合には(ステップS101:YES)、さらに、除数Dsが2のべき乗の数であるか否か判断し(ステップS103)、その結果に応じて次の処理を実行する。 First, it is determined whether or not the M-bit dividend Dd is equal to or greater than the N-bit divisor Ds (step S101). When the dividend Dd is smaller than the divisor Ds (step S101: NO), the quotients Q [M−1] to Q [0] of each bit of the M-bit quotient Q are set to “0” (step S102). Terminates the division operation. On the other hand, if the dividend Dd is equal to or greater than the divisor Ds (step S101: YES), it is further determined whether the divisor Ds is a power of 2 (step S103), and the next processing is performed according to the result. Execute.
除数Dsが2のべき乗の数である場合には(ステップS103:YES)、除数Dsに応じて被除数Ddをシフト演算することによりMビットの商Qの各ビットの商Q[M−1]〜Q[0]を求める(ステップS104)。 When the divisor Ds is a power of 2 (step S103: YES), the bit quotient Q [M−1] ˜ of the M-bit quotient Q is shifted by performing a shift operation on the dividend Dd according to the divisor Ds. Q [0] is obtained (step S104).
一方、除数Dsが2のべき乗の数でない場合には(ステップS103:NO)、ステップS105〜ステップS113の処理を実行し、Mビットの商Qの各ビットの商Q[M−1]〜Q[0]を求める。なお、このステップS105〜ステップS113は、図6のステップS1010〜ステップS1090による通常の除算演算処理と同じであるので、ここではその説明を省略する。 On the other hand, when the divisor Ds is not a power of 2 (step S103: NO), the processing of step S105 to step S113 is executed, and the quotient Q [M−1] to Q of each bit of the quotient Q of M bits. [0] is obtained. Note that steps S105 to S113 are the same as the normal division calculation processing in steps S1010 to S1090 in FIG. 6, and thus the description thereof is omitted here.
以上のように、本実施例のアルゴリズムでは、第1に、被除数Ddが除数Ds以上である場合には、Mビットの商Qの各ビットの商Q[M−1]〜Q[0]を“0”とすることにより除算結果を得るものである。第2に、除数Dsが2のべき乗の数である場合には、被除数Ddをシフト演算してMビットの商Qの各ビットの商Q[M−1]〜Q[0]を得ることにより除算結果を得るものである。第3に、第1の場合でも第2の場合でもない場合には、従来と同様の除算演算を実行してMビットの商Qの各ビットの商Q[M−1]〜Q[0]を得ることにより除算結果を得るものである。従って、被除数Ddが除数Dsよりも小さい場合および除数Dsが2のべき乗の数である場合には、従来と同様の除算演算処理であるステップS105〜ステップS113の処理を省略することができる。 As described above, in the algorithm of the present embodiment, first, when the dividend Dd is equal to or greater than the divisor Ds, the quotients Q [M−1] to Q [0] of each bit of the M-bit quotient Q are calculated. A division result is obtained by setting “0”. Second, when the divisor Ds is a power of two, the dividend Dd is shifted to obtain the quotients Q [M−1] to Q [0] of each bit of the M-bit quotient Q. A division result is obtained. Third, when neither the first case nor the second case is performed, a division operation similar to the conventional one is executed, and the quotients Q [M−1] to Q [0] of each bit of the quotient Q of M bits. To obtain the division result. Therefore, when the dividend Dd is smaller than the divisor Ds and when the divisor Ds is a power of 2, the processing of steps S105 to S113, which is a division operation processing similar to the conventional one, can be omitted.
例えば、上記したように、1枚の自然画像のJPEG方式による画像圧縮符号化処理の場合において、量子化処理としての除算演算の商である量子化係数が[0x000]となる場合、すなわち、Mビットの被除数Ddとしての11ビットのDCT係数がNビットの除数Dsとしての8ビットの量子化閾値よりも小さくなる場合が65〜80%である。従って、この場合には、上記自然画像の量子化処理としての除算演算処理のうち、65〜80%の除算演算処理における処理時間の短縮化を図ることができ、全体として除算演算処理の高速化を図ることが可能となる。また除数Dsとしての量子化閾値が2のべき乗である場合が、量子化係数が[0x000]とならない部分(全体の35〜15%)の中の10〜50%である。従って、この場合には、上記自然画像の量子化処理としての除算演算処理のうち、1.5〜17.5%の除算演算処理における処理時間の短縮化を図ることができ、全体として除算演算処理の高速化を図ることが可能である。 For example, as described above, in the case of image compression encoding processing of a single natural image by the JPEG method, the quantization coefficient that is the quotient of the division operation as quantization processing is [0x000], that is, M The case where the 11-bit DCT coefficient as the bit dividend Dd is smaller than the 8-bit quantization threshold as the N-bit divisor Ds is 65 to 80%. Therefore, in this case, it is possible to shorten the processing time in the division calculation process of 65 to 80% of the division calculation process as the quantization process of the natural image, and the speed of the division calculation process as a whole is increased. Can be achieved. Further, when the quantization threshold as the divisor Ds is a power of 2, it is 10 to 50% in the portion (35 to 15% of the whole) where the quantization coefficient is not [0x000]. Therefore, in this case, among the division calculation processing as the natural image quantization processing, the processing time in the division calculation processing of 1.5 to 17.5% can be shortened. It is possible to increase the processing speed.
B2.除算器の具体例:
図4は、本発明の実施例としての除算演算のアルゴリズムに従った除算器として、被除数Ddの各ビットについての処理を、基準クロックの1クロックの間に、1ビットの処理を実行する場合の構成を示すブロック図である。
B2. Specific examples of dividers:
FIG. 4 shows a case where the processing for each bit of the dividend Dd is executed as 1-bit processing during one clock of the reference clock as a divider according to the algorithm of division operation as an embodiment of the present invention. It is a block diagram which shows a structure.
この除算器100は、図7に示した基本的な除算演算のアルゴリズムに従った従来の除算器1000の構成に加えて、比較器112と、2のべき乗判定回路3と、シフト演算器114と、を備える。また、セレクタ110と商レジスタ103との間に、セレクタ115を備える。さらに、制御回路111に換えて、制御回路116を備える。
This
比較器112は、Mビットの被除数Ddと、Nビットの除数Dsと、を比較し、その比較結果を制御回路116へ出力する機能ブロックである。
The
2のべき乗判定回路113は、除数Dsが2のべき乗の数であるか否か判定するとともに、除数Dsが2のべき乗の数である場合の被除数Ddのシフト量を決定し、その判定結果を制御回路116へ出力するとともに、シフト量をシフト演算器114へ出力する機能ブロックである。2のべき乗の数であるか否かの判定およびシフト量は、除数Dsの各ビットのうちの1ビットのみが“1”となっていることを検出する論理回路により簡単に構成可能である。
The power-of-two
シフト演算器114は、2のべき乗判定回路113から入力されたシフト量で、被除数Ddをシフト演算し、得られた結果を商Qとしてセレクタ115に出力する機能ブロックである。
The shift calculator 114 is a functional block that shifts the dividend Dd with the shift amount input from the power-of-two
セレクタ115は、セレクタ110の出力を商レジスタ103に書き込むか、シフト演算器114の出力を商レジスタ103に書き込むか、“0”を商レジスタ103に書き込むか、を制御回路116の制御信号に応じて選択する機能ブロックである。
The
制御回路116は、比較器112の比較結果および2のべき乗判定回路113の判定結果に応じて、セレクタ104、セレクタ110、および、セレクタ115の動作を制御する機能ブロックである。
The
比較器112、セレクタ115、および、制御回路116によって、図3のステップS101およびステップS102の処理、すなわち、Mビットの被除数DdがNビットの除数Dsよりも小さいか否か判断し、被除数Dsが除数Dsよりも小さい場合には、Mビットの商Qの各ビットの商Q[M−1]〜Q[0]を“0”とする処理が実行される。
The
2のべき乗判定回路113、シフト演算器14、セレクタ115、および、制御回路116によって、ステップS103およびステップS104の処理、すなわち、除数Dsが2のべき乗の数であるか否か判断し除数Dsが2のべき乗の数である場合には、除数Dsに応じて被除数Ddをシフト演算することによりMビットの商Qの各ビットの商Q[M−1]〜Q[0]を求める処理が実行される。
The power-of-two determining
なお、従来の除算器1000と同じ構成部分である、セレクタ104、被減数レジスタ105、減算器106、比較器107、左シフト回路108、セレクタ109、および、セレクタ110によって、ステップS105〜S110の処理、すなわち、図6に示した従来の基本的な除算演算のアルゴリズムにおけるステップS1010〜ステップS1090による通常の除算演算処理と同じ処理が実行され、Mビットの商Qの各ビットの商Q[M−1]〜Q[0]を求める処理が実行される。
The processing of steps S105 to S110 is performed by the
この除算器100の構成では、図3に示した除算演算のアルゴリズムに従った除算演算を実行することができ、画像圧縮符号化装置における量子化処理としての除算演算の処理時間の短縮化を図ることができるので、量子化処理のための除算演算処理の高速化を図ることが可能である。
In the configuration of the
また、この除算器100の構成では、基本的には、従来の除算器1000(図7参照)に、比較器112、2のべき乗判定回路113、シフト演算器114、および、セレクタ115を追加するのみで構成することができるので、例えば、汎用プロセッサに備えられる除算器のような複雑かつ回路規模の大きい除算器と比較して、効率が良い。
Further, in the configuration of the
また、被除数Ddが除数Ds以上である場合や除数Dsが2のべき乗の数でない場合には、従来と同様の除算演算処理が実行されるので、少なくとも従来の除算器1000と同様に動作することができる。
Further, when the dividend Dd is equal to or greater than the divisor Ds or when the divisor Ds is not a power of two, the same division operation processing is executed, so that at least the same operation as the
図5は、本発明の実施例としての除算演算のアルゴリズムに従った除算器として、被除数Ddの各ビットについての処理を、基準クロックの1クロックの間に、3ビットの処理を実行する場合の構成を示すブロック図である。 FIG. 5 shows a case where the processing for each bit of the dividend Dd is performed as a divider according to the division operation algorithm as an embodiment of the present invention, and the processing of 3 bits is performed during one clock of the reference clock. It is a block diagram which shows a structure.
この除算器100Aは、図8に示した基本的な除算演算のアルゴリズムに従った従来の除算器1000Aの構成に加えて、図4に示した除算器100と同様に、比較器112と、2のべき乗判定回路3と、シフト演算器114と、を備える。また、セレクタ110と商レジスタ103との間に、セレクタ115を備える。さらに、制御回路111Aに換えて、制御回路116Aを備える。
In addition to the configuration of the
制御回路116Aは、比較器112の比較結果および2のべき乗判定回路113の判定結果に応じて、セレクタ104A、セレクタ110A、および、セレクタ115の動作を制御する機能ブロックである。
The
この除算器100Aの構成では、図4に示した除算器100と同様に、図3に示した除算演算のアルゴリズムに従った除算演算を実行することができ、画像圧縮符号化装置における量子化処理としての除算演算の処理時間の短縮化を図ることができるので、量子化処理のための除算演算処理の高速化を図ることが可能である。
In the configuration of the
また、この除算器100Aの構成では、図4に示した除算器100が、基準クロックの1クロックの間に1ビットの処理を実行するのに対して、3ビットの処理を実行することができるので、除算器100に比べて、図3のステップS105〜ステップS113において繰り返し実行される処理の時間をさらに短縮化することができるので、量子化処理のための除算演算処理の高速化を図ることが可能である。
Further, in the configuration of the
また、この除算器100Aの構成も、基本的には、従来の除算器1000A(図8参照)に、比較器112、2のべき乗判定回路113、シフト演算器114、および、セレクタ115を追加するのみで構成することができるので、例えば、汎用プロセッサに備えられる除算器のような複雑かつ回路規模の大きい除算器と比較して、効率が良い。
The configuration of the
また、被除数Ddが除数Ds以上である場合や除数Dsが2のべき乗の数でない場合には、従来と同様の除算演算処理が実行されるので、少なくとも従来の除算器1000Aと同様に動作することができる。
Further, when the dividend Dd is equal to or greater than the divisor Ds, or when the divisor Ds is not a power of two, the same division operation processing is executed, so that at least the same operation as the
なお、上記除算器100,100Aにおいて、比較器112が本発明の被除数全体比較手段に相当する。
In the
C.変形例:
なお、本発明は上記した実施例や実施形態に限られるものではなく、その要旨を逸脱しない範囲において種々の態様にて実施することが可能である。
C. Variations:
The present invention is not limited to the above-described examples and embodiments, and can be implemented in various modes without departing from the scope of the invention.
上記した実施例では、除算器の具体例として、1クロックの間に1ビットの処理を実行する場合の構成の例と、1クロックの間に3ビットの処理を実行する場合の構成の例を示したが、これに限定されるものではなく、1クロックの間に2ビットの処理を実行する場合や、4ビットの処理を実行する場合の構成等、1クロックの間に複数ビットの処理を実行する場合の構成に適用可能である。 In the above-described embodiment, as a specific example of the divider, an example of a configuration in which 1-bit processing is executed during one clock and an example of a configuration in which 3-bit processing is executed during one clock. Although shown, the present invention is not limited to this, and a multi-bit processing is performed during one clock, such as a configuration in which 2-bit processing is performed during one clock or a 4-bit processing is performed. Applicable to configurations for execution.
上記した実施例では、自然画像の画像データを二次元離散コサイン変換することにより得られたDCT係数を被除数とし、量子化閾値を除数とし、除算演算の商として量子化係数を得る場合を例として説明したが、これに限定されるものではなく、種々の場合に適用可能である。特に、除数が2のべき乗の数を多く含む場合に有効である。 In the above-described embodiment, as an example, a DCT coefficient obtained by performing two-dimensional discrete cosine transform on image data of a natural image is a dividend, a quantization threshold is a divisor, and a quantization coefficient is obtained as a quotient of a division operation. Although described, the present invention is not limited to this, and can be applied to various cases. This is particularly effective when the divisor includes a large number of powers of 2.
10…画像符号化装置
20…DCT部
30…量子化部
40…量子化テーブル
50…ハフマン符号化部
60…ハフマンテーブル
100…除算器
100A…除算器
101…被除数レジスタ
102…除数レジスタ
103…商レジスタ
105…被減数レジスタ
104…セレクタ
104A…セレクタ
106…減算器
107…比較器
108…左シフト回路
109…セレクタ
106a〜106c…減算器
107a〜107c…比較器
108a〜108c…左シフト回路
109a〜109c…セレクタ
110…セレクタ
110A…セレクタ
111…制御回路
111A…制御回路
112…比較器
113…2のべき乗判定回路
114…シフト演算器114
115…セレクタ
116…制御回路
116A…制御回路
DESCRIPTION OF
115:
Claims (5)
前記除数が2のべき乗の数であるか否か判定するとともに、前記除数が2のべき乗の数である場合における被除数のシフト量を決定する2のべき乗判定手段と、
前記被除数を前記シフト量に応じてシフト演算するシフト演算手段と、
前記除数が2のべき乗の数である場合には、前記シフト演算手段から出力されるシフト演算結果に基づいて前記商を求める制御手段と、
を備えることを特徴とする除算器。 A divider for obtaining a quotient obtained by dividing a dividend by a divisor,
Determining whether the divisor is a power of 2 and determining a power of 2 for determining a shift amount of the dividend when the divisor is a power of 2;
Shift computing means for computing the dividend according to the shift amount;
Control means for obtaining the quotient based on a shift calculation result output from the shift calculation means when the divisor is a power of 2;
A divider comprising:
さらに、前記被除数が前記除数よりも小さいか否か比較判定するための比較手段を備え、
前記制御手段は、前記被除数が前記除数よりも小さい場合には、各ビットの商をゼロとすることにより、前記商を求める
ことを特徴とする除算器。 The divider according to claim 1, wherein
Furthermore, a comparison means for comparing and determining whether or not the dividend is smaller than the divisor,
The divider obtains the quotient by setting the quotient of each bit to zero when the dividend is smaller than the divisor.
前記被除数は画像データを離散コサイン変換したDCT係数であり、前記除数は所定の量子化閾値である、
ことを特徴とする除算器。 A divider according to claim 1 or claim 2, wherein
The dividend is a DCT coefficient obtained by discrete cosine transform of image data, and the divisor is a predetermined quantization threshold.
A divider characterized by that.
前記除算器に、前記被除数として前記DCT係数を入力し、前記除数として前記量子化閾値を入力することにより、前記DCT係数を前記量子化閾値で除算して求められる商を前記量子化係数として得ることを特徴とする画像符号化装置。 A divider according to claim 3,
The quotient obtained by dividing the DCT coefficient by the quantization threshold is obtained as the quantization coefficient by inputting the DCT coefficient as the dividend and inputting the quantization threshold as the divisor to the divider. An image encoding apparatus characterized by that.
前記除数が2のべき乗の数であるか否か判定するとともに、前記除数が2のべき乗の数である場合における被除数のシフト量を決定し、
前記被除数を前記シフト量に応じてシフト演算し、
前記除数が2のべき乗の数である場合には、前記シフト演算手段から出力されるシフト演算結果に基づいて前記商を求める、
ことを特徴とする除算方法。 A division method for obtaining a quotient obtained by dividing a dividend by a divisor,
Determining whether the divisor is a power of 2 and determining a shift amount of the dividend when the divisor is a power of 2;
Shifting the dividend according to the shift amount,
When the divisor is a power of 2, the quotient is obtained based on a shift calculation result output from the shift calculation means.
A division method characterized by that.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008012787A JP2009175959A (en) | 2008-01-23 | 2008-01-23 | Divider, division method, and image encoding device using divider |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008012787A JP2009175959A (en) | 2008-01-23 | 2008-01-23 | Divider, division method, and image encoding device using divider |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2009175959A true JP2009175959A (en) | 2009-08-06 |
Family
ID=41030992
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008012787A Pending JP2009175959A (en) | 2008-01-23 | 2008-01-23 | Divider, division method, and image encoding device using divider |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2009175959A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016009492A (en) * | 2014-06-26 | 2016-01-18 | エイアールエム リミテッド | Apparatus and method for efficient division performance |
-
2008
- 2008-01-23 JP JP2008012787A patent/JP2009175959A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016009492A (en) * | 2014-06-26 | 2016-01-18 | エイアールエム リミテッド | Apparatus and method for efficient division performance |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH0793586B2 (en) | Data compression model selection method and system | |
EP0469841A1 (en) | Data round-off device | |
US20020114529A1 (en) | Arithmetic coding apparatus and image processing apparatus | |
CN1253338A (en) | Transform region correction of actual region error | |
JP2008118307A (en) | Coder, and its control method | |
US20080107349A1 (en) | Method and circuit of high performance variable length coding and decoding for image compression | |
KR20080016881A (en) | Compression and decompression using corrections of predicted values | |
TWI416959B (en) | Method and system for encoded video compression | |
CN110049333B (en) | JPEG _ LS image compression output coding code stream splicing system and method | |
JP2009175959A (en) | Divider, division method, and image encoding device using divider | |
KR100241069B1 (en) | Calculating the average of four integer numbers rounded away from zero in a single instruction cycle | |
JP2009175958A (en) | Divider, dividing method, and image encoding device using divider | |
CN111818335A (en) | Entropy coding method and device and electronic equipment | |
JP2002519957A (en) | Method and apparatus for processing a sign function | |
JP2011109172A (en) | Video encoder and data processing method for the same | |
JPH104557A (en) | Unit, and method for image processing and storage medium storing the method | |
JP4148356B2 (en) | Quantization step parameter determination device, quantization step parameter determination method, quantization step parameter determination program, and nonlinear quantization method, nonlinear quantization device, and nonlinear quantization program | |
JP4936574B2 (en) | Encoding apparatus and control method thereof | |
CN116828196A (en) | Implementation method of JPEG-LS encoder based on FPGA | |
EP3360315A1 (en) | Method and apparatus for determining an output value representing a picture data by applying a piece-wise linear function on an input data representing a picture data | |
JP3142356B2 (en) | Quantizer and image data quantizer | |
JP2006060553A (en) | Quantizer and inverse quantizer | |
KR20180031944A (en) | Video decoder and electronic system including the same | |
JP2008131526A (en) | Moving image coding apparatus, and moving image coding program | |
JP3127513B2 (en) | Encoding device |