JP2003177912A - Method of calculating median of numerical data array using simd operation - Google Patents

Method of calculating median of numerical data array using simd operation

Info

Publication number
JP2003177912A
JP2003177912A JP2001374196A JP2001374196A JP2003177912A JP 2003177912 A JP2003177912 A JP 2003177912A JP 2001374196 A JP2001374196 A JP 2001374196A JP 2001374196 A JP2001374196 A JP 2001374196A JP 2003177912 A JP2003177912 A JP 2003177912A
Authority
JP
Japan
Prior art keywords
data
pieces
median
numerical data
numerical
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.)
Withdrawn
Application number
JP2001374196A
Other languages
Japanese (ja)
Inventor
Saki Hiwatari
咲 樋渡
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.)
Canon Inc
Original Assignee
Canon 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 Canon Inc filed Critical Canon Inc
Priority to JP2001374196A priority Critical patent/JP2003177912A/en
Publication of JP2003177912A publication Critical patent/JP2003177912A/en
Withdrawn legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To speed up the processing of a median filter which is one of noise removing means for an image by using a parallel operation function that a processor has for the operation of finding a median from the numerical data array. <P>SOLUTION: An SIMD operation function that the processor has is used for respective pieces of numerical data to be processed and one piece of data is compared with all of other pieces of numerical data in parallel. Then the number of pieces of 'data having larger attribute values than the one piece of data' is obtained. In a data array of 2n-1 pieces of data, the number of pieces of 'data having larger attribute values than the one piece of data' which is n-1 is the median in the numerical data array. When there are a plurality of pieces data having the same attribute value in the data array, data whose number of pieces of 'data having larger attribute values than the one piece of data' is n-1 is possibly absent. To process the exception, the number of pieces of 'data having larger attribute values than the one piece of data' is stored as a histogram and the median is obtained from the histogram. <P>COPYRIGHT: (C)2003,JPO

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は数値データ(をその
属性値順に並べたとき)の中央値の演算方法に関するも
のであり、画像からノイズを除去するメディアンフィル
タのような処理に適用するSIMD演算を利用した数値
データ列の中央値算出方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of calculating a median value of numerical data (when they are arranged in the order of their attribute values), and SIMD calculation applied to a process such as a median filter for removing noise from an image. The present invention relates to a method of calculating a median value of a numerical data string using.

【0002】[0002]

【従来の技術】近年、画像や音声などのデータを高速に
処理することが求められている。データを高速に処理す
るには、演算装置の動作速度を向上させデータ演算処理
の速度を高速化する方法と、演算装置が複数のデータを
並列に演算処理し同時に演算できるデータ数を増やす方
法とがある。
2. Description of the Related Art In recent years, it has been required to process data such as images and sounds at high speed. In order to process data at high speed, there are a method of increasing the operation speed of the arithmetic device to speed up the data arithmetic processing, and a method of arithmetically processing a plurality of data in parallel by the arithmetic device to increase the number of data that can be simultaneously calculated. There is.

【0003】動作速度を向上させる方法として、SIM
D(Single Instruction Mult
iple Data,単一命令複数データ)演算があ
る。並列データ処理の一形式であり、後者に属する。従
来からある計算機を拡張し、その構成をあまり変えるこ
と無く並列データ処理を実現できる。
As a method of improving the operation speed, SIM
D (Single Instruction Multi)
There are operations of single data and multiple data). It is a form of parallel data processing and belongs to the latter. A conventional computer can be expanded and parallel data processing can be realized without changing its configuration.

【0004】画像におけるノイズを除去する方法とし
て、メディアンフィルタがある。画像中の対象画素につ
いて、その近傍を含めた画衆を数値データ列とし、画素
の濃度値の順に並び替えたとき、その中央に位置する画
素を対象画素に置き換えることでノイズを除去する。こ
のフィルタ処理を行うには画素の数値データ列を濃度値
順に並び替えるソーティング作業を必要とするが、単純
な比較法を用いるソーティングは多くの計算ステップを
要する。
A median filter is known as a method for removing noise in an image. With respect to the target pixel in the image, a group including its neighborhood is used as a numerical data string, and when the pixels are rearranged in the order of the density value of the pixel, the pixel located at the center thereof is replaced with the target pixel to remove noise. To carry out this filtering process, sorting work for rearranging the numerical data sequence of pixels in order of density value is required, but sorting using the simple comparison method requires many calculation steps.

【0005】[0005]

【発明が解決しようとする課題】数値データ列の中央値
を求めるには、ソーティングを行うことになり、比較演
算を多用する。処理時間を短縮するにはこの比較演算の
処理を高速化する必要がある。
In order to obtain the median value of a numerical data string, sorting is carried out and comparison operations are frequently used. In order to shorten the processing time, it is necessary to speed up the processing of this comparison operation.

【0006】本発明の目的は、数値データ列から中央値
を求める演算において、プロセッサのもつ並列演算機能
を用い、処理を高速化するSIMD演算を利用した数値
データ列の中央値算出方法を提供することである。
An object of the present invention is to provide a method of calculating a median value of a numerical data string using SIMD operation which uses a parallel operation function of a processor in an operation for obtaining a median value from a numerical data string and accelerates the processing. That is.

【0007】[0007]

【課題を解決するための手段】上記を達成するために、
本発明は、処理対象の数値データに対し、プロセッサの
持つSIMD演算機能を用いて並列処理を行う。
[Means for Solving the Problems] In order to achieve the above,
The present invention performs parallel processing on numerical data to be processed by using the SIMD operation function of the processor.

【0008】はじめに数値データ各々に対し、自データ
と、残りの数値データすべてとの並列比較演算を行う。
First, for each of the numerical data, a parallel comparison operation of the self data and all the remaining numerical data is performed.

【0009】次にそれぞれの比較結果を求める。こうし
て各データについて求めた比較結果、すなわち「自デー
タより属性値の大きいデータ」の数が求まる。2n−1
(nは自然数)個のデータ列において「自データより属
性値の大きいデータ」の数がn−1個であるものが、数
値データ列においての中央値である。
Next, the respective comparison results are obtained. In this way, the comparison result obtained for each data, that is, the number of “data having an attribute value larger than that of its own data” is obtained. 2n-1
In the (n is a natural number) number of data strings, the number of "data having a larger attribute value than its own data" is n-1, which is the median value in the numerical data string.

【0010】データ列に同じ大きさの属性値を持つデー
タが複数あった場合、「自データより属性値の大きいデ
ータ」の数がn−1個となるデータが存在しないことが
ある。この例外を処理するために、「自データより属性
値の大きいデータ」の数をヒストグラムとして記憶して
おき、このヒストグラムから中央値を得る。
When there are a plurality of data having the same size attribute value in the data string, there may be no data in which the number of "data having a larger attribute value than its own data" is n-1. In order to handle this exception, the number of “data whose attribute value is larger than its own data” is stored as a histogram, and the median value is obtained from this histogram.

【0011】以上、本発明を整理して要約すれば以下の
構成に集約できる。
The present invention can be summarized in the following configurations if it is summarized and summarized above.

【0012】(1)SIMD演算を用い並列にデータ比
較をすることによりデータ列の中央値を高速に求めるこ
とを特徴とするSIMD演算を利用した数値データ列の
中央値算出方法。
(1) A method for calculating a median value of a numerical data string using SIMD operation, characterized in that the median value of a data string is obtained at high speed by parallel data comparison using SIMD operation.

【0013】(2)比較データをヒストグラムテーブル
に配置した後、ヒストグラムテーブルを探索することに
よりデータ列の中央値を求めることを特徴とするSIM
D演算を利用した数値データ列の中央値算出方法。
(2) SIM is characterized in that after the comparison data is arranged in the histogram table, the median value of the data string is obtained by searching the histogram table.
A method of calculating the median value of a numerical data string using the D operation.

【0014】[0014]

【発明の実施の形態】(実施例1)図1は本発明の特徴
を最もよく表わす図面である。装置は101の入力デー
タ列の格納されているメモリ、102,105のSIM
D命令実行用レジスタ、103の結果出力用のメモリポ
インタを格納するレジスタ、104、106のSIMD
比較演算回路、108のビストグラム作成回路、109
のヒストグラム用テーブル、110の中央値出力回路か
ら構成され、中央値は111として出力される。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS (Embodiment 1) FIG. 1 is a drawing best showing the features of the present invention. The device is a memory in which 101 input data strings are stored, and SIMs 102 and 105.
D instruction execution register, 103 storing result output memory pointer, 104, 106 SIMD
Comparison operation circuit, bistogram creation circuit 108, 109
Of the histogram table and the median value output circuit of 110, and the median value is output as 111.

【0015】中間値を求めるデータ列のデータ数は2n
−1(nは自然数)とする。各レジスタは2n−2ブロ
ックに分割されており、各ブロックに1つのデータが格
納される。
The number of data in the data string for obtaining the intermediate value is 2n
-1 (n is a natural number). Each register is divided into 2n-2 blocks, and one data is stored in each block.

【0016】図2は本発明の流れ図である。まず201
で、メモリ101から2n−1(nは自然数)個の要素
をレジスタ102に格納する。格納方法は、図4のよう
に、2本有るレジスタ102に対し、202の通り、入
力データ列の各データを順に一回ずつ対象データ401
として選択し、それをレジスタ403の2n−2個のブ
ロック全てに格納する。残りのデータはレジスタ402
の各ブロックに格納する。また最終結果の出力用にデー
タ列のポインタをレジスタ103に格納しておく。
FIG. 2 is a flow chart of the present invention. First 201
Then, 2n-1 (n is a natural number) elements from the memory 101 are stored in the register 102. As shown in FIG. 4, the storage method is as shown in 202 for the two registers 102, and each data of the input data sequence is sequentially input once to the target data 401.
And stores it in all 2n−2 blocks of the register 403. The remaining data is the register 402
Store in each block of. Further, the pointer of the data string is stored in the register 103 for outputting the final result.

【0017】204で2つのレジスタ402,403間
の各ブロックの比較をSIMD演算で行う。比較結果
(データが大きいか、小さいか)はレジスタ105に真
(1)、偽(0)のかたちで格納される。この105の
値のうち、真であるものの個数を求めるため204で
は、レジスタ405に、各ブロックに数値1(真)が格
納されたデータ(単位ベクトル)を用意し、105と4
05の各ブロックに対する内積計算をSIMD演算で行
うことにより個数を求める。
At 204, comparison of each block between the two registers 402 and 403 is performed by SIMD operation. The comparison result (whether the data is large or small) is stored in the register 105 in the form of true (1) or false (0). In order to obtain the number of true values out of the values of 105, in 204, data (unit vector) in which the numerical value 1 (true) is stored in each block is prepared in the register 405, and 105 and 4
The number is obtained by performing inner product calculation for each block of 05 by SIMD calculation.

【0018】206で、「比較結果が真であるものの個
数」がn−1個であった場合、すなわち自データより大
きい(小さい)ものがn個存在するわけであるから、こ
の時の対象データ401はデータ列の中央値であり、2
09で結果を出力して終了する。それ以外の場合、20
7で例外(「比較結果が真であるものの個数」がn個で
あるデータが存在しない場合)処理のためのヒストグラ
ムを作成する。
At 206, if the "number of items for which the comparison result is true" is n-1, that is, there are n items that are larger (smaller) than the own data. 401 is the median value of the data string, 2
At 09, the result is output and the processing ends. Otherwise, 20
In step 7, a histogram is created for exception processing (when there is no data whose “number of comparison results is true” is n).

【0019】ヒストグラムは図3のように、「比較結果
が真であるものの個数」を項目として横軸に取り、対象
データのポインタ値302を103より得、対象データ
を303として一つにまとめ301としてヒストグラム
テーブル109に配置する。
In the histogram, as shown in FIG. 3, "number of items for which the comparison result is true" is taken as an item on the horizontal axis, the pointer value 302 of the target data is obtained from 103, and the target data is collected as 303 into one 301 Are arranged in the histogram table 109.

【0020】その後202に戻り、データ列中の全ての
データを対象データとして選択・比較し終えて(20
3)も、「比較結果が真であるものの個数」がn−1個
のものが無い場合、208でヒストグラムテーブル10
9を端からカウントしていき、n−1個目に相当するデ
ータ301を209で出力結果とする。
Then, returning to 202, all the data in the data string are selected and compared as target data (20
Also in 3), when there is no n−1 “number of items for which the comparison result is true”, the histogram table 10 is set in 208.
9 is counted from the end, and the data 301 corresponding to the (n-1) th data is output at 209.

【0021】(実施例2)ここでは個数9のデータ列
{d0,d1,2,d3,d4,d5,d6,d7,d
8}={2,5,0,8,5,7,5,8,0}の中央
値を求めた場合について述べる。対象データをd0にし
たとき、比較演算の結果のベクトル列は{1,0,1,
1,1,1,1,0}となり、「比較結果が真であるも
のの個数」は、単位ベクトル{1,1,1,1,1,
1,1,1}との内積の結果6となる。
(Embodiment 2) Here, a data string of nine numbers {d0, d1, 2, d3, d4, d5, d6, d7, d.
The case where the median of 8} = {2,5,0,8,5,7,5,8,0} is obtained will be described. When the target data is set to d0, the vector sequence of the result of the comparison operation is {1, 0, 1,
1,1,1,1,0}, and the "number of objects for which the comparison result is true" is the unit vector {1,1,1,1,1,
The inner product with 1, 1, 1} results in 6.

【0022】「比較結果が真であるものの個数」が4で
無いので次の対象データを選択して同様に比較演算を行
う。以下、d1d2,…,d8と対象データを選んでい
ったときの「比較結果が真であるものの個数」は、それ
ぞれ、{(d2,d8):7個,d0:6個,(d1d
4,d6):3個,d5:2個,(d3,d7):0
個}となって、結果が4個である対象データは存在しな
い。
Since "the number of items for which the comparison result is true" is not 4, the next target data is selected and the comparison operation is similarly performed. Hereinafter, “the number of items for which the comparison result is true” when selecting target data d1d2, ..., d8 is {(d2, d8): 7, d0: 6, (d1d
4, d6): 3 pieces, d5: 2 pieces, (d3, d7): 0
There is no target data for which the result is four.

【0023】これをヒストグラムとして表したものが図
3であり、「比較結果が真であるものの個数」順、すな
わちデータの大きさ順に並べられている。横軸の端から
探索していくと、4番目に相当する値は、「比較結果が
真であるものの個数」が3であり、これに相当するもの
は(d1,d4,d6)、すなわち中央値はこの時のデ
ータの値5となる。
FIG. 3 shows this as a histogram, which is arranged in the order of "the number of objects for which the comparison result is true", that is, in the order of data size. When searching from the end of the horizontal axis, the value corresponding to the fourth value is “the number of objects for which the comparison result is true” is 3, and the corresponding value is (d1, d4, d6), that is, the center. The value is the value 5 of the data at this time.

【0024】[0024]

【発明の効果】以上説明したように、本発明の方式で
は、従来の、値を一つ一つ比較していく方法で中央値を
求めるときの計算量がデータの個数nの2乗のオーダー
であるのに対し、n−1個の数値演算を同時に実行する
ことによりnのオーダーで求めることが可能である。
As described above, according to the method of the present invention, the calculation amount for obtaining the median by the conventional method of comparing the values one by one is on the order of the square of the number n of data. On the other hand, it is possible to obtain in the order of n by simultaneously executing n−1 numerical operations.

【図面の簡単な説明】[Brief description of drawings]

【図1】 本発明を実施した演算装置の構成図FIG. 1 is a block diagram of an arithmetic unit embodying the present invention.

【図2】 本発明に従い中央値を求めた場合の流れ図FIG. 2 is a flow chart when a median value is obtained according to the present invention.

【図3】 実施例2においてのビストグラムテーブルを
複式的に示した図
FIG. 3 is a view showing a bistogram table in Example 2 in a multiplex manner.

【図4】 本発明においてデータ列のデータ格納方法及
び演算の流れを示した図
FIG. 4 is a diagram showing a data storage method of a data string and a flow of operations in the present invention.

【符号の説明】[Explanation of symbols]

101 対象データ列を読み出すメモリ 102 SIMD比較演算を実行するレジスタ 103 計算結果出力時に用いるデータのポインタレジ
スタ 104 SIMD比較演算回路 105 SIMD比較演算の結果出力レジスタ 106 SIMD演算により「結果が真であるブロッ
ク」の個数を求める回路 107 「結果が真であるブロック」の個数を出力する
レジスタ 108 ヒストグラム作成回路 109 ヒストグラム用テーブル 110 ヒストグラムから中央値を求める回路 111 中央値を出力するレジスタ 301 ヒストグラム配置用のデータ(「結果が真であ
るブロック」の個数+データのアドレス) 302 対象データのポインタ値 303 対象データの値 401 対象データ 402 102を構成するレジスタ 403 102を構成するレジスタ(対象データの値が
各ブロックに格納される) 405 「結果が真であるブロック」の個数計算用デー
タを格納するレジスタ
101 Memory for reading target data string 102 Register for executing SIMD comparison operation 103 Pointer register 104 for data used when outputting calculation result 104 SIMD comparison operation circuit 105 SIMD comparison operation result output register 106 “Block whose result is true” by SIMD operation Circuit 107 for obtaining the number of "blocks for which the result is true" 108 histogram generation circuit 109 histogram table 110 circuit for obtaining the median value from the histogram 111 register 301 for outputting the median value data for histogram placement ( Number of “blocks for which the result is true” + data address) 302 Target data pointer value 303 Target data value 401 Target data 402 102 Registers 403 102 registers (pair Register data values to) 405 stored in the respective blocks "result is block true" stores the number calculation data of

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 SIMD演算を用い並列にデータ比較を
することによりデータ列の中央値を高速に求めることを
特徴とするSIMD演算を利用した数値データ列の中央
値算出方法。
1. A method for calculating a median value of a numerical data string using SIMD operation, characterized in that the median value of a data string is obtained at high speed by parallel data comparison using SIMD operation.
【請求項2】 比較データをヒストグラムテーブルに配
置した後、ヒストグラムテーブルを探索することにより
データ列の中央値を求めることを特徴とするSIMD演
算を利用した数値データ列の中央値算出方法。
2. A method of calculating a median value of a numerical data string using SIMD arithmetic, characterized in that after arranging comparison data in a histogram table, the median value of the data string is obtained by searching the histogram table.
JP2001374196A 2001-12-07 2001-12-07 Method of calculating median of numerical data array using simd operation Withdrawn JP2003177912A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001374196A JP2003177912A (en) 2001-12-07 2001-12-07 Method of calculating median of numerical data array using simd operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001374196A JP2003177912A (en) 2001-12-07 2001-12-07 Method of calculating median of numerical data array using simd operation

Publications (1)

Publication Number Publication Date
JP2003177912A true JP2003177912A (en) 2003-06-27

Family

ID=19182793

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001374196A Withdrawn JP2003177912A (en) 2001-12-07 2001-12-07 Method of calculating median of numerical data array using simd operation

Country Status (1)

Country Link
JP (1) JP2003177912A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019153001A (en) * 2018-03-01 2019-09-12 パナソニックIpマネジメント株式会社 Arithmetic processing apparatus, image processing system, arithmetic processing method, and program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019153001A (en) * 2018-03-01 2019-09-12 パナソニックIpマネジメント株式会社 Arithmetic processing apparatus, image processing system, arithmetic processing method, and program
JP7054775B2 (en) 2018-03-01 2022-04-15 パナソニックIpマネジメント株式会社 Arithmetic logic unit, image processing system, and program

Similar Documents

Publication Publication Date Title
RU2273044C2 (en) Method and device for parallel conjunction of data with shift to the right
JP4288461B2 (en) Symmetric image filter processing apparatus, program, and method
JPH06222918A (en) Mask for selection of multibit element at inside of compound operand
US10908877B2 (en) Median value determination in a data processing system
US10402196B2 (en) Multi-dimensional sliding window operation for a vector processor, including dividing a filter into a plurality of patterns for selecting data elements from a plurality of input registers and performing calculations in parallel using groups of the data elements and coefficients
Licciardo et al. Stream processor for real-time inverse Tone Mapping of Full-HD images
JP2002351858A (en) Processing device
US11321092B1 (en) Tensor-based memory access
JP2677969B2 (en) Orthogonal transformer
JP2003177912A (en) Method of calculating median of numerical data array using simd operation
JP2004334545A (en) Filter circuit
US10884736B1 (en) Method and apparatus for a low energy programmable vector processing unit for neural networks backend processing
US10891136B1 (en) Data transmission between memory and on chip memory of inference engine for machine learning via a single data gathering instruction
US20130003870A1 (en) Apparatus and method for video data processing
JPS6310263A (en) Vector processor
US20230206045A1 (en) Deep learning acceleration with mixed precision
JP2002504250A (en) Device for converting a sequence of data elements
CN114492728A (en) Processing method, device and equipment based on image data Y component and storage medium
JPS6386083A (en) Affine converting system
JP2000020705A (en) Parallel image processing processor
JPH10143661A (en) Data processor
JP2735255B2 (en) Hatching treatment method
JP3320767B2 (en) Data processing apparatus and control method thereof
JP2005018694A (en) Image processing method
JPS60250475A (en) Vector processor

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20050301