JP6424329B2 - Image data processing method in image processing processor and program thereof - Google Patents
Image data processing method in image processing processor and program thereof Download PDFInfo
- Publication number
- JP6424329B2 JP6424329B2 JP2016165442A JP2016165442A JP6424329B2 JP 6424329 B2 JP6424329 B2 JP 6424329B2 JP 2016165442 A JP2016165442 A JP 2016165442A JP 2016165442 A JP2016165442 A JP 2016165442A JP 6424329 B2 JP6424329 B2 JP 6424329B2
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- texture
- pixels
- grid
- division pattern
- 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.)
- Active
Links
Images
Landscapes
- Image Generation (AREA)
- Image Processing (AREA)
Description
本発明は、画像処理プロセッサにおける画像データ処理方法及びそのプログラムに関し、特に、プログラマブルシェーダを搭載した画像処理プロセッサにおける画像データ処理方法及びそのプログラムに関する。 The present invention relates to an image data processing method and program thereof in an image processing processor, and more particularly, to an image data processing method and program thereof in an image processor equipped with a programmable shader.
三次元コンピュータグラフィックスにおいては、描画すべきオブジェクトを、多数のポリゴンにより表現されるポリゴンモデルを利用して生成するのが一般的である。ポリゴンモデルの描画処理においては、ポリゴン表面に陰影をつけるシェーディング処理や、ポリゴンモデルの表面にテクスチャ画像を貼り付けるテクスチャマッピング処理が行われる。 In three-dimensional computer graphics, it is common to generate an object to be drawn using a polygon model represented by a large number of polygons. In the drawing process of the polygon model, a shading process for shading the surface of the polygon and a texture mapping process for attaching a texture image to the surface of the polygon model are performed.
これらの処理は、高速処理を期して、初期においては、専用のハードウェア回路を用いた固定パイプラインによって実現していたが、更に技術開発が進むに応じて、表現力の向上を目的として、三次元座標から二次元座標への変換およびシェーディング処理のプログラマブル化が進展し、全体として“プロセッサ”としての性格を帯びるようになった。従って、CPUに対して、画像処理プロセッサ(例えば、GPU(Graphic Processing Unit))と称されるようなった。 Although these processes were initially realized by fixed pipelines using dedicated hardware circuits for high-speed processing, in order to further improve their expressiveness as technology development progresses, Programmability of transformation from three-dimensional coordinates to two-dimensional coordinates and shading processing has progressed, and has become a character of "processor" as a whole. Accordingly, the CPU is called an image processing processor (for example, a GPU (Graphic Processing Unit)).
かかるGPUにおいては、上記座用変換からテクスチャマッピングまでの処理を行う機能部が全体として慣例上“シェーダ”とも称されているが、それを構成する各処理のプログラマブル化が進んでおり、固定処理ではなく、ユーザが自由に可変的に各種シェーディング処理を選択実行できるようになってきている。具体的には、ポリゴンの頂点単位でのプログラマブル化から、ラスタライズ後のピクセル単位でのプログラマブル化を経て、最近では、GPU内のプログラマブルな機能部分を、画像処理のみならず汎用計算にも利用可能なようにした“コンピュートシェーダ”と称される構成を有するものまで登場している。 In such a GPU, the functional units that perform the processing from the above seat transformation to the texture mapping are generally also commonly referred to as "shaders" as a whole, but the programmization of each processing that constitutes them is in progress, and fixed processing Instead, the user can select and execute various shading processes freely and variably. Specifically, after programmable from polygon vertex units to programmable pixel units after rasterization, recently, programmable functional parts in the GPU can be used not only for image processing but also for general-purpose calculations What has appeared to have a configuration called "compute shader".
ところで、上述のようなGPUにおけるレンダリング処理においては、ポリゴンへテクスチャ画像を貼り付ける処理の際に、テクスチャ画像を拡大したり、縮小したり、あるいは変形したりする処理が行われ、これらの拡大・縮小・変形の各処理にはバイリニアフィルタリングやバイキュービックフィルタリングが用いられる(例えば、特許文献1参照)。 By the way, in the rendering process in the above-described GPU, in the process of attaching a texture image to a polygon, a process of enlarging, reducing or deforming the texture image is performed, and these enlargements Bilinear filtering and bicubic filtering are used for each processing of reduction and deformation (see, for example, Patent Document 1).
しかしながら、バイリニアフィルタリングやバイキュービックフィルタリングの各処理では、オブジェクトの斜め方向のエッジにいわゆるシャギーが発生し、全体的にぼやけてしまうという課題がある。 However, in each process of bilinear filtering and bicubic filtering, there is a problem that so-called shaggy occurs at the edge in the diagonal direction of the object and the entire image is blurred.
一方、高品質な拡大手法として、コスト関数やエッジ方向などに応じて、画像領域を三角形に分割して画素を補間する三角形分割手法が提案されており、代表的なものとして、Data Dependent Triangulationが挙げられる(例えば、非特許文献1参照)。これは、各画素を頂点とする格子状の各領域に渡って、コスト関数に基づいて分割といわゆる”edge swap”とを繰り返して領域を分割し、補間すべき画素の値を算出する際のサンプリング(参照)画素点を決定する手法である。 On the other hand, as a high-quality enlargement method, a triangle division method has been proposed in which the image area is divided into triangles and the pixels are interpolated according to the cost function, the edge direction, etc. (See, for example, Non-Patent Document 1). This is based on the cost function in which division and so-called "edge swap" are repeated based on the cost function across each lattice-like area having each pixel as a vertex to divide the area and calculate the value of the pixel to be interpolated. This is a method of determining sampling (reference) pixel points.
この“三角形分割手法”を画像拡大処理に応用したものとして、例えば特許文献2がある。当該文献においては、2次元コンピュータグラフィックス処理において描画する際の補間処理として三角形分割手法を採用し、デコーダにより伸長された画像データと三角形分割評価回路により決定された各領域の分割パターンとを対応付けて画像メモリに格納すると共に、補間により値を決定すべき画素がある場合に、補間すべき画素を含む格子の領域についての分割パターンの情報と、その格子に係る所定の画素値を画像メモリから読み込み、補間すべき画素の値を求める画像表示処理装置及び画像表示処理方法が開示されている。
しかしながら、特許文献2に開示された技術においては、デコーダによりライン又はブロック単位で得られる二次元画像データをシーケンシャルに入力し、入力データに対して三角形分割手法を適用して処理を行ったデータをワークバッファ等のメモリに格納し、描画回路がワークバッファに格納されたデータにアクセスして補間データを得ているので、三次元コンピュータグラフィックスの描画回路のようにテクスチャマッピングのための特定アドレスのテクスチャをUV値で指定するような処理とは、前提の構成が異なる。
However, in the technique disclosed in
すなわち、三次元コンピュータグラフィックスにおけるテクスチャマッピングにように、任意の座標の補間データがランダムに要求される場合には、特許文献2に開示された技術のように画像データをシーケンシャル処理できず、また分割パターン情報を格納しておくためのワークバッファが必要であるが、例えば、ゲーム開発用のエンジンであるUnityなどの3Dレンダラのマテリアルにピクセルシェーダとして補間方法を与える場合など、レンダラ等の制約によりワークバッファを利用できない場合では、特許文献2に開示された技術を利用することができない。
That is, as in the case of texture mapping in three-dimensional computer graphics, when interpolation data at arbitrary coordinates is randomly required, image data can not be sequentially processed as in the technique disclosed in
また、コンピュートシェーダが搭載されてそれを利用する場合のように、ブロック単位で任意のブロック座標の補間データをランダムに要求されるような態様においては、特許文献2とは前提が異なり、新たな適用方法を模索する必要がある。
Also, in a mode in which interpolation data of arbitrary block coordinates is randomly requested in block units as in the case where a compute shader is mounted and used, the premise is different from
本発明は上述のような事情から為されたものであり、本発明の目的は、三角形分割手法を採用してより滑らかな拡大画像を得ることができる、プログラマブルシェーダ機能を有した画像処理プロセッサにおける画像データ処理方法及びそのプログラムを提供することにある。 The present invention has been made under the circumstances as described above, and it is an object of the present invention to provide an image processing processor having a programmable shader function capable of obtaining a smoother enlarged image by employing a triangulation method. An image data processing method and its program are provided.
上記目的を達成するため、本発明の画像処理プロセッサにおける画像データ処理方法は、入力されるポリゴンの頂点データに基づき、その頂点データに対応する、表示部上で位置を求める頂点シェーダと、前記頂点シェーダにより求められた前記表示部上での頂点の位置から、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するのに必要な、前記表示部上の画素を求めるラスタライザと、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するために、前記ラスタライザから、画素値の必要な前記表示部上の個々の画素の位置の情報が与えられるごとに、当該位置の画素値を、当該位置の所定の周辺のテクスチャ画素の値を補間することにより求めるピクセルシェーダと、を備えた画像処理プロセッサにおける画像データ処理方法であって、前記ピクセルシェーダは、当該位置が含まれる、前記テクスチャの画素格子に係る、三角形分割手法における三角形分割パターンを、前記画素格子を構成する画素及びその周辺の画素から決定し、決定された前記三角形分割パターンに基づき前記所定の周辺のテクスチャ画素の値を補間して、当該位置の画素値を求めることを要旨とする。 In order to achieve the above object, according to an image data processing method in an image processor of the present invention, there is provided a vertex shader for obtaining a position on a display unit corresponding to the vertex data based on vertex data of input polygons; From the position of the vertex on the display unit determined by the shader, the pixel on the display unit required to display an image having the specified texture mapped to the polygon on the display unit is determined In order to display on the display unit a rasterizer and an image in which a specified texture is mapped to the polygon, the rasterizer gives information on the position of each pixel on the display unit which requires a pixel value. Pixel shape at each position is determined by interpolating the values of texture pixels at predetermined positions around the position. An image data processing method in an image processing processor, wherein the pixel shader configures a triangle division pattern in a triangle division method according to the pixel grid of the texture including the position, the pixel grid The present invention is characterized in that the value of the predetermined surrounding texture pixel is determined based on the determined triangle division pattern, and the pixel value of the position is determined based on the determined pixel and the surrounding pixels.
ここで、前記ピクセルシェーダは、前記三角形分割パターンを決定する際に、前記画素格子を構成する画素及びその周辺の画素の各値について、低域濾過フィルタを施しつつ勾配値を求めることが望ましい。 Here, when the pixel shader determines the triangle division pattern, it is preferable that a low pass filter is applied to each value of pixels constituting the pixel grid and pixels therearound to obtain a gradient value.
また、詳細には、前記ピクセルシェーダは、前記三角形分割パターンを決定する際に、当該位置が含まれる、前記テクスチャの画素格子に係る前記三角形分割パターンと、当該画素格子の上下左右の格子に係る前記三角形分割パターンとを仮決定し、仮決定された、当該位置が含まれる、前記テクスチャの画素格子に係る前記三角形分割パターンと、当該画素格子の上下左右の格子に係る前記三角形分割パターンとが不整合の場合には、整合させることにより、当該位置が含まれる、前記テクスチャの画素格子に係る前記三角形分割パターンを最終決定する。 Also, in detail, when the pixel shader determines the triangle division pattern, the pixel shader relates to the triangle division pattern related to the pixel grid of the texture and the grids above and below and to the left and right of the pixel grid. The triangle division pattern according to the pixel grid of the texture, which temporarily determines the triangle division pattern and includes the position determined temporarily, and the triangle division pattern according to the top, bottom, left, and right grids of the pixel grid include In the case of misalignment, the final determination of the triangle division pattern of the texture pixel grid including the position is performed by matching.
また、上記目的を達成するため、本発明の画像処理プロセッサにおける画像データ処理プログラムは、入力されるポリゴンの頂点データに基づき、その頂点データに対応する、表示部上で位置を求める頂点シェーダ処理と、前記頂点シェーダ処理により求められた前記表示部上での頂点の位置から、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するのに必要な、前記表示部上の画素を求めるラスタライザ処理と、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するために、前記ラスタライザ処理から、画素値の必要な前記表示部上の個々の画素の位置の情報が与えられるごとに、当該位置の画素値を、当該位置の所定の周辺のテクスチャ画素の値を補間することにより求めるピクセルシェーダ処理と、を有し、画像処理プロセッサにレンダリング処理を行わせる画像データ処理プログラムであって、前記ピクセルシェーダ処理は、当該位置が含まれる、前記テクスチャの画素格子に係る、三角形分割手法における三角形分割パターンを、前記画素格子を構成する画素及びその周辺の画素から決定し、決定された前記三角形分割パターンに基づき前記所定の周辺のテクスチャ画素の値を補間して、当該位置の画素値を求めることを要旨とする。 Further, in order to achieve the above object, an image data processing program in an image processor of the present invention executes vertex shader processing for obtaining a position on a display unit corresponding to the vertex data based on vertex data of an input polygon. A position on the display unit, which is necessary for displaying on the display unit an image in which a designated texture is mapped to the polygon from the position of the vertex on the display unit determined by the vertex shader processing Rasterizer processing for obtaining the pixels of each of the pixels, and individual pixels on the display unit requiring pixel values from the rasterizer processing to display on the display unit an image in which a designated texture is mapped to the polygon Each time the information on the position is given, the pixel value at the position is interpolated by the value of the texture pixel at a predetermined periphery of the position. An image data processing program for causing an image processing processor to perform rendering processing, the pixel shader processing includes triangle division according to the pixel grid of the texture in which the position is included The triangle division pattern in the method is determined from the pixels constituting the pixel grid and pixels in the periphery thereof, and the values of the predetermined surrounding texture pixels are interpolated based on the determined triangle division pattern, and the pixels at the corresponding position The point is to determine the value.
また、上記目的を達成するため、本発明の画像処理プロセッサにおける画像データ処理方法は、複数のコンピュートユニットを有したコンピュートシェーダを備え、レンダリング処理を行う画像処理プロセッサにおける画像データ処理方法であって、各コンピュートユニットは、テクスチャを分割した各分割テクスチャを担当して並列的に処理するものであって、プログラムにより並列的に動作する複数のスレッドを有し、前記複数のスレッドを利用して、前記分割テクスチャを構成する各画素の値から、各画素により構成される各格子のうちの所定数の格子について、三角形分割手法で使用する三角形分割パターンを一括で決定し、ポリゴンに前記テクスチャがマッピングされた画像を表示部に表示するために、拡大した画像を格納するバッファ上の画素の位置に対応する前記所定数の格子上の位置を求め、各格子に含まれる前記位置に係る前記表示部上の画素の値を、各格子に対応する各スレッドを利用して、各格子に対して決定された前記三角形分割パターンに基づき当該分割テクスチャにおける周辺の画素の値を補間して求めることを要旨とする。 Further, in order to achieve the above object, an image data processing method in an image processing processor of the present invention is an image data processing method in an image processing processor that includes a compute shader having a plurality of compute units and performs rendering processing, Each compute unit takes charge of each divided texture obtained by dividing the texture and processes it in parallel, and has a plurality of threads operated in parallel by a program, and using the plurality of threads, From the values of each pixel constituting the divided texture, for a predetermined number of grids of each grid formed by each pixel, a triangle division pattern to be used in the triangle division method is determined at once, and the texture is mapped to polygons Stores the enlarged image in order to display the displayed image on the display unit. The predetermined number of grid positions corresponding to the pixel positions on the grid are determined, and the values of the pixels on the display unit related to the positions included in each grid are used for each thread corresponding to each grid. The gist of the present invention is to interpolate and obtain the values of peripheral pixels in the divided texture based on the triangle division pattern determined for each grid.
ここで、前記複数のスレッドは、前記三角形分割パターンを一括で決定する際に、処理の過程で得られた値を、前記複数のスレッドに共通のメモリに格納しつつ処理を行うことが好適である。 Here, when the plurality of threads collectively determine the triangle division pattern, it is preferable that the processing is performed while storing values obtained in the process of processing in a memory common to the plurality of threads. is there.
また、前記各コンピュートユニットは、前記複数のスレッドを利用して前記三角形分割パターンを一括で決定する際に、各格子を構成する画素及びその周辺の画素の各値について、低域濾過フィルタを施しつつ勾配値を求め、当該フィルタ処理により、利用する前記分割テクスチャの画素数に対して、得られる前記三角形分割パターンの数が減じてしまう分、前記各コンピュートユニットに、前記各分割テクスチャの境界部分が重複して割り当てられることが効果的である。 Further, when each of the compute units collectively determines the triangle division pattern using the plurality of threads, a low pass filter is applied to each value of pixels constituting each grid and pixels in the periphery thereof. While the gradient value is determined, the number of obtained triangle division patterns is reduced with respect to the number of pixels of the divided textures to be used by the filtering process, so that each compute unit has a boundary portion of each divided texture. It is effective that is assigned redundantly.
また、詳細には、前記各コンピュートユニットは、前記複数のスレッドを利用して前記三角形分割パターンを一括で決定する際に、各スレッドに対応する格子に係る前記三角形分割パターンと、当該格子の上下左右の格子に係る前記三角形分割パターンとを仮決定し、仮決定された、当該スレッドに対応する格子に係る前記三角形分割パターンと、当該格子の上下左右の格子に係る前記三角形分割パターンとが不整合の場合には、整合させることにより、当該スレッドに対応する格子に係る前記三角形分割パターンを最終決定する。 Further, in detail, when each of the compute units collectively determines the triangle division pattern using the plurality of threads, the triangle division pattern according to the grid corresponding to each thread, and the upper and lower sides of the grid The triangle division patterns for the left and right grids are temporarily determined, and the temporarily determined triangle division patterns for the grid corresponding to the thread and the triangle division patterns for the upper, lower, left, and right grids of the grid are not correct. In the case of matching, by matching, the triangulation pattern of the lattice corresponding to the thread is finally determined.
また、上記目的を達成するため、本発明の画像処理プロセッサにおける画像データ処理プログラムは、各々が複数の並列動作可能なスレッドを有する、複数の並列動作可能なコンピュートユニットを備えた画像処理プロセッサに、ポリゴンで構成される三次元モデルの情報と貼られるべきテクスチャの情報に基づきレンダリング処理を行わせる画像データ処理プログラムであって、前記テクスチャを複数に分割した分割テクスチャの各々を前記各コンピュートユニットに割り当てる処理と、前記複数のスレッドに、前記分割テクスチャを構成する各画素の値から、各画素により構成される各格子のうちの所定数の格子について、三角形分割手法で使用する三角形分割パターンを一括で決定させる処理と、前記ポリゴンに前記テクスチャがマッピングされた画像を表示部に表示するために、拡大した画像を格納するバッファ上の画素の位置に対応する前記所定数の格子上の位置を求める処理と、各格子に対応する各スレッドに、各格子に含まれる前記位置に係る前記表示部上の画素の値を、各格子に対して決定された前記三角形分割パターンに基づき当該分割テクスチャにおける周辺の画素の値を補間して求めさせる処理を有することを要旨とする。 Further, to achieve the above object, an image data processing program in an image processing processor according to the present invention comprises an image processing processor comprising a plurality of parallel operable compute units each having a plurality of parallel operable threads, An image data processing program that performs rendering processing based on information of a three-dimensional model configured by polygons and information of a texture to be attached, wherein each of divided textures obtained by dividing the texture into a plurality of pieces is allocated to each of the compute units Processing and, based on the values of the pixels constituting the divided texture, the triangle division patterns used in the triangle division method collectively for a predetermined number of grids of each grid formed of the pixels in the plurality of threads And the texture is mapped to the polygon. Processing for obtaining the positions on the predetermined number of grids corresponding to the positions of the pixels on the buffer storing the enlarged image, and displaying each of the threads corresponding to the grids, in order to display the scanned image on the display unit; Processing for interpolating values of surrounding pixels in the divided texture on the basis of the triangle division pattern determined for each lattice based on the triangle division pattern determined for each lattice; Make it a gist.
本発明の画像処理プロセッサにおける画像データ処理方法及びそのプログラムによれば、プログラマブルシェーダ機能を有した画像処理プロセッサにおいて、三角形分割手法を採用してより滑らかな拡大画像を得ることができる。 According to the image data processing method and program thereof in the image processing processor of the present invention, in the image processing processor having a programmable shader function, it is possible to obtain a smoother enlarged image by adopting a triangle division method.
特に、コンピュートシェーダを備えた画像処理プロセッサにおいては、三角形分割手法における複数の三角形分割パターンが一括で得られ、それにより、表示部での表示に必要な各画素の値も一括して求めることができる。 In particular, in an image processing processor provided with a compute shader, a plurality of triangle division patterns in the triangle division method can be obtained at once, thereby obtaining values of each pixel necessary for display on the display unit at once. it can.
また、各格子について三角形分割パターンを決定する際に、当該格子を構成する画素及びその周辺の画素の各値について、低域濾過フィルタを施しつつ勾配値を求めているので、ノイズ等を除去できる。 In addition, when determining the triangle division pattern for each grid, since the gradient value is obtained while applying low-pass filtering for each value of the pixels constituting the grid and the pixels around it, noise and the like can be removed. .
以下、図面を参照して、本発明の実施の形態について詳細に説明する。
<プログラマブルピクセルシェーダ機能を有するGPUでの実施形態>
図1は、本発明の画像データ処理方法及びそのプログラムの一実施形態が具現化される画像処理装置の構成を示すブロック図である。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
<Embodiment with GPU Having Programmable Pixel Shader Function>
FIG. 1 is a block diagram showing a configuration of an image processing apparatus in which an embodiment of an image data processing method and a program thereof according to the present invention is embodied.
同図に示した画像処理装置は、三次元グラフィックス画像が表示される表示部5と、複数のテクスチャのデータが格納されるVRAM3と、ポリゴンで構成される3Dモデルの頂点データと貼り付けるべき各テクスチャを特定する情報を供給するCPU1と、CPU1から供給された頂点データとテクスチャを特定する情報に基づき、頂点データから、表示部5上で表示される範囲に対応する各画素を求めると共に、VRAM3に格納された対応するテクスチャのデータを読み込んできて、それに基づき、上記対応する各画素の値を算出して出力するGPU2Aと、表示部5の前段に位置し、GPU2Aから出力された各画素データが格納されるフレームバッファ4と、を備えている。
The image processing apparatus shown in the figure should be attached with the
GPU2Aは、頂点シェーダ21、ラスタライザ22、ピクセルシェーダ23、及びテクスチャフェッチ部24を有している。以下、図1と併せて、図2乃至図10を参照しつつ、GPU2Aにおけるいわゆるレンダリング処理を詳細に説明する。なお、頂点シェーダ21、ラスタライザ22、及びピクセルシェーダ23は、いずれもプログラム可能なものである。
The
頂点シェーダ21は、CPU1から供給された頂点データに対して、各種の座標変換を施し、それらの表示部5上での表示位置(座標)を求める。
The
図2(a)は、ラスタライザ22における処理の手順を示すフローチャートであり、同図(b)はラスタライズ処理を説明するための図である。そこで、ラスタライザ22は、まず、頂点シェーダ21から送られてきた表示部5上での頂点データから、図2(b)に示すようにラスタライズ処理を行い、値の必要な画素を導き出す(ステップS11)。図2(b)では頂点データから導出した境界において、画素の中心が境界の内側に位置する場合に画素値を求める例を示している。次に、ラスタライザ22は、値の必要な画素ごとに、ピクセルシェーダ23に対して、各画素の位置を、テクスチャのUV座標系の値UV(0〜1,0〜1)として与えることにより、ピクセルシェーダ23に画素値の算出を依頼する(ステップS12)。そして、値の必要な画素ごとに、ピクセルシェーダ23から画素値を取得する(ステップS13)。S11の処理で得られた、値の必要な画素すべてについて画素値が得られれば(ステップS14において肯定判定)、ステップS15に移行し、取得した各画素値をフレームバッファ4に書き込んで表示部5での表示に供する。なお、ここでは、説明の便宜上、すべての画素値が得られてから一括してフレームバッファ4に供給するような手順になっているが、各画素値が得られるたびに個々にフレームバッファ4に供給することも考えられ、いずれであってもよい。
FIG. 2A is a flowchart showing the procedure of processing in the
図3は、ラスタライザ22から画素値の算出の依頼があるごとに行われるピクセルシェーダ23における処理の手順を示すフローチャートであり、図4は、その一部の処理である三角形分割パターンの決定処理の手順の詳細を示すフローチャートであり、図5乃至図10は、三角形分割パターンの決定処理と決定された分割パターンに基づく補間処理を説明するための図である。図3に示したピクセルシェーダ23における処理は、今回、ユーザにより特徴的にプログラミングされる部分である。プログラミング言語は、例えば、HLSL(High Level Shading Language)やCgである。
FIG. 3 is a flow chart showing the procedure of processing in the
図3を参照して、まず、ピクセルシェーダ23は、ラスタライザ22からのUV座標値UVの入力を伴って、ピクセルシェーダ23から、値の必要な画素のその値の算出の依頼があったか否かを判定し(ステップS21)、その依頼があった場合(ステップS21において肯定判定)には、当該値を三角形分割手法を用いて求めるべく、当該値の必要な画素に対応した1つの三角形分割パターンを決定する(ステップS22)。
Referring to FIG. 3, first, the
三角形分割パターンの決定処理の詳細は、図4を参照して、ピクセルシェーダ23は、まず、ラスタライザ22から受け取ったUV座標値UVをテクスチャピクセル座標値に変換する(ステップS221)。これは簡単には、テクスチャ画像の解像度を乗ずることにより行える。次に、ピクセルシェーダ23は、得られたテクスチャピクセル座標値から、図5(a)に示すように、その位置を囲う4点のテクスチャ画素の左上の画素を便宜上、基準点(0,0)としたときの、(−3、−3)〜(4,4)までの画素、すなわち8×8の画素の各値を、テクスチャフェッチ部24にテクスチャアドレスTAを指定することにより、VRAM3からの読込みを指示する(ステップS222)。この(−3、−3)〜(4,4)の8×8の画素の値は、当該UV座標値UVとして与えられた、当該値の必要な画素のその値を三角形分割手法による補間により求めるための三角形分割パターンを決定するために必要な情報である。また、このように8×8の画素の値を必要としたのは、以下に説明する低域濾過フィルタ処理を施してノイズ耐性を高める等のためである。
For details of the process of determining the triangle division pattern, referring to FIG. 4, the
そこで、図5(a)に示すような8×8の画素の値を受け取ると、ピクセルシェーダ23は、次に、同図(b)に示すような3×3の画素をカバーするようなプリフィルタPFを用意し、同図(c)に示すように、8×8の画素を順次走査し、その都度、3×3の画素の値を平均化することにより、走査終了時に、図6(a)に示すような6×6の画素値を得る(ステップS223)。
Therefore, when the value of 8 × 8 pixels as shown in FIG. 5A is received, the
次に、ピクセルシェーダ23は、得られた6×6の画素値に対して、図6(b)に示すような2×2の画素をカバーするような勾配フィルタGFを用意し、同図(c)に示すように、6×6の画素を順次走査し、その都度、2×2の画素の値に基づく勾配を求めることにより、言い換えれば、各格子に対応する勾配値を求めることにより、走査終了時に、図7(a)に示すような5×5の格子に対応した5×5の勾配値を得る(ステップS224)。
Next, the
次に、ピクセルシェーダ23は、得られた5×5の勾配値に対して、図7(b)に示すような3×3の勾配値をカバーするような平均化フィルタAFを用意し、同図(c)に示すように、5×5の勾配値を順次走査し、その都度、3×3の勾配値を平均化することにより、走査終了時に、図9(a)に示すような3×3の勾配値を得る(ステップS225)。
Next, the
上述のように得られた3×3の勾配値から、値を得たい位置を含む格子、すなわち(0,0)〜(1,1)で構成された格子についての三角形分割パターンを決定するのであるが、前提として、まず、その三角形分割パターンについて、図8を参照して説明する。ここでは、画素値の傾斜を360度/16の精度、すなわち22.5度単位の精度まで近似する場合を説明する。画素値の傾斜を22.5度単位の精度まで近似する場合、注目する4つの画素点が形成する格子領域の各々に決定される分割パターンは、図8に示した15通りとなる。 From the 3 × 3 gradient values obtained as described above, we determine the triangulation pattern for the grid that contains the position we want to obtain, ie, the grid composed of (0,0) to (1,1) As a premise, first, the triangle division pattern will be described with reference to FIG. Here, the case where the inclination of the pixel value is approximated to an accuracy of 360 degrees / 16, that is, an accuracy of 22.5 degrees will be described. When the inclination of the pixel value is approximated to an accuracy of 22.5 degrees, the division patterns determined for each of the lattice regions formed by the four pixel points of interest are fifteen shown in FIG.
そこで、図9(a)のように得られた3×3の勾配値から、中央の格子について、言い換えれば、テクスチャ画素(0,0)、(0,1)、(1,0)、(1,1)で構成された格子について、図8に示した分割パターンのいずれかを決定するのであるが、そのとき当該9個の勾配値から、中央の格子に加えて、その上下左右の格子についても分割パターンを求める(ステップS226)。このとき、中央の格子についての分割パターンとその上下左右の分割パターンの接続が整合のとれた接続であるならば(ステップS227において肯定判定)、そのときの中央の格子についても分割パターンが最終的な求めたい分割パターンとなる。例えば、分割パターンが図9(b)のように求まった場合には、整合がとれているので、求めたい中央の格子についての分割パターンは、同図(c)のように決定される。 Therefore, from the 3 × 3 gradient values obtained as shown in FIG. 9A, in the central grid, in other words, texture pixels (0, 0), (0, 1), (1, 0), ((0) For the grid constructed in 1, 1), any one of the division patterns shown in FIG. 8 is determined, then, from the nine gradient values, in addition to the center grid, the grids above, below, left and right The division pattern is also obtained for (step S226). At this time, if the connection of the divided pattern for the central grid and the connection of the upper, lower, left, and right divided patterns is matched (affirmative determination in step S227), the divided pattern is finally obtained also for the central grid at that time. It is the division pattern that you want to obtain. For example, when the division pattern is obtained as shown in FIG. 9B, since the alignment is made, the division pattern for the central grid to be obtained is determined as shown in FIG.
一方、中央の格子についての分割パターンとその上下左右の分割パターンの接続が不整合の場合には(ステップS227において否定判定)、例えば、図9(d)に示すように、整合するようにパターンを修正する(ステップS228)。 On the other hand, if the connection between the division pattern for the central grid and the division patterns on the upper, lower, left, and right sides is mismatched (negative determination in step S227), for example, as shown in FIG. Are corrected (step S228).
図3に戻り、次に、上述のようにステップS22で得られた三角形分割パターンを使用して、三角形分割手法に基づく補間により、値を得たい位置、言い換えれば、ラスタライザ22によりUV座標値UVとして与えられた、値の算出を要求された画素の値を算出する(ステップS23)。
Returning to FIG. 3, next, using the triangle division pattern obtained in step S22 as described above, the position where the value is desired to be obtained by interpolation based on the triangle division method, in other words, the UV coordinate value UV by the
このとき、補間に使用する周囲のテクスチャ画素は、三角形分割手法によれば、求められた分割パターンに応じて決まる。そのことを図10を参照して簡単に説明する。
図10(a)〜(h)は、参照画素の取り方を示した分割パターンの例を示す図である。例えば、同図(a)のように、分割なしのパターンの場合には、格子の各頂点の画素p(ul),p(ur),p(dl),p(dr)の線形補間により、値の必要な位置rpの値を算出する。また、同図(b)の2分割の場合であって、値の必要な位置rpが同図に示すような場合、画素p(ul),p(ur),p(dl)の値に基づき、位置rpの値を算出する。また、同図(c)に示す3分割の1パターンであって、値の必要な位置rpが同図に示すような場合、画素p(ur),p(dl),p(dll)の値に基づき、位置rpの値を算出する。また、同図(d)に示す3分割の1パターンであって、値の必要な位置rpが同図に示すような場合、画素p(ur),p(dl),p(urr)の値に基づき、位置rpの値を算出する。また、同図(e)に示す3分割の1パターンであって、値の必要な位置rpが同図に示すような場合、画素p(ur),p(dl),p(uru)の値に基づき、位置rpの値を算出する。また、同図(f)に示す3分割の1パターンであって、値の必要な位置rpが同図に示すような場合、画素p(ur),p(dl),p(dld)の値に基づき、位置rpの値を算出する。また、同図(g)及び(h)に示す4分割の各パターンについても、各分割領域において同様である。更に、図には例示していない他の7つの分割パターンについても同様である。
At this time, according to the triangle division method, surrounding texture pixels used for interpolation are determined in accordance with the obtained division pattern. This will be briefly described with reference to FIG.
FIGS. 10 (a) to 10 (h) are diagrams showing examples of division patterns showing how to take reference pixels. For example, as shown in FIG. 6A, in the case of a pattern without division, linear interpolation of pixels p (ul), p (ur), p (dl) and p (dr) at each vertex of the grid is performed. Calculate the required position rp of the value. Also, in the case of the two divisions of FIG. 7B, when the required position rp of the values is as shown in the same drawing, based on the values of the pixels p (ul), p (ur) and p (dl). To calculate the value of the position rp. In addition, in the case of one pattern of three divisions shown in (c) of the same figure and the required position rp of the values is as shown in the same figure, the values of the pixels p (ur), p (dl), p (dll) The value of the position rp is calculated based on In addition, in the case of one pattern of three divisions shown in (d) of the same figure and the required position rp of the values is as shown in the same figure, the values of the pixels p (ur), p (dl), p (urr) The value of the position rp is calculated based on In addition, in the case of one pattern of three divisions shown in (e) of the same figure and the required position rp of the values is as shown in the same figure, the values of the pixels p (ur), p (dl), p (uru) The value of the position rp is calculated based on Further, in the case of one pattern of three divisions shown in (f) of the figure and the required position rp of the values is as shown in the same figure, the values of the pixels p (ur), p (dl), p (dld) The value of the position rp is calculated based on The same applies to each of the divided areas also for each of the four divided patterns shown in (g) and (h) in the same figure. Furthermore, the same applies to the other seven division patterns not illustrated in the figure.
従って、結局、図10(i)に示す12個のテクスチャ画素の値があれば、その格子内の補間すべき位置については、値が決定できることになる。この12個については、三角形分割パターンを決定するために読み込んでくる図5(a)に示した8×8の画素に完全に含まれているので、改めてVRAM3から読み込んでくる必要はないことになる。
Therefore, after all, if there are 12 texture pixel values shown in FIG. 10I, values can be determined for the position to be interpolated in the grid. Since these 12 are completely included in the 8 × 8 pixels shown in FIG. 5A which are read to determine the triangle division pattern, it is not necessary to read them from
再度、図3に戻り、最後に、ステップS23で得られた画素値を、ラスタライザ22により要求された画素値として、ラスタライザ22に返す(ステップS24)。
Referring back to FIG. 3, finally, the pixel value obtained in step S23 is returned to the
以上が、プログラマブルピクセルシェーダ機能を有するGPUでの実施形態である。 The above is the embodiment of the GPU having the programmable pixel shader function.
なお、テクスチャフェッチ部24に標準仕様としてバイリニアやバイキュービック等のフィルタ処理が組み込まれている場合には、その機能は解除する。上述のようなピクセルシェーダ23でのフィルタ処理と競合してしまい、意図しないぼやけた画像等になってしまわないようにするためである。従って、上述のように、読み込んだ画素値をそのままピクセルシェーダ23に与える。
When the texture fetch
なお、上述した各フィルタ処理は、想定されるノイズの種類やその大きさに応じて、変更することができる。 In addition, each filter process mentioned above can be changed according to the kind and the magnitude | size of the noise assumed.
以上のように、プログラマブルピクセルシェーダ機能を有するGPUでの実施形態においては、ラスタライザ22が、値の必要な表示部5上の画素位置を画素単位でピクセルシェーダ23に知らせることによりピクセルシェーダ23にその値を要求し、ピクセルシェーダ23が、テクスチャの画素値を使用して、三角形分割手法に基づく補間により、その値を算出してラスタライザ22に返すという処理を行っているので、より滑らかな拡大画像を得ることができる。
As described above, in the embodiment of the GPU having the programmable pixel shader function, the
<コンピュートシェーダ機能を有するGPUでの実施形態>
図11は、本発明の画像データ処理方法及びそのプログラムにおける他の実施形態が具現化される画像処理装置の構成を示すブロック図である。
<Embodiment with GPU having Compute Shader Function>
FIG. 11 is a block diagram showing the configuration of an image processing apparatus in which another embodiment of the image data processing method and the program thereof of the present invention is embodied.
同図に示した画像処理装置は、三次元グラフィックス画像が表示される表示部5と、複数のテクスチャのデータが格納されるVRAM3と、少なくとも、ポリゴンで構成される3Dモデルの頂点データとテクスチャを特定する情報と共に、各テクスチャを分割して処理する際のその分割に係る情報を供給するCPU1と、CPU1から供給された頂点データ、テクスチャを特定する情報、及び上記分割情報に基づき、VRAM3に格納された対応するテクスチャを、分割された単位ごとに、一括してその三角形分割パターンを求めると共に、頂点データに基づく拡大率に応じて、表示部5における表示画素の値を、求めた全分割パターンに基づいて、三角形分割手法により、一括して補間して求めて出力するGPU2Bと、表示部5の前段に位置し、GPU2Aから出力された各画素データが格納されるフレームバッファ4と、を備えている。
The image processing apparatus shown in the figure includes a
また、図11に示すように、GPU2Bは、コンピュートシェーダ25及びディスパッチャ26を有しており、更に、コンピュートシェーダ25は、それぞれが、分割されたテクスチャの各々(以下、“分割テクスチャ”と称す)を担当して処理する複数のコンピュートユニット251a、251b、251c、・・・を有している。
Further, as shown in FIG. 11, the GPU 2B has a
図12は、各コンピュートユニット251の詳細構成を示すブロック図である。同図に示すように、各コンピュートユニット251は、VRAM3から担当する分割テクスチャの各画素値TPVを読み込んでくるテクスチャフェッチ部2511と、テクスチャフェッチ部2511を介して読み込まれた分割テクスチャの各画素値TPVをそれぞれ並列的に処理する複数のスレッド2512a、2512b、2512c、・・・と、各スレッド2512における処理の過程の情報や処理結果が格納される共有メモリ2513と、を備えている。スレッド2512の数は、例えば768である。また、共有メモリ2513は、例えば32kバイトのキャッシュメモリである。
FIG. 12 is a block diagram showing the detailed configuration of each
次に、図11に示した画像処理装置の動作及び処理手順を説明する。
VRAM3に格納されたテクスチャが、どのように分割されて処理されるかは、予め設計される。図13は、テクスチャをどのように分割して処理するかの例を示す図である。ここでは、一つの分割テクスチャを16×16のテクスチャ画素で構成するものとし、テクスチャを3×2の分割テクスチャ((0,0)〜(1,2))として分割している。ここで、各分割テクスチャを6格子分重複させているのは、後述する三角形分割パターンを決定する処理において、分割の境界で欠落なく分割パターンを求められるようにするためである(当該重複がなければ、後述するフィルタ処理に応じて欠落が生じてしまう)。
Next, the operation and processing procedure of the image processing apparatus shown in FIG. 11 will be described.
How the texture stored in the
そこで、CPU1は、GPU2Bに対して、頂点データ、テクスチャを特定する情報と共に、“分割情報”、すなわち分割テクスチャを構成する画素の数(例えば、上記のように16×16)や、分割テクスチャの数の情報等を予め通知する。GPU2Bのディスパッチャ26は、CPU1から供給された当該情報に基づき、必要な数のコンピュートユニット251を把握すると共に、それらのコンピュートユニット251に、担当して処理すべき分割テクスチャを、グループIDで通知する。それにより、例えば、図13に示す例では、例えば、コンピュートユニット251a、251b、251c、251d、251e、251fが、それぞれ、分割テクスチャ(0,0)、(0,1)、(0,2)、(1,0)、(1,1)、(1,2)を担当するように設定され、グループIDとして(0,0)、(0,1)、(0,2)、(1,0)、(1,1)、(1,2)が渡される。
Therefore, the
図14は、各コンピュートユニット251の処理手順を示すフローチャートである。当該処理は、各コンピュートユニット251にプログラムにより組み込まれ、また、各コンピュートユニット251は並列的に動作可能である。プログラム言語は、例えばHLSLやCgである。
FIG. 14 is a flowchart showing the processing procedure of each
そこで、その処理手順を同図に沿って説明すると、まず、各コンピュートユニット251のテクスチャフェッチ部2511が、ディスパッチャ26から通知されたグループIDから計算されるUV座標値の範囲により、担当する分割テクスチャの各画素値TPV(16×16画素)を読み込んでくる(ステップS31)。次に、読み込んだ16×16個の分割テクスチャ画素値TPVから、9×9個の三角形分割パターンを一括して決定する(ステップS32)。
Therefore, the processing procedure will be described along the same figure. First, the texture fetch
図15は、ステップS32における、16×16個の分割テクスチャ画素値TPVから、9×9個の分割パターンを一括して決定する処理の詳細手順を示すフローチャートである。図16乃至図20は、当該手順を説明するための図である。 FIG. 15 is a flowchart showing a detailed procedure of a process of collectively determining 9 × 9 divided patterns from 16 × 16 divided texture pixel values TPV in step S32. 16 to 20 are diagrams for explaining the procedure.
前提として、読み込んできた担当する分割テクスチャの16×16の画素値TPVを、図16に示すようにローカルに画素(x,y)(x=−3〜12、y=−3〜12)と表すものとし、一方、スレッド2512a、2512b、・・・のうち、256個を選択して、それらを、二次元の画素(x,y)に対応させて、スレッド2512[i,j](i=1〜16、j=1〜16)と表記するものとし、各スレッド2512[i,j]が、各画素(x,y)又は平均値に対して1対1で担当して処理する構成となっている。なお、図16以下に示す具体例では、画素(−3,−3)がスレッド2512[1,1]に対応し、画素(12,−3)がスレッド2512[16,1]に対応し、画素(−3,12)がスレッド2512[1,16]に対応し、そして最後に画素(12,12)がスレッド2512[16,16]に対応するようにしているが、これは単なる説明の便宜上の対応関係である。
As a premise, the 16 × 16 pixel values TPV of the divided textures in charge that have been read in are locally represented as pixels (x, y) (x = −3 to 12, y = −3 to 12) as shown in FIG. On the other hand, 256 of the
そこで、まず、スレッド2512[i,j](i=1〜16、j=1〜16)の各々は、対応する担当の画素(x,y)(x=−3〜12、y=−3〜12)の値TPVを、共有メモリ2513に格納する(ステップS321)。そして、メモリバリア処理、すなわち、各スレッド2512におけるすべての格納が終了するまで待機する(ステップS322)。 Therefore, first, each of the threads 2512 [i, j] (i = 1 to 16, j = 1 to 16) corresponds to the corresponding pixel (x, y) (x = −3 to 12, y = −3) 12) is stored in the shared memory 2513 (step S321). Then, the process waits until the memory barrier process, ie, all storage in each thread 2512 is completed (step S322).
次に、14×14個のスレッド2512[i,j](i=2〜15、j=2〜15)の各々は、図16に示すように、共有メモリ2513から自身担当の画素を中心とした3×3画素の値を共有メモリ2513から読み込んできて、プリフィルタ処理により一の値を算出し、共有メモリ2513に格納する(ステップS323)。このプリフィルタ処理は、図5(b)、(c)を参照して説明した処理と同じであるが、各スレッド2512が並列的に当該プリフィルタ処理を行うところが先の実施形態とは異なる。そして、スレッド2512[i,j](i=2〜15、j=2〜15)によるすべての格納が終了するまで待機する(ステップS324)。当該ステップを抜けると、この時点、14×14個の情報が共有メモリ2513に格納される。
Next, as shown in FIG. 16, each of 14 × 14 threads 2512 [i, j] (i = 2 to 15, j = 2 to 15) has its own pixel in charge from shared
次に、13×13個のスレッド2512[i,j](i=2〜14、j=3〜15)の各々は、図17に示すように、自身担当の画素を左下画素として含む格子を構成する2×2画素の値を共有メモリ2513から読み込んできて、勾配フィルタ処理により一の値を算出し、共有メモリ2513に格納する(ステップS325)。この勾配フィルタ処理は、図6(b)、(c)を参照して説明した処理と同じであるが、各スレッド2512が並列的に当該勾配フィルタ処理を行うところが先の実施形態とは異なる。そして、スレッド2512[i,j](i=2〜14、j=3〜15)によるすべての格納が終了するまで待機する(ステップS326)。当該ステップを抜けると、この時点、13×13個の情報が共有メモリ2513に格納される。
Next, as shown in FIG. 17, each of the 13 × 13 threads 2512 [i, j] (i = 2 to 14, j = 3 to 15) has a grid including a pixel in charge of itself as a lower left pixel. The value of 2 × 2 pixels to be configured can be read from the shared
次に、11×11個のスレッド2512[i,j](i=3〜13、j=4〜14)の各々は、図18に示すように、自身担当の画素が格子中心の左下側画素で、格子中心に最も近い画素として含まれる3×3の値を共有メモリ2513から読み込んできて、平均化フィルタ処理により一の値を算出し、共有メモリ2513に格納する(ステップS327)。この平均化フィルタ処理は、図7(b)、(c)を参照して説明した処理と同じであるが、各スレッド2512が並列的に当該平均化フィルタ処理を行うところが先の実施形態とは異なる。そして、スレッド2512[i,j](i=3〜13、j=4〜14)によるすべての格納が終了するまで待機する(ステップS328)。当該ステップを抜けると、この時点、11×11個の情報が共有メモリ2513に格納される。
Next, as shown in FIG. 18, each of the 11 × 11 threads 2512 [i, j] (i = 3 to 13, j = 4 to 14) has its own pixel at the lower left side of the lattice center Then, 3 × 3 values included as pixels closest to the lattice center can be read from the shared
次に、9×9個のスレッド2512[i,j](i=4〜12、j=5〜13)の各々は、図19に示すように、自身担当の格子の値を中心とした3×3の値を共有メモリ2513から読み込んできて、それらの値に基づき、自身担当の格子に加えて、その上下左右の格子についても分割パターン(図8参照)を求め、図4の手順で説明したのと同様、上下左右の格子についての分割パターンと整合が取れていれば、中央の分割パターンを自身担当の格子についての分割パターンとして決定し、整合が取れていなければ修正し、最終的に決定された中央の分割パターンを自身担当の格子についての分割パターンとして共有メモリ2513に格納する(実際に格納するのは、パターン番号等)(ステップS329)。この処理は、図9を参照して説明した処理と同じであるが、各スレッド2512が並列的に当該処理を行うところが先の実施形態とは異なる。そして、スレッド2512[i,j](i=4〜12、j=5〜13)によるすべての格納が終了するまで待機する(ステップS330)。当該ステップを抜けると、最終的に、9×9個の三角形分割パターンに係る情報が共有メモリ2513に格納される。
図13に示したように各分割テクスチャを6格子分重複させているのは、図20に示すように、16×16のテクスチャ画素から、上記のように最終的に9×9個の三角形分割パターンに係る情報を得るためであり、分割テクスチャを重複させないと、三角形分割パターンに係る情報が得られない領域が発生するためである。
Next, as shown in FIG. 19, each of 9 × 9 threads 2512 [i, j] (i = 4 to 12, j = 5 to 13) is centered on the value of its
The reason why the divided textures are overlapped by six grids as shown in FIG. 13 is that, as shown in FIG. 20, it is finally divided into 9 × 9 triangles as described above from 16 × 16 texture pixels. This is for obtaining information related to the pattern, and if the divided textures are not overlapped, an area where information related to the triangle divided pattern can not be obtained occurs.
図14に戻り、各コンピュートユニット251a、b、c、・・・(図13の場合は、コンピュートユニット251a〜251f)は、CPU1から供給されるテクスチャの拡大率に応じて確保された拡大画像を格納するためのバッファ内の表示画素であって、それらの位置をUV座標値としたときに、自身担当の分割テクスチャのUV座標値範囲に含まれるそれらの位置(RGBの値を求めたい位置)と、自身担当の分割テクスチャの画素との対応関係(拡大率が大きくなれば、値を求めたい各位置の方が精細になる)を求める(ステップS33)。
Returning to FIG. 14, each of the
そして、各コンピュートユニット251a、b、c、・・・(図13の場合は、コンピュートユニット251a〜251f)に含まれる9×9個のスレッド2512[i,j](i=4〜12、j=5〜13)の各々は、並列的に、自身が担当する格子に含まれる、値が求められるべき複数の位置の値を、自身が担当する格子について上記ステップS329において決定された三角形分割パターンに基づき、当該パターンに応じた周辺画素(図10参照)を利用して、三角形分割手法により求める(ステップS34)。
Then, 9 × 9 threads 2512 [i, j] (i = 4 to 12, j) included in each of the
最後に、各コンピュートユニット251a、b、c、・・・(図13の場合は、コンピュートユニット251a〜251f)は、含まれる9×9個のスレッド2512[i,j](i=4〜12、j=5〜13)の各々により算出された表示部5上の画素のためのすべての値をフレームバッファ4に出力する(ステップS35)。尚、スレッドの仕様効率を上げるため、9×9個の三角形分割情報の各々に対して、複数のスレッドを割り当てることもできる。
Finally, each of the
なお、上述したコンピュートシェーダ機能を有するGPUでの実施形態において、各コンピュートユニット251が担当するテクスチャ画素の数を16×16画素としたが、これに限られることはなく、必要なフィルタ処理に応じて決定すればよい。但し、当然、各コンピュートユニット251に含まれるスレッド2512の数で制限される。
In the above-described embodiment using a GPU having a compute shader function, the number of texture pixels handled by each
以上で説明したコンピュートシェーダ機能を有するGPUでの実施形態においては、各コンピュートユニット251が、テクスチャを分割して得られた各分割テクスチャについて並列的に処理し、かつ、各コンピュートユニット251に含まれる各スレッド2512がそれぞれ1画素を担当して、並列的に三角形分割パターンを求め、それらの三角形分割パターンに基づき、三角形分割手法により、並列的に補間を行っているので、高速により滑らかな拡大画像を得ることができる。
In the GPU embodiment having the compute shader function described above, each
本発明の画像処理プロセッサにおける画像データ処理方法及びそのプログラムは、例えば、ゲーム機、汎用PC、遊技機、いわゆるスマートフォン等に搭載されるGPUに採用できる。 The image data processing method and the program thereof in the image processing processor of the present invention can be adopted, for example, as a GPU mounted on a game machine, a general-purpose PC, a game machine, a so-called smartphone or the like.
1 CPU
2A、2B GPU
21 頂点シェーダ
22 ラスタライザ
23 ピクセルシェーダ
24 テクスチャフェッチ部
25 コンピュートシェーダ
251 コンピュートユニット
2511 テクスチャフェッチ部
2512 スレッド
2513 共有メモリ
26 ディスパッチャ
3 VRAM
4 フレームバッファ
5 表示部
1 CPU
2A, 2B GPU
4
Claims (9)
前記頂点シェーダにより求められた前記表示部上での頂点の位置から、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するのに必要な、前記表示部上の画素を求めるラスタライザと、
前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するために、前記ラスタライザから、画素値の必要な前記表示部上の個々の画素の位置の情報が与えられるごとに、当該位置の画素値を、当該位置の所定の周辺のテクスチャ画素の値を補間することにより求めるピクセルシェーダと、
を備えた画像処理プロセッサにおける画像データ処理方法であって、
前記ピクセルシェーダは、当該位置が含まれる、前記テクスチャの画素格子に係る、三角形分割手法における三角形分割パターンを、前記画素格子を構成する画素及びその周辺の画素から決定し、決定された前記三角形分割パターンに基づき前記所定の周辺のテクスチャ画素の値を補間して、当該位置の画素値を求めることを特徴とする画像データ処理方法。 A vertex shader for obtaining a position on the display unit corresponding to the vertex data of the input polygon based on the vertex data of the polygon;
Pixels on the display unit that are necessary for displaying on the display unit an image in which a designated texture is mapped to the polygon from the position of the vertex on the display unit determined by the vertex shader A rasterizer to determine
Each time the rasterizer gives information on the position of each pixel on the display unit for which a pixel value is required, in order to display on the display unit an image in which a designated texture is mapped to the polygon. A pixel shader which obtains the pixel value of the position by interpolating the values of texture pixels around predetermined positions of the position;
A method of processing image data in an image processing processor comprising:
The pixel shader determines a triangle division pattern in a triangle division method according to the texture grid of pixels including the position, from the pixels constituting the pixel grid and the peripheral pixels thereof, and is determined A method of processing image data comprising: interpolating values of the predetermined surrounding texture pixels based on a pattern to obtain pixel values at the corresponding positions.
前記頂点シェーダ処理により求められた前記表示部上での頂点の位置から、前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するのに必要な、前記表示部上の画素を求めるラスタライザ処理と、
前記ポリゴンに、指定されたテクスチャがマッピングされた画像を、前記表示部に表示するために、前記ラスタライザ処理から、画素値の必要な前記表示部上の個々の画素の位置の情報が与えられるごとに、当該位置の画素値を、当該位置の所定の周辺のテクスチャ画素の値を補間することにより求めるピクセルシェーダ処理と、
を有し、画像処理プロセッサにレンダリング処理を行わせる画像データ処理プログラムであって、
前記ピクセルシェーダ処理は、当該位置が含まれる、前記テクスチャの画素格子に係る、三角形分割手法における三角形分割パターンを、前記画素格子を構成する画素及びその周辺の画素から決定し、決定された前記三角形分割パターンに基づき前記所定の周辺のテクスチャ画素の値を補間して、当該位置の画素値を求めることを特徴とする画像データ処理プログラム。 Vertex shader processing for obtaining a position on the display unit corresponding to the vertex data based on vertex data of the input polygon;
From the position of the vertex on the display unit obtained by the vertex shader processing, it is necessary to display on the display unit an image in which the specified texture is mapped to the polygon, on the display unit Rasterizer processing to determine pixels,
Every time the rasterizer processing provides information on the position of each pixel on the display unit for which a pixel value is required, in order to display on the display unit an image in which a designated texture is mapped to the polygon. A pixel shader process for determining the pixel value of the position by interpolating the values of texture pixels around predetermined positions of the position;
And an image data processing program for causing an image processing processor to perform rendering processing,
The pixel shader process determines a triangle division pattern in a triangle division method according to the texture grid of pixels including the position, from the pixels constituting the grid of pixels and the pixels in the periphery thereof An image data processing program comprising: interpolating values of the predetermined surrounding texture pixels based on a division pattern; and determining a pixel value at the position.
各コンピュートユニットは、
テクスチャを分割した各分割テクスチャを担当して並列的に処理するものであって、プログラムにより並列的に動作する複数のスレッドを有し、
前記複数のスレッドを利用して、前記分割テクスチャを構成する各画素の値から、各画素により構成される各格子のうちの所定数の格子について、三角形分割手法で使用する三角形分割パターンを一括で決定し、
ポリゴンに前記テクスチャがマッピングされた画像を表示部に表示するために、拡大した画像を格納するバッファ上の画素の位置に対応する前記所定数の格子上の位置を求め、
各格子に含まれる前記位置に係る前記表示部上の画素の値を、各格子に対応する各スレッドを利用して、各格子に対して決定された前記三角形分割パターンに基づき当該分割テクスチャにおける周辺の画素の値を補間して求めることを特徴とする画像データ処理方法。 A method of processing image data in an image processing processor, comprising a compute shader having a plurality of compute units, which performs rendering processing,
Each compute unit is
It takes charge of each divided texture which divided the texture and processes it in parallel, and has a plurality of threads operated in parallel by the program,
From the value of each pixel making up the divided texture using the plurality of threads, for a predetermined number of lattices in each lattice made up of each pixel, a triangular division pattern used in the triangular division method is collectively Decide
In order to display on the display unit an image in which the texture is mapped to a polygon, positions on the predetermined number of grids corresponding to positions of pixels on a buffer storing the enlarged image are obtained.
The value of the pixel on the display unit according to the position included in each grid is used in each of the threads corresponding to each grid, based on the triangle division pattern determined for each grid, in the periphery of the divided texture. An image data processing method characterized by interpolating the pixel values of
当該フィルタ処理により、利用する前記分割テクスチャの画素数に対して、得られる前記三角形分割パターンの数が減じてしまう分、前記各コンピュートユニットに、前記各分割テクスチャの境界部分が重複して割り当てられることを特徴とする請求項5に記載の画像データ処理方法。 When each of the compute units collectively determines the triangle division pattern using the plurality of threads, gradients are applied while low-pass filtering is performed on the values of pixels constituting each grid and pixels in the periphery thereof. Find the value,
Since the number of obtained triangle division patterns is reduced with respect to the number of pixels of the divided textures to be used by the filtering process, the boundaries of the divided textures are redundantly allocated to the respective compute units. The image data processing method according to claim 5, characterized in that:
前記テクスチャを複数に分割した分割テクスチャの各々を前記各コンピュートユニットに割り当てる処理と、
前記複数のスレッドに、前記分割テクスチャを構成する各画素の値から、各画素により構成される各格子のうちの所定数の格子について、三角形分割手法で使用する三角形分割パターンを一括で決定させる処理と、
前記ポリゴンに前記テクスチャがマッピングされた画像を表示部に表示するために、拡大した画像を格納するバッファ上の画素の位置に対応する前記所定数の格子上の位置を求める処理と、
各格子に対応する各スレッドに、各格子に含まれる前記位置に係る前記表示部上の画素の値を、各格子に対して決定された前記三角形分割パターンに基づき当該分割テクスチャにおける周辺の画素の値を補間して求めさせる処理を有することを特徴とする画像データ処理プログラム。
An image processing processor comprising a plurality of parallel operable compute units each having a plurality of parallel operable threads, rendering processing based on information of a three-dimensional model composed of polygons and information of a texture to be attached An image data processing program to be executed,
Assigning each of the divided textures obtained by dividing the texture into a plurality to each of the compute units;
Process of causing the plurality of threads to collectively determine a triangle division pattern to be used in a triangle division method from a value of each pixel constituting the divided texture, for a predetermined number of lattices among the lattices constituted by each pixel When,
A process of determining positions on the predetermined number of grids corresponding to positions of pixels on a buffer storing an enlarged image, in order to display an image in which the texture is mapped to the polygon on a display unit;
In each thread corresponding to each grid, the value of the pixel on the display unit according to the position included in each grid is calculated based on the triangle division pattern determined for each grid, of surrounding pixels of the divided texture. An image data processing program comprising processing for interpolating and obtaining values.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016165442A JP6424329B2 (en) | 2016-08-26 | 2016-08-26 | Image data processing method in image processing processor and program thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016165442A JP6424329B2 (en) | 2016-08-26 | 2016-08-26 | Image data processing method in image processing processor and program thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2018032301A JP2018032301A (en) | 2018-03-01 |
JP6424329B2 true JP6424329B2 (en) | 2018-11-21 |
Family
ID=61303530
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2016165442A Active JP6424329B2 (en) | 2016-08-26 | 2016-08-26 | Image data processing method in image processing processor and program thereof |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6424329B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7154706B2 (en) | 2018-12-18 | 2022-10-18 | アール・ビー・コントロールズ株式会社 | Electronics |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110163790A (en) * | 2018-06-11 | 2019-08-23 | 腾讯科技(深圳)有限公司 | Image processing method, device, system, storage medium and computer equipment |
CN114782611B (en) * | 2022-06-24 | 2022-09-20 | 北京飞渡科技有限公司 | Image processing method, image processing apparatus, storage medium, and electronic device |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002342780A (en) * | 2001-05-15 | 2002-11-29 | Namco Ltd | Image generating system and image generating method and information storage medium |
JP5712387B2 (en) * | 2012-05-31 | 2015-05-07 | 株式会社アクセル | Image display processing method and image display processing apparatus |
JP5712386B2 (en) * | 2012-05-31 | 2015-05-07 | 株式会社アクセル | Image display processing method and image display processing apparatus |
-
2016
- 2016-08-26 JP JP2016165442A patent/JP6424329B2/en active Active
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7154706B2 (en) | 2018-12-18 | 2022-10-18 | アール・ビー・コントロールズ株式会社 | Electronics |
Also Published As
Publication number | Publication date |
---|---|
JP2018032301A (en) | 2018-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6903183B2 (en) | Changes in effective resolution based on screen position in graphics processing by approximating the projection of vertices on a curved viewport | |
EP3559914B1 (en) | Foveated rendering in tiled architectures | |
KR102101626B1 (en) | Gradient adjustment for texture mapping for multiple render targets with resolution that varies by screen location | |
KR102046616B1 (en) | Graphics processing enhancement by tracking object and/or primitive identifiers | |
KR101687520B1 (en) | Target independent stenciling in graphics processing | |
JP4327105B2 (en) | Drawing method, image generation apparatus, and electronic information device | |
KR101145260B1 (en) | Apparatus and method for mapping textures to object model | |
JP2010102713A (en) | Method of and apparatus for processing computer graphics | |
US7843463B1 (en) | System and method for bump mapping setup | |
JP2017517056A (en) | Effective construction method of high resolution display buffer | |
KR102278147B1 (en) | Clipping of graphics primitives | |
KR20200035467A (en) | Variable rate shading | |
JP6424329B2 (en) | Image data processing method in image processing processor and program thereof | |
TW201706962A (en) | Graphics processing | |
TW201234314A (en) | Micropolygon splatting | |
KR20170031479A (en) | Method and apparatus for performing a path stroke | |
US20230298212A1 (en) | Locking mechanism for image classification | |
US10339704B2 (en) | Image data processing method in image processor and computer readable medium storing program therefor for rendering a texture based on a triangulation pattern | |
JP5587132B2 (en) | Image processing apparatus and image processing method | |
KR101227155B1 (en) | Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image | |
JP4691494B2 (en) | Image drawing apparatus, vertex selection method, vertex selection program, and integrated circuit | |
JP2011028641A (en) | Image processing device and image processing method | |
US20230298133A1 (en) | Super resolution upscaling | |
JP4766576B2 (en) | Drawing method, image generation apparatus, and electronic information device | |
JP5712385B2 (en) | Image display processing apparatus and image display processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20180823 |
|
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: 20180904 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180921 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6424329 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |