CN102810199B - Image processing method based on GPU (Graphics Processing Unit) - Google Patents

Image processing method based on GPU (Graphics Processing Unit) Download PDF

Info

Publication number
CN102810199B
CN102810199B CN201210197945.8A CN201210197945A CN102810199B CN 102810199 B CN102810199 B CN 102810199B CN 201210197945 A CN201210197945 A CN 201210197945A CN 102810199 B CN102810199 B CN 102810199B
Authority
CN
China
Prior art keywords
layer
parameter
filter
image
thumbnail
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
Application number
CN201210197945.8A
Other languages
Chinese (zh)
Other versions
CN102810199A (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.)
Chengdu Pingxing Shiye Science & Technology Co Ltd
Original Assignee
Chengdu Pingxing Shiye Science & Technology Co Ltd
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 Chengdu Pingxing Shiye Science & Technology Co Ltd filed Critical Chengdu Pingxing Shiye Science & Technology Co Ltd
Priority to CN201210197945.8A priority Critical patent/CN102810199B/en
Publication of CN102810199A publication Critical patent/CN102810199A/en
Application granted granted Critical
Publication of CN102810199B publication Critical patent/CN102810199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses an image processing method based on a GPU (Graphics Processing Unit). The method can be used for efficiently processing multi-layer image data. The method mainly comprises the following steps: firstly, a layer is activated, i.e. a certain layer of an image to be processed is copied from a system internal memory into a video memory of the GPU, and if the capacity of the video memory is insufficient, data of other layers need to be deleted from the video memory simultaneously and only the data in the system internal memory is reserved; secondly, an image processing filter is started, and when a filter parameter is adjusted, a thumbnail in the current visual area of the activated layer is calculated in real time; thirdly, the thumbnail of each layer is used for mixing from bottom to top so as to render to a canvas, and the canvas is displayed in a window; and finally, the image processing filter is applied, and the complete adjustment result of the activated layer is calculated by utilizing the parameter of the filter. According to the image processing method disclosed by the invention, the video memory can be effectively saved, the processing speed of image rendering is improved, the image rendering is carried out in batch, and the rendering result can be displayed in real time.

Description

A kind of image processing method based on GPU
Technical field
The present invention relates to computer graphics techniques field, particularly relate to a kind of method of image procossing.
Background technology
The previous comprehensive image processing software of order needs to read image and to file, and to image applications filter, and supports cancelling and reforming etc. operation.Traditional synthetic image process software all designs based on CPU, because this program only needs the data of managing internal memory and hard disk, use CPU can realize above function easily, simultaneously core cpu Limited Number, can not to the too large challenge of the structure of algorithm.
A professional image processing software must support layer management, constituency management etc.These are limited at the video memory of GPU, in inflexible situation of programming, all bring sizable difficult design.
The full name of GPU is Graphics Processing Unit, i.e. graphics calculations unit, is also the display card chip on common meaning.Have a large amount of stream handle unit in GPU, can process data concomitantly, therefore GPU is well suited for and is used for image procossing.Although use GPU can realize the algorithm of an image procossing easily, a comprehensive image processing software to be realized based on GPU and but can run into a lot of difficulty, mainly comprise:
Storage administration difficulty: the storage unit that GPU can operate is the video memory on video card, what CPU can operate is then Installed System Memory, the capacity of video memory will be far smaller than internal memory usually, and GPU and CPU must be used due to software simultaneously, so need to have managed the use between these two storage systems efficiently, and the communication overhead as far as possible between minimizing two data storage areas.
Multithreading realizes difficulty: calculating owing to using GPU needs to use the figure API such as OpenGL usually, and these OpenGL API are merely able to be operated in main thread, under the pattern of namely GUI thread, so cannot as usual method, the mode using worker thread to be separated with GUI thread, provides interface feedback under the mode of intensive calculations.
Cancel/reform system and realize difficulty: carrying out image procossing owing to using GPU needs view data to be copied to video memory, traditional system of cancelling/reform realizes then needing view data in Installed System Memory.Like this, owing to all needing the backup carrying out cancelling/reform data after filter each time or adjustment operation, then require to copy during data are from video memory to internal memory, and a large amount of copies can cause larger pressure to the transmission of PCIE, and very huge on real-time impact.
Summary of the invention
The object of the invention is a kind of image processing method proposed for the problems referred to above, can when image rendering operations the filter regulating effect of Real-time Feedback, level and smooth painting canvas convergent-divergent and dragging effect, mutual copy between video memory and Installed System Memory greatly reduces, and can support multi-layer image when video memory finite capacity.
The invention provides a kind of image processing method, comprise the following steps:
A, obtain pending image, a layer of described pending image is copied in the video memory of Graphics Processing Unit from Installed System Memory;
B, a startup image procossing filter, when adjustment filter params, calculate in real time the thumbnail in the current visible region of described layer and obtain adjustment result;
C, the thumbnail of each layer of described pending image is used to carry out, by the supreme mixing in the end, to be rendered into painting canvas, and this painting canvas being shown to window;
D, last, apply this image procossing filter, use the parameter of filter calculate the layer that is activated complete adjustment result.
In technique scheme, preferably, steps A also comprises:
If video memory off-capacity, then need the data of other layer to delete in video memory simultaneously, be only retained in the data in Installed System Memory.
In technique scheme, preferably, step C comprises further:
The parameter of filter is set, calculates the result of thumbnail under described parameter of described pending layer in real time;
After described result changes compared with described pending layer, described pending layer is played up.
In technique scheme, preferably, described filter comprises a unique identification number and some by the parameter of serializing.
In technique scheme, preferably, also step is comprised:
Described pending image is carried out full figure backup and parameter backup, and All Layers backs up by described full figure backup, and described parameter backup is backed up the parameter of current operation;
When cancelling current operation parameter mode and carrying out the operation backed up, the most contiguous full figure backup finding described layer corresponding by the sequencing of operation, backs up date restoring to this full figure;
Application is all with the sequence of operation that parameter backup form stores successively.
In technique scheme, preferably, playing up in described step C specifically comprises:
Set up a blank frame buffer data district;
From top to bottom the thumbnail of each layer is mixed in described frame buffer data district and also changes corresponding value;
Time the thumbnail of described each layer mixes, OpenGL Shader Language is used to carry out assignment to each point in frame buffer data district.
Technique effect of the present invention is:
Can Real-time Feedback filter regulating effect, level and smooth painting canvas convergent-divergent and dragging effect, the mutual copy between video memory and Installed System Memory greatly reduces, and improves the processing speed of image rendering, save video memory, and can support that multi-layer image operates when video memory finite capacity.
Other features and advantages of the present invention will be set forth in the following description, and, partly become apparent from instructions, or understand by implementing the present invention.Object of the present invention and other advantages realize by structure specifically noted in write instructions, claims and accompanying drawing and obtain.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Accompanying drawing explanation
Accompanying drawing is used to provide a further understanding of the present invention, and forms a part for instructions, together with embodiments of the present invention for explaining the present invention, is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of a kind of image processing method embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein is only for instruction and explanation of the present invention, is not intended to limit the present invention.
A kind of embodiment of the present invention provides a kind of image processing method, comprises the following steps:
Step 101, activation layer, a certain layer by described pending image copies in the video memory of Graphics Processing Unit from Installed System Memory, if video memory off-capacity, then need the data of other layer to delete in video memory simultaneously, be only retained in the data in Installed System Memory;
Operate a layer and must first activate this layer, while activation layer, the current layer be activated can first by de-activated, and such moment only has a layer to be activated.The process of de-activated is exactly that the data of current layer are copied to Installed System Memory from GPU video memory, data in release GPU video memory, and locking this layer. the process of activation is then just contrary, and data copy GPU video memory to from Installed System Memory, and the data field still in reserved memory.Nonactivated layer then only preserves data in Installed System Memory, while which saving video memory, ensure that the rapidity of current operation, because the data required for current operation are all in video memory, can not cause larger delay.
Step 102, a startup image procossing filter, when adjustment filter params, calculate in real time to the thumbnail in the current visible region of the layer that is activated;
Each layer, comprises pixel layer and word layer, has thumbnail corresponding with it.For pixel layer, its thumbnail is the sub-layer of layer in painting canvas visible range, and its scaling current painting canvas be reduce time consistent with painting canvas, current painting canvas be amplify time keep 100%.Like this, guarantee layer thumbnail is very little data, can intactly be stored in GPU video memory.Carrying out in the middle of real-time layer render process, using thumbnail to participate in playing up calculating, namely play up and carry out with the thumbnail of each layer exactly.Because all data are all in GPU video memory, so very fast speed can be obtained.
Step 103, the thumbnail of each layer is used to carry out, by the supreme mixing in the end, to be rendered into painting canvas, and this painting canvas being shown to window;
The concrete grammar played up is: the frame buffer data district first setting up a blank (RGBA is 0), then from the bottom to top layer thumbnail to be mixed in this frame buffer data district and to change its value. the thumbnail of each layer, when mixing, all uses OpenGL Shader Language (GLSL) to put each in frame buffer data district and carries out assignment.
Step 104, last, apply this image procossing filter, use the parameter of filter calculate the layer that is activated complete adjustment result.
The difference of step 104 and step 102 is, step 102 calculates the thumbnail data of layer, and step 104 is the data calculating whole layer.Step 104 usually can be more a lot of than step 102, thus normally user click on interface determine after just can perform.
In rendering intent in step 103, filter and adjustment means can refresh in real time.Most filter and adjustment means have a lot of parameters to arrange, and such as expose the gamma parameter in adjustment means.Carrying out in the process of parameter adjustment to filter and adjustment means, user is desirably in live effect painting canvas obtaining corresponding parameter, and often kind of instrument has different parameters, can select corresponding parameter as required in practical operation.Render process is participated in owing to using thumbnail, so, when user makes the parameter of filter or adjustment means that any change occur, the method applied in the present invention is the effect of thumbnail under this parameter calculating current activation layer in real time, thumbnail rendering effect is only calculated when adjustment filter, then the effect calculating full figure layer when real application, then render process is triggered at once, any operation causing effect of visualization to change all can trigger render process, such as change parameter when a filter regulates, the effect of whole painting canvas can be shown after playing up.Due to the parallel processing capability that GPU is powerful, make related software of the present invention can reach the refresh rate of normal image process software more than ten times.
Both define some parameters of this filter in the class of each filter, parameter stores in class object, can by serializing in any data stream.The present invention achieves the serializing of these parameters and the interface of unserializing to each filter or adjustment means class, and namely filter params by the middle of serializing to flow data, also can be resolved out in the middle of flow data.Each filter has a unique identification number mark, and because its parameter can by serializing, the parameter of the identification number of a filter and a filter just can the operation of a perfect representation filter. and the operation of a series of filter can be stored in internal memory or hard disk culture, for being applied on other images. based on this function, the batch facility of file just can be realized.
Some operation steps is cancelled for needing in actual rendering image process or reforms, present invention also offers and a kind ofly cancel the method reformed, utilize the method rapidly to image manipulation, processing speed can be improved.
In view of GPU has powerful processing power, but the feature slower with Installed System Memory data copy, what the present invention devised innovation cancels/rework method, and based on above-mentioned parameter serializing function, the back-up of view data is divided into full figure backup and parameter backup by the present invention.Full figure backup refers to that whole layer all backs up, and parameter backup is then the parameter only storing current operation.When cancelling current operation parameter mode and carrying out the operation backed up, the full figure closed on the most backup that system finds this layer corresponding from front to back, then date restoring is backed up to this full figure, then apply all sequences of operation stored with parameter backup form successively.
One of ordinary skill in the art will appreciate that: all or part of step realizing said method embodiment can have been come by the hardware that programmed instruction is relevant, aforesaid program can be stored in a computer read/write memory medium, this program, when performing, performs the step comprising said method embodiment; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Last it is noted that the foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, although with reference to previous embodiment to invention has been detailed description, for a person skilled in the art, it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (5)

1. an image processing method, is characterized in that, comprises the following steps:
A, obtain pending image, a layer of described pending image is copied in the video memory of Graphics Processing Unit from Installed System Memory;
B, a startup image procossing filter, when adjustment filter params, calculate in real time the thumbnail in the current visible region of described layer and obtain adjustment result;
C, the thumbnail of each layer of described pending image is used to carry out, by the supreme mixing in the end, to be rendered into painting canvas, and this painting canvas being shown to window;
D, apply this image procossing filter, use the parameter of filter to calculate the complete adjustment result of the layer that is activated;
Described pending image is carried out full figure backup and parameter backup, and All Layers backs up by described full figure backup, and described parameter backup is backed up the parameter of current operation;
When cancelling current operation parameter mode and carrying out the operation backed up, the most contiguous full figure backup finding described layer corresponding by the sequencing of operation, backs up date restoring to this full figure;
Application is all with the sequence of operation that parameter backup form stores successively.
2. image processing method according to claim 1, is characterized in that, steps A also comprises, if video memory off-capacity, then needs the data of other layer to delete in video memory simultaneously, is only retained in the data in Installed System Memory.
3. image processing method according to claim 1, is characterized in that, step C comprises further:
The parameter of filter is set, calculates the result of thumbnail under described parameter of described pending layer in real time;
After described result changes compared with described pending layer, described pending layer is played up.
4. image processing method according to claim 3, is characterized in that, described filter comprises a unique identification number and some by the parameter of serializing.
5. image processing method according to claim 1, is characterized in that, playing up in described step C specifically comprises:
Set up a blank frame buffer data district;
From top to bottom the thumbnail of each layer is mixed in described frame buffer data district and also changes corresponding value;
Time the thumbnail of described each layer mixes, OpenGL Shader Language is used to carry out assignment to each point in frame buffer data district.
CN201210197945.8A 2012-06-15 2012-06-15 Image processing method based on GPU (Graphics Processing Unit) Active CN102810199B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210197945.8A CN102810199B (en) 2012-06-15 2012-06-15 Image processing method based on GPU (Graphics Processing Unit)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210197945.8A CN102810199B (en) 2012-06-15 2012-06-15 Image processing method based on GPU (Graphics Processing Unit)

Publications (2)

Publication Number Publication Date
CN102810199A CN102810199A (en) 2012-12-05
CN102810199B true CN102810199B (en) 2015-03-04

Family

ID=47233902

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210197945.8A Active CN102810199B (en) 2012-06-15 2012-06-15 Image processing method based on GPU (Graphics Processing Unit)

Country Status (1)

Country Link
CN (1) CN102810199B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268620A (en) * 2013-04-28 2013-08-28 华为技术有限公司 Graphic processing method, graphic processing device and terminal device
CN103593828A (en) * 2013-11-13 2014-02-19 厦门美图网科技有限公司 Image processing method capable of carrying out partial filter adding
US9633466B2 (en) * 2014-09-29 2017-04-25 Microsoft Technology Licensing, Llc Low latency ink rendering pipeline
CN104657206B (en) 2015-02-09 2018-09-28 青岛海信移动通信技术股份有限公司 A kind for the treatment of method and apparatus of image data
CN104657934B (en) 2015-02-09 2018-08-10 青岛海信移动通信技术股份有限公司 A kind for the treatment of method and apparatus of image data
CN104869323A (en) * 2015-05-18 2015-08-26 成都平行视野科技有限公司 Modularized real-time video and image processing method base on GPU
CN106548500A (en) * 2016-09-26 2017-03-29 中国电子科技集团公司第二十九研究所 A kind of two-dimension situation image processing method and device based on GPU
CN107945259A (en) * 2017-12-13 2018-04-20 杭州布魔方空间科技股份有限公司 The methods of exhibiting and device that scene dragging renders
CN110969247B (en) * 2018-09-30 2024-04-09 北京地平线信息技术有限公司 Tensor processing method and device based on neural network and electronic equipment
CN109918233B (en) * 2019-03-06 2021-02-26 珠海金山网络游戏科技有限公司 Data processing method and device, computing equipment and storage medium
CN110211022A (en) * 2019-05-16 2019-09-06 北京奇艺世纪科技有限公司 A kind of image processing method, device and electronic equipment
CN111161385B (en) * 2019-12-30 2023-10-10 北京奇艺世纪科技有限公司 Image rendering method and device, electronic equipment and storage medium
CN114612579A (en) * 2020-12-18 2022-06-10 完美世界(北京)软件科技发展有限公司 Image rendering method and device, computer equipment and readable storage medium
CN112988103B (en) * 2021-05-13 2021-08-20 统信软件技术有限公司 Data display method and computing device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8300050B2 (en) * 2006-11-28 2012-10-30 Adobe Systems Incorporated Temporary low resolution rendering of 3D objects
JP2012503811A (en) * 2008-09-24 2012-02-09 ザ・ベイカリー Method and system for rendering or interactive lighting of complex 3D scenes
US8581916B2 (en) * 2009-06-26 2013-11-12 Intel Corporation Graphics analysis techniques
CN101650822B (en) * 2009-09-21 2012-05-16 潘建 Method and system for generating mutual information

Also Published As

Publication number Publication date
CN102810199A (en) 2012-12-05

Similar Documents

Publication Publication Date Title
CN102810199B (en) Image processing method based on GPU (Graphics Processing Unit)
JP6001221B1 (en) Fault tolerant preemption mechanism at arbitrary control points for graphics processing
US20210350599A1 (en) Seamless representation of video and geometry
TWI515716B (en) Primitive re-ordering between world-space and screen-space pipelines with buffer limited processing
JP6073533B1 (en) Optimized multi-pass rendering on tile-based architecture
US9640148B2 (en) Method of and apparatus for controlling frame buffer operations
CN103810669B (en) The cache block of pixels of size is customized through adaptability in unified L2 caches high speed caching
US9715750B2 (en) System and method for layering using tile-based renderers
US10235799B2 (en) Variable rate deferred passes in graphics rendering
US10990258B2 (en) Interactively presenting a visible portion of a rendering surface on a user device
TW201432609A (en) Distributed tiled caching
US8707150B2 (en) Applying effects to a video in-place in a document
US9182934B2 (en) Method and apparatus for generating an output surface from one or more input surfaces in data processing systems
US20160148359A1 (en) Fast Computation of a Laplacian Pyramid in a Parallel Computing Environment
US8441491B2 (en) Method for performing undo and redo operations on a graphics processing unit
US10504281B2 (en) Tracking pixel lineage in variable rate shading
US20140354660A1 (en) Command instruction management
TW201447812A (en) Stencil-then-cover path rendering with shared edges
WO2022242379A1 (en) Stroke-based rendering method and device, storage medium and terminal
CN102142152A (en) Method, apparatus, and program for displaying an object on a computer screen
US8633937B2 (en) Information processing apparatus and information processing method
US20150015574A1 (en) System, method, and computer program product for optimizing a three-dimensional texture workflow
CN110737372A (en) newly-added primitive operation method and system for electronic whiteboard and electronic whiteboard
JP2020506474A (en) Exporting out-of-order pixel shaders
US20060232597A1 (en) Hybrid vector/raster based paint

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant