JP4833690B2 - Arithmetic circuit and arithmetic method - Google Patents

Arithmetic circuit and arithmetic method Download PDF

Info

Publication number
JP4833690B2
JP4833690B2 JP2006057810A JP2006057810A JP4833690B2 JP 4833690 B2 JP4833690 B2 JP 4833690B2 JP 2006057810 A JP2006057810 A JP 2006057810A JP 2006057810 A JP2006057810 A JP 2006057810A JP 4833690 B2 JP4833690 B2 JP 4833690B2
Authority
JP
Japan
Prior art keywords
product
sum
register
column
columns
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2006057810A
Other languages
Japanese (ja)
Other versions
JP2007233934A (en
Inventor
順之 橋本
クブチャンダニ テジュ
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kawasaki Microelectronics Inc
Original Assignee
Kawasaki Microelectronics Inc
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 Kawasaki Microelectronics Inc filed Critical Kawasaki Microelectronics Inc
Priority to JP2006057810A priority Critical patent/JP4833690B2/en
Publication of JP2007233934A publication Critical patent/JP2007233934A/en
Application granted granted Critical
Publication of JP4833690B2 publication Critical patent/JP4833690B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、2次元空間に配置されたデータに対し、畳み込み演算によって各種のフィルタ処理を行う演算回路およびその演算方法に関するものである。   The present invention relates to an arithmetic circuit that performs various types of filter processing on data arranged in a two-dimensional space by a convolution operation and an arithmetic method thereof.

元画像にデジタル処理を行い、画質の向上、ノイズ除去、エッヂ強調などのフィルタ処理を行う従来技術の1つとして畳み込み演算が知られている。畳み込み演算は、主に画像などのように、x列×y行からなる2次元空間に配置されたデータに対して各種のフィルタ処理をするために使用される。畳み込み演算は、一般的に上記の目的で使用される場合が多いが、その係数値を変えることによって、様々な特性を持つフィルタを構成することができる。   A convolution operation is known as one of conventional techniques for performing digital processing on an original image and performing filter processing such as image quality improvement, noise removal, and edge enhancement. The convolution operation is mainly used to perform various kinds of filter processing on data arranged in a two-dimensional space consisting of x columns × y rows, such as an image. In general, the convolution operation is often used for the above-mentioned purpose, but by changing the coefficient value, a filter having various characteristics can be configured.

例えば、5列×5行のフィルタ処理を行う場合、元画像の列方向(横方向)をx、行方向(縦方向)をy、元画像のx列y行目の画素値をLx,y、フィルタ処理後のx列y行目の画素値をPx,y、5列×5行のフィルタ係数のi列j行目の係数値をCi,jとすると、フィルタ処理後の画素値Px,yは下記式(1)により算出される。上記の通り、フィルタの特性は係数値Ci,jにより決定され、画質の向上、ノイズ除去、エッヂ強調などの各種の機能を果たす。 For example, when performing a filtering process of 5 columns × 5 rows, the column direction (horizontal direction) of the original image is x, the row direction (vertical direction) is y, and the pixel value of the x column y row of the original image is L x, If y is the pixel value in the x column and y row after the filter processing is P x, y , and the coefficient value in the i column j row of the 5 × 5 filter coefficients is C i, j , the filtered pixel The value P x, y is calculated by the following equation (1). As described above, the characteristics of the filter are determined by the coefficient values C i, j and perform various functions such as image quality improvement, noise removal, and edge enhancement.

Figure 0004833690
Figure 0004833690

以下、説明を簡単にするために、元画像(フィルタ処理前)の2列×2行の4画素分の画素値から、フィルタ処理後の1画素の画素値を算出する畳み込み演算を行うフィルタ(演算回路)について説明する。   Hereinafter, in order to simplify the description, a filter that performs a convolution operation for calculating a pixel value of one pixel after the filter processing from pixel values of four columns of 2 columns × 2 rows of the original image (before the filter processing) ( The arithmetic circuit will be described.

ここでは、図8に示す元画像の各画素の画素値L11,L12,L13,…、L21,L22,L23,…、L31,L32,L33,…に対して畳み込み演算によるフィルタ処理を行い、図9に示すフィルタ処理後の画像の各画素の画素値P11,P12,P12,…、P21,P22,P23,…を算出するものとする。   Here, the pixel values L11, L12, L13,..., L21, L22, L23,..., L31, L32, L33,. Assume that pixel values P11, P12, P12,..., P21, P22, P23,.

図10は、元画像の各画素の画素値とフィルタ処理後の画像の各画素の画素値との関係を表す一例の概念図である。すなわち、この例では、元画像の2列×2行=4画素分の画素値Li,j,Li,j+1,Li+1,j,Li+1,j+1を使用して、フィルタ処理後の1画素の画素値Pi,jが算出される。2列×2行のフィルタの場合、4個(=2列×2行)のフィルタ係数C1,1,C1,2,C2,1,C2,2が必要である。フィルタ処理後の各画素の画素値Pi,jは下記式(2)により算出される。 FIG. 10 is a conceptual diagram illustrating an example of a relationship between a pixel value of each pixel of the original image and a pixel value of each pixel of the image after filtering. That is, in this example, the pixel values L i, j , L i, j + 1 , L i + 1, j , L i + 1 , j + 1 of 2 columns × 2 rows = 4 pixels of the original image are used. Thus, the pixel value P i, j of one pixel after the filter processing is calculated. In the case of a filter of 2 columns × 2 rows, four (= 2 columns × 2 rows) filter coefficients C 1,1 , C 1,2 , C 2,1 , C 2,2 are required. The pixel value P i, j of each pixel after the filter processing is calculated by the following equation (2).

i,j=C1,1i,j+C1,2i,j+1+C2,1i+1,j+C2,2i+1,j+1 … (2) P i, j = C 1,1 L i, j + C 1,2 L i, j + 1 + C 2,1 L i + 1, j + C 2,2 L i + 1 , j + 1 (2)

例えば、フィルタ処理後の画像の最初の画素の画素値P11は、図11に示すように、四角の太枠で囲まれた元画像の1および2列目の4画素分の画素値L11,L21,L12,L22を使用して算出される。また、図13に示す順序でフィルタ処理を行う場合、フィルタ処理後の画像の2番目の画素の画素値P12は、図12に示すように、四角の太枠で囲まれた元画像の2及び3列目の4画素分の画素値L12,L22,L13,L23を使用して算出される。   For example, the pixel value P11 of the first pixel of the image after filtering is, as shown in FIG. 11, the pixel values L11 and L21 for four pixels in the first and second columns of the original image surrounded by a thick square frame. , L12, L22. Further, when the filtering process is performed in the order shown in FIG. 13, the pixel value P12 of the second pixel of the image after the filtering process is 2 and 2 of the original image surrounded by a square thick frame as shown in FIG. Calculation is performed using pixel values L12, L22, L13, and L23 for four pixels in the third column.

また、例えばノイズ除去のフィルタ処理を行う場合、元画像の4画素分の画素値Li,j,Li,j+1,Li+1,j,Li+1,j+1の平均値を算出するために、フィルタ係数C1,1,C1,2,C2,1,C2,2を下記式(3)のように全て同じ値の1/4に設定する。これにより、上記式(2)は下記式(4)の形式となる。このように、元画像の4画素分の画素値Li,j,Li,j+1,Li+1,j,Li+1,j+1の平均値を算出することにより、元画像における小さなノイズを除去する効果を得ることができる。 Also, for example, when performing noise removal filtering, the average of the pixel values L i, j , L i, j + 1 , L i + 1, j , L i + 1 , j + 1 of the four pixels of the original image In order to calculate the values, the filter coefficients C 1,1 , C 1,2 , C 2,1 , C 2,2 are all set to ¼ of the same value as in the following equation (3). Thereby, the said Formula (2) becomes a format of following Formula (4). Thus, by calculating the average value of the pixel values L i, j , L i, j + 1 , L i + 1, j , L i + 1 , j + 1 for the four pixels of the original image, An effect of removing small noise in the image can be obtained.

1,1=C1,2=C2,1=C2,2=1/4 … (3)
i,j=(Li,j+Li,j+1+Li+1,j+Li+1,j+1)/4 … (4)
C 1,1 = C 1,2 = C 2,1 = C 2,2 = 1/4 ... (3)
P i, j = (L i, j + L i, j + 1 + L i + 1, j + L i + 1 , j + 1 ) / 4 (4)

ここで、上記式(2)により、図13に示す順序でフィルタ処理を行う場合、例えばフィルタ処理後の画素の画素値P11とP12のように、隣りあう画素の演算において、図11と図12とを見比べると分かるように、1列の2画素分の画素値L12とL22が、P11とP12の演算の両方で使用されている。従って、例えば特許文献1などには、隣りあう画素の演算において共通に使用される元画像の同じ画素の画素値をメモリなどから2度読み出すことを防止する技術が提案されている。 Here, when the filter processing is performed in the order shown in FIG. 13 by the above equation (2), for example, in the calculation of adjacent pixels like the pixel values P11 and P12 of the pixels after the filter processing, FIG. 11 and FIG. As can be seen from the above, pixel values L12 and L22 for two pixels in one column are used in both the calculations of P11 and P12. Therefore, for example, Patent Document 1 proposes a technique for preventing the pixel value of the same pixel of the original image that is commonly used in calculation of adjacent pixels from being read twice from a memory or the like.

以下、特許文献1について説明する。   Hereinafter, Patent Document 1 will be described.

図14は、従来の畳み込み演算によるフィルタ処理を行う演算回路の構成を表す一例の概略図である。同図に示す演算回路140は、説明を簡単化するために、特許文献1によって提案された技術を2列×2行のフィルタとして構成したものである。演算回路140は、画像情報記憶装置141と、元画像用レジスタ142と、係数用シフトレジスタ144と、マルチプレクサ(MUX)145と、積和演算器146と、加算器148と、マルチプレクサ(MUX)149と、2つのフリップフロップ150a、150bからなる中間結果レジスタ154と、カウンタ156とによって構成されている。   FIG. 14 is a schematic diagram illustrating an example of a configuration of an arithmetic circuit that performs filter processing using a conventional convolution operation. An arithmetic circuit 140 shown in the figure is configured by applying the technique proposed in Patent Document 1 as a filter of 2 columns × 2 rows in order to simplify the description. The arithmetic circuit 140 includes an image information storage device 141, an original image register 142, a coefficient shift register 144, a multiplexer (MUX) 145, a product-sum operation unit 146, an adder 148, and a multiplexer (MUX) 149. And an intermediate result register 154 composed of two flip-flops 150a and 150b, and a counter 156.

また、図15および図16は、図14に示す演算回路140のカウンタ156のカウント値=0の場合と、カウント値=1の場合における演算回路140の状態を概念的に表したものである。また、図17は、演算回路140で用いられている積和演算器146の構成を表す概念図であって、係数値C1(C11またはC21)と画素値L1とを乗算する乗算器160aと、係数値C2(C12またはC22)と画素値L2とを乗算する乗算器160bと、2つの乗算器160a、160bの演算結果を加算する加算器162とによって構成されている。   15 and 16 conceptually show states of the arithmetic circuit 140 when the counter value 156 of the arithmetic circuit 140 shown in FIG. 14 is 0 and when the count value = 1. FIG. 17 is a conceptual diagram showing the configuration of the product-sum calculator 146 used in the arithmetic circuit 140. The multiplier 160a that multiplies the coefficient value C1 (C11 or C21) and the pixel value L1, The multiplier 160b that multiplies the coefficient value C2 (C12 or C22) and the pixel value L2 and the adder 162 that adds the operation results of the two multipliers 160a and 160b.

カウンタ156は、初期化後、0,1を繰り返しカウントする。カウンタ156のカウント値=0の場合、画像情報記憶装置141に記憶されている元画像の中から、処理対象となる1列の2画素分の画素値が読み出され、元画像用レジスタ142に、それぞれL1,L2として保持される。また、図15に示すように、係数用シフトレジスタ144からは、マルチプレクサ145を介して係数値C11,C21が出力される。   The counter 156 repeatedly counts 0 and 1 after initialization. When the count value of the counter 156 is 0, pixel values for two pixels in one column to be processed are read from the original image stored in the image information storage device 141, and are stored in the original image register 142. Are held as L1 and L2, respectively. Further, as shown in FIG. 15, coefficient values C <b> 11 and C <b> 21 are output from the coefficient shift register 144 via the multiplexer 145.

積和演算器146では、元画像用レジスタ142から入力される1列の2画素分の画素値L1,L2と、係数用シフトレジスタ144から入力される係数値C11,C21との積和演算C11L1+C21L2が行われる。加算器148では、積和演算器146の演算結果と0との加算が行われ、その加算結果C11L1+C21L2が、マルチプレクサ149を介して中間結果レジスタ154のフリップフロップ150aに入力される。   The product-sum operation unit 146 performs a product-sum operation C11L1 + C21L2 between the pixel values L1 and L2 for two pixels in one column input from the original image register 142 and the coefficient values C11 and C21 input from the coefficient shift register 144. Is done. The adder 148 adds the operation result of the product-sum operation unit 146 and 0, and the addition result C11L1 + C21L2 is input to the flip-flop 150a of the intermediate result register 154 via the multiplexer 149.

中間結果レジスタ154のフリップフロップ150aには、クロック信号に同期して、加算器148から入力される加算結果が保持される。フリップフロップ150bには、同じくクロック信号に同期して、フリップフロップ150aの出力が保持されるとともに、フィルタ処理後の画素の画素値として出力される。すなわち、フリップフロップ150bには、1サイクル(1クロック)前にフリップフロップ150aに保持された値が保持される。   The flip-flop 150a of the intermediate result register 154 holds the addition result input from the adder 148 in synchronization with the clock signal. Similarly, in synchronization with the clock signal, the output of the flip-flop 150a is held in the flip-flop 150b and is output as the pixel value of the pixel after the filter processing. That is, the value held in the flip-flop 150a before one cycle (one clock) is held in the flip-flop 150b.

一方、カウンタ156のカウント値=1の場合、画像情報記憶装置141から新たな画素値の読み出しは行われない。従って、元画像用レジスタ142には、カウンタ156のカウント値=0の時の2画素分の画素値L1,L2が保持されている。係数用シフトレジスタ144からは、図16に示すように、係数値C12,C22が出力される。積和演算器146では、1列の2画素分の画素値L1,L2と、係数値C12,C22との積和演算C12L1+C22L2が行われる。   On the other hand, when the count value of the counter 156 = 1, no new pixel value is read from the image information storage device 141. Therefore, the original image register 142 holds pixel values L1 and L2 for two pixels when the count value of the counter 156 = 0. Coefficient values C12 and C22 are output from the coefficient shift register 144 as shown in FIG. The product-sum calculator 146 performs a product-sum operation C12L1 + C22L2 of the pixel values L1 and L2 for two pixels in one column and the coefficient values C12 and C22.

加算器148では、積和演算器146の演算結果とフリップフロップ150bの出力とが加算される。これにより、3サイクル前にカウンタ156のカウンタ値=0であった時の積和演算器146の演算結果C11L1+C21L2とカウンタ値=1の時の演算結果C12L1+C22L2とが加算される。フリップフロップ150bには、クロック信号に同期して、加算器148の加算結果が保持されるとともに、フィルタ処理後の画素の画素値として出力される。フリップフロップ150aには、自分自身の1サイクル前の保持値が保持(維持)される。   The adder 148 adds the operation result of the product-sum operation unit 146 and the output of the flip-flop 150b. As a result, the calculation result C11L1 + C21L2 of the product-sum calculator 146 when the counter value of the counter 156 is 0 three cycles before and the calculation result C12L1 + C22L2 when the counter value = 1 are added. The flip-flop 150b holds the addition result of the adder 148 in synchronization with the clock signal and outputs it as the pixel value of the pixel after the filter processing. The flip-flop 150a holds (maintains) its own held value one cycle before.

次に、下記表1を参照しながら、演算回路140の動作を具体的に説明する。   Next, the operation of the arithmetic circuit 140 will be specifically described with reference to Table 1 below.

Figure 0004833690
Figure 0004833690

最初のサイクルは、初期化のサイクルである。中間結果レジスタ154の2つのフリップフロップ150a、150bの保持値P1,P2は0となる。また、表1中では省略しているが、係数用シフトレジスタ144には、係数値C11,C21,C12,C22が設定される。   The first cycle is an initialization cycle. The holding values P1 and P2 of the two flip-flops 150a and 150b of the intermediate result register 154 are zero. Although omitted in Table 1, coefficient values C11, C21, C12, and C22 are set in the coefficient shift register 144.

サイクル1では、カウンタ156のカウント値=0である。従って、画像情報記憶装置141から、最初の1列目の2画素分の画素値L11,L21が読み出され、それぞれ元画像用レジスタ142にL1,L2として保持される。また、係数用シフトレジスタ144からは係数値C11,C21が出力される。そして、積和演算器146により、C11L11+C21L21が演算され、加算器148により、さらに0が加算される。加算器148の加算結果C11L11+C21L21は、クロック信号に同期して、中間結果レジスタ154のフリップフロップ150aに、保持値P1として保持される。フリップフロップ150bには、フリップフロップ150aに1サイクル前に保持された値である0が、保持値P2として保持される。   In cycle 1, the count value of the counter 156 = 0. Therefore, the pixel values L11 and L21 for the first two columns of pixels are read from the image information storage device 141 and are stored in the original image register 142 as L1 and L2, respectively. The coefficient values C11 and C21 are output from the coefficient shift register 144. Then, C11L11 + C21L21 is calculated by the product-sum calculator 146, and 0 is further added by the adder 148. The addition result C11L11 + C21L21 of the adder 148 is held as the hold value P1 in the flip-flop 150a of the intermediate result register 154 in synchronization with the clock signal. In the flip-flop 150b, 0, which is the value held in the flip-flop 150a one cycle before, is held as the hold value P2.

サイクル2では、カウンタ156のカウント値=1となる。従って、元画像用レジスタ142のL1,L2は、L11,L21のままである。一方、係数用シフトレジスタ144からは係数値C12,C22が出力される。そして、積和演算器146により、C12L11+C22L21が演算され、加算器148により、さらに中間結果レジスタ154のフリップフロップ150bの出力0が加算される。加算器148の加算結果C12L11+C22L21は、クロック信号に同期して、中間結果レジスタ154のフリップフロップ150bに保持される。フリップフロップ150aは、自分自身の出力であるC11L11+C21L21を維持する。   In cycle 2, the count value of the counter 156 is 1. Therefore, L1 and L2 of the original image register 142 remain L11 and L21. On the other hand, coefficient values C12 and C22 are output from the coefficient shift register 144. The product-sum calculator 146 calculates C12L11 + C22L21, and the adder 148 further adds the output 0 of the flip-flop 150b of the intermediate result register 154. The addition result C12L11 + C22L21 of the adder 148 is held in the flip-flop 150b of the intermediate result register 154 in synchronization with the clock signal. The flip-flop 150a maintains C11L11 + C21L21, which is its own output.

サイクル3では、再びカウンタ156のカウント値=0となる。2番目の1列の2画素分の画素値L12,L22が読み出され、それぞれ元画像用レジスタ142にL1,L2として保持される。係数用シフトレジスタ144からは係数値C11,C21が出力される。そして、積和演算器146により、C11L12+C21L22が演算され、加算器148により、さらに0が加算される。加算器148の加算結果C11L12+C21L22は、クロック信号に同期して、中間結果レジスタ154のフリップフロップ150aに保持される。フリップフロップ150bには、フリップフロップ150aの出力C11L11+C21L21が保持される。   In cycle 3, the count value of the counter 156 becomes 0 again. Pixel values L12 and L22 for two pixels in the second one column are read and held in the original image register 142 as L1 and L2, respectively. Coefficient values C11 and C21 are output from the coefficient shift register 144. Then, C11L12 + C21L22 is calculated by the product-sum calculator 146, and 0 is further added by the adder 148. The addition result C11L12 + C21L22 of the adder 148 is held in the flip-flop 150a of the intermediate result register 154 in synchronization with the clock signal. The flip-flop 150b holds the output C11L11 + C21L21 of the flip-flop 150a.

サイクル4では、再びカウンタ156のカウント値=1となる。同じく元画像用レジスタ142のL1,L2は、L12,L22のままである。係数用シフトレジスタ144からは係数値C12,C22が出力される。そして、積和演算器146により、C12L12+C22L22が演算され、加算器148により、さらに中間結果レジスタ154のフリップフロップ150bの出力C11L11+C21L21が加算される。加算器148の加算結果C11L11+C21L21+C12L12+C22L22は、クロック信号に同期して、中間結果レジスタ154のフリップフロップ150bに保持され、フィルタ処理後の画素の画素値P11として出力される。フリップフロップ150aは、自分自身の出力C11L12+C21L22を維持する。   In cycle 4, the count value of the counter 156 becomes 1 again. Similarly, L1 and L2 of the original image register 142 remain L12 and L22. Coefficient values C12 and C22 are output from the coefficient shift register 144. The product-sum calculator 146 calculates C12L12 + C22L22, and the adder 148 further adds the output C11L11 + C21L21 of the flip-flop 150b of the intermediate result register 154. The addition result C11L11 + C21L21 + C12L12 + C22L22 of the adder 148 is held in the flip-flop 150b of the intermediate result register 154 in synchronization with the clock signal, and is output as the pixel value P11 of the pixel after filtering. The flip-flop 150a maintains its own output C11L12 + C21L22.

サイクル5以降の動作は、上記と同様である。すなわち、演算回路140では、初期化後、4サイクルでフィルタ処理後の最初の画素の画素値P11が出力され、以後、2サイクル毎に、フィルタ処理後の2番目以降の画素の画素値P12,P13,…が順次出力される。   The operations after cycle 5 are the same as described above. That is, in the arithmetic circuit 140, after initialization, the pixel value P11 of the first pixel after filtering is output in four cycles, and thereafter, the pixel value P12 of the second and subsequent pixels after filtering is processed every two cycles. P13,... Are sequentially output.

上記の通り、特許文献1では、隣りあう画素の演算で共通に使用される元画像の画素の画素値を、画像情報記憶装置から2度読み出す必要がないという利点がある。しかし、特許文献1では、初期化後、フィルタ処理後の最初の画素の画素値P11が出力されるまでに、4サイクルを必要とし、2番目以降の画素の画素値P12,P13,…が出力される毎に、2サイクルを必要とするため、フィルタ処理に処理時間(サイクル数)がかかりすぎるという問題がある。   As described above, Patent Document 1 has an advantage that it is not necessary to read out twice from the image information storage device the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels. However, in Patent Document 1, four cycles are required after the initialization until the pixel value P11 of the first pixel after the filtering process is output, and the pixel values P12, P13,... Of the second and subsequent pixels are output. Each time it takes two cycles, there is a problem that it takes too much processing time (number of cycles) for the filter processing.

特開昭51−141536号公報JP 51-141536 A

本発明の目的は、前記従来技術に基づく問題点を解消し、2次元空間に配置されたデータに対して、従来よりも少ないサイクル数で畳み込み演算によるフィルタ処理を行うことができる演算回路および演算方法を提供することにある。   SUMMARY OF THE INVENTION An object of the present invention is to solve the problems based on the prior art and to perform an arithmetic circuit and an arithmetic circuit capable of performing filter processing by convolution operation on data arranged in a two-dimensional space with fewer cycles than in the past. It is to provide a method.

また、本発明の他の目的は、畳み込み演算によるフィルタ処理に高速性が要求されない場合、処理速度よりも回路規模を優先させて、その回路規模を適宜削減することができる演算回路および演算方法を提供することにある。   Another object of the present invention is to provide an arithmetic circuit and an arithmetic method capable of appropriately reducing the circuit scale by giving priority to the circuit scale over the processing speed when high speed is not required for the filter processing by the convolution operation. It is to provide.

上記目的を達成するために、本発明は、2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは3以上の整数)の係数を保持する係数用レジスタと、
N個のデータ値を保持するデータレジスタと、
m個(2≦m<N)の積和演算器を備えた前処理回路と、
1〜N番目の積和レジスタを備えた後処理回路とを有し、
初期化サイクルにおいて前記1〜N番目の内の1〜N−1番目の積和レジスタを初期化し、
その後、1〜Nサイクルにかけて順に、前記2次元空間のN列×N行の範囲の1〜N列目のデータ値を前記データレジスタに保持し、
各サイクル毎に、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N個のデータ値と、前記N列×N行のいずれかの列のN個の係数との間の積和を演算する操作を、N回未満繰り返して行うことにより前記N個のデータ値と全ての列の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記N個のデータ値と前記1列目のN個の係数との間の積和演算結果を前記後処理回路の1番目の積和レジスタに保持するとともに、前記N個のデータ値と前記n列目(n=2〜N)の係数との間の積和演算結果と、前サイクルで前記後処理回路のn−1番目の積和レジスタに保持した値との積算値を、該後処理回路のn番目の積和レジスタに保持することにより、
前記N番目の積和レジスタから、前記2次元空間の前記N列×N行の範囲の中心に位置する第1の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路を提供する。
In order to achieve the above object , the present invention is an arithmetic circuit for performing a convolution operation of data arranged in a two-dimensional space,
A coefficient register for storing coefficients of N columns × N rows (N is an integer of 3 or more);
A data register holding N data values;
a pre-processing circuit including m (2 ≦ m <N) product-sum calculators;
And a post-processing circuit including 1st to Nth product-sum registers,
Initialize the 1-N-1 product-sum registers of the 1-Nth in the initialization cycle,
After that, in the order of 1 to N cycles, the data value of the 1st to Nth columns in the range of N columns × N rows of the two-dimensional space is held in the data register,
For each cycle,
In each of at least some of the m product-sum calculators of the preprocessing circuit, the product-sum between the N data values and the N coefficients of any column of the N columns × N rows. By calculating the product sum between the N data values and the coefficients of all the columns by repeating the operation of calculating N times less than N times,
A product-sum operation result between the N data values and the N coefficients in the first column calculated by the product-sum calculator is held in a first product-sum register of the post-processing circuit, and The product-sum operation result between the N data values and the coefficients of the n-th column (n = 2 to N), and the value held in the n−1th product-sum register of the post-processing circuit in the previous cycle Is held in the n-th product-sum register of the post-processing circuit,
Provided is an arithmetic circuit which outputs a convolution operation result of a first operation target point located at the center of the range of N columns × N rows in the two-dimensional space from the Nth product-sum register. .

ここで、前記後処理回路がさらに、前記1〜N番目の積和レジスタのそれぞれに対応して設けられた1〜N番目の一時レジスタを備え、
前記各サイクル毎に、前記積和演算器が演算した、前記データ値と前記1〜N列目の係数との間の積和演算結果のそれぞれを前記1〜N番目の一時レジスタに保持した後に、該一時レジスタのn番目に保持した積和演算結果と前記前サイクルでn−1番目の積和レジスタに保持された値との積算値を、前記n番目の積和レジスタに保持することが好ましい。
Here, the post-processing circuit further includes a 1-Nth temporary register provided corresponding to each of the 1-Nth product-sum registers,
After each product-sum operation result calculated by the product-sum operation unit between the data value and the coefficients in the 1st to Nth columns is held in the 1st to Nth temporary registers for each cycle. The integrated value of the n-th product-sum operation result held in the temporary register and the value held in the (n−1) -th product-sum register in the previous cycle may be held in the n-th product-sum register. preferable.

また、本発明は、2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは2以上の整数)の係数を保持する係数用レジスタと、
N列×N行のデータレジスタと、
N個の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを有し、
前記データレジスタに前記2次元空間のN列×N行の範囲の1〜N列目のデータを保持し、
第1サイクルにおいて、前記N個の内のn番目(n=1〜N)の積和演算器で、前記N列×N行のデータレジスタのn列目に保持されたN個のデータ値と前記N列×N行の1列目のN個の係数との間の積和を演算し、それぞれの演算結果を、前記後処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記データレジスタに保持されたデータを−1列分シフトし、該データレジスタのN列目に、前記2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、
前記n番目の積和演算器で、前記N列×N行のデータレジスタのn列目に保持されたN個のデータ値と前記N列×N行のk列目のN個の係数との間の積和を演算し、それぞれの演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、前記後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路を提供する。
The present invention is an arithmetic circuit for performing a convolution operation of data arranged in a two-dimensional space,
A coefficient register for holding coefficients of N columns × N rows (N is an integer of 2 or more);
N columns x N rows of data registers;
A preprocessing circuit having N product-sum calculators;
A post-processing circuit having N product-sum registers,
The data register holds the data of the 1st to Nth columns in the range of N columns × N rows of the two-dimensional space,
In the first cycle, the N data values held in the nth column of the data register of N columns × N rows in the nth (n = 1 to N) product-sum operation unit Calculate the sum of products with the N coefficients in the first column of the N columns × N rows, and store the respective operation results in the n th product sum register of the post-processing circuit,
Then, in order through the kth (k = 2 to N) cycle,
The data held in the data register is shifted by −1 column, and the N + k−1 column data adjacent to the N column × N row of the two-dimensional space in the column direction is shifted to the N column of the data register. Hold
In the nth product-sum operation unit, N data values held in the nth column of the N column × N row data register and N coefficients in the N column × N row k column The sum of the results of each operation and the value held in the nth product-sum register of the post-processing circuit in the previous cycle is calculated as the n-th product-sum register of the post-processing circuit. By repeating the operation to hold
From each of the N product-sum registers, a first calculation target point located in the center of a range of N columns × N rows of the two-dimensional space, and the first calculation target in the column direction of the two-dimensional space Provided is an arithmetic circuit characterized in that a convolution operation result of the 2nd to Nth operation target points that are adjacent to the point in order is output.

また、本発明は、2次元空間に配置されたデータとN列×N行(Nは2以上の整数)の係数との間の畳み込み演算を行う演算方法であって、
N個の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを用意し、
第1サイクルにおいて、前記2次元空間のN列×N行の範囲のデータ値と、前記N列×N行の第1列のN個の係数とを前記前処理回路に供給し、前記N個の内のn番目(n=1〜N)の積和演算器で、前記2次元空間のn列目のN個のデータ値と前記N個の係数との間の積和を演算し、その演算結果を、前記後処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記2次元空間のN列×N行のk列目から、該N列×N行の範囲に列方向に隣接する、N+k−1列目までのデータ値と、前記N列×N行の内のk列目のN個の係数とを前記前処理回路に供給し、前記n番目の積和演算器で、前記2次元空間の(N+k−1)列目のN個のデータ値と前記N個の係数との間の積和を演算し、それぞれの演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、前記後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算方法を提供する。
Further, the present invention is an arithmetic method for performing a convolution operation between data arranged in a two-dimensional space and coefficients of N columns × N rows (N is an integer of 2 or more),
A preprocessing circuit having N product-sum calculators;
Prepare a post-processing circuit with N product-sum registers,
In the first cycle, a data value in a range of N columns × N rows of the two-dimensional space and N coefficients of the first column of N columns × N rows are supplied to the preprocessing circuit, and the N pieces The product-sum calculator between the N data values in the n-th column of the two-dimensional space and the N coefficients is calculated by an nth (n = 1 to N) product-sum calculator The operation result is held in the nth product-sum register of the post-processing circuit,
Then, in order through the kth (k = 2 to N) cycle,
The data values from the Nth column × Nth row kth column to the N + k−1th column adjacent to the Nth column × Nth row in the column direction, and the Nth column × Nth row N coefficients in the k-th column are supplied to the pre-processing circuit, and the N-th product-sum calculator calculates the N data values in the (N + k−1) -th column in the two-dimensional space and the N The sum of products between the coefficients is calculated, and an integrated value of each operation result and the value held in the nth product-sum register of the post-processing circuit in the previous cycle is calculated as n of the post-processing circuit. By repeating the operation held in the th product-sum register,
From each of the N product-sum registers, a first calculation target point located in the center of a range of N columns × N rows of the two-dimensional space, and the first calculation target in the column direction of the two-dimensional space Provided is a calculation method characterized by outputting a convolution calculation result of 2nd to Nth calculation target points that are adjacent to a point in order.

また、本発明は、2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは2以上の整数)の係数を保持する係数用レジスタと、
N列×N行のデータレジスタと、
m個(m<N)の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを有し、
前記データレジスタに前記2次元空間内のN列×N行の範囲の1〜N列目のデータを保持し、
第1サイクルにおいて、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、前記N列×N行の1列目のN個の係数との間の積和を演算する操作を繰り返して行うことにより、前記データレジスタの全ての列に保持されたデータ値と前記1列目の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記データレジスタのn列目(n=1〜N)に保持されたデータ値と前記1列目の係数との間の積和演算結果を、前記前処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記データレジスタに保持されたデータを列方向に−1シフトし、該データレジスタのN列目に、前記2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、前記N列×N行のk列目のN個の係数との間の積和を演算する操作を、繰り返して行うことにより、前記データレジスタの全ての列に保持されたデータ値と前記k列目の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記データレジスタのn列目に保持されたデータ値と前記k列目の係数との間の積和演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、該後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1の演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路を提供する。
The present invention is an arithmetic circuit for performing a convolution operation of data arranged in a two-dimensional space,
A coefficient register for holding coefficients of N columns × N rows (N is an integer of 2 or more);
N columns x N rows of data registers;
a pre-processing circuit including m (m <N) product-sum calculators;
A post-processing circuit having N product-sum registers,
The data register holds data in the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space,
In the first cycle,
In each of at least some of the m product-sum calculators of the preprocessing circuit, N data values held in any column of the N columns × N rows of data registers, and the N columns × N By repeating the operation of calculating the product sum between the N coefficients in the first column of the row, the data values held in all the columns of the data register and the coefficients in the first column are The sum of products of
The pre-processing circuit calculates the product-sum operation result between the data value held in the n-th column (n = 1 to N) of the data register and the coefficient in the first column, which is calculated by the product-sum calculator. In the nth sum of products register
Then, in order through the kth (k = 2 to N) cycle,
The data held in the data register is shifted by −1 in the column direction, and the N + k−1th column adjacent to the N column × N row in the two-dimensional space in the column direction is shifted to the Nth column of the data register. Keep the data,
In each of at least some of the m product-sum calculators of the preprocessing circuit, N data values held in any column of the N columns × N rows of data registers, and the N columns × N By repeatedly performing the operation of calculating the sum of products between the N coefficients in the k-th column of the row, the data values held in all the columns of the data register and the coefficients in the k-th column are calculated. Perform product-sum operation between
The product-sum operation result between the data value held in the n-th column of the data register and the coefficient in the k-th column, calculated by the product-sum calculator, and the nth of the post-processing circuit in the previous cycle By repeating the operation of holding the integrated value with the value held in the product-sum register in the nth product-sum register of the post-processing circuit,
From each of the N product-sum registers, a first calculation target point located at the center of a range of N columns × N rows of the two-dimensional space, and the first calculation in the column direction of the two-dimensional space Provided is an arithmetic circuit that outputs a convolution calculation result of the 2nd to N-th calculation target points that are adjacent to the target point in order.

本発明によれば、従来と同様に、隣りあうデータの演算で共通に使用されるデータ値を記憶装置から2度読み出す必要がないという利点がある。また、本発明では、複数の積和演算器を用いて演算処理を行うことよって、従来の演算回路の数倍の処理速度を実現することができる。一方、処理速度が要求されない用途であれば、使用する積和演算器の個数を適宜減らす構成とすることもできるので、回路規模を適宜削減することができる。   According to the present invention, as in the prior art, there is an advantage that it is not necessary to read out twice from the storage device a data value that is commonly used in calculation of adjacent data. In the present invention, the processing speed is several times that of a conventional arithmetic circuit by performing arithmetic processing using a plurality of product-sum arithmetic units. On the other hand, if the processing speed is not required, the number of product-sum calculators to be used can be appropriately reduced, so that the circuit scale can be appropriately reduced.

以下に、添付の図面に示す好適実施形態に基づいて、本発明の演算回路および演算方法を詳細に説明する。   The arithmetic circuit and the arithmetic method of the present invention will be described below in detail based on preferred embodiments shown in the accompanying drawings.

図1は、本発明の演算回路の構成を表す第1の実施形態の概略図である。同図に示す演算回路10は、2次元空間に配置された元画像の内の2列×2行の4画素分の画素値から、畳み込み演算によるフィルタ処理を順次行う。演算回路10は、元画像用レジスタ12と、係数用レジスタ14と、前処理回路22と、後処理回路24とによって構成されている。   FIG. 1 is a schematic diagram of the first embodiment showing the configuration of the arithmetic circuit of the present invention. The arithmetic circuit 10 shown in the figure sequentially performs filter processing by convolution operation from pixel values of 4 pixels of 2 columns × 2 rows in an original image arranged in a two-dimensional space. The arithmetic circuit 10 includes an original image register 12, a coefficient register 14, a preprocessing circuit 22, and a postprocessing circuit 24.

元画像用レジスタ(本発明のデータレジスタ)12は、クロック信号に同期して、元画像の各画素の画素値が記憶されている画像情報記憶装置(図示省略、図14を参照)から処理順に読み出される、処理対象の1列の2画素分の画素値を、それぞれL1,L2として順次保持する。元画像用レジスタ12の出力L1,L2は、前処理回路22の積和演算器16a、16bの両方に共通に入力される。   The original image register (data register of the present invention) 12 is synchronized with the clock signal and is processed in the order of processing from an image information storage device (not shown, see FIG. 14) in which the pixel value of each pixel of the original image is stored. The read pixel values of two pixels in one column to be processed are sequentially held as L1 and L2, respectively. The outputs L1 and L2 of the original image register 12 are commonly input to both the product-sum calculators 16a and 16b of the preprocessing circuit 22.

係数用レジスタ14は、演算回路10の機能(フィルタ処理)を決定する係数値を保持する。本実施形態の場合、係数用レジスタ14には、元画像の2列×2行=4画素に対応する4個の係数値C11,C21,C12,C22が保持されている。1列目の係数値C11,C21は積和演算器16aに入力され、2列目の係数値C12,C22は積和演算器16bに入力される。   The coefficient register 14 holds a coefficient value that determines the function (filter processing) of the arithmetic circuit 10. In the present embodiment, the coefficient register 14 holds four coefficient values C11, C21, C12, and C22 corresponding to 2 columns × 2 rows = 4 pixels of the original image. The coefficient values C11 and C21 in the first column are input to the product-sum calculator 16a, and the coefficient values C12 and C22 in the second column are input to the product-sum calculator 16b.

前処理回路22は、列数分(行数分)の2つの積和演算器16a、16bによって構成されている。   The preprocessing circuit 22 is composed of two product-sum calculators 16a and 16b for the number of columns (for the number of rows).

積和演算器16aは、1列の2画素分の画素値L1,L2と、図1中左側から1列目の2つの係数値C11,C21との積和演算C11L1+C21L2を行う。   The product-sum calculator 16a performs a product-sum operation C11L1 + C21L2 of the pixel values L1 and L2 for two pixels in one column and the two coefficient values C11 and C21 in the first column from the left side in FIG.

積和演算器16bは、1列の2画素分の画素値L1,L2と、同2列目の2つの係数値C12,C22との積和演算C12L1+C22L2を行う。積和演算器16bから出力される演算結果(b)は、加算器18に入力される。   The product-sum operation unit 16b performs a product-sum operation C12L1 + C22L2 of the pixel values L1 and L2 for two pixels in one column and the two coefficient values C12 and C22 in the second column. The calculation result (b) output from the product-sum calculator 16 b is input to the adder 18.

積和演算器16a、16bは、例えば図17に示す構成とすることができる。なお、積和演算器16a、16bの構成は、何ら限定されず、同様の積和演算を行うことができる各種構成のものがいずれも使用可能である。   The product-sum calculators 16a and 16b can be configured as shown in FIG. 17, for example. The configuration of the product-sum calculators 16a and 16b is not limited at all, and any of various configurations capable of performing the same product-sum operation can be used.

続いて、後処理回路24は、列数分の2つの積和レジスタ21a、21bによって構成されている。   Subsequently, the post-processing circuit 24 includes two product-sum registers 21a and 21b corresponding to the number of columns.

積和レジスタ21aは、フリップフロップ20aによって構成されている。フリップフロップ20aは、クロック信号(図示省略)の有効エッジ(クロックエッジ)のタイミングで、積和演算器16aの出力T1を保持値P1として保持する。言い変えると、積和レジスタ21aは、積和演算器16aの出力と0との加算結果を保持する。このため、次に述べる積和レジスタ21bと比べて加算器が省略されている。フリップフロップ20aはまた、P1を保持する以前には、前サイクルで保持された値を、出力P1’として加算器18に出力する。   The product-sum register 21a is constituted by a flip-flop 20a. The flip-flop 20a holds the output T1 of the product-sum calculator 16a as the hold value P1 at the timing of the valid edge (clock edge) of the clock signal (not shown). In other words, the product-sum register 21a holds the addition result of the output of the product-sum calculator 16a and 0. For this reason, an adder is omitted as compared with a product-sum register 21b described below. The flip-flop 20a also outputs the value held in the previous cycle to the adder 18 as the output P1 'before holding P1.

積和レジスタ21bは、加算器18と、フリップフロップ20bとによって構成されている。加算器18によって、積和演算器16bの出力T2と、フリップフロップ20aの出力P1’との加算が行われ、その加算結果(o)は、クロックエッジのタイミングで、フリップフロップ20bに保持値P2として保持される。このように、積和レジスタ21bは、加算器18とフリップフロップ20bとを備えることにより、積和演算器16bの演算結果と前サイクルで積和レジスタ21aに保持された値との積算値を算出し、保持する。フリップフロップ20bに保持された値P2は、フィルタ処理後の画像の各画素の画素値として出力される。   The product-sum register 21b includes an adder 18 and a flip-flop 20b. The adder 18 adds the output T2 of the product-sum calculator 16b and the output P1 ′ of the flip-flop 20a, and the addition result (o) is stored in the flip-flop 20b at the hold value P2 at the timing of the clock edge. Held as. As described above, the product-sum register 21b includes the adder 18 and the flip-flop 20b, thereby calculating an integrated value between the operation result of the product-sum operation unit 16b and the value held in the product-sum register 21a in the previous cycle. And hold. The value P2 held in the flip-flop 20b is output as the pixel value of each pixel of the image after filtering.

なお、演算結果を保持するためにフリップフロップ20a、20bに供給するクロック信号は、画素値を保持するために元画素用レジスタ12に供給するクロック信号と同一のものにすることができる。そして、クロック信号の第1の有効エッジのタイミングで元画像用レジスタ12に保持した画素値を利用した演算結果を、同一のクロック信号の次の有効エッジのタイミングで、フリップフロップ20a、20bに保持することができる。この場合、クロック信号の第1の有効エッジから、次の有効エッジまでの期間が、演算回路10の1つの演算サイクルになる。   The clock signal supplied to the flip-flops 20a and 20b for holding the calculation result can be the same as the clock signal supplied to the original pixel register 12 for holding the pixel value. The calculation result using the pixel value held in the original image register 12 at the timing of the first valid edge of the clock signal is held in the flip-flops 20a and 20b at the timing of the next valid edge of the same clock signal. can do. In this case, the period from the first valid edge of the clock signal to the next valid edge is one computation cycle of the computation circuit 10.

次に、演算回路10の基本的な動作を説明する。   Next, the basic operation of the arithmetic circuit 10 will be described.

演算回路10では、初期化のサイクルで、少なくともフリップフロップ20aが初期化され、その保持値は0となる。また、係数用レジスタ14には、4個の係数値C11,C21,C12,C22が設定(保持)される。   In the arithmetic circuit 10, at least the flip-flop 20a is initialized in the initialization cycle, and the held value becomes zero. Further, four coefficient values C11, C21, C12, and C22 are set (held) in the coefficient register 14.

続いて、各サイクル毎に、処理順に読み出される元画像の1列の2画素分の画素値が、L1,L2として元画像用レジスタ12に保持される。例えば、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われる場合、元画像用レジスタ12のL1,L2には、1サイクル毎に、図8中左側から、1列目のL11,L21、2列目のL12,L22、3列目のL13,L23…の順序で1列の2画素分の画素値が保持される。   Subsequently, for each cycle, pixel values for two pixels in one column of the original image read in the processing order are held in the original image register 12 as L1 and L2. For example, when the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device and the filtering process is sequentially performed in the order shown in FIG. For each cycle, the pixel values of two pixels in one column are held in the order of L11, L21 in the first column, L12, L22 in the second column, L13, L23 in the third column, and so on from the left side in FIG. .

前処理回路22の積和演算器16aでは、元画像用レジスタ12から入力される1列の2画素分の画素値L1,L2と、係数用レジスタ14から入力される1列目の係数値C11,C21との積和演算C11L1+C21L2が行われる。また、積和演算器16bでは、同じく1列の2画素分の画素値L1,L2と、2列目の係数値C12,C22との積和演算C12L1+C22L2が行われる。   In the product-sum calculator 16 a of the pre-processing circuit 22, the pixel values L 1 and L 2 for two pixels in one column input from the original image register 12 and the coefficient value C 11 in the first column input from the coefficient register 14. , C21 and product-sum operation C11L1 + C21L2. Similarly, the product-sum calculator 16b performs a product-sum operation C12L1 + C22L2 of the pixel values L1 and L2 for two pixels in one column and the coefficient values C12 and C22 in the second column.

積和演算器16aの出力T1は、クロックエッジのタイミングで後処理回路24の積和レジスタ21aのフリップフロップ20aに保持値P1として保持される。そして、加算器18により、積和演算器16bの出力T2と、フリップフロップ20aの出力P1’(=1サイクル前の積和演算器16aの出力T1)とが加算される。その加算結果(o)は、同じくクロックエッジのタイミングで、積和レジスタ21bのフリップフロップ20bに保持値P2として保持され、フィルタ処理後の画像の各画素の画素値として順次出力される。   The output T1 of the product-sum calculator 16a is held as the hold value P1 in the flip-flop 20a of the product-sum register 21a of the post-processing circuit 24 at the timing of the clock edge. Then, the adder 18 adds the output T2 of the product-sum calculator 16b and the output P1 'of the flip-flop 20a (= 1 output T1 of the product-sum calculator 16a before one cycle). The addition result (o) is held as the hold value P2 in the flip-flop 20b of the product-sum register 21b at the same clock edge timing, and sequentially output as the pixel value of each pixel of the image after the filter processing.

なお、フィルタ処理後の画像の各画素(演算対象点)の画素値(畳み込み演算結果)は、図10〜図12に示すように、2次元空間の2列×2行の処理対象の画素の範囲の中心に位置する。   Note that the pixel value (convolution operation result) of each pixel (calculation target point) of the image after the filter processing is as shown in FIG. 10 to FIG. 12 of the pixel to be processed of 2 columns × 2 rows in the two-dimensional space. Located at the center of the range.

次に、下記表2を参照しながら、演算回路10の動作を具体的に説明する。以下の説明では、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われるものとする。   Next, the operation of the arithmetic circuit 10 will be specifically described with reference to Table 2 below. In the following description, it is assumed that the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device, and the filter processing is sequentially performed in the order shown in FIG.

Figure 0004833690
Figure 0004833690

表2には、各サイクルの開始時に元画像用レジスタ12に保持される画素値L1,L2、その画素値を利用して積和演算器16a、16bが算出する積和演算結果T1,T2、および、同一サイクルの最後にフリップフロップ20a、20bに保持される値P1,P2を示す。後から示す表3、4についても同様である。   Table 2 shows pixel values L1 and L2 held in the original image register 12 at the start of each cycle, and product-sum operation results T1 and T2 calculated by the product-sum operation units 16a and 16b using the pixel values. The values P1 and P2 held in the flip-flops 20a and 20b at the end of the same cycle are shown. The same applies to Tables 3 and 4 shown later.

最初のサイクルは、初期化のサイクルである。少なくともフリップフロップ20aの保持値が0に初期化される。   The first cycle is an initialization cycle. At least the hold value of the flip-flop 20a is initialized to zero.

サイクル1では、クロック信号の最初のエッジのタイミングで画像情報記憶装置から、図8中左側から1列目の2画素分の画素値L11,L21が読み出され、元画像用レジスタ12に、それぞれL1,L2として保持される。その結果、積和演算器16aからは、演算結果T1=C11L11+C21L21が出力され、積和演算器16bからは、演算結果T2=C12L11+C22L21が出力される。   In cycle 1, the pixel values L11 and L21 for the two pixels in the first column from the left side in FIG. 8 are read from the image information storage device at the timing of the first edge of the clock signal, and are stored in the original image register 12 respectively. It is held as L1 and L2. As a result, the operation result T1 = C11L11 + C21L21 is output from the product-sum operation unit 16a, and the operation result T2 = C12L11 + C22L21 is output from the product-sum operation unit 16b.

フリップフロップ20aには、クロック信号の次のエッジのタイミングで、積和演算器16aの出力T1=C11L11+C21L21が保持値P1として保持される。加算器18からは、フリップフロップ20aの出力P1’(表2では、前のサイクル、すなわち、初期化サイクルでのP1の値として示されている)=0と積和演算器16bの出力T2=C12L11+C22L21との積算結果(o)=C12L11+C22L21が出力される。フリップフロップ20bには、クロックエッジのタイミングで、この積算結果(o)が保持値P2として保持される。   The flip-flop 20a holds the output T1 = C11L11 + C21L21 of the product-sum calculator 16a as the hold value P1 at the timing of the next edge of the clock signal. From the adder 18, the output P1 ′ of the flip-flop 20a (shown in Table 2 as the value of P1 in the previous cycle, that is, the initialization cycle) = 0 and the output T2 of the product-sum calculator 16b = Integration result with C12L11 + C22L21 (o) = C12L11 + C22L21 is output. In the flip-flop 20b, the integration result (o) is held as the hold value P2 at the timing of the clock edge.

続いて、サイクル2では、画像情報記憶装置から、同2列目の2画素分の画素値L12,L22が読み出され、元画像用レジスタ12に、それぞれL1,L2として保持される。その結果、積和演算器16aからは、演算結果T1=C11L12+C21L22が出力され、積和演算器16bからは、演算結果T2=C12L12+C22L22が出力される。   Subsequently, in cycle 2, pixel values L12 and L22 for two pixels in the second column are read from the image information storage device, and are stored in the original image register 12 as L1 and L2, respectively. As a result, the operation result T1 = C11L12 + C21L22 is output from the product-sum operation unit 16a, and the operation result T2 = C12L12 + C22L22 is output from the product-sum operation unit 16b.

フリップフロップ20aには、クロックエッジに同期して、積和演算器16aの出力T1=C11L11+C21L21が保持される。加算器18からは、前サイクル(サイクル1)でフリップフロップ20aに保持された値P1’(表2では、前のサイクル、すなわち、サイクル1でのP1の値として示されている)=C11L11+C21L21と積和演算器16bの出力T2=C12L12+C22L22との積算結果(o)=C11L11+C12L12+C21L21+C22L22が出力される。フリップフロップ20bには、クロックエッジのタイミングで、この積算結果(o)が保持値P2として保持される。そして、フリップフロップ20bからは、この保持値が、フィルタ処理後の画素値P11として出力される。   The flip-flop 20a holds the output T1 = C11L11 + C21L21 of the product-sum calculator 16a in synchronization with the clock edge. From the adder 18, the value P1 ′ held in the flip-flop 20a in the previous cycle (cycle 1) (shown in Table 2 as the value of P1 in the previous cycle, ie, cycle 1) = C11L11 + C21L21 Accumulation result (o) = C11L11 + C12L12 + C21L21 + C22L22 with the output T2 = C12L12 + C22L22 of the product-sum calculator 16b is output. In the flip-flop 20b, the integration result (o) is held as the hold value P2 at the timing of the clock edge. Then, the hold value is output from the flip-flop 20b as the pixel value P11 after the filter processing.

続いて、サイクル3では、画像情報記憶装置から、同3列目の2画素分の画素値L13,L23が読み出され、元画像用レジスタ12に、それぞれL1,L2として保持される。その結果、積和演算器16aからは、演算結果T1=C11L13+C21L23が出力され、積和演算器16bからは、演算結果T2=C12L13+C22L23が出力される。   Subsequently, in cycle 3, the pixel values L13 and L23 for the two pixels in the third column are read from the image information storage device and held in the original image register 12 as L1 and L2, respectively. As a result, the operation result T1 = C11L13 + C21L23 is output from the product-sum operation unit 16a, and the operation result T2 = C12L13 + C22L23 is output from the product-sum operation unit 16b.

フリップフロップ20aには、クロックエッジのタイミングで、積和演算器16aの出力T1=C11L12+C21L22が保持される。加算器18からは、前サイクル(サイクル2)でフリップフロップ20aに保持された値P1’=C11L12+C21L22と積和演算器16bの出力T2=C12L13+C22L23との加算結果(o)=C11L12+C12L13+C21L22+C22L23が出力される。フリップフロップ20bには、クロックエッジのタイミングで、この加算結果(o)が保持され、フィルタ処理後の画素の画素値P12として出力される。   The flip-flop 20a holds the output T1 = C11L12 + C21L22 of the product-sum calculator 16a at the timing of the clock edge. The adder 18 outputs the addition result (o) = C11L12 + C12L13 + C21L22 + C22L23 of the value P1 ′ = C11L12 + C21L22 held in the flip-flop 20a in the previous cycle (cycle 2) and the output T2 = C12L13 + C22L23 of the product-sum calculator 16b. This addition result (o) is held in the flip-flop 20b at the timing of the clock edge, and is output as the pixel value P12 of the pixel after the filter processing.

これ以降の動作は、上記と同様である。演算回路10では、初期化後、2サイクルでフィルタ処理後の最初の画素の画素値P11が出力され、以後、1サイクル毎に、フィルタ処理後の2番目以降の画素の画素値P12,P13,…が順次出力される。   The subsequent operation is the same as described above. In the arithmetic circuit 10, the pixel value P11 of the first pixel after the filtering process is output in two cycles after the initialization. Thereafter, the pixel values P12, P13, ... are output sequentially.

なお、表2では、初期化サイクルにおいてフリップフロップ20bの保持値P2も0に初期化した場合を示した。しかし、サイクル1において、クロック信号以前に出力される値P1’が演算に利用されるフリップフロップ20aについては初期化の必要があるが、フリップフロップ20bについては初期化は必須ではない。また、図13に示す順序で1行目のフィルタ処理後の画素の画素値P11〜P15の出力を終えた後には、再び初期化サイクルを行ってから、1行目と同様のサイクルを繰り返すことによって2行目のフィルタ処理後の画素の画素値の保持および出力を行う。   Table 2 shows a case where the hold value P2 of the flip-flop 20b is also initialized to 0 in the initialization cycle. However, in cycle 1, it is necessary to initialize the flip-flop 20a in which the value P1 'output before the clock signal is used for the operation, but the initialization is not essential for the flip-flop 20b. Further, after the output of the pixel values P11 to P15 of the pixels after the filter processing in the first row in the order shown in FIG. 13, the initialization cycle is performed again, and then the same cycle as the first row is repeated. To hold and output the pixel value of the pixel after the filter processing in the second row.

本実施形態の演算回路10では、図14に示す従来の演算回路140と同様に、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点がある。また、従来の演算回路140では、積和演算器が1つだけしか用いられていないが、本実施形態の演算回路10では、2つの積和演算器を用いることによって、従来の演算回路140の2倍の処理速度が実現されている。さらに、従来の演算回路140とは異なり、カウンタ156やマルチプレクサ149を用いた複雑な制御を必要としない。従って、単純な構成で高い処理速度を実現することが可能である。   In the arithmetic circuit 10 of the present embodiment, as in the conventional arithmetic circuit 140 shown in FIG. 14, it is necessary to read the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device twice. There is an advantage that there is no. In addition, in the conventional arithmetic circuit 140, only one product-sum arithmetic unit is used, but in the arithmetic circuit 10 of the present embodiment, by using two product-sum arithmetic units, Twice the processing speed is realized. Further, unlike the conventional arithmetic circuit 140, complicated control using the counter 156 and the multiplexer 149 is not required. Therefore, it is possible to realize a high processing speed with a simple configuration.

次に、第1の実施形態の別の例として、元画像の5列×5行の25画素分の画素値を用いて畳み込み演算によるフィルタ処理を行う演算回路について説明する。   Next, as another example of the first embodiment, an arithmetic circuit that performs filter processing by convolution operation using pixel values for 25 pixels of 5 columns × 5 rows of the original image will be described.

図2は、本発明の演算回路の構成を表す第2の実施形態の概念図である。同図に示す演算回路30は、演算回路10と比べると抽象的な表現となっているが、2次元空間に配置された元画像の5列×5行の25画素分の画素値から、同様の畳み込み演算によるフィルタ処理を行う。演算回路30は、元画像用レジスタ32と、係数用レジスタ34と、前処理回路42と、後処理回路44とによって構成されている。   FIG. 2 is a conceptual diagram of the second embodiment showing the configuration of the arithmetic circuit of the present invention. The arithmetic circuit 30 shown in the figure is an abstract expression compared to the arithmetic circuit 10, but it is similar from the pixel values for 25 pixels of 5 columns × 5 rows of the original image arranged in the two-dimensional space. Filter processing by convolution operation. The arithmetic circuit 30 includes an original image register 32, a coefficient register 34, a preprocessing circuit 42, and a postprocessing circuit 44.

以下、図2に示す演算回路30について、図1の演算回路10との違いを重点的に説明する。   Hereinafter, the difference between the arithmetic circuit 30 shown in FIG. 2 and the arithmetic circuit 10 shown in FIG. 1 will be mainly described.

演算回路30において、元画像用レジスタ32および係数用レジスタ34は、図1の演算回路10の元画像用レジスタ12および係数用レジスタ14と同様の機能を有する。なお、図2では、元画像用レジスタ32が、Liと記された縦長の長方形で表現されている。これは、処理対象となる元画像のi番目の1列の5画素分の画素値L1i〜L5iをまとめてLiと簡略的に表現したものである。また、係数用レジスタ34のC1〜C5についても同様である。 In the arithmetic circuit 30, the original image register 32 and the coefficient register 34 have the same functions as the original image register 12 and the coefficient register 14 of the arithmetic circuit 10 in FIG. In FIG. 2, the original image register 32 is represented by a vertically long rectangle denoted by L i . This is obtained by L i and a simplified representation together pixel values L1i~L5i of five pixels of the i-th row of the original image to be processed. The same applies to C1 to C5 of the coefficient register 34.

前処理回路42は、列数分の5つの積和演算器36a、36b、36c、36d、36eによって構成されている。前処理回路42も、図1の演算回路10の前処理回路22と同様の機能を有する。例えば、図2中、一番上側(上側から1番目)の積和演算器36aは、C1Li(=C11L1i+C21L2i+C31L3i+C41L4i+C51L5i)の演算を行い、その演算結果T1を出力する。また、2〜5番目の積和演算器36b、36c、36d、36eも同様である。 The preprocessing circuit 42 includes five product-sum calculators 36a, 36b, 36c, 36d, and 36e corresponding to the number of columns. The preprocessing circuit 42 also has the same function as the preprocessing circuit 22 of the arithmetic circuit 10 in FIG. For example, in FIG. 2, the uppermost product-sum calculator 36a (first from the top) performs the calculation of C1L i (= C11L1i + C21L2i + C31L3i + C41L4i + C51L5i) and outputs the calculation result T1. The same applies to the second to fifth product-sum calculators 36b, 36c, 36d, and 36e.

また、後処理回路44は、列数分の5つの積和レジスタ41a、41b、41c、41d、41eによって構成されている。後処理回路44も、図1の演算回路10の積和レジスタ21a、21bと同様に構成され、同様の機能を有する。すなわち、1つめの積和レジスタ41aはフリップフロップのみからなるが、2〜5つめの積和レジスタ41b〜41eは、加算器とフリップフロップとから構成されている。   The post-processing circuit 44 includes five product-sum registers 41a, 41b, 41c, 41d, and 41e corresponding to the number of columns. The post-processing circuit 44 is also configured similarly to the product-sum registers 21a and 21b of the arithmetic circuit 10 in FIG. 1, and has the same function. That is, the first product-sum register 41a is composed of only flip-flops, while the second to fifth product-sum registers 41b-41e are composed of adders and flip-flops.

一番上側(上側から1番目)の積和レジスタ41aは、クロックエッジのタイミングで、1番目の積和演算器36aの出力T1を保持値P1として保持する。   The uppermost (first from the top) product-sum register 41a holds the output T1 of the first product-sum calculator 36a as the hold value P1 at the timing of the clock edge.

2番目の積和レジスタ41bは、クロックエッジのタイミングで、積和レジスタ41aの出力P1’と積和演算器36bの演算結果T2との加算結果を保持値P2として保持する。   The second product-sum register 41b holds the addition result of the output P1 'of the product-sum register 41a and the calculation result T2 of the product-sum calculator 36b as the hold value P2 at the timing of the clock edge.

3〜5番目の積和レジスタ41c、41d、41eは、2番目の積和レジスタ41bと同様に動作する。そして、最後(5番目)の積和レジスタ41eにクロック信号に同期して保持された保持値P5が、フィルタ処理後の画像の各画素の画素値Pとして出力される。   The third to fifth product-sum registers 41c, 41d, and 41e operate in the same manner as the second product-sum register 41b. Then, the hold value P5 held in synchronization with the clock signal in the last (fifth) product-sum register 41e is output as the pixel value P of each pixel of the image after filtering.

なお、画素値および係数値を8ビットとすると、図2に示すように、元画像用レジスタ32から前処理回路42に対しては8ビット×5=40本の配線が接続され、係数用レジスタ34から前処理回路42に対しては8ビット×5×5=200本の配線が接続される。また、演算結果T1〜T5を8ビットとすると、前処理回路42から後処理回路44に対しては8ビット×5=40本の配線が接続される。そして、フィルタ処理後の画素の画素値を8ビットとすると、後処理回路44からは、8ビット=8本の配線が接続される。また、これ以後の実施形態においても、必要に応じて、図中に配線のビット数を示す。   If the pixel value and the coefficient value are 8 bits, as shown in FIG. 2, 8 bits × 5 = 40 wires are connected from the original image register 32 to the preprocessing circuit 42, and the coefficient register From 34 to the pre-processing circuit 42, 8 bits × 5 × 5 = 200 wires are connected. Also, assuming that the calculation results T1 to T5 are 8 bits, 8 bits × 5 = 40 wires are connected from the preprocessing circuit 42 to the postprocessing circuit 44. When the pixel value of the pixel after the filter processing is 8 bits, 8 bits = 8 wires are connected from the post-processing circuit 44. Also in the subsequent embodiments, the number of wiring bits is shown in the figure as necessary.

演算回路30の基本的な動作は、図1の演算回路10と同様であるから、ここでは、繰り返しの説明を省略する。   Since the basic operation of the arithmetic circuit 30 is the same as that of the arithmetic circuit 10 of FIG. 1, repeated description is omitted here.

同様に、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われる場合、演算回路30の具体的な動作は、下記表3,4に示す通りである。   Similarly, when the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device and the filtering process is sequentially performed in the order shown in FIG. 13, the specific operation of the arithmetic circuit 30 is as shown in the following table. As shown in 3 and 4.

Figure 0004833690
Figure 0004833690

Figure 0004833690
Figure 0004833690

なお、上記表3,4において、元画像用レジスタ32の出力Liは、サイクル1でL1となっているが、L1=L11,L21,L31,L41,L51の意味である。サイクル2〜6のL2〜L6も同様である。また、積和演算器36aの出力T1は、サイクル1でC1L1となっているが、C1L1=C11L11+C21L21+C31L31+C41L41+C51L51の意味である。積和演算器36b、36c、36d、36eの出力T2〜T5、積和レジスタ41a、41b、41c、41d、41eの出力P1〜P5も同様である。 In Tables 3 and 4, the output L i of the original image register 32 is L1 in cycle 1, which means L1 = L11, L21, L31, L41, and L51. The same applies to L2 to L6 of cycles 2 to 6. The output T1 of the product-sum calculator 36a is C1L1 in cycle 1, which means C1L1 = C11L11 + C21L21 + C31L31 + C41L41 + C51L51. The same applies to the outputs T2 to T5 of the product-sum calculators 36b, 36c, 36d, and 36e, and the outputs P1 to P5 of the product-sum registers 41a, 41b, 41c, 41d, and 41e.

演算回路30では、初期化後、5サイクルでフィルタ処理後の最初の画素の画素値Pが出力され、以後、1サイクル毎に、フィルタ処理後の2番目以降の画素の画素値Pが順次出力される。また、演算回路30では、同様に、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点があるのはもちろん、5つの積和演算器が用いられているので、従来の5倍の処理速度が実現されている。   In the arithmetic circuit 30, after initialization, the pixel value P of the first pixel after filtering is output in five cycles, and thereafter, the pixel value P of the second and subsequent pixels after filtering is sequentially output every cycle. Is done. Similarly, the arithmetic circuit 30 has the advantage that it is not necessary to read out the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device twice. Since a product-sum operation unit is used, a processing speed five times that of the conventional one is realized.

なお、本発明は、上記第1および第2の実施形態のように、画像データに限らず、2次元空間に配置された、あらゆる種類のデータのデータ値を畳み込み演算によってフィルタ処理する演算回路にも同様に適用可能である。これ以後の実施形態においても同様である。また、上記第1および第2の実施形態の演算回路10,30は、2列×2行や5列×5行のフィルタ処理に限らず、N列×N行(Nは2以上の整数)のフィルタ処理を行う演算回路に適用可能である。   Note that the present invention is not limited to image data as in the first and second embodiments, and is an arithmetic circuit that filters data values of all types of data arranged in a two-dimensional space by a convolution operation. Is equally applicable. The same applies to the following embodiments. The arithmetic circuits 10 and 30 of the first and second embodiments are not limited to the filtering process of 2 columns × 2 rows or 5 columns × 5 rows, but N columns × N rows (N is an integer of 2 or more). The present invention can be applied to an arithmetic circuit that performs this filtering process.

第1および第2の実施形態の演算回路では、一般的に、初期化後、第1〜Nサイクルにかけて順に、2次元空間のN列×N行の範囲の1〜N列目のデータ値がデータレジスタに保持され、1番目の積和演算器の演算結果が1番目の積和レジスタに保持される。また、n番目(n=2〜N)の積和演算器の演算結果と、前サイクルでn−1番目の積和レジスタに保持された値との積算値がn番目の積和レジスタに保持される。これにより、N番目の積和レジスタから、2次元空間のN列×N行の範囲の中心に位置する第1の演算対象点の畳み込み演算結果が出力される。   In the arithmetic circuits of the first and second embodiments, generally, after the initialization, the data values of the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space are sequentially given from the 1st to Nth cycles. It is held in the data register and the operation result of the first product-sum operation unit is held in the first product-sum register. Also, the integrated value of the operation result of the nth (n = 2 to N) product-sum operation unit and the value held in the n−1th product-sum register in the previous cycle is held in the nth product-sum register. Is done. As a result, the convolution calculation result of the first calculation target point located at the center of the range of N columns × N rows in the two-dimensional space is output from the Nth product-sum register.

また、1〜Nサイクルに続くN+1サイクルにおいてさらに、順に、2次元空間のN列×N行の範囲に隣接するN+1列目以降のデータ値がデータレジスタに保持される。これにより、N+M(Mは1以上の整数)サイクル後に、N番目の積和レジスタから、第1の演算対象点から列方向に順に隣りあうM番目の演算対象点の畳み込み演算結果が出力される。   Further, in the (N + 1) cycle following the 1st to Nth cycles, the data values after the (N + 1) th column adjacent to the range of N columns × N rows in the two-dimensional space are sequentially held in the data register. As a result, after N + M cycles (M is an integer equal to or greater than 1), the Nth product-sum register outputs the convolution calculation result of the Mth calculation target point adjacent in the column direction from the first calculation target point. .

次に、本発明の第3の実施形態について説明する。   Next, a third embodiment of the present invention will be described.

図3は、本発明の演算回路の構成を表す第3の実施形態の概念図である。同図に示す演算回路50も、図2の演算回路30と同様に、2次元空間に配置された元画像の5列×5行の25画素分の画素値から、畳み込み演算によるフィルタ処理を行う。図3の演算回路50は、元画像用レジスタ52と、係数用レジスタ54と、前処理回路62と、後処理回路64と、カウンタ66とによって構成されている。   FIG. 3 is a conceptual diagram of the third embodiment showing the configuration of the arithmetic circuit of the present invention. Similar to the arithmetic circuit 30 in FIG. 2, the arithmetic circuit 50 shown in FIG. 2 also performs filter processing by convolution operation from pixel values for 25 pixels of 5 columns × 5 rows of the original image arranged in the two-dimensional space. . The arithmetic circuit 50 shown in FIG. 3 includes an original image register 52, a coefficient register 54, a preprocessing circuit 62, a postprocessing circuit 64, and a counter 66.

また、図4は、図3の演算回路50を具体的に表現した概略図である。なお、図4では、その煩雑さを避けるために、カウンタ66の表示を省略し、そのカウント値がj=0〜2で表されている。例えば、フリップフロップ60a1のクロック端子はj=0となっているが、これは、フリップフロップ60a1には、カウンタ66のカウント値j=0である期間に、クロック信号が入力されることを意味する。   FIG. 4 is a schematic diagram specifically showing the arithmetic circuit 50 of FIG. In FIG. 4, in order to avoid the complexity, the display of the counter 66 is omitted, and the count value is represented by j = 0-2. For example, the clock terminal of the flip-flop 60a1 is j = 0, which means that the clock signal is input to the flip-flop 60a1 during the period when the count value j = 0 of the counter 66. .

以下、図3および図4に示す演算回路50について、図2の演算回路30との違いを重点的に説明する。   Hereinafter, the difference between the arithmetic circuit 50 shown in FIGS. 3 and 4 and the arithmetic circuit 30 shown in FIG. 2 will be mainly described.

演算回路50において、元画像用レジスタ52および係数用レジスタ54は、図2の演算回路30の元画像用レジスタ32および係数用レジスタ34と同様の機能を有する。   In the arithmetic circuit 50, the original image register 52 and the coefficient register 54 have the same functions as the original image register 32 and the coefficient register 34 of the arithmetic circuit 30 in FIG.

図2の演算回路30では、係数用レジスタ34から5つの積和演算器36a、36b、36c、36d、36eに各々対応する係数値C1〜C5が同時(並列)に出力される。これに対し、図3の演算回路50では、カウンタ66のカウント値jが変わる毎に、係数用レジスタ54から2つの積和演算器56a、56bに、1つまたは2つの係数値のみが同時(並列)に出力される。両者は、この点で異なっている。   In the arithmetic circuit 30 of FIG. 2, coefficient values C1 to C5 respectively corresponding to the five product-sum calculators 36a, 36b, 36c, 36d, and 36e are output simultaneously (in parallel) from the coefficient register 34. On the other hand, in the arithmetic circuit 50 of FIG. 3, every time the count value j of the counter 66 changes, only one or two coefficient values are simultaneously sent from the coefficient register 54 to the two product-sum calculators 56a and 56b ( Output in parallel). The two are different in this respect.

図2に示す演算回路30では、1つの係数値Cを8ビットとすると、8ビット×5×5=200本の配線が必要となる。これに対し、図3および図4に示す演算回路50では、係数用レジスタ54から出力される係数値は最大で2つであるから、同じく1つの係数値を8ビットとすると、8ビット×5×2=80本の配線だけしか必要がなく、配線数を2/5に削減することができる。   In the arithmetic circuit 30 shown in FIG. 2, if one coefficient value C is 8 bits, 8 bits × 5 × 5 = 200 wires are required. On the other hand, in the arithmetic circuit 50 shown in FIGS. 3 and 4, since the coefficient value output from the coefficient register 54 is two at the maximum, if one coefficient value is similarly 8 bits, 8 bits × 5 X2 = Only 80 wires are required, and the number of wires can be reduced to 2/5.

つまり、本実施形態の場合、係数用レジスタ54の出力ビット幅を少なくできる。このように、出力ビット幅を少なくすることにより、係数用レジスタ54として、レジスタではなく、実際には、より面積が小さいメモリやFIFOなどを使用することが可能となる。また、このことは、係数用レジスタ54に限らず、以下の実施形態に示すように、元画像用レジスタについても同様である。   That is, in the present embodiment, the output bit width of the coefficient register 54 can be reduced. As described above, by reducing the output bit width, it is possible to use a memory, FIFO, or the like having a smaller area in place of the register as the coefficient register 54. Further, this is not limited to the coefficient register 54, and the same applies to the original image register as shown in the following embodiment.

続いて、前処理回路62は、列数(5)に比較して少ない2つの積和演算器56a、56bによって構成されている。   Subsequently, the preprocessing circuit 62 is constituted by two product-sum calculators 56a and 56b which are smaller than the number of columns (5).

積和演算器56aは、C2j+1iの演算を行い、その演算結果T2j+1を出力する。また、積和演算器56bは、C2j+2iの演算を行い、その演算結果T2j+2を出力する。 MAC unit 56a performs calculation of C 2j + 1 L i, and outputs the operation result T 2j + 1. Also, sum-of-products arithmetic unit 56b performs arithmetic operation of C 2j + 2 L i, and outputs the operation result T 2j + 2.

カウンタ66は、初期化後、クロック信号に同期して、0〜2を繰り返しカウントする。本実施形態の場合、カウンタ66のカウント値j=0の時、フィルタ係数用レジスタ54から係数値C1,C2が出力され、それぞれ積和演算器56a、56bに入力される。また、カウント値jが1の時、係数値C3,C4が、それぞれ積和演算器56a、56bに入力され、カウント値jが2の時、係数値C5が積和演算器56aに入力される。   The counter 66 repeatedly counts 0 to 2 in synchronization with the clock signal after initialization. In the present embodiment, when the count value j = 0 of the counter 66, the coefficient values C1 and C2 are output from the filter coefficient register 54 and input to the product-sum calculators 56a and 56b, respectively. When the count value j is 1, the coefficient values C3 and C4 are input to the product-sum calculators 56a and 56b, respectively. When the count value j is 2, the coefficient value C5 is input to the product-sum calculator 56a. .

積和演算器56aでは、係数値C1が入力されると、その演算結果T1として、C11L1i+C21L2i+C31L3i+C41L4i+C51L5iが出力される。また、C3が入力されると、T3として、C13L1i+C23L2i+C33L3i+C43L4i+C53L5iが出力され、C5が入力されると、T5として、C15L1i+C25L2i+C35L3i+C45L4i+C55L5iが出力される。   When the coefficient sum C1 is input to the product-sum calculator 56a, C11L1i + C21L2i + C31L3i + C41L4i + C51L5i is output as the calculation result T1. When C3 is input, C13L1i + C23L2i + C33L3i + C43L4i + C53L5i is output as T3, and when C5 is input, C15L1i + C25L2i + C35L3i + C45L4i + C55L5i is output as T5.

積和演算器56bでは、係数値C2が入力されると、その演算結果T2として、C12L1i+C22L2i+C32L3i+C42L4i+C52L5iが出力される。また、C4が入力されると、T4として、C14L1i+C24L2i+C34L3i+C44L4i+C54L5iが出力される。   When the coefficient sum C2 is input to the product-sum calculator 56b, C12L1i + C22L2i + C32L3i + C42L4i + C52L5i is output as the calculation result T2. When C4 is input, C14L1i + C24L2i + C34L3i + C44L4i + C54L5i is output as T4.

なお、積和演算器56aに係数値C5が入力される時、積和演算器56bの出力は後処理回路64で使用されないので、積和演算器56bに入力される係数値は何ら限定されない。   Note that when the coefficient value C5 is input to the product-sum calculator 56a, the output of the product-sum calculator 56b is not used by the post-processing circuit 64, so the coefficient value input to the product-sum calculator 56b is not limited.

続いて、後処理回路64は、列数分の5つの積和レジスタ61a、61b、61c、61d、61eによって構成されている。   Subsequently, the post-processing circuit 64 includes five product-sum registers 61a, 61b, 61c, 61d, and 61e corresponding to the number of columns.

図4に示すように、1番目の積和レジスタ61aは、2つのフリップフロップ60a1,60a2によって構成されている。1段目のフリップフロップ60a1は、カウンタ66のカウント値j=0の時に、クロックエッジのタイミングで、積和演算器56aの出力を1列目の積和演算結果T1として一時的に保持する。具体的には、例えば、クロック信号の有効エッジのタイミングでカウンタ66が動作してカウント値jが0に変化し、クロック信号の1周期の間に、係数値の演算器56aへの入力、および、演算器56aからの積和演算結果の出力が行われ、次の有効エッジのタイミングで、フリップフロップ60a1に保持される。この、1段目のフリップフロップ(以降、「一時レジスタ」と呼ぶ)60a1に保持された積和演算結果は、次にカウント値j=0となる期間に、クロックエッジのタイミングで、2段目のフリップフロップ60a2に保持値P1として保持される。一方、P1が保持される以前には、前回カウント値j=0であった期間に2段目のフリップフロップ60a2に保持された値P1’が、フリップフロップ60a2から出力され、2番目の積和レジスタ61bの加算器58bに入力される。   As shown in FIG. 4, the first product-sum register 61a is composed of two flip-flops 60a1 and 60a2. The flip-flop 60a1 in the first stage temporarily holds the output of the product-sum calculator 56a as the product-sum operation result T1 in the first column at the timing of the clock edge when the count value j = 0 of the counter 66. Specifically, for example, the counter 66 operates at the timing of the valid edge of the clock signal and the count value j changes to 0, and during one cycle of the clock signal, the coefficient value is input to the calculator 56a, and The product-sum operation result is output from the arithmetic unit 56a and held in the flip-flop 60a1 at the next effective edge timing. The product-sum operation result held in this first-stage flip-flop (hereinafter referred to as “temporary register”) 60a1 is the second-stage flip-flop at the clock edge timing in the period when the count value j = 0. Is held in the flip-flop 60a2 as the hold value P1. On the other hand, before P1 is held, the value P1 ′ held in the second flip-flop 60a2 during the period when the previous count value j = 0 is output from the flip-flop 60a2, and the second sum of products is output. The data is input to the adder 58b of the register 61b.

積和レジスタ61bは、加算器58bと、2つのフリップフロップ60b1,60b2とによって構成されている。1段目のフリップフロップ(一時レジスタ)60b1には、カウンタ66のカウント値j=0である期間に、クロックエッジのタイミングで、積和演算器56bの出力を2列目の積和演算結果T2として保持する。加算器58bは、一時レジスタ60b1に保持された積和演算結果T2と、上記フリップフロップ60a2の出力P1’とを加算する。フリップフロップ60b2は、次にカウンタ66のカウント値j=0となる期間に、クロックエッジのタイミングで、加算器58bの出力P1’+T2を保持する。ここでの演算に利用されるP1’は、P1が保持される以前にフリップフロップ60a2に保持されていた値である。   The product-sum register 61b includes an adder 58b and two flip-flops 60b1 and 60b2. The first-stage flip-flop (temporary register) 60b1 outputs the output of the product-sum operation unit 56b to the second-column product-sum operation result T2 at the timing of the clock edge during the period when the count value j = 0 of the counter 66. Hold as. The adder 58b adds the product-sum operation result T2 held in the temporary register 60b1 and the output P1 'of the flip-flop 60a2. The flip-flop 60b2 holds the output P1 '+ T2 of the adder 58b at the timing of the clock edge in the period when the count value j = 0 of the counter 66 is next. P1 'used for the calculation here is a value held in the flip-flop 60a2 before P1 is held.

積和レジスタ61c、61d、61eの構成および動作も、積和レジスタ61bの構成および動作と同様である。すなわち、積和レジスタ61cおよび積和レジスタ61dの一時レジスタ61c1,61d1は、カウンタ66のカウント値j=1である期間に、クロックエッジのタイミングで、それぞれ積和演算器56aおよび56bの出力を、3列目および4列目の積和演算結果T3,T4として保持する。積和レジスタ61eの一時レジスタ60e1は、カウンタ66のカウント値j=2である期間に、クロックエッジのタイミングで、積和演算器56aの出力を5列目の積和演算結果T5として保持する。また、積和レジスタ61c〜61eの加算器58c〜58eは、それぞれ、積和レジスタ61b〜61dの2段目のフリップフロップ60b2〜60d2に保持された値P2’〜P4’と、対応する一時レジスタに保持された積和演算結果T3〜T5との積算値を、2段目のフリップフロップ60c2〜60e2に出力する。そして、これらの積算値P2’+T3〜P4’+T5は、次にカウント値j=0になる期間に、クロックエッジのタイミングで、それぞれの積和レジスタの2段目のフリップフロップ60c2〜60e2に保持される。   The configuration and operation of the product-sum registers 61c, 61d, and 61e are the same as the configuration and operation of the product-sum register 61b. That is, the product-sum register 61c and the temporary registers 61c1 and 61d1 of the product-sum register 61d respectively output the outputs of the product-sum calculators 56a and 56b at the clock edge timing during the period when the count value j = 1 of the counter 66. The product-sum operation results T3 and T4 in the third and fourth columns are held. The temporary register 60e1 of the product-sum register 61e holds the output of the product-sum calculator 56a as the product-sum operation result T5 in the fifth column at the timing of the clock edge during the period when the count value j = 2 of the counter 66. Further, the adders 58c to 58e of the product-sum registers 61c to 61e respectively correspond to the values P2 ′ to P4 ′ held in the second-stage flip-flops 60b2 to 60d2 of the product-sum registers 61b to 61d and the corresponding temporary registers. The accumulated value of the product-sum operation results T3 to T5 held in is output to the second-stage flip-flops 60c2 to 60e2. Then, these integrated values P2 ′ + T3 to P4 ′ + T5 are held in the second-stage flip-flops 60c2 to 60e2 of the respective product-sum registers at the timing of the clock edge in the next period when the count value j = 0. Is done.

次に、演算回路50の基本的な動作を説明する。   Next, the basic operation of the arithmetic circuit 50 will be described.

演算回路50では、初期化処理として、係数用レジスタ14に、5つの列のそれぞれ5個の係数値C1〜C5が保持される。そして、少なくとも積和レジスタ61a、61b、61c、61dの一時レジスタおよび2段目のフリップフロップの保持値は全て0に初期化される。   In the arithmetic circuit 50, five coefficient values C1 to C5 in five columns are held in the coefficient register 14 as initialization processing. At least the temporary registers of the product-sum registers 61a, 61b, 61c, and 61d and the holding values of the second-stage flip-flops are all initialized to zero.

前述の通り、カウンタ66は、クロック信号に同期して、0〜2の順に繰り返しカウントを行い、そのカウント値j=0〜2を出力する。このカウント値jは、係数用レジスタ54、元画像用レジスタ52、前処理回路62および後処理回路64に入力される。そして、カウント値j=0になる毎に、処理対象となる元画像の1列の5画素分の画素値が、元画像用レジスタ52にLiとして保持される。   As described above, the counter 66 repeatedly counts in the order of 0 to 2 in synchronization with the clock signal, and outputs the count value j = 0 to 2. The count value j is input to the coefficient register 54, the original image register 52, the preprocessing circuit 62, and the postprocessing circuit 64. Each time the count value j = 0, the pixel values for five pixels in one column of the original image to be processed are held in the original image register 52 as Li.

カウンタ66のカウント値j=0の期間には、係数値レジスタ54から、1および2番目の係数値C1,C2が出力され、それぞれ前処理回路62の積和演算器56a、56bに入力される。   During the period of the count value j = 0 of the counter 66, the first and second coefficient values C1 and C2 are output from the coefficient value register 54 and input to the product-sum calculators 56a and 56b of the preprocessing circuit 62, respectively. .

積和演算器56aでは、元画像用レジスタ52から入力される、1番目の1列の5画素分の画素値L1と、係数用レジスタ54から入力される、1番目の1列の5つの係数値C1との積和演算C1L1が行われ、その演算結果T1が出力される。また、積和演算器56bでは、1番目の1列の5画素分の画素値L1と、2番目の1列の5つの係数値C2との積和演算C2L1が行われ、その演算結果T2が出力される。   In the product-sum calculator 56a, the pixel values L1 for five pixels in the first column input from the original image register 52 and the five factors in the first column input from the coefficient register 54 are displayed. A product-sum operation C1L1 with the numerical value C1 is performed, and the operation result T1 is output. The product-sum calculator 56b performs a product-sum operation C2L1 of the pixel values L1 for five pixels in the first column and the five coefficient values C2 in the second column, and the calculation result T2 is Is output.

積和演算器56a、56bの出力T1およびT2は、クロックエッジのタイミングで、それぞれ1番目の積和レジスタ61aのフリップフロップ60a1および2番目の積和レジスタ61bのフリップフロップ60b1に保持される。   The outputs T1 and T2 of the product-sum calculators 56a and 56b are held in the flip-flop 60a1 of the first product-sum register 61a and the flip-flop 60b1 of the second product-sum register 61b, respectively, at the timing of the clock edge.

続いて、カウンタ66のカウント値j=1の期間には、係数用レジスタ54から、3および4列目の係数値C3,C4が出力され、それぞれ積和演算器56a、56bに入力される。   Subsequently, during the period of the count value j = 1 of the counter 66, the coefficient values C3 and C4 in the third and fourth columns are output from the coefficient register 54 and input to the product-sum calculators 56a and 56b, respectively.

同様に、積和演算器56aでは、1番目の1列の5画素分の画素値L1と、3番目の1列の5つの係数値C3との積和演算C3L1が行われ、その演算結果T3が出力される。また、積和演算器56bでは、1番目の1列の5画素分の画素値L1と、4番目の1列の5つの係数値C4との積和演算C4L1が行われ、その演算結果T4が出力される。   Similarly, the product-sum operation unit 56a performs a product-sum operation C3L1 of the pixel values L1 for five pixels in the first column and the five coefficient values C3 in the third column, and the calculation result T3 Is output. The product-sum calculator 56b performs a product-sum operation C4L1 of the pixel values L1 for five pixels in the first column and the five coefficient values C4 in the fourth column, and the calculation result T4 is Is output.

積和演算器56a、56bの出力T3およびT4は、クロックエッジのタイミングで、それぞれ3番目の積和レジスタ61cの一時レジスタ60c1および4番目の積和レジスタ61dの一時レジスタ60d1に保持される。   The outputs T3 and T4 of the product-sum calculators 56a and 56b are held in the temporary register 60c1 of the third product-sum register 61c and the temporary register 60d1 of the fourth product-sum register 61d, respectively, at the timing of the clock edge.

続いて、カウンタ66のカウント値j=2の期間には、係数用レジスタ54から、5番目の係数値C5が出力され、前処理回路62の積和演算器56aに入力される。   Subsequently, during the period of the count value j = 2 of the counter 66, the fifth coefficient value C5 is output from the coefficient register 54 and input to the product-sum calculator 56a of the preprocessing circuit 62.

積和演算器56aでは、1番目の1列の5画素分の画素値L1と、5番目の1列の5つの係数値C5との積和演算C5L1が行われ、その演算結果T5が出力される。   The product-sum operation unit 56a performs a product-sum operation C5L1 of the pixel values L1 for five pixels in the first column and the five coefficient values C5 in the fifth column, and outputs the calculation result T5. The

積和演算器56aの出力T5は、クロックエッジのタイミングで、5番目の積和レジスタ61eの一時レジスタ60e1に保持される。このように、演算回路50では、列数(5)よりも少ない個数(2個)の積和演算器56a、56bを使用して、カウンタ66のカウント値がj=0,1,2と変化する間に、5個の積和演算結果T1〜T5を算出し、それぞれの積和レジスタ61a〜61eの一時レジスタ60a1〜60e1に保持する。   The output T5 of the product-sum calculator 56a is held in the temporary register 60e1 of the fifth product-sum register 61e at the timing of the clock edge. As described above, in the arithmetic circuit 50, the count value of the counter 66 is changed to j = 0, 1, 2 by using the product-sum arithmetic units 56a, 56b which is smaller in number (two) than the number of columns (5). In the meantime, five product-sum operation results T1 to T5 are calculated and held in the temporary registers 60a1 to 60e1 of the respective product-sum registers 61a to 61e.

そして、次のカウント値j=0の期間には、一時レジスタ60a1〜60e1に一時的に保持した積和演算結果を、そのまま、もしくは、積和レジスタ61a〜61dの2段目のフリップフロップに保持されていた値と積算した上で、2段目のフリップフロップ60a2〜60e2に保持する。   Then, during the next count value j = 0, the product-sum operation results temporarily held in the temporary registers 60a1 to 60e1 are held as they are or in the second-stage flip-flops of the product-sum registers 61a to 61d. After being integrated with the value that has been set, it is held in the second-stage flip-flops 60a2 to 60e2.

積和レジスタ61aでは、一時レジスタ60a1に保持された積和演算結果T1が、クロックエッジのタイミングでフリップフロップ60a2に保持される。また、積和レジスタ61bでは、加算器58bにより、一時レジスタ60b1に保持された積和演算結果T2と、フリップフロップ60a2の出力P1’とが加算され、その加算結果P1’+T1が、クロックエッジのタイミングでフリップフロップ60b2に、保持値P2として保持される。ここでの加算演算に利用されるフリップフロップ60a2の出力P1’は、前回、カウンタ66のカウント値j=0であった期間にフリップフロップ60a2に保持された値である。この場合には初期化後の値、すなわち0である。   In the product-sum register 61a, the product-sum operation result T1 held in the temporary register 60a1 is held in the flip-flop 60a2 at the timing of the clock edge. In the product-sum register 61b, the adder 58b adds the product-sum operation result T2 held in the temporary register 60b1 and the output P1 ′ of the flip-flop 60a2, and the addition result P1 ′ + T1 is the clock edge. At the timing, it is held in the flip-flop 60b2 as the hold value P2. The output P1 'of the flip-flop 60a2 used for the addition operation here is the value held in the flip-flop 60a2 during the previous period when the count value j = 0 of the counter 66. In this case, the value after initialization, that is, 0.

積和レジスタ61cでは、加算器58cにより、一時レジスタ60c1に保持された積和演算結果T3と、フリップフロップ60b2の出力P2’とが加算され、その加算結果P2’+T3が、クロックエッジのタイミングでフリップフロップ60c3に、保持値P3として保持される。また、積和レジスタ61dでは、加算器58dにより、一時レジスタ60d1に保持された積和演算結果T4と、フリップフロップ60c2の出力P3’とが加算され、その加算結果P3’+T4が、クロックエッジのタイミングでフリップフロップ60d2に、保持値P4として保持される。ここでの加算結果に利用されるフリップフロップ60b2および60c2の出力P2’およびP3’は、前回、カウント値j=0であった期間にフリップフロップ60b2および60c2に保持された値である。この場合には初期化後の値、すなわち0である。   In the product-sum register 61c, the adder 58c adds the product-sum operation result T3 held in the temporary register 60c1 and the output P2 ′ of the flip-flop 60b2, and the addition result P2 ′ + T3 is obtained at the timing of the clock edge. It is held in the flip-flop 60c3 as a hold value P3. In the product-sum register 61d, the adder 58d adds the product-sum operation result T4 held in the temporary register 60d1 and the output P3 ′ of the flip-flop 60c2, and the addition result P3 ′ + T4 is added to the clock edge. At the timing, it is held in the flip-flop 60d2 as the hold value P4. The outputs P2 'and P3' of the flip-flops 60b2 and 60c2 used for the addition result here are values held in the flip-flops 60b2 and 60c2 during the previous period when the count value j = 0. In this case, the value after initialization, that is, 0.

積和レジスタ61eでは、加算器58eにより、一時レジスタ60e1に保持された積和演算結果T5と、フリップフロップ60d2の出力P4’とが加算され、その加算結果P4’+T5が、クロックエッジのタイミングで、保持値P5としてフリップフロップ60e2に保持される。ここでの加算演算に利用されるフリップフロップ60d2の出力P4’は、前回、カウント値j=0であった期間に保持された値である。この場合には、初期化後の値、すなわち0である。そして、フリップフロップ60e2の出力P5が、フィルタ処理後の画像の各画素の画素値Pとして出力される。   In the product-sum register 61e, the adder 58e adds the product-sum operation result T5 held in the temporary register 60e1 and the output P4 ′ of the flip-flop 60d2, and the addition result P4 ′ + T5 is obtained at the timing of the clock edge. The held value P5 is held in the flip-flop 60e2. The output P4 'of the flip-flop 60d2 used for the addition operation here is a value held last time during the period in which the count value j = 0. In this case, the value after initialization, that is, 0. Then, the output P5 of the flip-flop 60e2 is output as the pixel value P of each pixel of the image after filtering.

このように、演算回路50では、カウンタ66のカウンタ値jが0,1,2と変化する過程で、2個の積和演算器56a、56bを利用して積和演算C1L1〜C5L1を行い、その演算結果T1〜T5を、1〜5番目の積和レジスタ61a〜61eのそれぞれの一時レジスタ60a1〜60e1に保持する。そして、次にカウント値j=0になった期間に、1番目の積和レジスタ61aの一時レジスタ60a1に保持された積和演算結果T1が同一の積和レジスタ61aの2段目のフリップフロップ60a2に保持される。同時に、2〜5番目の積和レジスタ61b〜61eの2段目のフリップフロップ60b2〜60e2には、それぞれ、同一の積和レジスタ61b〜61eの一時レジスタ60b1〜60e1に保持された積和演算結果T2〜T5と、1〜4番目の積和レジスタ61a〜61dの2段目のフリップフロップ60a2〜60d2に、前回カウント値j=0であった期間に保持された値P1’〜P4’との積算値が、保持される。   As described above, the arithmetic circuit 50 performs the product-sum operations C1L1 to C5L1 using the two product-sum calculators 56a and 56b in the process in which the counter value j of the counter 66 changes to 0, 1, and 2. The calculation results T1 to T5 are held in the temporary registers 60a1 to 60e1 of the first to fifth product-sum registers 61a to 61e, respectively. Then, during the next period when the count value j = 0, the product-sum operation result T1 held in the temporary register 60a1 of the first product-sum register 61a is the second-stage flip-flop 60a2 of the same product-sum register 61a. Retained. At the same time, the product-sum operation results held in the temporary registers 60b1 to 60e1 of the same product-sum registers 61b to 61e are respectively stored in the second flip-flops 60b2 to 60e2 of the second to fifth product-sum registers 61b to 61e. T2 to T5 and the values P1 ′ to P4 ′ held in the period when the previous count value j = 0 was stored in the second flip-flops 60a2 to 60d2 of the first to fourth product-sum registers 61a to 61d. The integrated value is held.

すなわち、演算回路50では、カウンタ66のカウント値jが0,1,2と変化し、さらに0に戻る過程で、図2の演算回路30が1サイクルに実施する演算を実施する。これ以降、カウント値jが0,1,2であるそれぞれの期間を、演算のサイクルと区別するために、ステップと呼ぶ。   That is, in the arithmetic circuit 50, the arithmetic circuit 30 shown in FIG. 2 performs an operation performed in one cycle in the process in which the count value j of the counter 66 changes to 0, 1, 2 and returns to 0. Hereinafter, each period in which the count value j is 0, 1, and 2 is referred to as a step in order to distinguish it from a calculation cycle.

演算回路50では、さらに、カウンタ66によって、0〜2の順に繰り返しカウントが行われ、上記の動作が繰り返される。そして、演算回路30と同様に、初期化後5サイクルで、5列×5行の畳み込み演算によるフィルタ処理を行った最初の画素の画素値Pが後処理回路64の最後の積和レジスタ61eのフリップフロップ60e2に保持され、出力される。   In the arithmetic circuit 50, the counter 66 repeatedly performs counting in the order of 0 to 2, and the above operation is repeated. Similarly to the arithmetic circuit 30, the pixel value P of the first pixel subjected to the filter processing by the 5 column × 5 row convolution operation in the five cycles after the initialization is stored in the last product-sum register 61 e of the post-processing circuit 64. It is held in the flip-flop 60e2 and output.

同様に、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われる場合、演算回路50の具体的な動作は、下記表5,6に示す通りである。   Similarly, when the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device and the filter processing is sequentially performed in the order shown in FIG. 13, the specific operation of the arithmetic circuit 50 is as follows. As shown in FIGS.

Figure 0004833690
Figure 0004833690

Figure 0004833690
Figure 0004833690

表5および表6には、各ステップにおけるカウント値jと、クロックエッジに同期して積和レジスタ61a〜61eのそれぞれの一時レジスタ60a1〜60e1に保持される積和演算結果T1〜T5、および、2段目のフリップフロップ60a2〜60e2に保持される値P1〜P5を示した。従って、カウント値j=0となるステップにおいて2段目のフリップフロップ60b2〜60e2に保持する値を算出するために、それぞれの積和レジスタ61b〜61eの加算器58b〜58eに供給される値P1’〜P4’は、同一ステップにおけるP1〜P4の値として表6に示された値とは異なる。例えば、表6には、第4ステップにおけるP1〜P4の値としては、それぞれT11,T21,T31,T41が示されている。しかし、同一ステップにおいて加算器58b〜58eに供給されるP1’〜P4’の値は、前回j=0であった第1ステップにおいてそれぞれのフリップフロップ60a2〜60d2に保持され、その後、第3ステップまで維持されていた値、すなわち、0である。なお、表5および表6において、例えばT11は、表4におけるC1L1と同じものである。T12,T13,…およびT21,T31,…、等についても同様である。   Tables 5 and 6 show the count value j in each step, the product-sum operation results T1 to T5 held in the temporary registers 60a1 to 60e1 of the product-sum registers 61a to 61e in synchronization with the clock edge, and The values P1 to P5 held in the second-stage flip-flops 60a2 to 60e2 are shown. Therefore, the value P1 supplied to the adders 58b to 58e of the product-sum registers 61b to 61e in order to calculate the value held in the second-stage flip-flops 60b2 to 60e2 in the step where the count value j = 0. “˜P4” is different from the values shown in Table 6 as the values of P1 to P4 in the same step. For example, Table 6 shows T11, T21, T31, and T41 as values of P1 to P4 in the fourth step, respectively. However, the values of P1 ′ to P4 ′ supplied to the adders 58b to 58e in the same step are held in the respective flip-flops 60a2 to 60d2 in the first step where j = 0 last time, and then the third step. The value that has been maintained until 0, that is, 0. In Tables 5 and 6, for example, T11 is the same as C1L1 in Table 4. The same applies to T12, T13,... And T21, T31,.

ここで、表4,5を参照しながら、カウンタ66のカウント値jが0,1,2と変化し、さらに0に戻る過程で、演算回路50が、図2の演算回路30が1サイクルに実施する演算を実施する処理を説明する。   Here, referring to Tables 4 and 5, in the process in which the count value j of the counter 66 changes to 0, 1, and 2 and further returns to 0, the arithmetic circuit 50 makes the arithmetic circuit 30 in FIG. A process for performing an operation to be performed will be described.

例えば、表5,6の第1ステップから開始される第1サイクルにおいては、まず、第1ステップにおいて、元画像用レジスタ52に1番目の1列の画素値L1が保持される。そして、第1〜第3ステップにかけて、2つの積和演算器56a、56bによって、元画像用レジスタ52に保持された1番目の1列の画素値L1と係数用レジスタ54に保持された係数値との間の積和演算が行われる。そして、この積和演算結果T11〜T51が、図4に示されたT1〜T5の値として、積和レジスタ61a〜61eの一時レジスタ60a1〜60e1に保持される。続いて、第4ステップにおいて、1番目の積和レジスタ61aの一時レジスタ60a1に保持された、1番目の1列の画素値と1列目の係数との間の積和演算結果T11が、1番目の積和レジスタ61aの2段目のフリップフロップ60a2に、表6のP1の値として保持される。また、2〜5番目の積和レジスタ61b〜61eの一時レジスタ60b1〜60e1に保持された、1番目の1列の画素値と2〜5列目の係数値との間の積和演算結果T21〜T51は、それぞれ、1〜4番目の積和レジスタ61a〜61dの2段目のフリップフロップ60a2〜60d2から供給される値P1’〜P4’(第1ステップにおいて保持された値P1〜P4)と積算され、2〜5番目の積和レジスタ61b〜61eの2段目のフリップフロップ60b2〜60e2に保持される。この場合には、第1ステップにおいてフリップフロップ60a2〜60d2に保持された値はいずれも0であるため、積和演算結果T21〜T51がそのまま、表6のP2〜P5の値として保持される。これによって、第1の処理サイクルが完了する。   For example, in the first cycle starting from the first step of Tables 5 and 6, first, the pixel value L1 of the first one column is held in the original image register 52 in the first step. Then, through the first to third steps, the first column of pixel values L1 held in the original image register 52 and the coefficient values held in the coefficient register 54 by the two product-sum calculators 56a and 56b. Multiply-and-accumulate operations are performed. The product-sum calculation results T11 to T51 are held in the temporary registers 60a1 to 60e1 of the product-sum registers 61a to 61e as the values of T1 to T5 shown in FIG. Subsequently, in a fourth step, the product-sum operation result T11 between the pixel value of the first column and the coefficient of the first column held in the temporary register 60a1 of the first product-sum register 61a is 1 The value of P1 in Table 6 is held in the second flip-flop 60a2 of the second product-sum register 61a. The product-sum operation result T21 between the pixel values of the first column and the coefficient values of the second to fifth columns held in the temporary registers 60b1 to 60e1 of the second to fifth product-sum registers 61b to 61e. To T51 are values P1 ′ to P4 ′ (values P1 to P4 held in the first step) supplied from the second-stage flip-flops 60a2 to 60d2 of the first to fourth product-sum registers 61a to 61d, respectively. And are held in the second flip-flops 60b2 to 60e2 of the second to fifth product-sum registers 61b to 61e. In this case, since the values held in the flip-flops 60a2 to 60d2 in the first step are all 0, the product-sum operation results T21 to T51 are held as they are as the values of P2 to P5 in Table 6. This completes the first processing cycle.

この第4ステップにおいては、第1サイクルにおける第2段のフリップフロップ60a2〜60e2への積和演算結果もしくは積算値の保持と並行して、第2サイクルにおける元画像用レジスタ52への2番目の1列の画素値L2の保持、および、この画素値L2と係数値との間の積和演算とその結果の一時レジスタへの保持が開始される。すなわち、表5のT1,T2の値は、それぞれT12,T22に変化する。このように、演算回路50においては、カウンタ66のカウント値jが0になるステップにおいて、連続する2つのサイクルの処理の一部が並列して行われる。   In the fourth step, the second sum to the original image register 52 in the second cycle is held in parallel with the product-sum operation result or the accumulated value in the second-stage flip-flops 60a2 to 60e2 in the first cycle. The holding of the pixel value L2 of one column, the product-sum operation between the pixel value L2 and the coefficient value, and the holding of the result in the temporary register are started. That is, the values of T1 and T2 in Table 5 change to T12 and T22, respectively. Thus, in the arithmetic circuit 50, in the step where the count value j of the counter 66 becomes 0, part of the processing of two consecutive cycles is performed in parallel.

第2サイクルの処理は、さらに第5〜第7ステップにおいて引き続いて行われる。すなわち、第4ステップに続いて第5,6ステップにおいて積和演算とその結果の一時レジスタへの保持が行われ、第7ステップにおいて、第2段のフリップフロップ60a2〜60e2への積和演算結果もしくは積算値の保持が行われる。ここで、第7ステップにおいて積算値の算出において利用される、1〜4番目の積和レジスタ61a〜61dの2段目のフリップフロップ60a〜60dに保持された値は、前サイクル、すなわち、第4ステップで、クロック信号に同期して保持されたものである。   The processing in the second cycle is further performed in the fifth to seventh steps. That is, following the fourth step, the product-sum operation is performed in the fifth and sixth steps and the result is stored in the temporary register. In the seventh step, the product-sum operation result to the second-stage flip-flops 60a2 to 60e2 is performed. Alternatively, the integrated value is held. Here, the values held in the second-stage flip-flops 60a to 60d of the first to fourth product-sum registers 61a to 61d used in the integration value calculation in the seventh step are the previous cycle, that is, the first cycle. It is held in four steps in synchronization with the clock signal.

ここで、上記第1サイクルの最後に、第4ステップにおいて行われる積算に利用される値P1’〜P4’は、初期化ステップに続く第1ステップにおいて2段目のフリップフロップ60a〜60dに保持値P1〜P4として保持されたものである。前述のように、第1ステップにおいては、既に第1サイクルの処理としての積和演算および積和演算結果の一時レジスタへの保持が開始されている。しかし、やはり前述のように、演算回路50においては、カウント値jが0になるステップにおいて、連続する2つのサイクルの処理の一部が並列して行われる。すなわち、第1ステップでの2段目のフリップフロップ60a〜60dへの保持値P1〜P4の保持は、前サイクルである初期化サイクルの一部として行われる。従って、第1サイクルの最後の第4ステップにおいて積算値の算出に利用される、1〜4番目の積和レジスタ61a〜61dの2段目のフリップフロップ60a〜60dの保持値も、前サイクルで保持された値である。   Here, at the end of the first cycle, values P1 ′ to P4 ′ used for integration performed in the fourth step are held in the second-stage flip-flops 60a to 60d in the first step following the initialization step. It is held as values P1 to P4. As described above, in the first step, the product-sum operation as the processing of the first cycle and the holding of the product-sum operation result in the temporary register are already started. However, as described above, in the arithmetic circuit 50, in the step where the count value j becomes 0, part of the processing of two consecutive cycles is performed in parallel. That is, the holding values P1 to P4 in the second-stage flip-flops 60a to 60d in the first step are performed as part of the initialization cycle that is the previous cycle. Accordingly, the holding values of the second-stage flip-flops 60a to 60d of the first to fourth product-sum registers 61a to 61d, which are used to calculate the integrated value in the last fourth step of the first cycle, are also the previous cycle. It is the retained value.

その後、第3以降のサイクルの処理も同様に行われ、第5サイクルが終了する第16ステップにおいて、最初のフィルタ処理後の画素の画素値Pが出力される。以後、3サイクル毎に、2番目以降のフィルタ処理後の画素の画素値Pが順次出力される。   Thereafter, the processes in the third and subsequent cycles are performed in the same manner, and the pixel value P of the pixel after the first filter process is output in the sixteenth step when the fifth cycle ends. Thereafter, every three cycles, the pixel value P of the pixel after the second and subsequent filter processing is sequentially output.

本実施形態の演算回路50においても、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点がある。また、演算回路50では、2つの積和演算器56a、56bだけを用いている。これにより、その処理速度は、従来の1/3倍となるが、処理速度が要求されない用途であれば、回路規模を削減することができるという利点がある。   The arithmetic circuit 50 of this embodiment also has an advantage that it is not necessary to read out the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device twice. The arithmetic circuit 50 uses only two product-sum arithmetic units 56a and 56b. As a result, the processing speed is 1/3 times the conventional speed, but there is an advantage that the circuit scale can be reduced if the processing speed is not required.

なお、本実施形態では、積和演算器56aには、係数値C1,C3,C5の順で順次係数値が入力され、積和演算器56bには、C2,C4の順で順次係数値が入力されている。しかし、本発明は、これに限らず、積和演算器に係数値が入力される順序はどのような順序であっても良い。また、積和演算器56a、56bのどちらにどの係数値を入力するかも任意である。   In the present embodiment, coefficient values are sequentially input to the product-sum calculator 56a in the order of coefficient values C1, C3, and C5, and coefficient values are sequentially input to the product-sum calculator 56b in the order of C2 and C4. Have been entered. However, the present invention is not limited to this, and the order in which the coefficient values are input to the product-sum operation unit may be any order. It is also arbitrary which coefficient value is input to which of the product-sum calculators 56a and 56b.

第3の実施形態の演算回路は、5列×5行に限らず、N列×N行(Nは3以上の整数)の畳み込み演算によるフィルタ処理に適用可能である。この時、前処理回路52の積和演算器の個数mは、2≦m<Nとする。   The arithmetic circuit of the third embodiment is not limited to 5 columns × 5 rows, but can be applied to filter processing by convolution operation of N columns × N rows (N is an integer of 3 or more). At this time, the number m of product-sum calculators in the preprocessing circuit 52 is 2 ≦ m <N.

本実施形態の演算回路では、一般的に、初期化後、1〜Nサイクルにかけて順に、2次元空間のN列×N行の範囲の1〜N列目のデータ値をデータレジスタに保持し、各サイクル毎に、前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、N個のデータ値と、N列×N行のいずれかの列のN個の係数との間の積和を演算する操作を、N回(Nステップ)未満繰り返して行うことによりN個のデータ値と全ての列の係数との間の積和の演算を行う。そして、積和演算器が演算した、N個のデータ値と1列目のN個の係数との間の積和演算結果を後処理回路の1番目の積和レジスタに保持するとともに、N個のデータ値とn列目(n=2〜N)の係数との間の積和演算結果と、前サイクルでの後処理回路のn−1番目の積和レジスタに保持した値との積算値を、後処理回路のn番目の積和レジスタに保持する。これにより、N番目の積和レジスタから、2次元空間の前記N列×N行の範囲の中心に位置する第1の演算対象点の畳み込み演算結果が出力される。   In the arithmetic circuit of the present embodiment, generally, after initialization, data values in the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space are sequentially stored in the data register over 1 to N cycles. For each cycle, between each of at least some of the m multiply-add calculators of the pre-processing circuit, between N data values and N coefficients in any column of N columns × N rows. The operation of calculating the sum of products is repeated less than N times (N steps), thereby calculating the sum of products between the N data values and the coefficients of all the columns. The product-sum operation result between the N data values and the N coefficients in the first column calculated by the product-sum calculator is held in the first product-sum register of the post-processing circuit, and N Of the product-sum operation between the data value of n and the coefficients of the n-th column (n = 2 to N) and the value held in the n−1th product-sum register of the post-processing circuit in the previous cycle Is held in the nth product-sum register of the post-processing circuit. As a result, the convolution calculation result of the first calculation target point located at the center of the range of N columns × N rows in the two-dimensional space is output from the Nth product-sum register.

また、図4に示すように、後処理回路がさらに、1〜N番目の積和レジスタのそれぞれに対応して設けられた1〜N番目の一時レジスタ(図4のフリップフロップ60a1,60b1,60c1,60d1,60e1)を備えることが好ましい。この場合、各サイクル毎に、積和演算器が演算した、データ値と1〜N列目の係数値との間の積和演算結果のそれぞれが1〜N番目の一時レジスタに保持された後に、一時レジスタのn番目に保持された積和演算結果と前サイクルでn−1番目の積和レジスタに保持された値との積算値が、n番目の積和レジスタに保持される。   Further, as shown in FIG. 4, the post-processing circuit is further provided with 1-Nth temporary registers (flip-flops 60a1, 60b1, 60c1 of FIG. 4) provided corresponding to each of the 1-Nth product-sum registers. , 60d1, 60e1). In this case, after each product-sum operation result between the data value and the coefficient value in the 1st to Nth columns calculated by the product-sum operation unit is held in the 1st to Nth temporary registers for each cycle. The integrated value of the nth product-sum operation result held in the temporary register and the value held in the n−1th product-sum register in the previous cycle is held in the nth product-sum register.

次に、本発明の第4の実施形態について説明する。   Next, a fourth embodiment of the present invention will be described.

図5は、本発明の演算回路の構成を表す第4の実施形態の概略図である。同図に示す演算回路70は、2次元空間に配置された元画像の2列×2行の4画素分の画素値から、畳み込み演算によるフィルタ処理を行う。演算回路70は、元画像用シフトレジスタ72と、係数用シフトレジスタ74と、前処理回路82と、後処理回路84と、カウンタ86とによって構成されている。   FIG. 5 is a schematic diagram of the fourth embodiment showing the configuration of the arithmetic circuit of the present invention. The arithmetic circuit 70 shown in the figure performs a filtering process by a convolution operation from pixel values of 4 pixels of 2 columns × 2 rows of an original image arranged in a two-dimensional space. The arithmetic circuit 70 includes an original image shift register 72, a coefficient shift register 74, a preprocessing circuit 82, a postprocessing circuit 84, and a counter 86.

元画像用シフトレジスタ72は、処理対象となる元画像の2列×2行=4画素分の画素値を保持する。そして、1サイクル毎に、次の1列の2画素分の画素値が、図5中右側の1列にシフトインされ、各列の2画素分の画素値が左側に1列ずつシフトされる。   The original image shift register 72 holds pixel values of 2 columns × 2 rows = 4 pixels of the original image to be processed. Then, for each cycle, the pixel values for the two pixels in the next column are shifted into the right column in FIG. 5, and the pixel values for the two pixels in each column are shifted one column to the left. .

すなわち、元画像用シフトレジスタ72では、1サイクル毎に、左側(1列目)の1列の2画素分の画素値Liがシフトアウトされ、右側(2列目)の1列の2画素分の画素値Li+1が左側の1列にシフトされてLiとして保持され、処理対象となる次の1列の2画素分の画素値が新たなLi+1として右側の1列に保持される。1サイクル毎に、左側の1列の2画素分の画素値Liは積和演算器76aに入力され、右側の1列の2画素分の画素値Li+1は積和演算器76bに入力される。 That is, in the original image shift register 72, for each cycle, the pixel value L i of two pixels in one column of the left (first column) are shifted out, two pixels in one column on the right (second row) The pixel value L i + 1 of the minute is shifted to one column on the left side and held as L i , and the pixel value for two pixels in the next one column to be processed is a new column on the right side as a new L i + 1 Retained. For each cycle, the pixel values L i for two pixels in the left column are input to the product-sum calculator 76a, and the pixel values L i + 1 for the two pixels in the right column are input to the product-sum calculator 76b. Entered.

続いて、係数用シフトレジスタ74は、演算回路70の機能(フィルタ処理)を決定するための、元画像の2列×2行=4画素に対応する4個の係数値C11,C21,C12,C22を保持する。   Subsequently, the coefficient shift register 74 determines the function (filtering process) of the arithmetic circuit 70, and the four coefficient values C11, C21, C12, corresponding to 2 columns × 2 rows = 4 pixels of the original image. Hold C22.

係数用シフトレジスタ74では、1サイクル毎に、図5中、左側の1列の2つの係数値C11,C21と、右側の1列の2つの係数値C12,C22とが交互にシフト(ローテーション)され、左側の1列の2つの係数値が出力される。1列の2つの係数値C1(=C11,C21)もしくはC2(=C12,C22)は、1サイクル毎に、積和演算器76a、76bの両方に共通に入力される。   In the coefficient shift register 74, two coefficient values C11 and C21 in one column on the left side and two coefficient values C12 and C22 in one column on the right side in FIG. 5 are alternately shifted (rotated) every cycle. Then, two coefficient values in one column on the left side are output. Two coefficient values C1 (= C11, C21) or C2 (= C12, C22) in one column are input in common to both the product-sum calculators 76a and 76b for each cycle.

カウンタ86は、初期化後、クロック信号に同期して1〜2を繰り返しカウントする。このカウンタ86の計数と、係数用シフトレジスタ74のシフトとが、同一のクロック信号に同期して行われることにより、本実施形態の場合、カウント値k=1の時には係数値C1が、カウント値k=2の時には係数値C2が、積和演算器76a、76bに共通に入力される。   The counter 86 repeatedly counts 1 to 2 in synchronization with the clock signal after initialization. The count of the counter 86 and the shift of the coefficient shift register 74 are performed in synchronization with the same clock signal. In this embodiment, when the count value k = 1, the coefficient value C1 becomes the count value. When k = 2, the coefficient value C2 is commonly input to the product-sum calculators 76a and 76b.

前処理回路82は、列数分の2つの積和演算器76a、76bによって構成されている。   The preprocessing circuit 82 includes two product-sum calculators 76a and 76b corresponding to the number of columns.

積和演算器76aは、サイクル毎に、元画像用シフトレジスタ72の左側の1列の2画素分の画素値Li(例えば、サイクル1ではL1,サイクル2ではL2)と、係数用シフトレジスタ74の1番目(図5中、左側)の1列の2つの係数値Ck(例えば、サイクル1ではC1,サイクル2ではC2)との積和演算T1=Ckiを行う。積和演算器76aの出力T1は加算器78aに入力される。 The product-sum operation unit 76a includes, for each cycle, pixel values L i (for example, L1 in cycle 1 and L2 in cycle 2) for two pixels in one column on the left side of the original image shift register 72, and a coefficient shift register. A product-sum operation T1 = C k Li is performed with two coefficient values C k (for example, C1 in cycle 1 and C2 in cycle 2) in the first column of 74 (left side in FIG. 5). The output T1 of the product-sum calculator 76a is input to the adder 78a.

一方、積和演算器76bは、元画像用シフトレジスタ72の右側の1列の2画素分の画素値Li+1(例えば、サイクル1ではL2,サイクル2ではL3)と、係数用シフトレジスタ74の1番目の1列の2つの係数値Ckとの積和演算T2=Cki+1を行う。積和演算器76bの出力T2は加算器78bに入力される。 On the other hand, the product-sum operation unit 76b includes pixel values L i + 1 (for example, L2 in cycle 1 and L3 in cycle 2) for two pixels in one column on the right side of the original image shift register 72, and a coefficient shift register. A product-sum operation T2 = C k L i + 1 with the two coefficient values C k in the first column of 74 is performed. The output T2 of the product-sum calculator 76b is input to the adder 78b.

後処理回路84は、列数分の2つの積和レジスタ81a、81bによって構成されている。   The post-processing circuit 84 includes two product-sum registers 81a and 81b corresponding to the number of columns.

積和レジスタ81aは、加算器78aと、セレクタ79aと、フリップフロップ80aによって構成されている。加算器78aは、積和演算器76aの出力T1とフリップフロップ80aの出力P1’とを加算する。セレクタ79aは、カウンタ86のカウント値k=1の時には積和演算器76aの出力T1を選択し、出力する。カウント値k=2の時には加算器78aの出力P1’+T1を選択し、出力する。フリップフロップ80aは、クロックエッジのタイミングで、セレクタ79aの出力を保持する。保持された値P1は、フィルタ処理後の画像の奇数番目の各画素の画素値として出力される。   The product-sum register 81a includes an adder 78a, a selector 79a, and a flip-flop 80a. The adder 78a adds the output T1 of the product-sum calculator 76a and the output P1 'of the flip-flop 80a. The selector 79a selects and outputs the output T1 of the product-sum calculator 76a when the count value k = 1 of the counter 86 is 1. When the count value k = 2, the output P1 '+ T1 of the adder 78a is selected and output. The flip-flop 80a holds the output of the selector 79a at the timing of the clock edge. The held value P1 is output as the pixel value of each odd-numbered pixel of the image after filtering.

また、積和レジスタ81bは、加算器78bと、セレクタ79bと、フリップフロップ80bによって構成されている。加算器78bは、積和演算器76bの出力T2とフリップフロップ80bの出力P2’とを加算する。セレクタ79bは、カウンタ86のカウント値k=1の時には積和演算器76bの出力T1を選択し、出力する。カウント値k=2の時には加算器78bの出力P2’+T2を選択し、出力する。フリップフロップ80bは、クロック信号に同期して、セレクタ79bの出力を保持する。保持された値P2は、フィルタ処理後の画像の偶数番目の各画素の画素値として出力される。   The product-sum register 81b includes an adder 78b, a selector 79b, and a flip-flop 80b. The adder 78b adds the output T2 of the product-sum calculator 76b and the output P2 'of the flip-flop 80b. The selector 79b selects and outputs the output T1 of the product-sum calculator 76b when the count value k = 1 of the counter 86 is 1. When the count value k = 2, the output P2 '+ T2 of the adder 78b is selected and output. The flip-flop 80b holds the output of the selector 79b in synchronization with the clock signal. The held value P2 is output as the pixel value of each even-numbered pixel of the image after filtering.

次に、表7を参照しながら、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われる場合の演算回路70の動作を説明する。   Next, referring to Table 7, the operation of the arithmetic circuit 70 when the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device and the filter processing is sequentially performed in the order shown in FIG. Will be explained.

Figure 0004833690
Figure 0004833690

初期化のサイクルでは、元画像用シフトレジスタ72には、図5中上側に示すように、左側の1列の2画素分の画素値Liとして、元画像の1列目の2画素分の画素値L11,L21が保持され、右側の2画素分の画素値Li+1として、元画像の2列目の2画素分の画素値L12,L22が保持される。係数用シフトレジスタ74には、係数値C1(=C11,C21)およびC2(=C12,C22)が、最初にC1が出力される状態に保持される。 In the initialization cycle, the original image shift register 72, as shown in the upper side in FIG. 5, as the pixel value L i of two pixels of one column to the left, the first column of the original image of two pixels Pixel values L11 and L21 are held, and pixel values L12 and L22 for two pixels in the second column of the original image are held as pixel values L i + 1 for the two pixels on the right side. The coefficient shift register 74 holds the coefficient values C1 (= C11, C21) and C2 (= C12, C22) in a state where C1 is first output.

サイクル1では、積和演算器76aでは、元画像用レジスタ72から入力される左側の1列の2画素分の画素値L1=L11,L21と、係数用シフトレジスタ74から入力される2つの係数値C1=C11,C21との積和演算C1L1=C11L11+C21L21が行われる。   In cycle 1, the product-sum calculator 76 a receives the pixel values L 1 = L 11 and L 21 for two pixels in the left column input from the original image register 72 and the two relations input from the coefficient shift register 74. The product-sum operation C1L1 = C11L11 + C21L21 with the numerical values C1 = C11, C21 is performed.

同様に、積和演算器76bでは、右側の1列の2画素分の画素値L2=L12,L22と、2つの係数値C1=C11,C21との積和演算C1L2=C11L12+C21L22が行われる。   Similarly, the product-sum calculator 76b performs a product-sum operation C1L2 = C11L12 + C21L22 of the pixel values L2 = L12, L22 for two pixels in the right column and the two coefficient values C1 = C11, C21.

そして、サイクル1では、カウンタ86のカウント値k=1であるため、セレクタ79aにより、積和演算器76aの出力T1=C11L11+C21L21が選択され、クロックエッジのタイミングでフリップフロップ80aに保持される。   In cycle 1, since the count value k of the counter 86 is 1, the output T1 = C11L11 + C21L21 of the product-sum calculator 76a is selected by the selector 79a and is held in the flip-flop 80a at the timing of the clock edge.

同様に、セレクタ79bにより、積和演算器76bの出力T2=C11L12+C21L22が選択され、クロックエッジのタイミングでフリップフロップ80bに保持される。   Similarly, the selector 79b selects the output T2 = C11L12 + C21L22 of the product-sum calculator 76b and holds it in the flip-flop 80b at the timing of the clock edge.

サイクル2では、図5中下側に示すように、元画像用シフトレジスタ72の左側の1列の2画素分の画素値Liとして、元画像の2列目の2画素分の画素値L12,L22が保持され、右側の2画素分の画素値Li+1として、元画像の3列目の2画素分の画素値L13,L23が保持され、それぞれ、積和演算器76aおよび76bに入力される。また、係数用シフトレジスタ74からは、係数値C2(=C12,C22)が出力される。 In cycle 2, as shown in the lower side of FIG. 5, the pixel value L12 for the two pixels in the second column of the original image is used as the pixel value L i for the two pixels in the first column on the left side of the shift register 72 for the original image. , L22 are held, and pixel values L13, L23 for the second pixel in the third column of the original image are held as pixel values Li + 1 for the two pixels on the right side, and are respectively stored in the product-sum calculators 76a and 76b. Entered. Further, the coefficient value C2 (= C12, C22) is output from the coefficient shift register 74.

従って、積和演算器76aでは、左側の1列の2画素分の画素値L2=L12,L22と、係数値C2=C12,C22との積和演算C2L2=C12L12+C22L22が行われる。   Accordingly, the product-sum calculator 76a performs a product-sum operation C2L2 = C12L12 + C22L22 of the pixel values L2 = L12, L22 for the two pixels in the left column and the coefficient values C2 = C12, C22.

同様に、積和演算器76bでは、右側の1列の2画素分の画素値L3=L13,L23と、係数値C2=C12,C22との積和演算C2L3=C12L13+C22L23が行われる。   Similarly, the product-sum calculator 76b performs a product-sum operation C2L3 = C12L13 + C22L23 of the pixel values L3 = L13, L23 for the two pixels in the right column and the coefficient values C2 = C12, C22.

積和レジスタ81aでは、加算器78aにより、積和演算器76aの出力T1=C12L12+C22L22とフリップフロップ80aの出力P1’=C11L11+C21L21とが加算される。そして、サイクル2では、カウンタ86のカウント値k=2であるため、セレクタ79aにより、加算器78aの出力P1’+T1=C11L11+C12L12+C21L21+C22L22が選択され、クロックエッジのタイミングでフリップフロップ80aに保持される。保持された値P1は、フィルタ処理後の画像の1番目の画素の画素値P11として出力される。   In the product-sum register 81a, the output T1 = C12L12 + C22L22 of the product-sum calculator 76a and the output P1 ′ = C11L11 + C21L21 of the flip-flop 80a are added by the adder 78a. In cycle 2, since the count value k of the counter 86 is 2, the selector 79a selects the output P1 '+ T1 = C11L11 + C12L12 + C21L21 + C22L22 of the adder 78a and holds it in the flip-flop 80a at the timing of the clock edge. The held value P1 is output as the pixel value P11 of the first pixel of the image after filtering.

同様に、積和レジスタ81bでは、加算器78bにより、積和演算器76bの出力T2=C12L13+C22L23と、クロック信号以前のフリップフロップ80bの出力P2’=C11L12+C21L22とが加算される。そして、セレクタ79bにより、加算器78bの出力P2’+T2=C11L12+C12L13+C21L22+C22L23が選択され、クロックエッジのタイミングでフリップフロップ80bに保持される。保持された値P2は、フィルタ処理後の画像の2番目の画素の画素値P11として出力される。   Similarly, in the product-sum register 81b, the adder 78b adds the output T2 = C12L13 + C22L23 of the product-sum calculator 76b and the output P2 '= C11L12 + C21L22 of the flip-flop 80b before the clock signal. Then, the output P2 '+ T2 = C11L12 + C12L13 + C21L22 + C22L23 of the adder 78b is selected by the selector 79b and held in the flip-flop 80b at the timing of the clock edge. The held value P2 is output as the pixel value P11 of the second pixel of the image after filtering.

これ以降の動作は、上記と同様である。すなわち、演算回路70では、初期化後、2サイクルで1および2番目のフィルタ処理後の2画素分の画素値P11,P12が同時(並列)に出力される。これ以後、2サイクル毎に、フィルタ処理後の2画素分の画素値が同時に出力される。   The subsequent operation is the same as described above. That is, in the arithmetic circuit 70, pixel values P11 and P12 for two pixels after the first and second filter processing in two cycles after initialization are output simultaneously (in parallel). Thereafter, pixel values for two pixels after the filter processing are simultaneously output every two cycles.

本実施形態の演算回路70においても、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点がある。また、本実施形態の演算回路70では、2つの積和演算器76a、76bと、2つの積和レジスタ81a、81bとが用いられている。これによって、従来の2倍の処理速度が実現されている。   The arithmetic circuit 70 of this embodiment also has an advantage that it is not necessary to read out the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device. In the arithmetic circuit 70 of this embodiment, two product-sum calculators 76a and 76b and two product-sum registers 81a and 81b are used. As a result, the processing speed twice as high as that of the prior art is realized.

次に、第4の実施形態の別の例として、元画像の5列×5行の25画素分の画素値を用いて畳み込み演算によるフィルタ処理を行う演算回路について説明する。   Next, as another example of the fourth embodiment, an arithmetic circuit that performs filter processing by convolution operation using pixel values of 25 pixels of 5 columns × 5 rows of the original image will be described.

図6は、本発明の演算回路の構成を表す第5の実施形態の概念図である。同図に示す演算回路100は、2次元空間に配置された元画像の5列×5行の25画素分の画素値から、畳み込み演算によるフィルタ処理を行う。演算回路100は、元画像用シフトレジスタ102と、係数用シフトレジスタ104と、前処理回路112と、後処理回路114と、カウンタ116とによって構成されている。   FIG. 6 is a conceptual diagram of the fifth embodiment showing the configuration of the arithmetic circuit of the present invention. The arithmetic circuit 100 shown in the figure performs a filter process by a convolution operation from pixel values for 25 pixels of 5 columns × 5 rows of an original image arranged in a two-dimensional space. The arithmetic circuit 100 includes an original image shift register 102, a coefficient shift register 104, a pre-processing circuit 112, a post-processing circuit 114, and a counter 116.

以下、図6に示す演算回路100について、図5の演算回路70との違いを重点的に説明する。   Hereinafter, the difference between the arithmetic circuit 100 shown in FIG. 6 and the arithmetic circuit 70 of FIG. 5 will be mainly described.

演算回路100において、元画像用シフトレジスタ102および係数用シフトレジスタ104は、図5の演算回路70の元画像用シフトレジスタ72および係数用シフトレジスタ74と同様の機能を有する。   In the arithmetic circuit 100, the original image shift register 102 and the coefficient shift register 104 have the same functions as the original image shift register 72 and the coefficient shift register 74 of the arithmetic circuit 70 in FIG.

前処理回路112は、列数分の5つの積和演算器106a、106b、106c、106d、106eによって構成されている。前処理回路112も、図5の前処理回路82と同様の機能を有する。   The pre-processing circuit 112 includes five product-sum calculators 106a, 106b, 106c, 106d, and 106e corresponding to the number of columns. The preprocessing circuit 112 also has the same function as the preprocessing circuit 82 in FIG.

また、後処理回路114は、列数分の5つの積和レジスタ111a、111b、111c、111d、111eによって構成されている。後処理回路114も、図5の演算回路70の後処理回路84と同様の機能を有する。   Further, the post-processing circuit 114 includes five product-sum registers 111a, 111b, 111c, 111d, and 111e corresponding to the number of columns. The post-processing circuit 114 also has the same function as the post-processing circuit 84 of the arithmetic circuit 70 in FIG.

カウンタ116は、初期化後、クロック信号に同期して、1サイクル毎に1〜5を繰り返しカウントする。本実施形態の場合、カウンタ116のカウント値k=1の時、係数用シフトレジスタ104から係数値C1(=C11,C21,C31,C41,C51)が出力され、全ての積和演算器106a、106b、106c、106d、106eに共通に入力される。また、カウント値k=2〜5の時に、係数値C2〜C5が、それぞれ出力される。   The counter 116 repeatedly counts 1 to 5 every cycle in synchronization with the clock signal after initialization. In the present embodiment, when the count value k = 1 of the counter 116, the coefficient value C1 (= C11, C21, C31, C41, C51) is output from the coefficient shift register 104, and all the product-sum calculators 106a, 106b, 106c, 106d, and 106e are input in common. Further, when the count value k = 2 to 5, coefficient values C2 to C5 are output, respectively.

すなわち、カウンタ116のカウント値k=1〜5の時に、係数値C1〜C5についての処理がそれぞれ行われる。   That is, when the count value k of the counter 116 is 1 to 5, the processing for the coefficient values C1 to C5 is performed.

演算回路100の動作は、図5の演算回路70と同様である。前処理回路112では、前述のように、カウンタ116のカウント値k=1〜5の時に、それぞれ係数値C1〜C5を利用した積和演算処理が行われ、積和演算結果T1〜T5が出力される。後処理回路114では、k=1のときには、前処理回路から入力された積和演算結果T1〜T5がそのまま保持される。一方、k=2〜5のときには、前サイクルで(すなわち、それぞれk=1〜4のときに)保持された値P1’〜P5’とT1〜T5との積算値が保持される。そして、5サイクル毎に、後処理回路114から、フィルタ処理後の画像の5画素分の画素値Pが出力される。   The operation of the arithmetic circuit 100 is the same as that of the arithmetic circuit 70 in FIG. In the pre-processing circuit 112, as described above, when the count value k of the counter 116 is 1 to 5, product-sum operation processing using the coefficient values C1 to C5 is performed, and product-sum operation results T1 to T5 are output. Is done. In the post-processing circuit 114, when k = 1, the product-sum operation results T1 to T5 input from the pre-processing circuit are held as they are. On the other hand, when k = 2 to 5, the integrated values of the values P1 'to P5' and T1 to T5 held in the previous cycle (that is, when k = 1 to 4 respectively) are held. Then, every five cycles, the post-processing circuit 114 outputs the pixel value P for five pixels of the image after filtering.

同様に、図8に示す元画像の各画素の画素値が画像情報記憶装置に記憶され、図13に示す順序でフィルタ処理が順次行われる場合、演算回路100の具体的な動作は、下記表8〜10に示す通りである。   Similarly, when the pixel value of each pixel of the original image shown in FIG. 8 is stored in the image information storage device and the filter processing is sequentially performed in the order shown in FIG. 13, the specific operation of the arithmetic circuit 100 is as follows. As shown in 8-10.

Figure 0004833690
Figure 0004833690

Figure 0004833690
Figure 0004833690

Figure 0004833690
Figure 0004833690

すなわち、演算回路100では、初期化後、5サイクルで最初のフィルタ処理後の5画素分の画素値P11〜P51が同時に出力される。これ以後、5サイクル毎に、フィルタ処理後の5画素分の画素値が同時に出力される。   That is, in the arithmetic circuit 100, pixel values P11 to P51 for five pixels after the first filter processing are output simultaneously in five cycles after initialization. Thereafter, pixel values for five pixels after the filter processing are simultaneously output every five cycles.

本実施形態の演算回路100においても、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点がある。また、本実施形態の演算回路100では、5つの積和演算器106a、106b、106c、106d、106eと、5つの積和レジスタ111a、111b、111c、111d、111eとを用いているため、従来の5倍の処理速度が実現されている。   The arithmetic circuit 100 of the present embodiment also has an advantage that it is not necessary to read out the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device twice. In addition, the arithmetic circuit 100 according to the present embodiment uses five product-sum arithmetic units 106a, 106b, 106c, 106d, and 106e and five product-sum registers 111a, 111b, 111c, 111d, and 111e. 5 times the processing speed.

なお、第4および第5の実施形態の演算回路70,100も、5列×5行に限らず、N列×N行(Nは2以上の整数)の畳み込み演算によるフィルタ処理に適用可能である。   The arithmetic circuits 70 and 100 of the fourth and fifth embodiments are not limited to 5 columns × 5 rows, and can be applied to filter processing by convolution operation of N columns × N rows (N is an integer of 2 or more). is there.

第4および第5の実施形態の演算回路では、一般的に、データレジスタに2次元空間のN列×N行の範囲の1〜N列目のデータを保持する。そして、第1サイクルにおいて、N個の内のn番目(n=1〜N)の積和演算器で、N列×N行のデータレジスタのn列目に保持されたN個のデータ値と、N列×N行の1列目のN個の係数との間の積和を演算し、それぞれの演算結果を、後処理回路のn番目の積和レジスタに保持する。その後、第k(k=2〜N)サイクルにかけて順に、データレジスタに保持されたデータを−1列分シフトし、データレジスタのN列目に、2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、さらに、N個の内のn番目の積和演算器で、N列×N行のデータレジスタのn列目に保持されたN個のデータ値とN列×N行のk列目のN個の係数との間の積和を演算し、それぞれの演算結果と、前サイクルで後処理回路のn番目の積和レジスタに保持された値との積算値を、後処理回路のn番目の積和レジスタに保持する操作を繰り返す。これにより、N個の積和レジスタのそれぞれから、2次元空間のN列×N行の範囲の中心に位置する第1演算対象点、および、2次元空間の列方向に第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果が出力される。   In the arithmetic circuits of the fourth and fifth embodiments, generally, data in the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space is held in the data register. Then, in the first cycle, the N data values held in the nth column of the data register of N columns × N rows are calculated by the nth (n = 1 to N) product-sum calculators out of N , N-column × N-row N-th coefficient of the first column is calculated, and each calculation result is held in the n-th product-sum register of the post-processing circuit. Thereafter, the data held in the data register is shifted by −1 column in order through the k-th (k = 2 to N) cycle, and the Nth column of the data register is shifted to the range of N columns × N rows in the two-dimensional space. N + k−1 columns of data adjacent in the column direction are held, and further, N pieces of data held in the nth column of the data register of N columns × N rows by the nth product-sum calculator. Is calculated and stored in the n-th product-sum register of the post-processing circuit in the previous cycle. The operation of holding the integrated value with the obtained value in the nth product-sum register of the post-processing circuit is repeated. Thereby, from each of the N product-sum registers, the first calculation target point located in the center of the range of N columns × N rows in the two-dimensional space, and the first calculation target point in the column direction of the two-dimensional space The results of the convolution calculation of the 2nd to Nth calculation target points that are adjacent to each other are output.

最後に、本発明の第6の実施形態について説明する。   Finally, a sixth embodiment of the present invention will be described.

図7は、本発明の演算回路の構成を表す第6の実施形態の概念図である。同図に示す演算回路120も、2次元空間に配置された元画像の5列×5行の25画素分の画素値から、畳み込み演算によるフィルタ処理を行う。図7の演算回路120は、元画像用シフトレジスタ122と、係数用シフトレジスタ124と、前処理回路132と、後処理回路134と、カウンタ136とによって構成されている。   FIG. 7 is a conceptual diagram of the sixth embodiment showing the configuration of the arithmetic circuit of the present invention. The arithmetic circuit 120 shown in the figure also performs a filtering process by a convolution operation from pixel values for 25 pixels of 5 columns × 5 rows of the original image arranged in the two-dimensional space. 7 includes an original image shift register 122, a coefficient shift register 124, a pre-processing circuit 132, a post-processing circuit 134, and a counter 136.

図7に示す演算回路120は、図6に示す演算回路100において、積和演算器の個数を減らし、図3に示す演算回路50のように、これを時系列(時分割)に使用する構成のものである。従って、カウンタ136は、図6に示す演算回路100のカウンタ116の機能と、図3に示す演算回路50のカウンタ66の機能とを併せ持つ。すなわち、後処理回路134の処理サイクルを制御するカウント値kと、前処理回路の処理のステップを制御するカウント値jとを生成する。カウント値jは、0に初期化された後、クロック信号に同期して0〜4のカウントを繰り返す。カウント値kは、1に初期化された後、カウント値jが0に戻る毎に1つずつ加算されて、1〜5のカウントを繰り返す。   The arithmetic circuit 120 shown in FIG. 7 has a configuration in which the number of product-sum arithmetic units is reduced in the arithmetic circuit 100 shown in FIG. 6 and is used in time series (time division) like the arithmetic circuit 50 shown in FIG. belongs to. Therefore, the counter 136 has both the function of the counter 116 of the arithmetic circuit 100 shown in FIG. 6 and the function of the counter 66 of the arithmetic circuit 50 shown in FIG. That is, a count value k for controlling the processing cycle of the post-processing circuit 134 and a count value j for controlling the processing steps of the pre-processing circuit are generated. After the count value j is initialized to 0, the count of 0 to 4 is repeated in synchronization with the clock signal. After the count value k is initialized to 1, the count value j is incremented by one every time the count value j returns to 0, and the count of 1 to 5 is repeated.

以下、図7の演算回路120について、図6の演算回路100との違いを重点的に説明する。   Hereinafter, the difference between the arithmetic circuit 120 in FIG. 7 and the arithmetic circuit 100 in FIG. 6 will be mainly described.

演算回路120において、元画像用シフトレジスタ122および係数用シフトレジスタ124は、図6の演算回路100の元画像用シフトレジスタ102および係数用シフトレジスタ104と同様の機能を有する。   In the arithmetic circuit 120, the original image shift register 122 and the coefficient shift register 124 have the same functions as the original image shift register 102 and the coefficient shift register 104 of the arithmetic circuit 100 in FIG.

図6の演算回路100では、元画像用シフトレジスタ102から、前処理回路112の5つの積和演算器106a、106b、106c、106d、106eに対して、各々対応する各列の1画素分の画素値Li〜Li+4が同時に入力される。これに対し、図7の演算回路120では、1ステップ毎に、各列の5画素分の画素値Li+jがカウント値jの変化に従って順に、1つの積和演算器126に時系列に入力される。両者は、この点で異なっている。そして、カウント値jが0〜4に変化する過程で5ステップの処理が行われた後、カウント値jが0に戻り、次のサイクルに進むときに、処理対象となる次の1列の5画素分の画素値がシフトインされる。 In the arithmetic circuit 100 shown in FIG. 6, from the original image shift register 102 to the five product-sum arithmetic units 106a, 106b, 106c, 106d, and 106e of the preprocessing circuit 112, one pixel of each corresponding column. Pixel values L i to L i + 4 are input simultaneously. On the other hand, in the arithmetic circuit 120 of FIG. 7, for each step, the pixel values L i + j for five pixels in each column are sequentially transmitted to one product-sum arithmetic unit 126 in time series in accordance with the change in the count value j. Entered. The two are different in this respect. Then, after the process of 5 steps is performed in the process of the count value j changing from 0 to 4, the count value j returns to 0, and when proceeding to the next cycle, 5 of the next column to be processed is processed. Pixel values for pixels are shifted in.

1つの画素の画素値を8ビットとすると、図6に示す演算回路100では、8ビット×5×5=200本の配線が必要となる。これに対し、図7に示す演算回路120では、元画像用シフトレジスタ122から出力される画素値は1列の5画素分だけであるから、同じく1つの画素値を8ビットとすると、8ビット×5=40本の配線だけしか必要がなく、配線数を1/5に削減することができる。   If the pixel value of one pixel is 8 bits, the arithmetic circuit 100 shown in FIG. 6 requires 8 bits × 5 × 5 = 200 wires. On the other hand, in the arithmetic circuit 120 shown in FIG. 7, since the pixel value output from the original image shift register 122 is only 5 pixels in one column, similarly, if one pixel value is 8 bits, 8 bits. X5 = Only 40 wires are required, and the number of wires can be reduced to 1/5.

また、係数用シフトレジスタ124では、図6の係数用シフトレジスタ104と同様に、1サイクル毎に、すなわち、カウント値kが変化する毎に、図6中、5つの係数値C1〜C5が順次シフト(ローテーション)され、図中で最も左側の1列の5つの係数値が出力される。ただし、同一の係数値Ckの供給が、カウント値jが0〜4の間に変化する5ステップの期間継続して行われ、その後、カウント値kが変化し、次のサイクルに進む時に係数C1〜C5のシフトが行われる点で、図6の係数用シフトレジスタ104とは異なっている。 Further, in the coefficient shift register 124, as in the coefficient shift register 104 in FIG. 6, the five coefficient values C1 to C5 in FIG. 6 are sequentially applied every cycle, that is, every time the count value k changes. It is shifted (rotated), and five coefficient values in the leftmost column in the figure are output. However, the supply of the same coefficient value C k is continuously performed for a period of five steps in which the count value j changes between 0 and 4, and then the coefficient value is changed when the count value k changes and proceeds to the next cycle. 6 is different from the coefficient shift register 104 in FIG. 6 in that the shifts C1 to C5 are performed.

続いて、前処理回路62は、1つの積和演算器126によって構成されている。積和演算器126は、Cki+jの積和演算を行い、その演算結果Tj+1を出力する。 Subsequently, the preprocessing circuit 62 is configured by one product-sum calculator 126. The product-sum operation unit 126 performs a product-sum operation on C k L i + j and outputs the operation result T j + 1 .

また、後処理回路134は、列数分の5つの積和レジスタ131a、131b、131c、131d、131eによって構成されている。後処理回路134の積和レジスタ131a〜131eのそれぞれは、例えば、図5の積和レジスタ81a(または81b)の前段に、図4の一時レジスタ60a1(または60b1〜60e1)を組み合わせた構成とすることができる。この場合、図4に示した演算回路50と同様に、それぞれの積和レジスタ131a〜131eの一時レジスタには、カウント値jが対応する値である期間にクロック信号を供給する。また、2段目のフリップフロップには、カウント値jが0に戻った期間にクロック信号を供給する。   Further, the post-processing circuit 134 includes five product-sum registers 131a, 131b, 131c, 131d, and 131e corresponding to the number of columns. Each of the product-sum registers 131a to 131e of the post-processing circuit 134 has, for example, a configuration in which the temporary register 60a1 (or 60b1 to 60e1) of FIG. 4 is combined with the preceding stage of the product-sum register 81a (or 81b) of FIG. be able to. In this case, similarly to the arithmetic circuit 50 shown in FIG. 4, a clock signal is supplied to the temporary registers of the product-sum registers 131a to 131e during a period in which the count value j is a corresponding value. A clock signal is supplied to the flip-flop at the second stage during the period when the count value j returns to zero.

次に、演算回路120の動作を説明する。   Next, the operation of the arithmetic circuit 120 will be described.

演算回路120では、初期化のサイクルで、元画像用シフトレジスタ122には、1〜5列目の画素値L1〜L5が保持され、係数用レジスタ14には、5列分の係数値C1〜C5が保持される。   In the arithmetic circuit 120, in the initialization cycle, the pixel values L1 to L5 for the first to fifth columns are held in the original image shift register 122, and the coefficient values C1 to C5 for five columns are stored in the coefficient register 14. C5 is retained.

サイクル1では、カウンタ136のカウント値j=0〜4に応じて、元画像用シフトレジスタ122から、1〜5列目の画素値L1〜L5が順次出力され、係数用シフトレジスタ124から、係数値C1(すなわち、k=1である)が出力される。   In cycle 1, the pixel values L1 to L5 in the first to fifth columns are sequentially output from the original image shift register 122 according to the count value j = 0 to 4 of the counter 136, and the coefficient shift register 124 A numerical value C1 (that is, k = 1) is output.

前処理回路132の積和演算器126では、カウンタ136のカウント値j=0〜4に応じて、1ステップ毎に、1〜5列目の画素値Li+j(=L1〜L5)と、係数値C1とから積和演算C1Li+jが行われ、その演算結果Tj+1(T1〜T5)が順次出力される。すなわち、積和演算器126では、カウント値j=0〜4に応じて、1ステップ毎に、積和演算C1L1、C1L2、C1L3、C1L4、C1L5が順次行われ、その演算結果T1〜T5が出力される。 In the sum-of-products calculator 126 of the pre-processing circuit 132, the pixel values L i + j (= L1 to L5) in the first to fifth columns are obtained for each step in accordance with the count value j = 0 to 4 of the counter 136. The product-sum operation C1L i + j is performed from the coefficient value C1, and the operation results T j + 1 (T1 to T5) are sequentially output. That is, the product-sum calculator 126 sequentially performs product-sum operations C1L1, C1L2, C1L3, C1L4, and C1L5 for each step according to the count value j = 0 to 4, and outputs the calculation results T1 to T5. Is done.

ステップ1〜5の積和演算器126の出力T1〜T5(=C1L1、C1L2、C1L3、C1L4、C1L5)は、後処理回路134の積和レジスタ131a、131b、131c、131d、131eにそれぞれ入力され、クロックエッジのタイミングで保持される。   Outputs T1 to T5 (= C1L1, C1L2, C1L3, C1L4, C1L5) of the product-sum operation unit 126 in steps 1 to 5 are respectively input to the product-sum registers 131a, 131b, 131c, 131d, and 131e of the post-processing circuit 134. , And held at the timing of the clock edge.

次のサイクル2で、元画像用シフトレジスタ122に、処理対象となる次の1列の5画素分の画素値L6がシフトインされ、元画像用シフトレジスタ122には、2〜6列目の画素値L2〜L6が保持される。   In the next cycle 2, the pixel values L 6 for five pixels in the next column to be processed are shifted into the original image shift register 122, and the second to sixth columns are stored in the original image shift register 122. Pixel values L2 to L6 are held.

サイクル2におけるステップ1〜5では、カウンタ136のカウント値j=0〜4に応じて、元画像用シフトレジスタ122から、1〜5列目の画素値L2〜L6が順次出力され、係数用シフトレジスタ124から、係数値C2(すなわち、k=2である)が出力される。   In steps 1 to 5 in cycle 2, the pixel values L2 to L6 in the first to fifth columns are sequentially output from the original image shift register 122 according to the count value j = 0 to 4 of the counter 136, and the coefficient shift is performed. The coefficient value C2 (that is, k = 2) is output from the register 124.

同様に、積和演算器126では、カウンタ136のカウント値j=0〜4に応じて、1〜5列目の画素値Li+j(=L2〜L6)と、係数値C2とから積和演算C2Li+jが行われ、その演算結果Tj+1(T1〜T5)が順次出力される。すなわち、積和演算器132では、カウント値j=0〜4に応じて、1ステップ毎に、積和演算C2L2、C2L3、C2L4、C2L5、C2L6が順次行われ、その演算結果T1〜T5が出力される。 Similarly, the product-sum calculator 126 calculates the product from the pixel values L i + j (= L2 to L6) in the first to fifth columns and the coefficient value C2 in accordance with the count value j = 0 to 4 of the counter 136. The sum operation C2L i + j is performed, and the operation results T j + 1 (T1 to T5) are sequentially output. That is, the product-sum calculator 132 sequentially performs the product-sum operations C2L2, C2L3, C2L4, C2L5, and C2L6 for each step according to the count value j = 0 to 4, and outputs the calculation results T1 to T5. Is done.

サイクル2での積和演算器126の出力T1〜T5(=C2L2、C2L3、C2L4、C2L5、C2L6)は、それぞれサイクル1で積和レジスタ131a、131b、131c、131d、131eに保持された各々対応するP1’〜P5’(=C1L1、C1L2、C1L3、C1L4、C1L5)と加算される。そして、その加算結果が、クロックエッジのタイミングで、それぞれ積和レジスタ131a、131b、131c、131d、131eに再度保持される。   Outputs T1 to T5 (= C2L2, C2L3, C2L4, C2L5, C2L6) of the product-sum calculator 126 in cycle 2 correspond to the product-sum registers 131a, 131b, 131c, 131d, and 131e respectively stored in cycle 1. P1 ′ to P5 ′ (= C1L1, C1L2, C1L3, C1L4, C1L5) to be added. The addition result is again held in the product-sum registers 131a, 131b, 131c, 131d, and 131e at the timing of the clock edge.

すなわち、積和レジスタ131a、131b、131c、131d、131eには、それぞれC1L1+C2L2、C1L2+C2L3、C1L3+C2L4、C1L4+C2L5、C1L5+C2L6が保持される。   That is, C1L1 + C2L2, C1L2 + C2L3, C1L3 + C2L4, C1L4 + C2L5, and C1L5 + C2L6 are held in the product-sum registers 131a, 131b, 131c, 131d, and 131e, respectively.

なお、前述のように、後処理回路134を、図3,4に示した演算回路50の場合のように、カウント値jが増大する過程で積和演算結果を一時レジスタに保持し、カウント値jが0に戻った期間に、そのまま、もしくは、前サイクルで保持した値と積算して、後段のフリップフロップに保持する構成とすることができる。このとき、カウント値jが0に戻るタイミングでカウント値kのカウントを進めた場合、サイクル1における積和演算結果の保持は、実際には、カウント値k=2に変化した後に行われる。また、サイクル2における積和演算結果と前のサイクルで保持した値との積算値の保持は、カウント値k=3に変化した後に行われる。従って、積和演算結果をそのまま保持するか、前のサイクルで保持した値と積算してから保持するかの制御を、図5に示した演算回路70のように、セレクタを用いて行う場合、カウント値k=2であるときには一時レジスタの出力を選択し、カウント値kが2以外であるときには加算器の出力を選択するように制御することができる。   As described above, the post-processing circuit 134 holds the product-sum operation result in the temporary register in the process of increasing the count value j as in the case of the arithmetic circuit 50 shown in FIGS. In the period when j returns to 0, it can be held in the flip-flop at the subsequent stage as it is, or integrated with the value held in the previous cycle. At this time, when the count value k is incremented at the timing when the count value j returns to 0, the product-sum operation result in the cycle 1 is actually held after the count value k = 2. The accumulated value of the product-sum operation result in cycle 2 and the value held in the previous cycle is held after the count value k changes to 3. Therefore, when control is performed using a selector as in the arithmetic circuit 70 shown in FIG. 5 to control whether the product-sum operation result is held as it is or after being integrated with the value held in the previous cycle, It can be controlled to select the output of the temporary register when the count value k = 2, and to select the output of the adder when the count value k is other than 2.

以下同様にして、1サイクル毎に、元画像用シフトレジスタ122に、次の1列の5画素分の画素値がシフトインされ、係数用シフトレジスタ124から、次の係数値Ckが出力され、上記の動作が繰り返し行われる。その結果、初期化後、25サイクル毎に、フィルタ処理後の5画素分の画素値Pが同時に出力される。 In the same manner, the pixel values for the next five pixels are shifted into the original image shift register 122 for each cycle, and the next coefficient value C k is output from the coefficient shift register 124. The above operation is repeated. As a result, after initialization, the pixel value P for five pixels after the filter processing is simultaneously output every 25 cycles.

本実施形態の演算回路120においても、隣りあう画素の演算で共通に使用される元画像の画素の画素値を画像情報記憶装置から2度読み出す必要がないという利点がある。また、演算回路120では、5つではなく、1つの積和演算器126だけを用いることによって、その処理速度は、従来の1/5倍となるが、処理速度が要求されない用途であれば、回路規模を削減することができるという利点がある。もちろん、図3の演算回路50のように、前処理回路132に複数の積和演算器を設け、5列の画素値を利用した積和演算結果T1〜T5を、列数(5)未満の繰り返し回数で得ることも可能である。これによって、処理速度と回路規模とのバランスをはかることが可能である。   The arithmetic circuit 120 of this embodiment also has an advantage that it is not necessary to read out the pixel value of the pixel of the original image that is commonly used in the calculation of adjacent pixels from the image information storage device. Further, in the arithmetic circuit 120, by using only one product-sum arithmetic unit 126 instead of five, the processing speed becomes 1/5 times that of the conventional one, but if the processing speed is not required, There is an advantage that the circuit scale can be reduced. Of course, like the arithmetic circuit 50 in FIG. 3, the pre-processing circuit 132 is provided with a plurality of product-sum arithmetic units, and the product-sum arithmetic results T1 to T5 using the pixel values of five columns are less than the number of columns (5). It is also possible to obtain the number of repetitions. This makes it possible to balance the processing speed and the circuit scale.

なお、本実施形態の演算回路120では、積和演算器126に画素値をLiからLi+4の順序で入力しているが、これに限らず、画素値はどのような順序で入力しても良い。また、後処理回路134において、積和演算結果T1〜T4をそのまま保持するか、前のサイクルで保持した値P1’〜P5’と積和演算結果T1〜T5との積算値を保持するかの制御を、セレクタを用いて行うことは必須ではない。例えば、積和レジスタを構成するフリップフロップに加算器の出力を直接接続した構成とした場合であっても、フリップフロップからのフィルタ処理後の画素値Pの出力を終えた後に、次の画素についての積和演算結果T1〜T5の一時レジスタへの保持を行っている期間に、フリップフロップの初期化を行い、保持値P1〜P5を0とする処理を行うことが可能である。 In the arithmetic circuit 120 of this embodiment, the pixel values are input to the product-sum calculator 126 in the order of L i to L i + 4 , but the present invention is not limited to this, and the pixel values are input in any order. You may do it. Further, in the post-processing circuit 134, whether the product-sum operation results T1 to T4 are held as they are or whether the accumulated values of the values P1 ′ to P5 ′ held in the previous cycle and the product-sum operation results T1 to T5 are held. It is not essential to perform control using a selector. For example, even when the output of the adder is directly connected to the flip-flop constituting the product-sum register, after the output of the pixel value P after the filter processing from the flip-flop, During the period in which the product-sum operation results T1 to T5 are held in the temporary register, it is possible to initialize the flip-flop and perform the process of setting the hold values P1 to P5 to 0.

また、本実施形態の演算回路は、5列×5行に限らず、N列×N行(Nは2以上の整数)の畳み込み演算によるフィルタ処理に適用可能である。この場合、積和演算器の個数mは、1≦m<Nとする。   In addition, the arithmetic circuit according to the present embodiment is not limited to 5 columns × 5 rows, and can be applied to filter processing based on N columns × N rows (N is an integer of 2 or more). In this case, the number m of product-sum calculators is 1 ≦ m <N.

本実施形態の演算回路では、一般的に、データレジスタに2次元空間内のN列×N行の範囲の1〜N列目のデータを保持する。第1サイクルにおいて、前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、N列×N行の1列目のN個の係数との間の積和を演算する操作を繰り返して行うことにより、データレジスタの全ての列に保持されたデータ値と1列目の係数との間の積和の演算を行う。そして、積和演算器が演算した、データレジスタのn列目(n=1〜N)に保持されたデータ値と1列目の係数との間の積和演算結果を、前処理回路のn番目の積和レジスタに保持する。その後、第k(k=2〜N)サイクルにかけて順に、データレジスタに保持されたデータを列方向に−1シフトし、データレジスタのN列目に、2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、N列×N行のk列目のN個の係数との間の積和を演算する操作を、繰り返して行うことにより、データレジスタの全ての列に保持されたデータ値とk列目の係数との間の積和の演算を行う。続いて、積和演算器が演算した、データレジスタのn列目に保持されたデータ値とk列目の係数との間の積和演算結果と、前サイクルで後処理回路のn番目の積和レジスタに保持された値との積算値を、後処理回路のn番目の積和レジスタに保持する操作を繰り返す。これにより、N個の積和レジスタのそれぞれから、2次元空間のN列×N行の範囲の中心に位置する第1の演算対象点、および、2次元空間の列方向に第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果が出力される。   In the arithmetic circuit of this embodiment, generally, data in the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space is held in the data register. In the first cycle, N data values held in any column of N columns × N rows of data registers in each of at least some of the m product-sum calculators of the preprocessing circuit, and N columns X By repeating the operation of calculating the sum of products with the N coefficients in the first column of N rows, the data values held in all the columns of the data register and the coefficients in the first column Perform product-sum operation. Then, the product-sum operation result between the data value held in the n-th column (n = 1 to N) of the data register and the coefficient in the first column, which is calculated by the product-sum calculator, is expressed as n in the preprocessing circuit. Hold in the th product-sum register. Thereafter, the data held in the data register is sequentially shifted by −1 in the column direction over the kth (k = 2 to N) cycle, and the range of N columns × N rows in the two-dimensional space is shifted to the Nth column of the data register. N + k−1 columns of data adjacent to each other in the column direction are held in at least one part of the m product-sum calculators of the pre-processing circuit, and stored in any column of N columns × N rows of data registers. By repeatedly performing the operation of calculating the sum of products between the held N data values and the N coefficients of the N columns × N rows and the kth column, the data values are held in all the columns of the data register. The product-sum operation is performed between the obtained data value and the coefficient in the k-th column. Subsequently, the product-sum operation result between the data value held in the nth column of the data register and the coefficient in the kth column calculated by the product-sum calculator and the nth product of the post-processing circuit in the previous cycle The operation of holding the integrated value with the value held in the sum register in the nth product-sum register of the post-processing circuit is repeated. Thereby, from each of the N product-sum registers, the first calculation target point located in the center of the range of N columns × N rows in the two-dimensional space, and the first calculation target in the column direction of the two-dimensional space A convolution calculation result of the 2nd to Nth calculation target points that are adjacent to the point in order is output.

なお、本発明において、データレジスタは、記憶装置(例えば、元画像用レジスタは、画像情報記憶装置)から、ラインメモリやFIFOなどのバッファを介してデータを読み込む構成としても良い。また、前処理回路は、積和演算器以外の構成要素を含んでいても良いし、後処理回路は、積和レジスタ以外の構成要素を含んでいても良い。また、積和演算器や積和レジスタの具体的な構成も何ら限定されず、同様の機能を果たす各種構成のものが使用可能である。   In the present invention, the data register may be configured to read data from a storage device (for example, the original image register is an image information storage device) via a buffer such as a line memory or FIFO. The preprocessing circuit may include components other than the product-sum operation unit, and the post-processing circuit may include components other than the product-sum register. Further, the specific configurations of the product-sum operation unit and the product-sum register are not limited at all, and various configurations having the same functions can be used.

本発明は、基本的に以上のようなものである。
以上、本発明の演算回路および演算方法について詳細に説明したが、本発明は上記実施形態に限定されず、本発明の主旨を逸脱しない範囲において、種々の改良や変更をしてもよいのはもちろんである。
The present invention is basically as described above.
Although the arithmetic circuit and the arithmetic method of the present invention have been described in detail above, the present invention is not limited to the above-described embodiments, and various improvements and modifications may be made without departing from the gist of the present invention. Of course.

本発明の演算回路の構成を表す第1の実施形態の概略図である。It is the schematic of 1st Embodiment showing the structure of the arithmetic circuit of this invention. 本発明の演算回路の構成を表す第2の実施形態の概念図である。It is a conceptual diagram of 2nd Embodiment showing the structure of the arithmetic circuit of this invention. 本発明の演算回路の構成を表す第3の実施形態の概念図である。It is a conceptual diagram of 3rd Embodiment showing the structure of the arithmetic circuit of this invention. 図3に示す演算回路の具体的な構成を表す概略図である。FIG. 4 is a schematic diagram illustrating a specific configuration of the arithmetic circuit illustrated in FIG. 3. 本発明の演算回路の構成を表す第4の実施形態の概略図である。It is the schematic of 4th Embodiment showing the structure of the arithmetic circuit of this invention. 本発明の演算回路の構成を表す第5の実施形態の概念図である。It is a conceptual diagram of 5th Embodiment showing the structure of the arithmetic circuit of this invention. 本発明の演算回路の構成を表す第6の実施形態の概念図である。It is a conceptual diagram of 6th Embodiment showing the structure of the arithmetic circuit of this invention. 2次元空間に配置された元画像の各画素の画素値を表す一例の概念図である。It is a conceptual diagram of an example showing the pixel value of each pixel of the original image arranged in the two-dimensional space. 2列×2行のフィルタ処理後の画像の各画素の画素値を表す一例の概念図である。It is a conceptual diagram of an example showing the pixel value of each pixel of the image after the filter process of 2 columns × 2 rows. 図8に示す元画像の各画素の画素値と図9に示すフィルタ処理後の画像の各画素の画素値との関係を表す概念図である。It is a conceptual diagram showing the relationship between the pixel value of each pixel of the original image shown in FIG. 8, and the pixel value of each pixel of the image after the filter process shown in FIG. 図10において、1番目の処理対象の元画像の4画素分の画素値とフィルタ処理後の画素の画素値を表す概念図である。In FIG. 10, it is a conceptual diagram showing the pixel value for 4 pixels of the original image of the 1st process target, and the pixel value of the pixel after a filter process. 図10において、2番目の処理対象の元画像の4画素分の画素値とフィルタ処理後の画素の画素値を表す概念図である。In FIG. 10, it is a conceptual diagram showing the pixel value for 4 pixels of the 2nd original image of a process target, and the pixel value of the pixel after a filter process. 畳み込み演算によるフィルタ処理の順序を表す一例の概念図である。It is a conceptual diagram of an example showing the order of the filter process by a convolution operation. 従来の畳み込み演算によるフィルタ処理を行う演算回路の構成を表す一例の概略図である。It is the schematic of an example showing the structure of the arithmetic circuit which performs the filter process by the conventional convolution operation. 図14に示す演算回路において、カウンタのカウント値が0の場合の状態を表す概念図である。FIG. 15 is a conceptual diagram illustrating a state when the count value of the counter is 0 in the arithmetic circuit illustrated in FIG. 14. 図14に示す演算回路において、カウンタのカウント値が1の場合の状態を表す概念図である。FIG. 15 is a conceptual diagram illustrating a state when the count value of the counter is 1 in the arithmetic circuit illustrated in FIG. 14. 積和演算器の構成を表す一例の概念図である。It is a conceptual diagram of an example showing the structure of a product-sum calculator.

符号の説明Explanation of symbols

10,30,50,70,100,120,140 演算回路
12,32,52,102,142 元画像用レジスタ
14,34,54,104 係数用レジスタ
22,42,62,82,112,132 前処理回路
24,44,64,84,114,134 後処理回路
16a、16b、36a、36b、36c、36d、36e、56a、56b、76a、76b、106a、106b、106c、106d、106e、126,146 積和演算器
21a、21b、41a、41b、41c、41d、41e、61a、61b、61c、61d、61e、81a、81b、111a、111b、111c、111d、111e、131a、131b、131c、131d、131e 積和レジスタ
66,116,136,156 カウンタ
60a1,60a2,60b1,60b2,60c1,60c2,60d1,60d2,60e1,60e2、80a、80b、80c、80d、80e、150a、150b フリップフロップ
58b、58c、58d、58e、78a、78b、78c、78d、78e、148,162 加算器
72,122 元画像用シフトレジスタ
74,124,144 係数用シフトレジスタ
79a、79b セレクタ
86 カウンタ
141 画像情報記憶装置
145,149 マルチプレクサ(MUX)
154 中間結果レジスタ
160a、160b 乗算器
10, 30, 50, 70, 100, 120, 140 Arithmetic circuit 12, 32, 52, 102, 142 Original image register 14, 34, 54, 104 Coefficient register 22, 42, 62, 82, 112, 132 Previous Processing circuit 24, 44, 64, 84, 114, 134 Post-processing circuit 16a, 16b, 36a, 36b, 36c, 36d, 36e, 56a, 56b, 76a, 76b, 106a, 106b, 106c, 106d, 106e, 126, 146 Multiply-accumulator 21a, 21b, 41a, 41b, 41c, 41d, 41e, 61a, 61b, 61c, 61d, 61e, 81a, 81b, 111a, 111b, 111c, 111d, 111e, 131a, 131b, 131c, 131d 131e product-sum register 66, 116, 136, 156 counter 60a1, 60a2, 60b1, 60b2, 60c1, 60c2, 60d1, 60d2, 60e1, 60e2, 80a, 80b, 80c, 80d, 80e, 150a, 150b Flip-flops 58b, 58c, 58d, 58e, 78a, 78b, 78c, 78d 78e, 148, 162 Adder 72, 122 Original image shift register 74, 124, 144 Coefficient shift register 79a, 79b Selector 86 Counter 141 Image information storage device 145, 149 Multiplexer (MUX)
154 Intermediate result register 160a, 160b Multiplier

Claims (5)

2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは3以上の整数)の係数を保持する係数用レジスタと、
N個のデータ値を保持するデータレジスタと、
m個(2≦m<N)の積和演算器を備えた前処理回路と、
1〜N番目の積和レジスタを備えた後処理回路とを有し、
初期化サイクルにおいて前記1〜N番目の内の1〜N−1番目の積和レジスタを初期化し、
その後、1〜Nサイクルにかけて順に、前記2次元空間のN列×N行の範囲の1〜N列目のデータ値を前記データレジスタに保持し、
各サイクル毎に、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N個のデータ値と、前記N列×N行のいずれかの列のN個の係数との間の積和を演算する操作を、N回未満繰り返して行うことにより前記N個のデータ値と全ての列の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記N個のデータ値と前記1列目のN個の係数との間の積和演算結果を前記後処理回路の1番目の積和レジスタに保持するとともに、前記N個のデータ値と前記n列目(n=2〜N)の係数との間の積和演算結果と、前サイクルで前記後処理回路のn−1番目の積和レジスタに保持した値との積算値を、該後処理回路のn番目の積和レジスタに保持することにより、
前記N番目の積和レジスタから、前記2次元空間の前記N列×N行の範囲の中心に位置する第1の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路。
An arithmetic circuit that performs a convolution operation of data arranged in a two-dimensional space,
A coefficient register for storing coefficients of N columns × N rows (N is an integer of 3 or more);
A data register holding N data values;
a pre-processing circuit including m (2 ≦ m <N) product-sum calculators;
And a post-processing circuit including 1st to Nth product-sum registers,
Initialize the 1-N-1 product-sum registers of the 1-Nth in the initialization cycle,
After that, in the order of 1 to N cycles, the data value of the 1st to Nth columns in the range of N columns × N rows of the two-dimensional space is held in the data register,
For each cycle,
In each of at least some of the m product-sum calculators of the preprocessing circuit, the product-sum between the N data values and the N coefficients of any column of the N columns × N rows. By calculating the product sum between the N data values and the coefficients of all the columns by repeating the operation of calculating N times less than N times,
A product-sum operation result between the N data values and the N coefficients in the first column calculated by the product-sum calculator is held in a first product-sum register of the post-processing circuit, and The product-sum operation result between the N data values and the coefficients of the n-th column (n = 2 to N), and the value held in the n−1th product-sum register of the post-processing circuit in the previous cycle Is held in the n-th product-sum register of the post-processing circuit,
An arithmetic circuit that outputs a convolution calculation result of a first calculation target point located in the center of the range of N columns × N rows in the two-dimensional space from the Nth product-sum register.
前記後処理回路がさらに、前記1〜N番目の積和レジスタのそれぞれに対応して設けられた1〜N番目の一時レジスタを備え、
前記各サイクル毎に、前記積和演算器が演算した、前記データ値と前記1〜N列目の係数との間の積和演算結果のそれぞれを前記1〜N番目の一時レジスタに保持した後に、該一時レジスタのn番目に保持した積和演算結果と前記前サイクルでn−1番目の積和レジスタに保持された値との積算値を、前記n番目の積和レジスタに保持することを特徴とする請求項記載の演算回路。
The post-processing circuit further includes a 1-Nth temporary register provided corresponding to each of the 1-Nth product-sum registers;
After each product-sum operation result calculated by the product-sum operation unit between the data value and the coefficients in the 1st to Nth columns is held in the 1st to Nth temporary registers for each cycle. The accumulated value of the n-th product-sum operation result held in the temporary register and the value held in the (n-1) -th product-sum register in the previous cycle is held in the n-th product-sum register. The arithmetic circuit according to claim 1 , wherein:
2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは2以上の整数)の係数を保持する係数用レジスタと、
N列×N行のデータレジスタと、
N個の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを有し、
前記データレジスタに前記2次元空間のN列×N行の範囲の1〜N列目のデータを保持し、
第1サイクルにおいて、前記N個の内のn番目(n=1〜N)の積和演算器で、前記N列×N行のデータレジスタのn列目に保持されたN個のデータ値と前記N列×N行の1列目のN個の係数との間の積和を演算し、それぞれの演算結果を、前記後処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記データレジスタに保持されたデータを−1列分シフトし、該データレジスタのN列目に、前記2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、
前記n番目の積和演算器で、前記N列×N行のデータレジスタのn列目に保持されたN個のデータ値と前記N列×N行のk列目のN個の係数との間の積和を演算し、それぞれの演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、前記後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路。
An arithmetic circuit that performs a convolution operation of data arranged in a two-dimensional space,
A coefficient register for holding coefficients of N columns × N rows (N is an integer of 2 or more);
N columns x N rows of data registers;
A preprocessing circuit having N product-sum calculators;
A post-processing circuit having N product-sum registers,
The data register holds the data of the 1st to Nth columns in the range of N columns × N rows of the two-dimensional space,
In the first cycle, the N data values held in the nth column of the data register of N columns × N rows in the nth (n = 1 to N) product-sum operation unit Calculate the sum of products with the N coefficients in the first column of the N columns × N rows, and store the respective operation results in the n th product sum register of the post-processing circuit,
Then, in order through the kth (k = 2 to N) cycle,
The data held in the data register is shifted by −1 column, and the N + k−1 column data adjacent to the N column × N row of the two-dimensional space in the column direction is shifted to the N column of the data register. Hold
In the nth product-sum operation unit, N data values held in the nth column of the N column × N row data register and N coefficients in the N column × N row k column The sum of the results of each operation and the value held in the nth product-sum register of the post-processing circuit in the previous cycle is calculated as the n-th product-sum register of the post-processing circuit. By repeating the operation to hold
From each of the N product-sum registers, a first calculation target point located in the center of a range of N columns × N rows of the two-dimensional space, and the first calculation target in the column direction of the two-dimensional space An arithmetic circuit which outputs a convolution operation result of the 2nd to Nth operation target points adjacent to each other in order.
2次元空間に配置されたデータとN列×N行(Nは2以上の整数)の係数との間の畳み込み演算を行う演算方法であって、
N個の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを用意し、
第1サイクルにおいて、前記2次元空間のN列×N行の範囲のデータ値と、前記N列×N行の第1列のN個の係数とを前記前処理回路に供給し、前記N個の内のn番目(n=1〜N)の積和演算器で、前記2次元空間のn列目のN個のデータ値と前記N個の係数との間の積和を演算し、その演算結果を、前記後処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記2次元空間のN列×N行のk列目から、該N列×N行の範囲に列方向に隣接する、N+k−1列目までのデータ値と、前記N列×N行の内のk列目のN個の係数とを前記前処理回路に供給し、前記n番目の積和演算器で、前記2次元空間の(N+k−1)列目のN個のデータ値と前記N個の係数との間の積和を演算し、それぞれの演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、前記後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算方法。
An arithmetic method for performing a convolution operation between data arranged in a two-dimensional space and coefficients of N columns × N rows (N is an integer of 2 or more),
A preprocessing circuit having N product-sum calculators;
Prepare a post-processing circuit with N product-sum registers,
In the first cycle, a data value in a range of N columns × N rows of the two-dimensional space and N coefficients of the first column of N columns × N rows are supplied to the preprocessing circuit, and the N pieces The product-sum calculator between the N data values in the n-th column of the two-dimensional space and the N coefficients is calculated by an nth (n = 1 to N) product-sum calculator The operation result is held in the nth product-sum register of the post-processing circuit,
Then, in order through the kth (k = 2 to N) cycle,
The data values from the Nth column × Nth row kth column to the N + k−1th column adjacent to the Nth column × Nth row in the column direction, and the Nth column × Nth row N coefficients in the k-th column are supplied to the pre-processing circuit, and the N-th product-sum calculator calculates the N data values in the (N + k−1) -th column in the two-dimensional space and the N The sum of products between the coefficients is calculated, and an integrated value of each operation result and the value held in the nth product-sum register of the post-processing circuit in the previous cycle is calculated as n of the post-processing circuit. By repeating the operation held in the th product-sum register,
From each of the N product-sum registers, a first calculation target point located in the center of a range of N columns × N rows of the two-dimensional space, and the first calculation target in the column direction of the two-dimensional space A calculation method that outputs a convolution calculation result of the 2nd to Nth calculation target points that are adjacent to each other in order.
2次元空間に配置されたデータの畳み込み演算を行う演算回路であって、
N列×N行(Nは2以上の整数)の係数を保持する係数用レジスタと、
N列×N行のデータレジスタと、
m個(m<N)の積和演算器を備えた前処理回路と、
N個の積和レジスタを備えた後処理回路とを有し、
前記データレジスタに前記2次元空間内のN列×N行の範囲の1〜N列目のデータを保持し、
第1サイクルにおいて、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、前記N列×N行の1列目のN個の係数との間の積和を演算する操作を繰り返して行うことにより、前記データレジスタの全ての列に保持されたデータ値と前記1列目の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記データレジスタのn列目(n=1〜N)に保持されたデータ値と前記1列目の係数との間の積和演算結果を、前記前処理回路のn番目の積和レジスタに保持し、
その後、第k(k=2〜N)サイクルにかけて順に、
前記データレジスタに保持されたデータを列方向に−1シフトし、該データレジスタのN列目に、前記2次元空間のN列×N行の範囲に列方向に隣接するN+k−1列目のデータを保持し、
前記前処理回路のm個の積和演算器の少なくとも一部のそれぞれで、前記N列×N行のデータレジスタのいずれかの列に保持されたN個のデータ値と、前記N列×N行のk列目のN個の係数との間の積和を演算する操作を、繰り返して行うことにより、前記データレジスタの全ての列に保持されたデータ値と前記k列目の係数との間の積和の演算を行い、
前記積和演算器が演算した、前記データレジスタのn列目に保持されたデータ値と前記k列目の係数との間の積和演算結果と、前サイクルで前記後処理回路のn番目の積和レジスタに保持された値との積算値を、該後処理回路のn番目の積和レジスタに保持する操作を繰り返すことにより、
前記N個の積和レジスタのそれぞれから、前記2次元空間のN列×N行の範囲の中心に位置する第1の演算対象点、および、該2次元空間の列方向に前記第1の演算対象点に順に隣りあう、2〜N番目の演算対象点の畳み込み演算結果を出力することを特徴とする演算回路。
An arithmetic circuit that performs a convolution operation of data arranged in a two-dimensional space,
A coefficient register for holding coefficients of N columns × N rows (N is an integer of 2 or more);
N columns x N rows of data registers;
a pre-processing circuit including m (m <N) product-sum calculators;
A post-processing circuit having N product-sum registers,
The data register holds data in the 1st to Nth columns in the range of N columns × N rows in the two-dimensional space,
In the first cycle,
In each of at least some of the m product-sum calculators of the preprocessing circuit, N data values held in any column of the N columns × N rows of data registers, and the N columns × N By repeating the operation of calculating the product sum between the N coefficients in the first column of the row, the data values held in all the columns of the data register and the coefficients in the first column are The sum of products of
The pre-processing circuit calculates the product-sum operation result between the data value held in the n-th column (n = 1 to N) of the data register and the coefficient in the first column, which is calculated by the product-sum calculator. In the nth sum of products register
Then, in order through the kth (k = 2 to N) cycle,
The data held in the data register is shifted by −1 in the column direction, and the N + k−1th column adjacent to the N column × N row in the two-dimensional space in the column direction is shifted to the Nth column of the data register. Keep the data,
In each of at least some of the m product-sum calculators of the preprocessing circuit, N data values held in any column of the N columns × N rows of data registers, and the N columns × N By repeatedly performing the operation of calculating the sum of products between the N coefficients in the k-th column of the row, the data values held in all the columns of the data register and the coefficients in the k-th column are calculated. Perform product-sum operation between
The product-sum operation result between the data value held in the n-th column of the data register and the coefficient in the k-th column, calculated by the product-sum calculator, and the nth of the post-processing circuit in the previous cycle By repeating the operation of holding the integrated value with the value held in the product-sum register in the nth product-sum register of the post-processing circuit,
From each of the N product-sum registers, a first calculation target point located at the center of a range of N columns × N rows of the two-dimensional space, and the first calculation in the column direction of the two-dimensional space An arithmetic circuit which outputs a convolution calculation result of the 2nd to Nth calculation target points adjacent to the target point in order.
JP2006057810A 2006-03-03 2006-03-03 Arithmetic circuit and arithmetic method Expired - Fee Related JP4833690B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006057810A JP4833690B2 (en) 2006-03-03 2006-03-03 Arithmetic circuit and arithmetic method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006057810A JP4833690B2 (en) 2006-03-03 2006-03-03 Arithmetic circuit and arithmetic method

Publications (2)

Publication Number Publication Date
JP2007233934A JP2007233934A (en) 2007-09-13
JP4833690B2 true JP4833690B2 (en) 2011-12-07

Family

ID=38554428

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006057810A Expired - Fee Related JP4833690B2 (en) 2006-03-03 2006-03-03 Arithmetic circuit and arithmetic method

Country Status (1)

Country Link
JP (1) JP4833690B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018067154A (en) * 2016-10-19 2018-04-26 ソニーセミコンダクタソリューションズ株式会社 Arithmetic processing circuit and recognition system
WO2021000285A1 (en) * 2019-07-03 2021-01-07 华为技术有限公司 Data processing system and method, encoding unit, processing engine, and storage medium
CN111340208B (en) * 2020-03-04 2023-05-23 开放智能机器(上海)有限公司 Vectorization calculation depth convolution calculation method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS51141536A (en) * 1975-05-31 1976-12-06 Toshiba Corp Image-paralleling calculation processing device
JPS63219082A (en) * 1987-10-23 1988-09-12 Hitachi Ltd Parallel image processor
JP2001222712A (en) * 2000-02-08 2001-08-17 Sega Corp Image processor, convolutional integration circuit and method therefor

Also Published As

Publication number Publication date
JP2007233934A (en) 2007-09-13

Similar Documents

Publication Publication Date Title
US5297069A (en) Finite impulse response filter
JPS62286307A (en) Apparatus and method for multiplication and addition of multiple stage digital signal
JP4833690B2 (en) Arithmetic circuit and arithmetic method
JP2002158561A (en) Fir filter, and data processing method therefor
JP3584027B2 (en) Digital filter
US5886912A (en) Processing elements connected in cascade having a controllable bypass
EP0988699A2 (en) Sharing resources in a digital filter
JP4630056B2 (en) Convolution arithmetic circuit
US5812866A (en) Parallel processor with controllable relation between input and output data
JP4586114B1 (en) Product-sum operation unit
JPH0998069A (en) Fir type digital filter
JP2001160736A (en) Digital filter circuit
CN116781041B (en) Multi-rate conversion filter with high resource utilization rate
JP2000124773A (en) Digital filter
JP2002300597A (en) Digital filtering device
US5933545A (en) Device for the decimation of digital data sequences
JPH1127563A (en) Image filter circuit
JP5535101B2 (en) Image processing apparatus and image forming apparatus
JPH05283979A (en) Fir type filter
JP2009140040A (en) Data processor
JP2010011493A (en) Digital filter
JP3104001B2 (en) Line buffer and image processing apparatus using the same
JPH0535865A (en) Filter
JP2003076986A (en) Data aligning circuit
JP5493646B2 (en) Discrete Fourier transform apparatus and discrete Fourier transform / discrete inverse Fourier transform method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080724

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110131

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110215

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110415

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110920

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110922

R150 Certificate of patent or registration of utility model

Ref document number: 4833690

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20140930

Year of fee payment: 3

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees