The piece field depth filtering system and method for adjustable variant electric
Technical field
What the present invention relates to is the technology of graphics process in a kind of plot of three-D computer system, what be particularly related to is the system and method for keeping in the depth of field relation of stereoscopic drawing object a kind of, supply is used in digital camera (DSC), digital camera (DV), personal digital aid (PDA) (PDA), action electronic equipment, third generation mobile phone, hand-held mobile phone or intelligent mobile phone etc. and can takes on the handheld apparatus, but is not defined as said apparatus.
Background technology
In recent years, but on the market demand at hand-held portable electronic product is increased day by day, meanwhile, the province of three-dimensional drawing system energy effect, but fractal key is also got in the status in the hand-held portable electronic product that needs exquisite low power consuming small size especially.In the three-dimensional drawing system, the massage storage access in the calculating process partly is the energy dissipation of most critical; The memory access that comprises five kinds of kenels in the three-dimensional drawing system: the material data reads (Texture Read), depth of field working area (Depth Buffer or Z Buffer) data and reads that (Z Read), depth of field working area data write (Z Write), chroma working area data reads (Color Read) and chroma working area data writes (Color Write); The internal memory frequency range size required according to these five kinds of memory access, wherein, depth of field working area data read (ZR) accounted in the middle of at least 40% frequency range; Therefore read the action enforcement optimization of (ZR) at depth of field working area data, result preferably can be arranged minimizing in energy dissipation.
Previous Morein once proposed a kind of filtering method (Zmax) of the maximum depth of field, was that the cutting district (DisplayRegion) that draws becomes some pieces, and was the filtering class condition with the maximal value (Zmax) of all the pixel depth of field in the piece; When the piece that will draw at present, the big piece depth of field maximal value (Zmax) of formerly drawing of its minimum depth of field, to paint a little all be to belong to what quilt was covered painting a little to should give and abandoning to all in the piece so at present.The method of Morein has been saved in the three-dimensional drawing, and those are by the operation of comparing (Z Test) future in the access of depth of field working area (Z-Buffer) and the depth of field of painting of the object that covered.
Proposing a kind of filtering method (Zmin) of the minimum depth of field in addition, is that the cutting district (Display Region) that draws becomes some pieces, and is the filtering class condition with the minimum value (Zmin) of all the pixel depth of field in the piece; When the piece that will draw at present, the little piece depth of field minimum value (Zmin) of formerly drawing of its maximum depth of field, all in the piece are painted a little all to be considered as seen painting a little and are preserved so at present.
Method saved in the three-dimensional drawing, painting a little of the object that those are not covered read shared frequency range at depth of field working area (Z-Buffer).Yuand Kim has also proposed their filtering method, similarly, drawing district (Display Region) is cut into some pieces, different is, the field depth filtering condition of establishing in the piece is fixed, be called depth of field plane filtering method (Depth PlanFilter), corresponding piece pixel also has a depth of field plane landmark (DF-flag) simultaneously, and its size is the number of pixels in the piece; When the depth of field of present piece interior pixel is little during in the depth of field condition that this piece is set (Depth Plan), the depth of field plane landmark (DF-flag) of the piece pixel that it is corresponding can be flagged as 1; And when the depth of field of present piece interior pixel during greatly in the depth of field condition that this piece is set (Depth Plan), the former depth of field plane landmark (DF-flag) of the piece pixel that it is corresponding can be suggested, if former depth of field plane landmark is 1 words, painting one before the representative, to paint some its depth of field values little of painting a little of will painting at present, so a present genus of painting is painted a little to should give and abandoned what quilt covered.
Clearly, the maximum field depth filtering method (Zmax) of Morein has only filtered the point that is covered, and
The filtering method (Zmin) of the minimum depth of field only filtered the point that is not covered, the benefit of the filtering method of Yu and Kim has very big relation with the depth of field plane numerical value of its definition in addition, the particularly dynamic more difficult variation of catching its depth of field of scene.
Summary of the invention
The objective of the invention is to, overcome described defective, save the internal memory frequency range, have outside the filtering classification of segmentation, also going dynamically the size of modulation piece, when scene need renew, was all depth of field values that need to remove lining, depth of field working area (Z Buffer) originally, and all change depth of field value maximum in the system, in order to avoid entanglement takes place when doing new depth of field comparison.
For achieving the above object, the technical solution used in the present invention is, a kind of piece field depth filtering system of adjustable variant electric is provided, and it comprises:
A portion three-dimensional picture pasting geometric calculus device, be provided with handling the geometric operation of 3 D stereo object drawing intermediate cam pinup picture group, and the district that will draw (Display Region) be cut into some pieces (Tile), with the scan unit (Scan Unit) of this piece group as this triangle pinup picture group;
A type variable piece field depth filtering device is provided with that disallowable (Rejected) paints point (Point) in this triangle pinup picture group of filtering, does not need the depth of field to read (No-z-read) to paint point and normal (Normal) paints a little;
A piece scratch-pad memory district (Tile Buffer), the pixel (Pixel) that is provided with temporarily depositing this piece group is covered the data of shielding (Coverage Mask), field depth (Zmax and Zmin) and piece pattern (Mode), whether this pixel depth of field shielding is the point of painting for this piece interior pixel of record, this field depth is for the bound of the pixel depth of field of having painted in this piece of record, and this piece pattern is for the pattern of this piece of record;
This type variable piece field depth filtering device is a loop apparatus that scans all these triangle pinup picture groups, and this triangle pinup picture group loop includes all these piece group loops of scanning again, and this piece group loop includes the loop of these all pixels of piece of scanning again; In this pixel loop, there is a pixel depth of field counter to be provided with calculating this triangle pinup picture in the piece of present place earlier to depth of field value (Z Value) that should pixel, follow a pixel depth of field sorter comparator, the pixel that returns this piece according to the piece scratch-pad memory is covered shielding, field depth, and the data of piece pattern, make comparisons and classify with the depth of field value of this pixel, this pixel is divided into is covered pixel (OccludedPixel), do not covered pixel (Non-occluded Pixel), do not determine pixel (Uncertain Pixel), or do not paint pixel (Uncovered Pixel); Then a pixel is painted point (Point) sorter comparator, and being provided with above-mentioned four kinds of pixel classes are divided into does not need depth of field value to read to paint a little, normally paint a little and disallowable painting a little; Do not covered pixel and do not paint pixel and belong to not needing depth of field value to read and paint point (No-z-read), determine that pixel belongs to normally to paint point (Normal), covered pixel and belong to and painting a little at disallowable (Reject); This pixel loop all finish after, then piece data updating device, the present pixel that is provided with upgrading this piece piece scratch-pad memory district in is covered the data of shielding and present field depth; Then a pixel is covered the shielding sorter comparator, handles pixel after this renewals and covers the data of shielding and also classified; If whole pixels of this piece are all the pixel of painting, this piece cuts into two or most secondary pieces; If it is the pixel of painting that this piece has only partial pixel, this part of this piece cuts into one or more secondary pieces, and the other parts that former piece is not cut are a secondary piece; Without this piece of cutting, leap to this piece circulation bottom, enter next piece; The piece that has cut enters a secondary piece loop; This secondary piece loop includes a secondary piece pixel loop, in this pair piece pixel loop, there is a secondary piece pixel depth of field counter to be provided with calculating this triangle pinup picture in the secondary piece in present place earlier to depth of field value (Z Value) that should pixel, follow a secondary piece pixel depth of field sorter comparator, cover shielding according to the pixel that this piece scratch-pad memory returns this pair piece, field depth, and the data of secondary piece pattern, make comparisons and classify with the depth of field value of this pair piece pixel, should pair piece pixel be divided into and be covered pixel (Occluded Pixel), do not covered pixel (Non-occluded Pixel), do not determine pixel (Uncertain Pixel), or do not paint pixel (Uncovered Pixel); Then a secondary piece pixel is painted point (Point) sorter comparator, and being provided with above-mentioned four kinds of pixel classes are divided into does not need depth of field value to read to paint a little, normally paint a little and disallowable painting a little; Do not covered pixel and do not paint pixel and belong to not needing depth of field value to read and painting a little, determine that pixel belongs to normally to paint point (Normal), covered pixel and belong to and painting a little disallowable; This pair piece pixel loop all finish after, then secondary piece data updating device, be provided with upgrading in the piece scratch-pad memory district should the pair piece pixel cover the data of shielding and field depth.
A kind of piece field depth filtering method of adjustable variant electric is provided simultaneously, comprising the following step:
Via the portion three-dimensional picture pasting geometric calculus, handle the geometry of 3 D stereo object drawing intermediate cam pinup picture group, and the district that will draw (Display Region) be cut into some pieces (Tile), and with the scan unit (Scan Unit) of this piece group as this triangle pinup picture group;
The geometry data of this triangle pinup picture group is handled via a type variable piece field depth filtering, paints point (Point) with disallowable (Rejected) in this triangle pinup picture group of filtering, does not need the depth of field to read (No-z-read) to paint point and normal (Normal) paints a little; Processing procedure is that the pixel of setting up this piece group is earlier covered shielding (Coverage Mask), be responsible for the situation whether this piece group interior pixel of record was drawn, set up the field depth (Zmax and Zmin) of being responsible for this piece interior pixel depth of field bound of record equally again, also set up the piece pattern (Tile Mode) of being responsible for the existing pattern of record piece, again through three layers of loop calculation; These three layers are respectively the loop that scans all these triangle pinup picture groups, and this triangle pinup picture group loop includes all these piece group loops of scanning again, and this piece group loop includes the loop of these all pixels of piece of scanning again; In this pixel loop, calculate earlier this triangle pinup picture in the piece of present place to depth of field value (Z Value) that should pixel, then cover the data of shielding, field depth and piece pattern according to the preceding pixel of this piece, make comparisons with the present depth of field value of this pixel and classify, this piece pixel is divided into is covered pixel (Occluded Pixel), do not covered pixel (Non-occluded Pixel), determine pixel (Uncertain Pixel) or do not paint pixel (Uncovered Pixel); Then will above-mentioned four kinds of pixel classes be divided into and do not need depth of field value to read to paint point, normally paint a little and disallowable painting a little; Do not covered pixel and do not paint pixel and belong to not needing depth of field value to read and paint point (No-z-read), determine that pixel belongs to normally to paint point (Normal), covered pixel and belong to and painting a little at disallowable (Reject); This pixel loop all finish after, then upgrade this piece data, comprise the present pixel of this piece and cover the shielding and the present data of field depth; This pixel after then processing is upgraded is covered the data of shielding and is classified; If whole pixels of this piece are all the pixel of painting, this piece cuts into two or most secondary pieces; If it is the pixel of painting that this piece has only partial pixel, this part of this piece cuts into one or more secondary pieces, and the other parts that former piece is not cut are a secondary piece; Without this piece of cutting, leap to this piece circulation bottom, enter next piece; The piece that has cut enters a secondary piece loop; This secondary piece loop includes a secondary piece pixel loop, in this pair piece pixel loop, calculate earlier this triangle pinup picture in the secondary piece in present place to depth of field value (Z Value) that should pixel, then cover shielding according to the pixel of this pair piece, field depth, and the data of secondary piece pattern, make comparisons and classify with the depth of field value of this pair piece pixel, should pair piece pixel be divided into and be covered pixel (Occluded Pixel), do not covered pixel (Non-occluded Pixel), do not determine pixel (Uncertain Pixel), or do not paint pixel (Uncovered Pixel); Then will above-mentioned four kinds of pixel classes be divided into and do not need depth of field value to read to paint point, normally paint a little and disallowable painting a little; Do not covered pixel and do not paint pixel and belong to not needing depth of field value to read and painting a little, determine that pixel belongs to normally to paint point (Normal), covered pixel and belong at the disallowable point (Rejected) of painting; This pair piece pixel loop all finish after, the pixel of then upgrading this pair piece is covered the data of shielding and field depth.
For the present invention above-mentioned and other purpose, feature and advantage can be become apparent, below cooperate graphic and preferred embodiment with explanation the present invention.
Description of drawings
Fig. 1 is the geometry (depth of field and two-dimensional pixel) for explanation three-dimensional drawing of the present invention;
Fig. 2 is the synoptic diagram for explanation pixel of the present invention and piece;
Fig. 3 is the rough schematic for three-dimensional drawing flow process of the present invention;
Fig. 4 is the synoptic diagram that explanation piece interior pixel of the present invention is divided three classes according to the piece field depth;
Fig. 5 be explanation piece interior pixel of the present invention according to the piece field depth with cover shielding and be divided into the synoptic diagram of four classes;
Fig. 6 is how explanation the present invention utilizes and cover shielding and judge that piece cuts apart the synoptic diagram of situation;
Fig. 7 is the synoptic diagram how explanation the present invention stores the data of different secondary piece situations;
Fig. 8 is that the secondary piece interior pixel of explanation the present invention is complied with secondary piece field depth and covered the synoptic diagram that shielding is divided into four classes separately.
Description of reference numerals: A1-object one; A2-object two; 210,220-triangle pinup picture; The 230-pixel; The 240-piece; 310-portion three-dimensional picture pasting geometric calculus; The 320-killfile; 322-piece scratch-pad memory district; 330-depth of field comparison program; 32-depth of field scratch-pad memory district; The 340-calculation; 342-material memory field; 350-depth of field comparison program; The 360-calculation; 362-chroma scratch-pad memory district; 410,412-field depth (value); 830,420-is not being hidden pixel; 430,850-does not determine pixel; 440-is being hidden pixel; 510-covers shielding; 860,520-is covered pixel; 530-does not determine pixel; The pixel that 532-was not painted; 540-is covered pixel; The 610-piece; The 620-piece; 810,812,820,822-field depth; The pixel that 840-does not draw.
Embodiment
As shown in Figure 1, in order to draw the spatial structure in the three dimension system, the depth of field relation of keeping between each pinup picture is very important; Generally without the depth of field comparison program (Z Test) of filtering method be one by one pixel compare one by one whose depth of field preceding who after, as shown in Figure 2, the depth of field of object two A2 is less, so the part that object one A1 is covered by object two A2 will can not drawn; If the pixel size in this drawing district is 64 * 64 (bit), each triangle pinup picture 210,220 all needs to also have through 64 * 64 comparison the access in this depth of field working area of 64 * 64 (Z Buffer), and such operand is very considerable with required internal memory frequency range.The present invention does filtering earlier before this depth of field comparison program, pick painting a little with calculation and internal memory frequency range in the minimizing depth of field comparison program that some is covered one step ahead; Except by painting a little of being picked, the present invention can also filtering goes out not need that depth of field working area reads paints a little, can further save a part of internal memory frequency range.Fig. 3 promptly shows the flow process of whole three-dimensional drawing, drawing object via portion three-dimensional picture pasting geometric calculus 310 after, via the killfile among the present invention 320, result with filtering send and advance depth of field comparison program (Z Test Front) 330 again, and then carry out the calculation (Texture) 340 of material, if in the material calculation Ayre method of unlatching test (Alpha Test) is arranged, transparent material, or the words of other visibility (Visibility) material, just carry out once follow-up depth of field comparison program (Z TestBack) 350 again, the flow process of three-dimensional drawing is promptly finished in the calculation (Color Operation) 360 that enters chroma at last.
In the present embodiment, the drawing district of whole 64 * 64 pixels 230 (Display Region) cuts (block that marks as thick line among Fig. 2) with 8 * 4 pieces 240, and whole drawing district has 8 * 16=128 piece; When three-dimensional triangle pinup picture 210 geometric calculuses of doing at the beginning, just scan (Tile Base) with this piece structure, the i.e. circulation of a triangle pinup picture is comprising a piece circulation, before making round-robin, field depth (CurZmax and CurZmin) in the present piece of statistics is covered shielding (Coverage Mask) with foundation earlier, and is recorded in piece scratch-pad memory district (Tile Buffer) 322; The shared memory size of the field depth of piece is 128 (piece numbers) * 2 * 16/32 (16 or 32 ends is seen the degree of accuracy of this system's depth of field), depositing two depth of field numerical value of all pieces, and piece to cover the shared memory size of shielding be that also wait at 64 * 64 * 1 128 (piece number) * 32 (piece interior pixel) * 1, depositing whether all district's pixels of drawing are the sign of painting (Flag), do not paint the person and be designated as 1, painted the person and be designated as 0; Then in the piece round-robin, the field depth (DstZmax410 andDstZmin412) that reads earlier this piece from the piece memory field with cover shielding (Coverage Mask) 510, and the triangle pinup picture that proceeds at present of calculating paint the some depth of field value in this piece.
Then carry out the comparison of piece interior pixel, represent pixel in the piece as the circle among Fig. 4; If the depth of field value of this pixel is little of the minimum depth of field value (DstZmin412) of piece, this pixel genus is not being hidden pixel (Non-occluded Pixel) 420; If the depth of field value of this pixel is greatly in the maximum depth of field value (DstZmax410) of piece, this pixel genus is being hidden pixel (Occluded Pixel) 440; If the depth of field value of this pixel is situated between between minimum depth of field value (DstZmin412) of piece and the maximum depth of field value of piece (DstZmax410), this pixel belongs to is not determining pixel (Uncertain Pixel) 430 to be designated as empty circles in Fig. 4.In addition, propose to cover the comparison of shielding, above-mentionedly determine in the pixel that it covers Shield Flag is 1, can be gone out pixel 532 for not painting by filtering again, as the thick line circle among Fig. 5, remaining then be last definite pixel 530.Last determine that triangle pinup picture on the pixel (as Fig. 5 hollow core circle) 530 is painted a little to be classified as and normally paint point (Normal Point), compare program for needs that can't filtering through the normal depth of field and can learn that just as seen those for painting a little; Covered triangle pinup picture on the pixel 540 and painted a little then directly disallowablely, be considered as invisible painting a little and need do not pass through plotter program; And those are not covered pixel 520 and do not paint triangle pinup picture on the pixel 532 and paint a little to be classified as and do not need the depth of field to read to paint point (No-z-read Point), need not read depth of field scratch-pad memory through the depth of field comparison program time, painting of this class a little also can be saved a part of internal memory frequency range.When all piece interior pixels all be classified finish after, the present field depth of this piece (CurMax and CurMin) and (the DstMax and DstMin) comparison of reading from piece scratch-pad memory district obtain new final field depth (DstMax and DstMin); Present cover shielding and also do comparison with door (AND Gate), return in the lump with final field depth and have piece scratch-pad memory district with the shielding of covering that read in piece scratch-pad memory district.
Another important feature of the present invention, in not definite pixel 430 that the first time, depth of field classification drew, there is no the pixel 530 of not painted, the present invention can be motor-driven our piece size of modulation, another cuts piece becomes secondary piece 620 about two, secondary piece can remake a subseries about making, as long as piece scratch-pad memory district read cover the shielding its be totally 0 (being the sign of painting) or at least the left side be entirely 0 or at least right-hand part be 0 entirely, secondary piece 620 (as Fig. 6) about this piece is cut into.The cutting back about secondary piece each have its field depth (L-ZMax810 and L-ZMin812, and R-ZMax820 and R-ZMin822), about pixel in the secondary piece classify with this scope separately, simultaneously, about the pixel 840 (as Fig. 8) do not drawn in the secondary piece about the covering shielding (L-CM and R-CM) situation and can tell again of secondary piece, because the motor-driven piece size of cutting apart, because the more feasible preceding undetermined pixel filtering again again of Xi Fen field depth.
In the present invention, even former piece 610 is cut, still can come correct storage also entanglement can not take place with the internal memory working area of former piece; As 11 patterns among Fig. 6 (Full Tile with Coverage Mask), the shielding of covering of spelling piece is all 0, therefore no longer needing to store it covers masking value, only need the form of logging mode to get final product, also because so, the field depth of secondary piece about the having only of required memory, indicate as pattern among Fig. 7 11, left and right sides field depth accounts for 4 * 15 altogether, in addition, also has 4 to store its mode flags-11; If 10 patterns among Fig. 6 (Sub-tile with Right Coverage Mask), the shielding of covering of the left side of former piece is all 0, need not store the shielding of covering of left side, the shielding (R-CM) of covering of the field depth of only remaining left right-hand part and right-hand part needs to store, shown in Fig. 7 pattern 10, the field depth of its left side is with 2 * 15 internal memory working areas that have former piece, and deducting the field depth of left side earlier, the field depth of its right-hand part gets its difference, difference is compressed to 8 from 16, obtain the depth of field difference that two of right-hand parts account for 8, again with account for 16 right-hand part cover the internal memory working area that former piece is deposited back in shielding, remaining two are used in the patterns 10 that store this piece; If 01 pattern among Fig. 6 (Sub-tile with Left Coverage Mask), the shielding of covering of the right-hand part of former piece is all 0, need not store the shielding of covering of right-hand part, the shielding (L-CM) of covering of the field depth of only remaining left right-hand part and left side needs to store, shown in Fig. 7 pattern 01, the field depth of its right-hand part is with 2 * 15 internal memory working areas that have former piece, and deducting the field depth of right-hand part earlier, the field depth of its left side gets its difference, difference is compressed to 8 from 16, obtain the depth of field difference that two of left sides account for 8, again with account for 16 the left side cover the internal memory working area that former piece is deposited back in shielding, remaining two are used in the patterns 01 that store this piece; If former piece is not cut apart, pattern 00 as shown in Figure 6, the shielding of covering that accounts for 32 needs total the storage, and shown in Fig. 7 pattern 00, remaining 2 * 15 then is to deposit field depth and piece pattern 00.
What classification was finished paints a little, disallowable preceding promptly disallowable (Reject) that paints a little in next step depth of field comparison program, can not carry out computing, and painting of not needing that the depth of field reads a little can be skipped the part that reads from depth of field scratch-pad memory district 332 (as shown in Figure 3) in depth of field comparison program, remaining do not determine to paint to name a person for a particular job normally carry out depth of field comparison program, drawing those at last is real as seen painting a little; Draw as seen paint a little after carry out material calculation, if in the material calculation Ayre method of unlatching test (Alpha Test) is arranged, transparent material, or the words of other visibility (Visibility) material, just carry out once follow-up depth of field comparison program (Z Test Back) again, the flow process of three-dimensional drawing is promptly finished in the calculation that enters chroma at last, wherein, as shown in Figure 3, the present invention comprises a material memory field (TextureMemory) 342 again, for storing the material data of as seen painting in this triangle pinup picture group a little, and a chroma scratch-pad memory district 362, as seen paint a little chroma data for temporary this.
According to the above-mentioned explanation that discloses and graphic, the present invention can reach the invention its intended purposes, a kind of adjustable variant electric piece field depth filtering system and method that can save the internal memory frequency range is provided, and can increases filtering usefulness and efficient.
The above only is preferred embodiment of the present invention, only is illustrative for the purpose of the present invention, and nonrestrictive.Those skilled in the art is understood, and can carry out many changes to it in the spirit and scope that claim of the present invention limited, revise, even equivalence, but all will fall within the scope of protection of the present invention.