CN1200396C - Method and device for compressing pixel data during computer drawing - Google Patents

Method and device for compressing pixel data during computer drawing Download PDF

Info

Publication number
CN1200396C
CN1200396C CN 01110428 CN01110428A CN1200396C CN 1200396 C CN1200396 C CN 1200396C CN 01110428 CN01110428 CN 01110428 CN 01110428 A CN01110428 A CN 01110428A CN 1200396 C CN1200396 C CN 1200396C
Authority
CN
China
Prior art keywords
block
data
pixel
compression
aforementioned
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.)
Expired - Fee Related
Application number
CN 01110428
Other languages
Chinese (zh)
Other versions
CN1378174A (en
Inventor
吕忠晏
赖守仁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Silicon Integrated Systems Corp
Original Assignee
Silicon Integrated Systems Corp
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 Silicon Integrated Systems Corp filed Critical Silicon Integrated Systems Corp
Priority to CN 01110428 priority Critical patent/CN1200396C/en
Publication of CN1378174A publication Critical patent/CN1378174A/en
Application granted granted Critical
Publication of CN1200396C publication Critical patent/CN1200396C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The present invention relates to a method for compressing pixel data during computer drawing. In the method, a frame is divided into a plurality of blocks, and a block drawn by a triangle can be calculated according to the pixel position of a drawn triangle; if the block drawn by the triangle is not completely covered by the triangle, data compressed by the block is read from a memory and is decompressed for reference; subsequently, pixels of the triangle are drawn in the blocks, and the blocks are compressed; finally, compressed block data is stored to the memory. Since a compression method is simple, the present invention can process the data in real time, reduces data size and increases use rates of frequency bandwidth.

Description

When computer drawing, carry out the method for pixel data compression
Technical field
The present invention relates to a kind of plotting method of computer drafting system, particularly about the data in real time compression that will describe and the method and apparatus that is stored to storer.
Background technology
Use the drawing (graphics) or the application demand of animation (animation) that the trend of growth is arranged.For example computer resultant image or animation are used on computer game (game), teaching tools (educational tools), office automation (office automation) or the field of animated film (filmmaking).Improve along with the function of desktop computer is lasting, many application are developed and are applied flexibly on this function that is enhanced, and produce how interesting and interactive drawing interface.Yet though the desktop computer function continues to improve, 3D drawing object (graphicsobject) and particularly 3D animation still need the hardware of costliness and specific purposes just can finish.
Present real-time (real-time) trace system (rendering system) since in a large number special memories and required processing resource reach virtual reality (visual realism), so cost is very high.In order to reach interactive truly and realistic effect, system must describe drawing object in the very short time and produce new image, and allowing the user feel is the object continuous action.In addition, system also must respond user's input in the shortest time delay, and the reaction of representative input can be presented in the shown image in real time.
In most drawing system, the surface of drawing object be by a large amount of plane polygon (planar polygon) copy (modeled) and form.For example color (color) is stored in polygonal summit (vertices) with figure line (texture) data etc.And the program that produces each frame (frame) of image data comprises many steps.The first, which object is system must calculate visually is potential visual (potentially visible).The second, system becomes the polygon scan conversion array of (rasterize or scan convert) pixel data (pixel dara).At last, the show image that will describe of system is transferred to display device.
In the content of real-time system, there are two distinct methods to narrate and show the feature that produces speed (rate ofdisplay generation).A kind of is the speed that drawing pipeline (pipeline) upgrades frame buffer (frame buffer), promptly so-called computation rate (computational rate).And another kind is a display device frame updating speed.For fear of film flicker, frame updating speed is at least 60 frames of per second, and computation rate need not equal frame updating speed.Yet the new image data that produces in order to allow can not influence the image data in the demonstration, and existing structure comprises at least two framing impact dampers.
According to above-mentioned situation, the real-time depiction system needs a large amount of frame buffers, and the cost of frame buffer is determined by memory span and frequency range.Therefore, if can reduce the demand of frame buffer, then can reduce the cost of real-time depiction system.
Summary of the invention
In order to overcome the deficiencies in the prior art, the purpose of this invention is to provide a kind of method of when computer drawing, carrying out pixel data compression, use this method when computer drawing, to reduce the frame buffer demand in Real Time Compression pixel data mode.
Another object of the present invention provides a kind of drawing engine of computer drafting system.
In order to achieve the above object, method of carrying out pixel data compression when computer drawing of the present invention comprises the following step:
Carry out drawing for order, use the generation graphic element;
Whether decision former figures element needs to describe, if do not need to describe then to finish, otherwise continues the following step;
According to the location of pixels of former figures element, calculate the block that this graphic element distributes;
Decompression block step, if aforementioned each block need with reference to be stored in aforementioned memory compress the data of block the time, then get these data of having compressed block and decompress from aforementioned memory read;
Describe step, the pixel of former figures element is depicted in the block;
Compression step compresses aforementioned each block individually; Compression step comprises,
Calculate initial value seed color, specify a plurality of marks and the pairing initial value seed of this mark color according to the raw pixel data of each block;
Assigned tags, each raw pixel data of comparison blocks and each initial value seed color, and specify the mark of immediate aforementioned seed color to give each pixel;
Calculate definite value seed color,, calculate definite value seed color that should mark according to all pixel datas of same tag; And
Send data, with the aforementioned seed color of the mark of each pixel and each mark after as compression data and
Storing step, with the data storing of block after the compression to storer.
The drawing engine of computer drafting system of the present invention, it is to carry out the block compression before image data is stored to storer earlier, this drawing engine comprises:
One instruction queue stores drawing for order;
One describes controller, receives aforementioned drawing for order, and calculates the drawing element of this drawing for order, and all blocks of containing of this drawing element;
One compression unit is described the block of pixel data compression that controller exports and is become block data aforementioned; And
One decompression unit de-compresses into the block of pixel data with a block data that compresses;
Used before aforementioned block pixel data is stored to aforementioned memory, store again after earlier being compressed into block data, and further handle again after de-compressing into the block of pixel data through aforementioned decompression unit earlier by the block data that storer reads by aforementioned compression unit.
The present invention carries out pixel data compression when computer drawing method is to calculate the block that this triangle is contained according to the leg-of-mutton location of pixels of being described; If block is not all contained by triangle, then read the data of compressing block and also decompress for your guidance from storer; Leg-of-mutton pixel is depicted in each block, and each block is compressed; At last, the block data after the compression is stored to storer.And compression method is to specify a plurality of marks and the pairing initial value seed of each mark color according to the pixel data of block; Specify near the mark of the seed color of each pixel data and give each pixel; According to all pixel datas of same tag, calculate color near all pixel datas of this mark as definite value seed color; And with the definite value seed color of the mark of each pixel and each mark data after as compression.
The invention has the beneficial effects as follows: because compression method is quite simple, therefore can handle and reduce data volume in real time, increase the frequency range utilization rate.Can when computer drawing, reduce the frame buffer demand, then can reduce the cost of real-time depiction system in Real Time Compression pixel data mode.
Description of drawings
The present invention is described in detail below in conjunction with accompanying drawing:
Fig. 1 shows that the present invention has the structure of the computer drafting system of compression and decompression;
Fig. 2 shows the process flow diagram of describing of the present invention;
Fig. 3 shows that pixel that the present invention describes does not comprise the synoptic diagram of whole block;
Fig. 4 shows compression process figure of the present invention;
Fig. 5 shows the data compression situation of a block;
Fig. 6 shows decompression flow process figure of the present invention.
10 drawing engines
11 instruction queues
12 describe controller
13 compression units
14 decompression units
20 main frames
30 storeies
40 display device
Embodiment
Fig. 1 shows the structure of the computer drafting system that has compression and decompress.As shown in the figure, computer drafting system generally comprises main frame (host) 20, frame buffer (storer) 30, display device (display device) 40 and drawing engine (graphics engine) 10.After drawing engine 10 receives drawing for orders (graphics command) from main frame 20, the object that promptly calculates which drawing for order visually whether be potential visual, the polygon of drawing for order is drawn as the array of pixel data and the show image that is stored in frame buffer 30 and will be stored in frame buffer 30 is transferred to display device 40.And so-called drawing engine is meant that the object that software will be painted is plotted in firmware of screen (firmware) and hardware (hardware).Drawing engine 10 of the present invention comprises an instruction queue (queue) 11, and describes control module 12, compression unit 13 and decompression unit 14.Describing control module 12 calculates each polygon and is drawn as the block of the array of pixel data corresponding to frame buffer.13 of compression units will be stored to frame buffer 30 after the indivedual compressions of each block.The block data that 14 of decompression units will be stored in frame buffer 30 de-compresses into the array of pixel data.Be stored to frame buffer again after the compression earlier owing to each polygon is drawn as the array of pixel data, so can reduce the capacity of frame buffer.
Fig. 2 shows the example of triangle corresponding to the synoptic diagram of block.When utilizing plotting method of the present invention, frame (frame) is divided into a plurality of blocks of identical size, and according to the location of pixels of the triangle A that desires to describe, calculate the block that this triangle A is distributed.The big I of block freely defines, for example the matrix of size such as 4*4 or 5*5.As shown in the figure, this triangle A is distributed in 15 blocks, is denoted as B1~B15 respectively, wherein has only block B7 all to be contained by triangle A.After calculating the block that triangle A distributed, then be each block of unit individual treated, and will handle data storing after the compression at storer with the block.Because block B7 all contained by triangle A, can not need, so system can directly compress block B7, and be stored to storer with reference to other block data.But, for for example B1, B2, B3 ... wait other block, the only a part of pixel data that comprises triangle A.Because block is a reduced overall, therefore before handling and compressing this block, must read other data that do not contained of this block earlier by triangle A.Promptly must read the data of this block from storer, and just can further handle after decompressing.
Fig. 3 shows that the present invention describes an example of process flow diagram.As shown in the figure, polygon of the present invention (triangle) to describe step as follows:
Step S302: begin to describe a triangle;
Step S304: whether the triangle of this drawing for order needs is described, and promptly whether this triangle visual? if do not need to be described then to skip to step S320, otherwise skip to next step;
Step S306:, calculate the block that this triangle is contained according to this triangular pixel position;
Step S308: handle next block data;
Step S310: this block data that needs to be stored in storer? if need then skip to step S312, then skip to step S314 if not;
Step S312: read this block data and decompress from storer;
Step S314: describe and upgrade this block data;
Step S316: the block data that will upgrade compresses and is stored to storer;
Do step S318: the data of each block dispose all? finish if be untreated, then rebound step S308, otherwise skip to step S320;
Step S320: finish this leg-of-mutton describing and move.
Because needed data processing amount is quite big when describing, must consider execution speed when therefore compression is with decompression.If compression is too slow with the speed that decompresses, then influence the usefulness of system on the contrary.Below with reference to Fig. 4 compression method of the present invention is described.
Step S402: beginning;
Step S404: the pel array data that read block;
Step S406: calculate initial value seed color (initial seed color), and set mark (label);
Step S408: handle next pixel;
Step S410: calculate the immediate initial value seed of this pixel data color, and specify the mark that is labeled as this pixel data of this initial value seed color;
Step S412: is the pixel data of all blocks all to specify the mark of an initial value seed color? if inwhole as yet appointments then skip to step S408, otherwise skip to step S414;
Step S414: the definite value seed color (target seed color) that recomputates each mark;
Step S416: the mark of output definite value seed color and pixel data;
Step S418: finish.
The method that step S406 calculates initial value seed color have need multiple, the random pixel color in the selected block, the mean value of the partial pixel color in also can calculation block.So-called initial value seed color is meant by the color data that pixel color calculated in the block.Fig. 5 (A) shows the pixel data of a block, and this block data is the matrix of 4*4.If calculate its initial value seed color in the mean value mode, then this block can be divided into upper left, upper right, four zones in lower-left and bottom right, and specify four zones be labeled as 0,1,2,3, and calculating each regional color mean value is initial value seed color, and then its mark and initial value seed color are respectively 0 (95), 1 (37), 2 (57) and 3 (27).Then, each pixel data of comparison diagram 5 (A) and four initial value seed colors, and the mark of appointment and the immediate initial value seed of this pixel data color is given this pixel.For example so long as greater than 76 pixel near 95, so this pixel all is appointed as 0; Pixel between 47~76 all is appointed as 2; Pixel between 32~47 all is appointed as 1; And all be appointed as 3 less than 32 pixel.Fig. 5 (B) is the flag data of this block.
At last, calculate definite value seed color according to the flag data of Fig. 5 (B) again.And so-called definite value seed color is the seed color that flag data calculated according to the appointment of this block.Its method is the pixel data of same tag in the selected block, and calculates the color data near these pixel datas.The method of calculating definite value seed color has many kinds, for example root-mean-square value or mean value etc.For example if with mean value calculation, then be labeled as 0 pixel data and comprise 5 pixels such as 80,100,100,100,100, thus be labeled as 0 definite value seed color mean value for these 5 pixel datas, that is to be labeled as 0 definite value seed color be 96.Comprise 2 pixels such as 40,40 and be labeled as 1 pixel data, thus be labeled as 1 definite value seed color mean value for these 2 pixel datas, that is to be labeled as 1 definite value seed color be 40.Comprise 3 pixels such as 50,60,70 and be labeled as 2 pixel data, thus be labeled as 2 definite value seed color mean value for these 3 pixel datas, that is to be labeled as 2 definite value seed color be 60.Comprise 6 pixels such as 10,20,20,20,30,30 and be labeled as 3 pixel data, thus be labeled as 3 definite value seed color mean value for these 6 pixel datas, that is to be labeled as 3 definite value seed color be 22.Therefore, the definite value seed color of each mark is 0 (96), 1 (40), 2 (60), 3 (22).
Picture element matrix with 32 4*4 blocks is an example, and the size of data before it does not compress is 512 (32*16) positions (bit).But after overcompression, the size of data of this 4*4 block is 128 (2*16+24*4) position, i.e. 16 flag datas and 4 definite value seed colors are shown in Fig. 5 (C).Owing to be labeled as 0~3, so each pixel only needs two positions.So compression method of the present invention can reach 4 times decrement.Not only can reduce the frame buffer of drafting system, also reduce the use of memory band width simultaneously.
Fig. 6 shows the process flow diagram of a kind of embodiment of decompression.Its step is described as follows:
Step S602: the data of the block that begins to decompress;
Step S604: the block data that reads a compression;
Step S606: with flag data and definite value seed color-separated;
Step S608: handle next pixel;
Step S610: specify corresponding definite value seed color to give this pixel according to the mark value of this pixel;
Step S612: whether are all pixels all to specify definite value seed color? if do not specify fully as yet, then rebound step S608, otherwise skip to step S614;
Step S614: with the pixel data output of this block;
Step S616: finish.
Because above-mentioned decompression method only specifies corresponding definite value seed color to give this pixel according to the mark value of pixel, does not need other complex calculations, therefore, can provide real-time decompression.
Though more than with embodiment the present invention is described, therefore do not limit scope of the present invention, only otherwise break away from main idea of the present invention, those skilled in the art can carry out various distortion or change.

Claims (4)

1. method of carrying out pixel data compression when computer drawing comprises the following step:
Carry out drawing for order, use the generation graphic element;
Whether decision former figures element needs to describe, if do not need to describe then to finish, otherwise continues the following step;
According to the location of pixels of former figures element, calculate the block that this graphic element distributes;
Decompression block step, if aforementioned each block need with reference to be stored in aforementioned memory compress the data of block the time, then get these data of having compressed block and decompress from aforementioned memory read;
Describe step, the pixel of former figures element is depicted in the block;
Compression step compresses aforementioned each block individually; Compression step comprises,
Calculate initial value seed color, specify a plurality of marks and the pairing initial value seed of this mark color according to the raw pixel data of each block;
Assigned tags, each raw pixel data of comparison blocks and each initial value seed color, and specify the mark of immediate aforementioned seed color to give each pixel;
Calculate definite value seed color,, calculate definite value seed color that should mark according to all pixel datas of same tag; And
Send data, with the aforementioned seed color of the mark of each pixel and each mark after as compression data and
Storing step, with the data storing of block after the compression to storer.
2. method of carrying out pixel data compression when computer drawing according to claim 1 is characterized in that: the quantity of described mark is 2 power.
3. method of carrying out pixel data compression when computer drawing according to claim 1 is characterized in that: aforementioned block is a 4*4 picture element matrix.
4. method of carrying out pixel data compression when computer drawing according to claim 3 is characterized in that: aforementioned block comprises four not isolabeling and corresponding four definite value seed colors.
CN 01110428 2001-04-04 2001-04-04 Method and device for compressing pixel data during computer drawing Expired - Fee Related CN1200396C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 01110428 CN1200396C (en) 2001-04-04 2001-04-04 Method and device for compressing pixel data during computer drawing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 01110428 CN1200396C (en) 2001-04-04 2001-04-04 Method and device for compressing pixel data during computer drawing

Publications (2)

Publication Number Publication Date
CN1378174A CN1378174A (en) 2002-11-06
CN1200396C true CN1200396C (en) 2005-05-04

Family

ID=4658592

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 01110428 Expired - Fee Related CN1200396C (en) 2001-04-04 2001-04-04 Method and device for compressing pixel data during computer drawing

Country Status (1)

Country Link
CN (1) CN1200396C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101114381B (en) * 2006-05-22 2012-02-22 辉达公司 Frame buffer merging

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101114381B (en) * 2006-05-22 2012-02-22 辉达公司 Frame buffer merging

Also Published As

Publication number Publication date
CN1378174A (en) 2002-11-06

Similar Documents

Publication Publication Date Title
EP0995154B1 (en) Virtual address access to tiled surfaces
CN1136517C (en) Method of producing image data, image data processing apparatus, and recording medium
CN1138234C (en) Image generating method and apparatus
CN1287330C (en) Eeficient graphics state management for zone rendering
CN1150675A (en) Method and apparatus for mapping texture
CN1893564A (en) Image special effect device, graphic processor and recording medium
CN1173575C (en) Method and apparatus for generating non-uniform resolution image data
US8395619B1 (en) System and method for transferring pre-computed Z-values between GPUs
CN1993728A (en) Filtering unit for floating-point texture data
CN1639686A (en) Apparatus, method and system with a graphics-rendering engine having a graphics context manager
CN102834808A (en) Method, system, and apparatus for processing video and/or graphics data using multiple processors without losing state information
CN1256675C (en) Method and device for pre-storage data in voiceband storage
CN111406277B (en) Low resolution depth storage based on image block
CN1086040C (en) Method and apparatus for generating images
CN101114381A (en) Frame buffer merging
CN1111301C (en) Image generation apparatus
CN1279430C (en) Digital document processing
CN101754039A (en) Three-dimensional parameter decoding system for mobile devices
CN105895030B (en) Controller for persistence display panel
CN102682465B (en) 3D format conversion system and method
CN1200396C (en) Method and device for compressing pixel data during computer drawing
CN1165017C (en) Graphic processor and graphic processing method
CN1612163A (en) Graphic decoder, image reproduction apparatus and method for graphic display acceleration based on commands
CN1311405C (en) Image processor
US10271097B2 (en) Dynamic resolution determination

Legal Events

Date Code Title Description
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C06 Publication
PB01 Publication
C14 Grant of patent or utility model
GR01 Patent grant
C19 Lapse of patent right due to non-payment of the annual fee
CF01 Termination of patent right due to non-payment of annual fee