CN110231928A - For handling system, the floating number processing method and processing device of floating number - Google Patents

For handling system, the floating number processing method and processing device of floating number Download PDF

Info

Publication number
CN110231928A
CN110231928A CN201810184557.3A CN201810184557A CN110231928A CN 110231928 A CN110231928 A CN 110231928A CN 201810184557 A CN201810184557 A CN 201810184557A CN 110231928 A CN110231928 A CN 110231928A
Authority
CN
China
Prior art keywords
color data
processing unit
central processing
floating number
processed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810184557.3A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810184557.3A priority Critical patent/CN110231928A/en
Publication of CN110231928A publication Critical patent/CN110231928A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/483Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Nonlinear Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the present application discloses system, floating number processing method and processing device for handling floating number.One specific embodiment of the system includes: graphics processor, for receiving the floating number to be processed of central processing unit transmission, mathematical operation is executed to floating number to be processed, obtains operation result, color data is converted by operation result, exports the color data to central processing unit;Central processing unit is converted into result data for reading color data, and by color data.The embodiment make graphics processor shared central processing unit floating point arithmetic task.

Description

For handling system, the floating number processing method and processing device of floating number
Technical field
The invention relates to field of computer technology, and in particular to for handling the system, method and dress of floating number It sets.
Background technique
Graphics processor is a kind of specially in PC, work station, game machine and some mobile devices (such as plate electricity Brain, smart phone etc.) on image operation work microprocessor.Image rendering processing usually is carried out using picture processor, from And the image processing tasks of central processing unit have been shared, allow central processing unit to execute other more system tasks.
Summary of the invention
The embodiment of the present application proposes system, floating number processing method and processing device for handling floating number.
In a first aspect, the embodiment of the present application provides a kind of system for handling floating number, comprising: graphics processor, For receiving the floating number to be processed of central processing unit transmission, mathematical operation is executed to floating number to be processed, obtains operation result, Color data is converted by operation result, exports color data to central processing unit;Central processing unit, for reading number of colours According to, and by color data convert result data.
In some embodiments, color data is stored in the form of four-tuple, wherein four-tuple includes red component, green Colouring component, blue component and transparency component.
In some embodiments, central processing unit, the floating number for being also used to will acquire split at least two parts, are formed Floating number to be processed.
In some embodiments, graphics processor is also used to receive the color data to be processed of central processing unit transmission, right Color data to be processed is handled, the color data that obtains that treated, to central processing unit output treated color data.
Second aspect, the embodiment of the present application provide a kind of floating number processing method for graphics processor, this method It include: the floating number to be processed for receiving central processing unit and sending;Mathematical operation is executed to floating number to be processed, obtains operation knot Fruit;Color data is converted by operation result;Color data is exported to central processing unit.
In some embodiments, color data is stored in the form of four-tuple, wherein four-tuple includes red component, green Colouring component, blue component and transparency component.
In some embodiments, this method further include: receive the color data to be processed that central processing unit is sent;Treat place Reason color data is handled, the color data that obtains that treated;To central processing unit output treated color data.
The third aspect, the embodiment of the present application provide a kind of floating number processing unit for graphics processor, the device Include: floating number receiving unit, is configured to receive the floating number to be processed that central processing unit is sent;Floating number computing unit, It is configured to execute mathematical operation to floating number to be processed, obtains operation result;Conversion unit is configured to turn operation result Turn to color data;Output unit is configured to export color data to central processing unit.
In some embodiments, color data is stored in the form of four-tuple, wherein four-tuple includes red component, green Colouring component, blue component and transparency component.
In some embodiments, device further include: color data receiving unit is configured to receive central processing unit hair The color data to be processed sent;Color data processing unit is configured to handle color data to be processed, be handled Color data afterwards;Output unit is further configured to export treated color data to central processing unit.
Fourth aspect, the embodiment of the present application provide a kind of electronic equipment, which includes: one or more figures Processor;Storage device, for storing one or more programs;When one or more programs are by one or more graphics processors It executes, so that one or more graphics processors realize the method as described in implementation any in second aspect.
5th aspect, the embodiment of the present application provide a kind of computer-readable medium, are stored thereon with computer program, should The method as described in implementation any in second aspect is realized when computer program is executed by graphics processor.
System, the floating number processing method and processing device provided by the embodiments of the present application for being used to handle floating number, firstly, figure Processor receives the floating number to be processed that central processing unit is sent, and executes mathematical operation to floating number to be processed, obtains operation knot Fruit;Then, color data is converted by operation result, exports the color data to central processing unit;Finally, central processing unit Color data is read, and converts result data for color data.By executing the calculating of floating number by graphics processor, and Calculated result is converted to the color data that can be exported, so that central processing unit need to only count the color data received The calculated result that floating number can be obtained according to conversion, to share the task of the floating point arithmetic of central processing unit.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is can be using the floating number processing method of the embodiment of the present application or the exemplary system of floating number processing unit Architecture diagram;
Fig. 2 is the timing diagram according to one embodiment of the system for handling floating number of the application;
Fig. 3 is the timing diagram according to another embodiment of the system for handling floating number of the present embodiment;
Fig. 4 is the flow chart according to one embodiment of the method for handling floating number of the application;
Fig. 5 is the structural schematic diagram according to one embodiment of the device for handling floating number of the application;
Fig. 6 is adapted for the structural schematic diagram for realizing the graphics processor in the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the exemplary of the floating number processing method or floating number processing unit that can apply the embodiment of the present application System architecture 100.
As shown in Figure 1, system architecture 100 may include central processing unit 101, graphics processor 102.Central processing unit It is communicated to connect between 101 and graphics processor 102.Central processing unit 101 and graphics processor 102 generally comprise logical operation section Part, register block and control unit.Wherein, central processing unit 101 can be used for interpretive machine instruction and processing data. Graphics processor 102 can be used for large-scale concurrent calculating, accelerate image processing process.
Central processing unit 101 and graphics processor 102 can be support OpenCL (Open Computing Language, Open operation language) and/or UCDA's (Compute Unified Device Architecture unifiedly calculates framework) is each The central processing unit and graphics processor of the various models of kind producer production.
It should be understood that the number of central processing unit and graphics processor in Fig. 1 is only schematical.According to realization need It wants, can have any number of central processing unit and graphics processor.
With continued reference to Fig. 2, the timing of one embodiment of the system for handling floating number according to the application is shown Figure 200.
The system for handling floating number in the embodiment of the present application may include: graphics processor and central processing unit. Wherein, graphics processor executes mathematics fortune to floating number to be processed for receiving the floating number to be processed of central processing unit transmission It calculates, obtains operation result, convert color data for operation result, export the color data to central processing unit.Centre Device is managed, is converted into result data for reading color data, and by color data.
As shown in Fig. 2, in step 201, graphics processor receives the floating number to be processed that central processing unit is sent.
In the present embodiment, when central processing unit will execute floating point arithmetic, the task of floating point arithmetic can be handed over Give graphics processor processing.Specifically, floating number to be processed is passed to graphics processor first.
In step 202, graphics processor executes mathematical operation to floating number to be processed, obtains operation result.
In the present embodiment, graphics processor executes mathematical operation to the floating number to be processed received, obtains operation knot Fruit.Wherein, mathematical operation may include it is common such as add, subtract, multiplication and division, power, evolution, logarithm operation, can also include such as The operations such as derivative, integral, convolution, rounding.Generally, result data is floating number, executes operation as to floating number to be processed Result afterwards.
In step 203, operation result is converted color data by graphics processor.
In the present embodiment, based on operation result obtained in above-mentioned steps 202, various sides are can be used in graphics processor Operation result is converted corresponding color data by method.Wherein, color data can refer to the data of expression color, and data Representation meet common color mode.Generally, common color mode has RGB mode (wherein, it is red to represent Red by R Color, G represent Green green, B represents Blue blue), (wherein, R represents that Red is red, G represents Green green, B to RGBA mode Represent Blue blue, A represent Alpha transparency), CMYK mode (wherein, C represent Cyan cyan, M represent Magenta magenta Color, Y represent Yellow yellow, K represent Key Plate positioning registering color i.e. black), HSB mode (H represent Hue form and aspect, S represent Saturation saturation degree, B represent Brightness brightness), (wherein, Y represents brightness to YUV mode, and U represents coloration, V generation Table concentration), Lab mode (wherein, L represents luminance channel, a and b and represents Color Channel, wherein the color in the channel a be from red to Dark green, the color in the channel b is from blue to yellow), the pattern bitmap color of two kinds of colors of black and white one of (only use) with And grayscale mode (using the grey of different lightness) etc..
In some optional implementations of the present embodiment, color data can be including red component, green component, The four-tuple of blue component and transparency component totally four components.Using red component, green component, blue component come generation The intensity of three kinds of colors of table, and various colors are obtained using the superposition of these three colors, reuse transparency point Amount indicates different transparencies when color display, is a kind of color table standard up to standard being widely used at present.Generally, red point Each component in amount, green component and blue component respectively occupies the memory space of 8 (i.e. 1 byte).Transparency component can be with The Overlay of above-mentioned three kinds of colors is influenced, the transparency of the color formed after above-mentioned three kinds of color additions is changed.Transparency Component generally also occupies the memory space of 8 (i.e. 1 byte).Graphics processor can use various method for transformation for operation result It is converted into the color data including red component, green component, blue component and transparency component.
It, can be according to method for transformation as follows by operation result in some optional implementations of the present embodiment It is converted into color data:
Step 1 calculates red component:
Step 1.1, by operation result divided by " 1/256 ", obtain the first intermediate result.
Step 1.2, to being rounded under the first intermediate result obtained in above-mentioned steps 1.1, and will be by after lower rounding Value of the result arrived as red component.Wherein, rounding under certain number is indicated to take the maximum integer no more than the number.
Step 2 calculates green component:
Step 2.1, using operation result divided by " 1/256 " obtained remainder as the second intermediate result.
Step 2.2, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/2562", obtain knot among third Fruit.
Step 2.3 carries out lower rounding to third intermediate result obtained in above-mentioned steps 2.2, and will be by lower rounding Value of the result obtained afterwards as green component.
Step 3 calculates blue component:
Step 3.1, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/2562" obtained remainder conduct 4th intermediate result.
Step 3.2, by the 4th intermediate result obtained in above-mentioned steps 3.1 divided by " 1/2563", obtain knot among the 5th Fruit.
Step 3.3 carries out lower rounding to the 5th intermediate result obtained in above-mentioned steps 3.2, and will be by lower rounding Value of the result obtained afterwards as blue component.
Step 4 calculates transparency component:
Step 4.1, by the 4th intermediate result obtained in above-mentioned steps 3.1 divided by " 1/2563" obtained remainder conduct 6th intermediate result.
Step 4.2, by the 6th intermediate result obtained in above-mentioned steps 4.1 divided by " 1/2564", obtain knot among the 7th Fruit.
Step 4.3 carries out lower rounding to the 7th intermediate result obtained in above-mentioned steps 4.2, and will be by lower rounding Value of the result obtained afterwards as transparency component.
It, can be according to method for transformation as follows by operation result in some optional implementations of the present embodiment It is converted into color data:
Step 1 calculates red component:
Step 1.1, by operation result divided by " 1/128 ", obtain the first intermediate result.
Step 1.2, to being rounded under the first intermediate result obtained in above-mentioned steps 1.1, and will be by after lower rounding Value of the result arrived as red component.
Step 2 calculates green component:
Step 2.1, using operation result divided by " 1/128 " obtained remainder as the second intermediate result.
Step 2.2, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/1282", obtain knot among third Fruit.
Step 2.3 carries out lower rounding to third intermediate result obtained in above-mentioned steps 2.2, and will be by lower rounding Value of the result obtained afterwards as green component.
Step 3 calculates blue component:
Step 3.1, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/1282" obtained remainder conduct 4th intermediate result.
Step 3.2, by the 4th intermediate result obtained in above-mentioned steps 3.1 divided by " 1/1283", obtain knot among the 5th Fruit.
Step 3.3 carries out lower rounding to the 5th intermediate result obtained in above-mentioned steps 3.2, and will be by lower rounding Value of the result obtained afterwards as blue component.
Step 4 calculates transparency component: to the result work for being rounded, and being obtained later under operation result by lower rounding For the value of transparency component.
In some optional implementations of the present embodiment, color data be can be including red component, green component With the triple of blue component totally three components.The strong of three kinds of colors is represented using red component, green component, blue component Degree, and various colors are obtained using the superposition of these three colors.Graphics processor can use various conversion sides Operation result is converted the color data including red component, green component and blue component by method.
It, can be according to method for transformation as follows by operation result in some optional implementations of the present embodiment It is converted into color data:
Step 1 calculates red component:
Step 1.1, by operation result divided by " 1/256 ", obtain the first intermediate result.
Step 1.2, to being rounded under the first intermediate result obtained in above-mentioned steps 1.1, and will be by after lower rounding Value of the result arrived as red component.Wherein, above-mentioned lower rounding expression takes the maximum integer no more than the first intermediate result.
Step 2 calculates green component:
Step 2.1, using operation result divided by " 1/256 " obtained remainder as the second intermediate result.
Step 2.2, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/2562", obtain knot among third Fruit.
Step 2.3 carries out lower rounding to third intermediate result obtained in above-mentioned steps 2.2, and will be by lower rounding Value of the result obtained afterwards as green component.
Step 3 calculates blue component:
Step 3.1, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/2562" obtained remainder conduct 4th intermediate result.
Step 3.2, by the 4th intermediate result obtained in above-mentioned steps 3.1 divided by " 1/2563", obtain knot among the 5th Fruit.
Step 3.3 carries out lower rounding to the 5th intermediate result obtained in above-mentioned steps 3.2, and will be by lower rounding Value of the result obtained afterwards as blue component.
It, can be according to method for transformation as follows by operation result in some optional implementations of the present embodiment It is converted into color data:
Step 1 calculates red component:
Step 1.1, by operation result divided by " 1/128 ", obtain the first intermediate result.
Step 1.2, to being rounded under the first intermediate result obtained in above-mentioned steps 1.1, and will be by after lower rounding Value of the result arrived as red component.
Step 2 calculates green component:
Step 2.1, using operation result divided by " 1/128 " obtained remainder as the second intermediate result.
Step 2.2, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/1282", obtain knot among third Fruit.
Step 2.3 carries out lower rounding to third intermediate result obtained in above-mentioned steps 2.2, and will be by lower rounding Value of the result obtained afterwards as green component.
Step 3 calculates blue component:
Step 3.1, by the second intermediate result obtained in above-mentioned steps 2.1 divided by " 1/1282" obtained remainder conduct 4th intermediate result.
Step 3.2, by the 4th intermediate result obtained in above-mentioned steps 3.1 divided by " 1/1283", obtain knot among the 5th Fruit.
Step 3.3 carries out lower rounding to the 5th intermediate result obtained in above-mentioned steps 3.2, and will be by lower rounding Value of the result obtained afterwards as blue component.
In step 204, graphics processor exports color data to central processing unit.
In the present embodiment, graphics processor will be from calculated color data in above-mentioned steps 203 to central processing unit Output.
In step 205, color data is converted result data by central processing unit.
In the present embodiment, central processing unit converts color data for operation result according to above-mentioned steps 203 Various method for transformation in each step inverse operation, by graphics processor send color data be converted into result data. Generally, result data is floating number, as to the result after floating number to be processed execution operation.
In some optional implementations of the present embodiment, if color data is to include red component, green component, indigo plant The four-tuple of colouring component and transparency component can convert result for color result according to method for transformation as follows Data:
Step 1, by red component multiplied by " 1/256 ", obtain the first intermediate result.
Step 2, by green component multiplied by " 1/2562", obtain the second intermediate result.
Step 3, by blue component multiplied by " 1/2563", obtain third intermediate result.
Step 4, by transparency component multiplied by " 1/2564", obtain the 4th intermediate result.
Step 5 calculates the first intermediate result, the second intermediate result, third intermediate result obtained in above-mentioned steps 1~4 And the 4th intermediate result summation, and by calculated result data as a result.
In some optional implementations of the present embodiment, if color data is to include red component, green component, indigo plant The four-tuple of colouring component and transparency component can convert result for color result according to method for transformation as follows Data:
Step 1, by red component multiplied by " 1/128 ", obtain the first intermediate result.
Step 2, by green component multiplied by " 1/1282", obtain the second intermediate result.
Step 3, by green component multiplied by " 1/1283", obtain third intermediate result.
Step 4 calculates the first intermediate result, the second intermediate result, third intermediate result obtained in above-mentioned steps 1~3 And the summation of transparency component, and by calculated result data as a result.
In some optional implementations of the present embodiment, if color data be include red component, green component with And the triple of blue component, result data can be converted by color result according to method for transformation as follows:
Step 1, by red component multiplied by " 1/256 ", obtain the first intermediate result.
Step 2, by green component multiplied by " 1/2562", obtain the second intermediate result.
Step 3, by green component multiplied by " 1/2563", obtain third intermediate result.
Step 4 calculates knot among the first intermediate result obtained in above-mentioned steps 1~3, the second intermediate result and third The summation of fruit, and by calculated result data as a result.
In some optional implementations of the present embodiment, if color data be include red component, green component with And the triple of blue component, result data can be converted by color result according to method for transformation as follows:
Step 1, by red component multiplied by " 1/128 ", obtain the first intermediate result.
Step 2, by green component multiplied by " 1/1282", obtain the second intermediate result.
Step 3, by blue component multiplied by " 1/1283", obtain third intermediate result.
Step 4 calculates the first intermediate result, the second intermediate result, third intermediate result obtained in above-mentioned steps 1~3 And the summation of transparency component, and by calculated result data as a result.
In some optional implementations of the present embodiment, graphics processor can also receive central processing unit transmission Color data to be processed.Then, graphics processor handles color data to be processed, the color data that obtains that treated. Then, graphics processor is to central processing unit output treated color data.Wherein, graphics processor can be to face to be processed Chromatic number is according to the various processing of progress, such as the conversion of gray processing, binaryzation, mode, data compression and data screening etc..Wherein, face The data of chromatic number evidence and treated color data can refer to expression color, and the representation of data meets common face Color pattern.Generally, common color mode has RGB mode (wherein, R represents that Red is red, G represents Green green, B is represented Blue blue), (wherein, R represents that Red is red, G represents Green green, B represents Blue blue, A represents Alpha to RGBA mode Transparency), CMYK mode (wherein, C represents Cyan cyan, M represents Magenta magenta, Y represents Yellow yellow, K represent Key Plate position registering color, that is, black), HSB mode (H represents Hue form and aspect, S represents Saturation saturation degree, B represent Brightness brightness), YUV mode (wherein, Y represents brightness, and U represents coloration, and V represents concentration), Lab mode (wherein, L It represents luminance channel, a and b and represents Color Channel, wherein the color in the channel a is from red to dark green, and the color in the channel b is from indigo plant Color is to yellow), the pattern bitmap color of two kinds of colors of black and white one of (only use) and grayscale mode (use different lightness Grey) etc..
In some optional implementations of the present embodiment, graphics processor can carry out ash to color data to be processed Degreeization processing.Assuming that color data to be processed be include red component, green component and blue component totally three components three Tuple, then treated, color data is the triple for including three identical gray components.It specifically, can be by a variety of Color data to be processed is carried out gray processing processing by method.For example, can be using the one third of the summation of three components as ash Spend component, obtain include three identical gray components triple expression treated color data.For example, it is also possible to will Red component obtains the first Middle Component multiplied by 30, green component is obtained the second Middle Component multiplied by 59, multiplies blue component Third Middle Component is obtained with 11, then adds the summation of the first Middle Component, the second Middle Component and third Middle Component again Upper 50, then divided by 100 obtained results as gray component, obtain include three identical gray components three close member Group indicates treated color data.
In some optional implementations of the present embodiment, graphics processor can carry out mould to color data to be processed Formula conversion.Assuming that color data to be processed is the ternary for including luminance component, chromatic component and concentration component totally three components Group, color data that treated are the triple for including red component, green component and blue component totally three components.Specifically Ground can have and convert treated color data for above-mentioned color data to be processed using various methods.For example, can be with By luminance component multiplied by 1.164, then plus concentration component and 1.596 product, then 222.9 obtained result conducts are subtracted Red component.By luminance component multiplied by 1.164, then subtract the product of chromatic component and 0.392, then subtract concentration component with 0.823 product, finally plus 135.6 obtained results as green component.By luminance component multiplied by 1.164, then plus Upper chromatic component and 2.017 product, then subtract 276.8 obtained results as blue component.For example, it is also possible to by dense The difference of component and 128 is spent, then multiplied by 1.4075, along with the obtained result of luminance component is as red component.First calculate Chromatic component and 128 difference, then obtain the first intermediate variable multiplied by 0.3455, then calculate concentration component and 128 difference, so The second intermediate variable is obtained multiplied by 0.7169 afterwards, then luminance component is successively subtracted to the first intermediate variable and the second intermediate variable Obtained result is as green component later.Then the difference for calculating chromatic component and 128 adds coloration then multiplied by 1.799 Component, and using obtained result as blue component.
The system provided by the above embodiment for handling floating number of the application has shared center by graphics processor The task of the floating point arithmetic of processor executes mathematical operation to floating number to be processed and obtains operation result.At figure Reason device cannot directly export floating number, therefore, first convert color data for operation result, then export again to central processing unit The corresponding color data of operation result.Central processing unit need to only convert the color data that graphics processor exports Result data is obtained, as floating point arithmetic as a result, to alleviate the floating-point operation task of central processing unit burden.
With further reference to another embodiment that Fig. 3, Fig. 3 are according to the system for handling floating number of the present embodiment Timing diagram 300.
As shown in figure 3, in step 301, the floating number that central processing unit first will acquire splits at least two parts, shape At floating number to be processed.
In the present embodiment, central processing unit can first tear floating number involved in floating point arithmetic task open Point, according to various method for splitting, the floating number being related to is split into two or more multiple portions, and will be after fractionation As a result graphics processor is sent to as floating number to be processed.
In some optional implementations of the present embodiment, above-mentioned floating number can be split as to two parts, including refer to Number part and mantissa part.
It, can be according to the digit of above-mentioned floating number by above-mentioned floating number in some optional implementations of the present embodiment It is split as multiple portions.For example, it is assumed that above-mentioned floating number occupies 32 memory spaces, then before can taking above-mentioned floating number 16 are used as a part, and latter 16 are used as another part.Preceding 8 conducts of above-mentioned floating number can also be taken a part of, latter 24 As another part.4 parts can also be split as altogether by every 8 in above-mentioned floating number as a part.
In some optional implementations of the present embodiment, the array of the odd bits of above-mentioned floating number can be extracted at one The array of the even bit of above-mentioned floating number is extracted into another part in part.
In step 302, graphics processor receives the floating number to be processed that central processing unit is sent.
In the present embodiment, based in above-mentioned steps 301, central processing unit is floated to involved in floating point arithmetic task Points are split as multiple portions, and using the multiple portions obtained after fractionation as floating number to be processed.During graphics processor receives The floating number to be processed including multiple portions that central processor is sent.
In step 303, graphics processor executes mathematical operation to floating number to be processed, obtains operation result.
In the present embodiment, graphics processor executes mathematical operation to floating number to be processed, obtains operation result.Specifically , graphics processor executes mathematical operation to various pieces included by floating number to be processed respectively, obtains and various pieces point The operation result of not corresponding each section.Wherein, mathematical operation may include it is common as added, subtracting, multiplication and division, power, evolution, The operations such as logarithm can also include such as derivative, integral, convolution, rounding operation.
In step 304, operation result is converted color data by graphics processor.
In the present embodiment, based on operation result obtained in above-mentioned steps 303, various sides are can be used in graphics processor Operation result is converted corresponding color data by method.Specifically, various methods can be used by above-mentioned steps in graphics processor It is corresponding to be separately converted to various pieces for the corresponding operation result of various pieces included by floating number to be processed in 303 Wherein, color data can refer to the data of expression color to color data, and the representation of data meets common color Mode.Generally, common color mode has RGB mode (wherein, R represents that Red is red, G represents Green green, B is represented Blue blue), (wherein, R represents that Red is red, G represents Green green, B represents Blue blue, A represents Alpha to RGBA mode Transparency), CMYK mode (wherein, C represents Cyan cyan, M represents Magenta magenta, Y represents Yellow yellow, K represent Key Plate position registering color, that is, black), HSB mode (H represents Hue form and aspect, S represents Saturation saturation degree, B represent Brightness brightness), YUV mode (wherein, Y represents brightness, and U represents coloration, and V represents concentration), Lab mode (wherein, L It represents luminance channel, a and b and represents Color Channel, wherein the color in the channel a is from red to dark green, and the color in the channel b is from indigo plant Color is to yellow), the pattern bitmap color of two kinds of colors of black and white one of (only use) and grayscale mode (use different lightness Grey) etc..
The conversion process for converting corresponding color data for operation result specifically can be with reference in Fig. 2 corresponding embodiment Related description in step 203, details are not described herein.
In step 305, graphics processor exports color data to central processing unit.
In the present embodiment, graphics processor exports the color data in above-mentioned steps 304 to central processing unit.Specifically Ground, graphics processor by color data corresponding to various pieces included by the floating number to be processed in above-mentioned steps 304 to Central processing unit output.
Within step 306, color data is converted result data by central processing unit.
In the present embodiment, central processing unit converts color data for operation result according to above-mentioned steps 304 Various method for transformation in each step inverse operation, by graphics processor send color data be converted into result data. Specifically, central processing unit by step 305 as graphics processor send floating number to be processed included by various pieces institute Corresponding color data is converted into result data corresponding to various pieces included by floating number to be processed.
The conversion process for converting color data for operation result specifically can be with reference to the step in Fig. 2 corresponding embodiment Related description in 205, details are not described herein.
In some optional implementations of the present embodiment, central processing unit can also according to in above-mentioned steps 301 Various method for splitting corresponding to inverse method for splitting by graphics processor send include the corresponding number of results of multiple portions According to merging into complete result data.For example, if above-mentioned floating number is split as exponential part and mantissa part, then central processing unit The corresponding result data of exponential part that graphics processor can be sent is as the exponential part of complete result data, by figure Mantissa part of the corresponding result data of mantissa part that processor is sent as complete result data.For example, if above-mentioned floating-point Number is split as each 16 two parts in front and back, then 16 before the preceding floating number that central processing unit can send graphics processor First half of the corresponding result data in part as complete result data, by 16 after the preceding floating number of graphics processor transmission Latter half of the corresponding result data in part as complete result data, former and later two parts are merged to obtain whole result number According to.
From figure 3, it can be seen that compared with the corresponding embodiment of Fig. 2, in the present embodiment is for handle floating number The timing 300 of system increases step 301.First the floating number in floating point arithmetic task is carried out by central processing unit as a result, It splits, the multiple portions obtained after fractionation is then sent to graphics processor as floating number to be processed and are handled, and scheme Shape processor can concurrently be performed simultaneously the operation of various pieces, to further increase the arithmetic speed of floating number. In addition, due to through fractionation after floating number each section byte number it is smaller, can reduce to a certain degree operation result and Loss of significance that may be present in the conversion process of color data is converted by operation result.
With further reference to Fig. 4, it illustrates according to one embodiment of the method for handling floating number of the application Flow chart 400.This is used to handle the process 400 of the method for floating number, comprising the following steps:
Step 401, the floating number to be processed that central processing unit is sent is received.
In the present embodiment, when central processing unit will execute floating point arithmetic, the task of floating point arithmetic can be handed over Give graphics processor processing.Specifically, floating number to be processed is passed to graphics processor first.
Step 402, mathematical operation is executed to floating number to be processed, obtains operation result.
In the present embodiment, graphics processor executes mathematical operation to floating number to be processed, obtains operation result.Wherein, Mathematical operation may include it is common such as add, subtract, multiplication and division, power, evolution, logarithm operation, can also include such as derivative, product Point, convolution, the operations such as rounding.
Step 403, color data is converted by operation result.
In the present embodiment, based on operation result obtained in above-mentioned steps 202, various sides are can be used in graphics processor Operation result is converted corresponding color data by method.Wherein, color data can refer to the data of expression color, and data Representation meet common color mode.Generally, common color mode has RGB mode (wherein, it is red to represent Red by R Color, G represent Green green, B represents Blue blue), (wherein, R represents that Red is red, G represents Green green, B to RGBA mode Represent Blue blue, A represent Alpha transparency), CMYK mode (wherein, C represent Cyan cyan, M represent Magenta magenta Color, Y represent Yellow yellow, K represent Key Plate positioning registering color i.e. black), HSB mode (H represent Hue form and aspect, S represent Saturation saturation degree, B represent Brightness brightness), (wherein, Y represents brightness to YUV mode, and U represents coloration, V generation Table concentration), Lab mode (wherein, L represents luminance channel, a and b and represents Color Channel, wherein the color in the channel a be from red to Dark green, the color in the channel b is from blue to yellow), the pattern bitmap color of two kinds of colors of black and white one of (only use) with And grayscale mode (using the grey of different lightness) etc..
In the present embodiment, the conversion process for converting color data for operation result specifically can be corresponding real with reference to Fig. 2 The explanation of the dependent conversion mode of the step 203 in example is applied, details are not described herein.
Step 404, the color data is exported to central processing unit.
In the present embodiment, graphics processor will be by calculated red component, green component, indigo plant in above-mentioned steps 203 Four-tuple composed by colouring component and transparency component is exported as color data to central processing unit.
In some optional implementations of the present embodiment, graphics processor can also receive central processing unit transmission Color data to be processed.Then, graphics processor handles color data to be processed, the color data that obtains that treated. Then, graphics processor is to central processing unit output treated color data.It specifically can be with reference in Fig. 2 corresponding embodiment The related description of step 203, details are not described herein.
In the present embodiment for handle floating number method by as in the terminal device where central processing unit Other processors share the floating point arithmetic task of central processing unit, alleviate the burden of central processing unit, so that other processing For device when executing the task of floating point arithmetic, other tasks in terminal device are can also be performed in central processing unit, to improve The overall performance of terminal device where central processing unit.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides for handling floating number Device one embodiment, the Installation practice is corresponding with embodiment of the method shown in Fig. 4.
As shown in figure 5, described in the present embodiment for handle floating number device 500 include floating number receiving unit 501, Floating number computing unit 502, conversion unit 503 and output unit 504.Wherein, floating number receiving unit 501 is configured to connect Receive the floating number to be processed that central processing unit is sent;Floating number computing unit 502 is configured to execute number to floating number to be processed Student movement is calculated, and operation result is obtained;Conversion unit 503 is configured to convert color data for operation result;Output unit 504, It is configured to export color data to central processing unit.
In the present embodiment, in the device 500 for generating information: floating number receiving unit 501, floating number computing unit 502, the specific processing of conversion unit 503 and output unit 504 and its brought technical effect can be corresponding real with reference to Fig. 4 respectively Step 401, step 402, the related description of step 403 and step 404 in example are applied, details are not described herein.
In some optional implementations of the present embodiment, above-mentioned color data is stored in the form of four-tuple, wherein Four-tuple includes red component, green component, blue component and transparency component.
In some optional implementations of the present embodiment, above-mentioned apparatus further include: color data receiving unit is (in figure It is not shown), it is configured to receive the color data to be processed that central processing unit is sent;Color data processing unit (does not show in figure Out), it is configured to handle color data to be processed, the color data that obtains that treated;Output unit 504 is further matched It sets for central processing unit output treated color data.
The device provided by the above embodiment of the application receives central processing unit by floating number receiving unit 501 and sends Floating number to be processed, then by floating number computing unit 502 to floating number to be processed execute mathematical operation, obtain operation knot Then fruit converts corresponding color data for above-mentioned operation result by conversion unit 503, last output unit 504 is by face Chromatic number is exported according to central processing unit, so that the task of the floating point arithmetic of central processing unit has been shared, so that central processing unit It can handle other tasks, to improve the task treatment effeciency of central processing unit.
Below with reference to Fig. 6, it illustrates be suitable for being used to realizing that the structure of the graphics processor 600 in the embodiment of the present application is shown It is intended to.Shown in Fig. 6 is only an example, should not function to the embodiment of the present application and use scope bring any restrictions.
As shown in fig. 6, graphics processor 600 includes storage section 601, caching part 602, control section 603 and calculates Part 604.Wherein, calculating section 604 mainly executes various operations, such as arithmetic operator, shifting function, address arithmetic and conversion It can be obtained from storage section 601 and/or caching part 602 Deng, data involved in calculating process.Storage section 601 is main It is used to be stored in the data generated in calculating process or instruction etc..Control unit 603 mainly decodes instruction, and The multiple control signal executed instruction is issued to storage section 601, caching part 602 and calculating section 604.Cache part 602 Accessible storage section 601 reads required data.
Particularly, in accordance with an embodiment of the present disclosure, the process described above with reference to flow chart may be implemented as terminal and set Standby and computer software programs.For example, embodiment of the disclosure includes a kind of terminal device and computer program product.Wherein, Terminal device includes graphics processor, and graphics processor can be communicated to connect with the central processing unit included by terminal device.Meter Calculation machine program product includes the computer program on the readable medium of carrying on the terminal device, which includes to be used for The program code of method shown in execution flow chart.In such embodiments, which can call graphics process Device executes the above-mentioned function of limiting in the present processes.
It should be noted that computer-readable medium described herein can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires It takes formula computer disk, hard disk, static random-access memory (SRAM), dynamic RAM (DRAM), read-only deposit Reservoir (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this application, computer-readable Storage medium can be it is any include or storage program tangible medium, the program can be commanded execution system, device or Device use or in connection.And in this application, computer-readable signal media may include in a base band or The data-signal that person propagates as carrier wave a part, wherein carrying computer-readable program code.The data of this propagation Signal can take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer Readable signal media can also be any computer-readable medium other than computer readable storage medium, this is computer-readable Medium can send, propagate or transmit for by instruction execution system, device or device use or it is in connection Program.The program code for including on computer-readable medium can transmit with any suitable medium, including but not limited to: nothing Line, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit also can be set in graphics processor, for example, can be described as: a kind of figure Processor, including floating number receiving unit, floating number computing unit, conversion unit and output unit.Wherein, the name of these units Claim not constituting the restriction to the unit itself under certain conditions, for example, receiving unit is also described as receiving center The unit for the floating number to be processed that processor is sent.
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be Included in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that should Device: the floating number to be processed that central processing unit is sent is received;Mathematical operation is executed to floating number to be processed, obtains operation knot Fruit;Color data is converted by operation result;Color data is exported to central processing unit.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (12)

1. a kind of system for handling floating number, comprising:
Graphics processor executes number to the floating number to be processed for receiving the floating number to be processed of central processing unit transmission Student movement is calculated, and operation result is obtained, and converts color data for the operation result, Xiang Suoshu central processing unit exports the color Data;
The central processing unit is converted into result data for reading the color data, and by the color data.
2. system according to claim 1, wherein the color data is stored in the form of four-tuple, wherein described four Tuple includes red component, green component, blue component and transparency component.
3. system according to claim 1, wherein the central processing unit, the floating number for being also used to will acquire are split At at least two parts, the floating number to be processed is formed.
4. system according to claim 1, wherein the graphics processor is also used to receive the central processing unit hair The color data to be processed sent handles the color data to be processed, the color data that obtains that treated, in described Color data that treated described in central processor output.
5. a kind of floating number processing method for graphics processor, wherein the graphics processor is communicated with central processing unit Connection, which comprises
Receive the floating number to be processed that the central processing unit is sent;
Mathematical operation is executed to the floating number to be processed, obtains operation result;
Color data is converted by the operation result;
The color data is exported to the central processing unit.
6. according to the method described in claim 5, wherein, the color data is stored in the form of four-tuple, wherein described four Tuple includes red component, green component, blue component and transparency component.
7. according to the method described in claim 5, wherein, the method also includes:
Receive the color data to be processed that the central processing unit is sent;
The color data to be processed is handled, the color data that obtains that treated;
To central processing unit output treated the color data.
8. a kind of floating number processing unit for graphics processor, comprising:
Floating number receiving unit is configured to receive the floating number to be processed that central processing unit is sent;
Floating number computing unit is configured to execute mathematical operation to the floating number to be processed, obtains operation result;
Conversion unit is configured to convert color data for the operation result;
Output unit is configured to export the color data to the central processing unit.
9. device according to claim 8, wherein the color data is stored in the form of four-tuple, wherein described four Tuple includes red component, green component, blue component and transparency component.
10. device according to claim 8, wherein described device further include:
Color data receiving unit is configured to receive the color data to be processed that the central processing unit is sent;
Color data processing unit is configured to handle the color data to be processed, the number of colours that obtains that treated According to;
The output unit is further configured to export treated the color data to the central processing unit.
11. a kind of electronic equipment, comprising:
One or more graphics processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of graphics processors, so that one or more of figures Processor realizes the method as described in any in claim 5-7.
12. a kind of computer-readable medium, is stored thereon with computer program, wherein when the program is executed by graphics processor Realize the method as described in any in claim 5-7.
CN201810184557.3A 2018-03-06 2018-03-06 For handling system, the floating number processing method and processing device of floating number Pending CN110231928A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810184557.3A CN110231928A (en) 2018-03-06 2018-03-06 For handling system, the floating number processing method and processing device of floating number

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810184557.3A CN110231928A (en) 2018-03-06 2018-03-06 For handling system, the floating number processing method and processing device of floating number

Publications (1)

Publication Number Publication Date
CN110231928A true CN110231928A (en) 2019-09-13

Family

ID=67862244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810184557.3A Pending CN110231928A (en) 2018-03-06 2018-03-06 For handling system, the floating number processing method and processing device of floating number

Country Status (1)

Country Link
CN (1) CN110231928A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105303506A (en) * 2014-06-19 2016-02-03 Tcl集团股份有限公司 Data parallel processing method and system based on HTML5
CN107515736A (en) * 2017-07-01 2017-12-26 广州深域信息科技有限公司 A kind of method for accelerating depth convolutional network calculating speed on embedded device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105303506A (en) * 2014-06-19 2016-02-03 Tcl集团股份有限公司 Data parallel processing method and system based on HTML5
CN107515736A (en) * 2017-07-01 2017-12-26 广州深域信息科技有限公司 A kind of method for accelerating depth convolutional network calculating speed on embedded device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
吴恩华, 柳有权: "基于图形处理器(GPU)的通用计算", 计算机辅助设计与图形学学报, no. 05, pages 601 - 611 *
王家华;刘琳;: "油藏建模三维显示的交互式设计与研究――基于GPGPU技术", 科技资讯, no. 02, pages 31 - 32 *

Similar Documents

Publication Publication Date Title
Chernov et al. Integer-based accurate conversion between RGB and HSV color spaces
Grigoryan et al. Retooling of color imaging in the quaternion algebra
US7973797B2 (en) Programmable blending in a graphics processing unit
US8330769B2 (en) System and method for monochromatic tinting using saturation maps
CN107213638B (en) 3D game skeleton processing system and processing method thereof
Xue et al. Joint luminance and chrominance learning for underwater image enhancement
Chang et al. Example-based color transformation of image and video using basic color categories
JPH0613914A (en) Method and apparatus for discrete cosine conversion which does not require multiplication
Kumar et al. Efficient hardware of RGB to Gray conversion realized on FPGA and ASIC
CN111784703B (en) Image segmentation method and device, electronic equipment and storage medium
Reddy et al. Grey level to RGB using YCbCr color space Technique
CN104796682A (en) Image signal color enhancement method and image signal color enhancement device
JP2006154992A (en) Neuro-processor
CN110231928A (en) For handling system, the floating number processing method and processing device of floating number
CN104077794A (en) Picture staining method and device
CN105704464A (en) Color space transformation method based on FPGA
CN113160379B (en) Material rendering method and device, storage medium and electronic equipment
CN112862943A (en) Virtual model rendering method and device, storage medium and electronic equipment
CN109447085A (en) A kind of mask convolution operation method
CN107872657A (en) The method of color gamut space conversion based on FPGA
CN115936980A (en) Image processing method and device, electronic equipment and storage medium
CN110298783B (en) Image matting method and system
JPH07200869A (en) Alpha blending arithmetic unit
US20130041929A1 (en) Arithmetic circuit and arithmetic apparatus
KR100430393B1 (en) Apparatus for converting color space coordinate in video decoder

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination