CN103268307A - Graphic processing method based on logarithm segmentation linear approximation - Google Patents
Graphic processing method based on logarithm segmentation linear approximation Download PDFInfo
- Publication number
- CN103268307A CN103268307A CN2013100056712A CN201310005671A CN103268307A CN 103268307 A CN103268307 A CN 103268307A CN 2013100056712 A CN2013100056712 A CN 2013100056712A CN 201310005671 A CN201310005671 A CN 201310005671A CN 103268307 A CN103268307 A CN 103268307A
- Authority
- CN
- China
- Prior art keywords
- interval
- logarithm
- linear approximation
- piecewise
- expression
- 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
Links
Images
Abstract
The invention relates to a graphic processing method based on logarithm segmentation linear approximation. The method comprises the following steps: according to a logarithm segmentation linear approximation theory, finding out xi and xi+1 which are respectively a head point and a tail point of each segmentation region; then calculating ai and di to form a lookup table LUT, wherein the ai represents a control parameter of the segmentation linear approximation degree of each region; comparing x with the end points of each region and the xi+1 by taking the x as an input of the lookup table to find out the region where the x is positioned, wherein the x is operators of multiplication, division and index calculation in a graphic processing system, and looking up to four parameters, namely p, q, r and d of the corresponding region, wherein p, q and r represents shifting bits performed on the x; according to the obtained parameters, shifting the input parameter x, and respectively shifting the x by p, q and r, wherein obtained shifting results are respectively represented as x1', x2' and x3'; and summing the x1', x2' and x3' into d, and obtaining a summed result s. By the method for instructing logarithm segmentation by relative error control, the error of logarithm transformation can be reduced, and the calculation precision of the graphic processing method is greatly improved.
Description
Technical field
The present invention relates to a kind of graphic processing method based on the logarithm piecewise linear approximation, is to utilize error analysis to instruct the graphic processing method of logarithm piecewise linear approximation.
Background technology
Along with popularizing of mobile intelligent terminal, graphics capability is subjected to increasing attention, in the embedded graphic disposal system, because graphics process needs a large amount of matrix multiples, the vector unitization, multiplication of vectors, complex calculation such as exponent arithmetic and root mean square, and intelligent terminal has characteristics such as powered battery, therefore for the power consumption of graph processing chips, area has very large restriction, therefore the computing meeting that directly utilizes general number system to calculate relative complex in the graphics process increases the power consumption of chip and increases area, in order to simplify the complexity of calculating, can adopt the log-domain computing usually.The characteristics of this method are under the situation that reduces computational accuracy, multiplication, division, exponential sum trigonometric function operation etc. under the general number system can be converted to adding computing and subtracting computing on the log-domain, thereby reach the purpose that reduces computational complexity.Take all factors into consideration from hard-wired angle, adopt piecewise function to approach logarithm usually, generally can or utilize to calculate in real time and approach by look-up table, but whether segmentation method is reasonable, can determine whole logarithm to be transformed into precision.Therefore the operational precision that graphic processing method based on the logarithm piecewise approximation improves need have been proposed.
Summary of the invention
Fundamental purpose of the present invention is the not high defective of precision at the prior art existence, graphic processing method based on the logarithm piecewise linear approximation is provided, based on error analysis, control logarithm piecewise linear approximation, by setting the look-up table LUT that corresponding maximum relative error obtains concrete segmentation, thereby improve graphic processing method to the number conversion computational accuracy.
For achieving the above object, design of the present invention is to utilize error analysis to instruct the concrete calculating look-up table LUT method of segmentation, segments, waypoint and maximum relative error unification can be combined, provide the corresponding relation between maximum relative error, waypoint and the segments.Can rational look-up table be set according to predefined error parameter like this, obtain the best effect of approaching, specifically comprise following content:
Instruct logarithm piecewise approximation approach method to provide relative error by error
E R And the mathematical relation between the piecewise interval.
The maximum relative error parameter that instructs logarithm piecewise approximation approach method to set in advance according to error
And waypoint
x 1Obtain the waypoint of each piecewise interval, it is impartial making each interval maximum relative error distribute.
The present invention can preestablish maximum relative error and instruct segmentation according to concrete requirement, determine the content of look-up table, satisfies the demand of different field; Provide the computing flow process of carrying out the logarithm piecewise linear approximation based on maximum relative error simultaneously.According to the design of foregoing invention, the present invention adopts following technical proposals:
A kind of graphic processing method based on the logarithm piecewise linear approximation, this disposal route operation steps is as follows:
(1) according to the principle of logarithm piecewise linear approximation, finds out
x i With
x I+1
,
,
x I+1
Be respectively head-end and the distal point of each piecewise interval, calculate then
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept constitutes look-up table LUT.
(2) will
xAs the input of look-up table,
xBe the computing operator of the multiplication in the graphic system, division and exponent arithmetic,
xWith each interval end points
,
x I+1
Compare, find out
xThe interval at place finds out corresponding 4 interval parameters
P, q, r, d,
P, q, rExpression
xThe displacement figure place of carrying out,
dExpression the
iInterval intercept.
(3) according to the parameter that obtains in the step (2), to input parameter
xCarry out shifting function, respectively displacement
P, q, r, the shift result that obtains is expressed as respectively
x 1 ' ,
x 2 ' ,
x 3 ' , namely
,
,
(4) will
,
x 1 ' ,
x 2 ' ,
x 3 ' With
dCarry out addition, addition result is s, the result during the s presentation graphic is handled after the log-transformation, namely
Described a kind of graphic processing method based on the logarithm piecewise linear approximation is characterized in that the concrete steps of the formation look-up table LUT in the described step (1) are as follows:
(1-1) two parameter maximum relative errors in advance are set
E Rmax Head-end with first piecewise interval
x 1=1.0;
(1-2) according to the parameter in the step (1-1)
x 1,
E Rmax With following formula, can calculate
x 2
In the formula
x 1 , x 2Be the end points in interval,
X 'Be the maximum relative error data point,
E R Be relative error;
(1-3) will
x 2As the head-end of second piecewise interval, repeating step (1-2) can obtain then
x 3, then, with this iteration, up to obtaining last interval endpoint
x i
(1-4) all waypoints that obtain according to step (1-3) according to following formula, calculate
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept; Adopt the method for traversal to calculate then
P, q, r, wherein
,
P, q, rExpression
xCarry out the figure place of dextroposition, will
P, q, rWith
d i As the delegation among the LUT, finally constitute the content of whole look-up table LUT;
x 1, x I+1
The end points of representing each interval segmentation.
The present invention has following apparent outstanding substantive distinguishing features and remarkable advantage compared with prior art: each end points in logarithm piecewise linear approximation interval and the segments in whole interval are by the preset parameters maximum relative error
Decide.Can to the mode of number conversion complex calculation be simplified by affiliated step (1)~(4), obtain a high-precision graphics process result.
Description of drawings
Fig. 1 illumination computing realization flow figure
Fig. 2 inner product of vectors operation program block diagram
Fig. 3 vector division arithmetic flow chart
Fig. 4 exponent arithmetic flow chart
Fig. 5 logarithm is piecewise linear to be approached
The realization block diagram of Fig. 6 logarithm piecewise linear approximation method
Embodiment
The invention will be further described below by specific embodiment and in conjunction with realizing accompanying drawing.
Embodiment one: present embodiment is based on the graphic processing method of logarithm piecewise linear approximation, and this disposal route operation steps is as follows:
(1) according to the principle of logarithm piecewise linear approximation, finds out
x i With
x I+1
,
,
x I+1
Be respectively head-end and the distal point of each piecewise interval, calculate then
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept constitutes look-up table LUT.
(2) will
xAs the input of look-up table,
xBe the computing operator of the multiplication in the graphic system, division and exponent arithmetic,
xWith each interval end points
,
x I+1
Compare, find out
xThe interval at place finds out corresponding 4 interval parameters
P, q, r, d,
P, q, rExpression
xThe displacement figure place of carrying out,
dExpression the
iInterval intercept.
(3) according to the parameter that obtains in the step (2), to input parameter
xCarry out shifting function, respectively displacement
P, q, r, the shift result that obtains is expressed as respectively
x 1 ' ,
x 2 ' ,
x 3 '
Embodiment two: present embodiment and embodiment one are basic identical, and its special feature is as follows: the concrete steps of the formation look-up table LUT in the described step (1) are as follows:
(1-1) two parameter maximum relative errors in advance are set
E Rmax Head-end with first piecewise interval
x 1=1.0;
(1-2) according to the parameter in the step (1-1)
x 1,
E Rmax With following formula, can calculate
x 2
In the formula
x 1 , x 2Be the end points in interval,
X 'Be the maximum relative error data point,
E R Be relative error;
(1-3) will
x 2As the head-end of second piecewise interval, repeating step (1-2) can obtain then
x 3, then, with this iteration, up to obtaining last interval endpoint
x i
(1-4) all waypoints that obtain according to step (1-3) according to following formula, calculate
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept; Adopt the method for traversal to calculate then
P, q, r, wherein
,
P, q, rExpression
xCarry out the figure place of dextroposition, will
P, q, rWith
d i As the delegation among the LUT, finally constitute the content of whole look-up table LUT;
x 1, x I+1
The end points of representing each interval segmentation.
Embodiment three: before describing this enforcement, what should be noted that is that present embodiment is present among the illumination method step and device feature in the graphic system, and it relates to the computing of inner product of vectors computing, vectorial division arithmetic and index.Therefore, provided the software implementation method step of every kind of computing in the accompanying drawings, and elaborated the details that helps to understand the specific embodiment of the invention.
Illumination arithmetic unit in the graphic system mainly is in order to strengthen the sense of reality effect of object in the virtual scene, and its operational formula can be expressed as following formula:
,
,
The material properties of expression object,
,
What represent is the light source attribute,
IThe color value on expression summit, N, L, H representation unit vector.
Inner product of vectors operation program block diagram as shown in Figure 2,
Be respectively the component of two input vectors, multiplication of vectors can be expressed as follows:
, d represents the result of two multiplication of vectors.If in the log-domain arithmetic system, carry out computing, then can be converted to
Concrete implementing procedure is 1, right
Carry out the log-transformation computing; 2, carry out the additive operation of logarithm number field; 3, carry out transformation transformation for 2 results that obtain.
Vector division arithmetic flow chart as shown in Figure 3,
,
,
, if
X, y, zThe expression vector (
X, y, z) three components, d represent vector (
X, y, z) mould,
Nx, Ny, NzThe expression vector (
X, y, z) the unit polarization component.In logarithm number field arithmetic system, carry out computing, then can be converted to
The exponent arithmetic program is as shown in the figure shown in 4,
X NS If exponent arithmetic is carried out computing in logarithm number field arithmetic system and then can be converted to descending then very complicated in general number field arithmetic system
The implementation method of specific implementation method and inner product of vectors computing is similar, at first carries out number conversion, carries out the computing of logarithm number field then, finally by crossing the logarithm inverse transformation.
In the concrete device for carrying out said and implementation method of illumination, a crucial implementation step is to number conversion in graphic system, and its conversion accuracy height has great influence to final result.Following mask body set forth in the present invention's statement to the number conversion implementation step.
Because the function of piecewise approximation of the present invention is
, wherein the segmentation interval is arbitrarily
,
Represent respectively
iThe head-end of piecewise interval and distal point, and satisfy
, specifically as shown in Figure 5.
The present invention is in the whole interval piecewise linear approximation that adopts, and wherein some segmentations namely can draw following expression formula:
(1) |
Wherein
E Rmax The relative error of maximum in representing a certain section,
, The expression waypoint,
The maximum relative error data point.
Like this as long as the preliminary setting parameter maximum relative error
E Rmax With the end points of any one piecewise interval, just can obtain this interval another one end points by the formula 6,7 that provides; Whole FB(flow block) based on the logarithm piecewise linear approximation so just can obtain the end points of all piecewise intervals on the whole interval, and can guarantee that each interval maximum relative error equates as shown in Figure 6.
Setting maximum relative error such as us is 0.001, because initial
x 1=1.0, then list down establishing an equation:
Can solve maximum by top system of equations
x 2Value, namely
x 2=1.002.
From accompanying drawing 6 as can be seen, second piecewise interval
x 1=1.002, so second section second end points can asking
Value by the FB(flow block) shown in the accompanying drawing 6, can be obtained all waypoints like this.Calculate the slope of each piecewise interval straight line then according to formula (1)
a i And intercept
d i Thereby, can obtain look-up table (LUT) content.
Provide the mathematical relation between maximum relative error and the waypoint like this, thereby can utilize given maximum relative error to make table content.Accompanying drawing 6 is according to the realization flow figure that concerns between maximum relative error and the waypoint, can utilize the graphic processing method based on the logarithm piecewise linear approximation to obtain higher precision in sum.
In graphic system, for obtaining graphic processing method corresponding to the logarithm converting unit the illumination calculation device from foregoing description based on log-linear piecewise approximation method, mainly formed by following step: 1, the field of using according to graphic system, set suitable maximum relative error
E Rmax Calculate each waypoint according to the mathematical relation between the maximum relative error that provides and each waypoint; According to obtaining waypoint information, obtain slope and the intercept of each segmentation, draw about logarithm segment lookup table; Whole to analog-to-digital conversion apparatus according to look-up tables'implementation.2, with the illumination computing that will handle in the graphics process by analog-to-digital conversion apparatus being converted to the calculating on the log-domain, thereby reduce computational complexity with minimum loss of significance.3, log-domain is handled data later and carry out transformation transformation, export the result then.
Claims (2)
1. graphic processing method based on the logarithm piecewise linear approximation is characterized in that operation steps is as follows:
According to the principle of logarithm piecewise linear approximation, find out
x i With
x I+1
,
,
x I+1
Be respectively head-end and the distal point of each piecewise interval, calculate then
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept constitutes look-up table LUT; Will
xAs the input of look-up table,
xBe the computing operator of the multiplication in the graphic system, division and exponent arithmetic,
xWith each interval end points
,
x I+1
Compare, find out
xThe interval at place finds out corresponding 4 interval parameters
P, q, r, d,
P, q, rExpression
xThe displacement figure place of carrying out,
dExpression the
iInterval intercept; According to the parameter that obtains in the step (2), to input parameter
xCarry out shifting function, respectively displacement
P, q, r, the shift result that obtains is expressed as respectively
x 1 ' ,
x 2 ' ,
x 3 ' , namely
,
,
Will
,
x 1 ' ,
x 2 ' ,
x 3 ' With
dCarry out addition, addition result is s, the result during the s presentation graphic is handled after the log-transformation, namely
2. the graphic processing method based on the logarithm piecewise linear approximation according to claim 1 is characterized in that the concrete steps of the formation look-up table LUT in the described step (1) are as follows:
Two parameter maximum relative errors in advance are set
E Rmax Head-end with first piecewise interval
x 1=1.0;
According to the parameter in the step (1-1)
x 1,
E Rmax With following formula, can calculate
x 2
In the formula
x 1 , x 2Be the end points in interval,
X 'Be the maximum relative error data point,
E R Be relative error;
Will
x 2As the head-end of second piecewise interval, repeating step (1-2) can obtain then
x 3, then, with this iteration, up to obtaining last interval endpoint
x i
All waypoints according to step (1-3) obtains according to following formula, calculate
a i With
d i ,
a i The control parameter of representing each interval segmentation straight line approximation ratio,
d i The expression intercept; Adopt the method for traversal to calculate then
P, q, r, wherein
,
P, q, rExpression
xCarry out the figure place of dextroposition, will
P, q, rWith
d i As the delegation among the LUT, finally constitute the content of whole look-up table LUT;
,
x 1, x I+1
The end points of representing each interval segmentation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013100056712A CN103268307A (en) | 2013-01-08 | 2013-01-08 | Graphic processing method based on logarithm segmentation linear approximation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013100056712A CN103268307A (en) | 2013-01-08 | 2013-01-08 | Graphic processing method based on logarithm segmentation linear approximation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103268307A true CN103268307A (en) | 2013-08-28 |
Family
ID=49011938
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2013100056712A Pending CN103268307A (en) | 2013-01-08 | 2013-01-08 | Graphic processing method based on logarithm segmentation linear approximation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103268307A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4700319A (en) * | 1985-06-06 | 1987-10-13 | The United States Of America As Represented By The Secretary Of The Air Force | Arithmetic pipeline for image processing |
US6681237B1 (en) * | 2000-09-07 | 2004-01-20 | International Business Machines Corporation | Exponentiation circuit for graphics adapter |
CN102566965A (en) * | 2011-12-22 | 2012-07-11 | 上海大学 | Floating-point number logarithmic operation device with flat errors |
-
2013
- 2013-01-08 CN CN2013100056712A patent/CN103268307A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4700319A (en) * | 1985-06-06 | 1987-10-13 | The United States Of America As Represented By The Secretary Of The Air Force | Arithmetic pipeline for image processing |
US6681237B1 (en) * | 2000-09-07 | 2004-01-20 | International Business Machines Corporation | Exponentiation circuit for graphics adapter |
CN102566965A (en) * | 2011-12-22 | 2012-07-11 | 上海大学 | Floating-point number logarithmic operation device with flat errors |
Non-Patent Citations (3)
Title |
---|
BYEONG-GYU NAM等: "Power and Area-Efficient Unified Computation of Vector and Elementary Functions for Handheld 3D Graphics Systems", 《COMPUTERS, IEEE TRANSACTIONS ON》 * |
LIUCHUANG GAO等: "High Efficient Logarithm Convertor for Graphics Physics Simulation", 《AUDIO,LANGUAGE AND IMAGE PROCESSING(ICALIP),2012 INTERNATIONAL CONFERENCE ON》 * |
MENGYAO ZHU等: "Error Flatten Logarithm Approximation for Graphics Processing Unit", 《MICROELECTRONICS(ICM ),2011 INTERNATIONAL CONFERENCE ON》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102125959B1 (en) | Method and apparatus for determining a matching relationship between point cloud data | |
EP3922951A1 (en) | Method and device for drawing a three-dimensional road network map, apparatus and medium | |
CN108875177B (en) | Method for creating inland waterway dredging graph under single beam measuring point based on BIM model | |
CN105654483A (en) | Three-dimensional point cloud full-automatic registration method | |
CN102903134A (en) | Method for rapidly drawing curves multiple times | |
CN112763995A (en) | Radar calibration method and device, electronic equipment and road side equipment | |
CN104392013A (en) | Integrated modeling and calculating system and method for substation-project cable trench on basis of CAD (Computer-Aided Design) | |
CN114387319A (en) | Point cloud registration method, device, equipment and storage medium | |
CN104361625A (en) | Ray principle based cloud data compaction algorithm with boundary reservation | |
CN107329732A (en) | It is a kind of to be used to perform a variety of apparatus and method for surmounting function computing | |
CN106372348A (en) | Vector fitting model order reduction method based on error control in linear system | |
CN103268307A (en) | Graphic processing method based on logarithm segmentation linear approximation | |
CN110827393B (en) | Image processing method, image processing device, storage medium and electronic equipment | |
CN104933080A (en) | Method and apparatus for determining abnormal data | |
US20220326034A1 (en) | Method and apparatus for road guidance, electronic device and storage medium | |
CN113799798B (en) | Method and device for determining running track of vehicle, electronic equipment and memory | |
CN104809297A (en) | Electromagnetic force density transferring method used among special-shaped grids in magnetic field-structure field coupling calculation | |
CN105096379A (en) | Triangular mesh surface reconstruction method based on k-neighborhood | |
CN109388911B (en) | Equivalent model establishing method and device for semiconductor device and terminal equipment | |
CN109509218B (en) | The method, apparatus of disparity map is obtained based on FPGA | |
CN111426329A (en) | Road generation method and device, computer equipment and storage medium | |
CN104344828A (en) | Method capable of generating curvature data of road of navigation map | |
CN110282073A (en) | Ship hydrodynamics prediction technique and system based on hull Wet surface grid in wave | |
Huang et al. | Stereo matching algorithm for autonomous positioning of underground mine robots | |
CN107357950A (en) | Fabricated construction triaxial imitation design method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20130828 |