This application is related to co-pending application Ser. No. 14/473,607, filed Aug. 29, 2014 and to co-pending application Ser. No. 14/508,851, filed Oct. 7, 2014.
1. Field of the invention
This invention relates to image generation, and more particularly, to a method and system for effectively displaying images.
2. Description of the Related Art
MS-RDPRFX (short for “Remote Desktop Protocol: RemoteFX Codec Extension”, Microsoft's MSDN library documentation), U.S. Pat. No. 7,460,725, US Pub. No. 2011/0141123 and US Pub. No. 2010/0226441 disclose a system and method for encoding and decoding electronic information. A tiling module of the encoding system divides source image data into data tiles. A frame differencing module compares the current source image, on a tile-by-tile basis, with similarly-located comparison tiles from a previous frame of input image data. To reduce the total number of tiles that requires encoding, the frame differencing module outputs only those altered tiles from the current source image that are different from corresponding comparison tiles in the previous frame. A frame reconstructor of a decoding system performs a frame reconstruction procedure to generate a current decoded frame that is populated with the altered tiles and with remaining unaltered tiles from a prior frame of decoded image data. Referring to the
Microsoft's MSDN library documentation, such as Remote Desktop Protocol: Graphics Pipeline Extension (MS-RDPEGFX), Graphics Device Interface Acceleration Extensions (MS-RDPEGDI) and Basic Connectivity and Graphics Remoting Specification (MS-RDPBCGR), discloses a Graphics Remoting system. The data can be sent on the wire, received, decoded, and rendered by a compatible client. In this Graphics Remoting system, bitmaps are transferred from the server to an offscreen surface on the client, bitmaps are transferred between offscreen surfaces, bitmaps are transferred between offscreen surfaces and a bitmap cache, and a rectangular region is filled on an offscreen surface with a predefine color. For example, the system uses a special frame composition command “RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU message” to instruct the client to BitBlit or Blit a surface to a rectangular area of the graphics output buffer (also called “shadow buffer” or “offscreen buffer” or “back buffer”) for displaying. After the graphics output buffer has been reconstructed completely, the whole frame image data are moved from the graphics output buffer to primary buffer (also called “front buffer”) for displaying (hereinafter called “single buffer structure”).
In the conventional single buffer architecture, the memory access includes operations of: (a) writing decoded data to a temporary buffer by a decoder, (b) then moving decoded data from the temporary buffer to the shadow surface (back buffer), (c) then moving full frame image content from the shadow surface to the primary surface for displaying. The shadow surface contains full frame image content of a previous frame in the single buffer architecture. Therefore, only the altered image region which contains image data of difference between a current frame and a previous frame needs to be moved from the temporary buffer to the shadow surface. After altered image data have been moved to the shadow surface, the full content of the shadow surface must be moved to the primary surface (front buffer or output buffer) for displaying. Thus, since the single buffer architecture needs a large amount of memory access, the system performance is dramatically reduced.
A major problem with this single buffer architecture is screen tearing. Screen tearing is a visual artifact where information from two or more different frames is shown in a display device in a single screen draw. For high resolution image, there is no enough time to move frame image content from the shadow surface (offscreen surface) to the primary surface in vertical retrace interval of display device. The most common solution to prevent screen tearing is to use multiple frame buffering, e.g. Double-buffering. At any one time, one buffer (front buffer or primary surface) is being scanned for displaying while the other (back buffer or shadow surface) is being drawn. While the front buffer is being displayed, a completely separate part of back buffer is being filled with data for the next frame. Once the back buffer is filled, the front buffer is instructed to look at the back buffer instead. The front buffer becomes the back buffer, and the back buffer becomes the front buffer. This swap is usually done during the vertical retrace interval of the display device to prevent the screen from “tearing”.
In view of the above-mentioned problems, an object of the invention is to provide a method for effectively displaying images without visual artifact.
One embodiment of the invention provides a method for displaying images. The method is applied to an image display system comprising a display device and a plurality of display buffers. The method comprises the steps of: transferring a content of a first one of the display buffers to the display device; overwriting a second one of the display buffers with first image data, wherein the first image data represent data of updated pixels between two corresponding adjacent frames; obtaining a bit-map mask according to the updated pixels, wherein the bit-map mask indicates altered pixels for the two corresponding adjacent frames; and, then overwriting the second one of the display buffers with second image data from the other display buffers according to at least one bit-map mask.
Another embodiment of the invention provides an apparatus for displaying images. The apparatus is applied to an image display system comprising a display device. The apparatus comprises: a plurality of display buffers, a display unit, an update unit, a mask generation unit and a display compensate unit. The display buffers are used to store image data. The display unit transfers a content of a first one of the display buffers to the display device. The update unit overwrites a second one of the display buffers with first image data, wherein the first image data represent data of updated pixels between two corresponding adjacent frames. The mask generation unit generates a bit-map mask according to the updated pixels, wherein the bit-map mask indicates altered pixels for two corresponding adjacent frames. The display compensate unit overwrites the second one of the display buffers with second image data from the other display buffers according to at least one bit-map mask. The display control unit causes the display unit to transfer the content of the first one of the display buffers to the display device.
Further scope of the applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.
The present invention will become more fully understood from the detailed description given hereinbelow and the accompanying drawings which are given by way of illustration only, and thus are not limitative of the present invention, and wherein:
As used herein and in the claims, the term “source buffer” refers to any memory device that has a specific address in a memory address space of an image display system. As used herein, the term “a,” “an,” “the” and similar terms used in the context of the present invention (especially in the context of the claims) are to be construed to cover both the singular and plural unless otherwise indicated herein or clearly contradicted by the context.
The present invention adopts a frame mask map mechanism for determining inconsistent regions between several adjacent frame buffers. A feature of the invention is the use of a multiple-buffering architecture and at least one frame mask map to reduce data transfer from a previous frame buffer to a current frame buffer (back buffer), thereby to speed up the image reconstruction.
Generally, frame composition commands have similar formats. For example, a BitBlt (called “Bit Blit”) command performs a bit-block transfer of the color data corresponding to a rectangle of pixels from a source device context into a destination device context. The BitBlt command has the following format: BitBlt(hdcDest, XDest, YDest, Width, Height, hdcSrc, XSrc, YSrc, dwRop), where hdcDest denotes a handle to the destination device context, XDest and YDest denote the x-coordinate and y-coordinate of the upper-left corner of the destination rectangle, Width and Height denote the width and the height of the source and destination rectangles, hdcSrc denotes a handle to the source device context, and XSrc and YSrc denote the x-coordinate and y-coordinate of the upper-left corner of the source rectangle. Likewise, each frame composition command contains a source handle pointing to the source device context and four destination parameters (Dest_left, Dest_top, Dest_right and Dest_bottom) defining a rectangular region in an output frame buffer (destination buffer or back buffer).
During a frame reconstruction process, the current frame mask map n and the previous frame mask map n-1 are combined to determine which image region needs to be moved from a previous frame buffer to a current frame buffer (i.e., the back buffer).
Referring to
Referring now to
As described above in connection with
Step S402: Render an image into a temporary buffer or an external memory. For example, the 2D graphics engine 312 may receive incoming image data and a 2D command (such as filling a specific rectangle with blue color) and renders a painted image into the temporary buffer 321; the JPEG decoder 314 may receive encoded image data and a decode command, performs decoding operations and renders a decoded image into the temporary buffer 322; a specific image is written to the external memory 320. Once the rendering process has been completely written, the rendering engine 310 sets the status signal s1 to 1, indicating the rendering process is completed.
Step S404: Scan the contents of the front buffer to the display device. Assume that a previously written complete frame is stored in the front buffer. The display unit 365 transfers the contents of the front buffer to the display device of the image display system. Since this embodiment is based on a double-buffering architecture, the front buffer is equivalent to the previous frame buffer. The image data of the front buffer are being scanned to the display device at the same time that new data are being written into the back buffer. The writing process and the scanning process begin at the same time, but may end at different time. In one embodiment, assume that the total number of all scan lines is equal to 1080. If the display device generates the display timing signal TS containing the information that the number of already scanned lines is equal to 900, it indicates the scanning process keeps going on. Contrarily, when the display device generates the display timing signal indicating that the number of already scanned lines is equal to 1080, it represents the scanning process is completed. In an alternative embodiment, the display timing signal TS is equivalent to the VS signal. When a corresponding vertical synchronization pulse is received, it indicates the scanning process is completed.
Step S406: Obtain a current frame mask map n according to frame composition commands. The mask generation unit 350 generates a current frame mask map n and writes it to a current frame mask map buffer (38A or 38B) in accordance with the incoming frame composition commands, for example but not limited to, “bitblt” commands. Once the current frame mask map n has been generated, the mask generation unit 350 sets the status signal s3 to 1, indicating the frame mask map generation is completed.
Step S408: Update a back buffer with contents of the source buffer according to the frame composition commands. According to the frame composition commands, the update unit 361 moves image data (type B) from the source buffer (including but not limited to the temporary buffer 321 and 322 and the external memory 320) to the back buffer.
Step S410: Copy image data from the previous frame buffer to the back buffer. After the update unit 361 completes updating operations, the display compensate unit 363 copies image data (type C) from the previous frame buffer to the back buffer according to the two frame mask maps n and n-1. As to the “type A” regions, since they are consistent regions between the current frame buffer and previous frame buffer, no data transfer need to be performed. Once the back buffer has been completely written, the display compensate unit 363 sets the status signal s2 to 1, indicating the frame reconstruction process is completed.
Step S412: Swap the back buffer and the front buffer. The display control unit 340 constantly monitors the three status signals s1-s3 and the display timing signal TS. According to the display timing signal TS (e.g., the VS signal or containing the number of already scanned lines) and the three status signals s1-s3, the display control unit 340 determines whether to swap the back buffer and the front buffer. In a case that all the three status signals s1-s3 are equal to 1 (indicating the rendering process, the frame mask generation and the frame reconstruction are completed) and the display timing signal indicates the scanning process is completed, the display control unit 340 updates the reconstructor buffer index (including but not limited to: an external memory base address, the two temporary buffer base addresses, the current frame buffer index, a previous frame buffer index, the current frame mask map index and a previous frame mask map index) to swap the back buffer and the front buffer during a vertical retrace interval of the display device of the image display system. Contrarily, in a case that at least one of the three status signals and the display timing signal indicates at least one corresponding process is not completed, the display control unit 340 does not update the reconstructor buffer index until all the four processes are completed. For example, if only the status signal s2 maintains at the value of 0 (indicating the frame reconstruction is not completed), the display control unit 340 does not update the reconstructor buffer index until the frame reconstructor 360 completes the frame reconstruction.
Referring to
Next, assume that the rendering engine 310 renders an altered region r1 representing an inconsistent region between Frame 1 and Frame 2 into the temporary buffer 321. To reconstruct a full frame image, the frame reconstructor 360 moves image data of altered region r1 (i.e., the white hexagon r1 having a current mask value of 1 according to
During the frame reconstruction period of Frame 3, assume that the decoder 314 decodes an altered region r2 and updates the temporary buffer 322 with decoded image data. To reconstruct a full frame image, the frame reconstructor 360 moves image data of the altered region r2 (having a current mask value of 1 according to
Referring to
Next, assume that the external memory 320 is written with an altered region r1 representing an inconsistent region between Frame 1 and Frame 2. To reconstruct a full frame image, the frame reconstructor 360 moves image data of altered region r1 (i.e., the white hexagon r1) from the external memory 320 to the back buffer 33B according to corresponding frame composition commands and then moves the image data of unaltered region (i.e., the hatched region outside the hexagon r1) from the front buffer 33A to the back buffer 33B according to a current frame mask map 2. After Frame 2 has been reconstructed, two frame buffers are swapped again during the vertical retrace interval of the display device so that the frame buffer 33B becomes the front buffer and the frame buffer 33A becomes the back buffer.
During the frame reconstruction period of Frame 3, the rendering engine 310 renders an altered region r2 representing an inconsistent region between Frame 2 and Frame 3 into the source buffer. According to the invention, inconsistent regions among three adjacent frames can be determined in view of two adjacent frame mask maps. Thus, to reconstruct a full frame image, after moving image data of the altered region r2 (type B) from the source buffer to the back buffer 33A according to corresponding frame composition commands, the frame reconstructor 360 only copies inconsistent image data (type C) from the front buffer 33B to the back buffer 33A according to two frame mask maps 3 and 2, without copying consistent image data (type A). In comparison with
Likewise, the present invention can be applied to more than two frame buffers, for example but not limited to a triple frame buffering architecture (having three frame buffers) and a quad frame buffering architecture (having four frame buffers). It is noted that the number Y of the frame mask maps is less than or equal to the number X of frame buffers, i.e., X>=Y. For example, the triple frame buffering architecture may operate in conjunction with one, two or three frame mask maps; the quad frame buffering architecture may operate in conjunction with one, two, three or four frame mask maps. In addition, the number P of the frame mask map buffers is greater than or equal to the number Y of the frame mask maps i.e., P>=Y.
While certain exemplary embodiments have been described and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention should not be limited to the specific construction and arrangement shown and described, since various other modifications may occur to those ordinarily skilled in the art.
Number | Name | Date | Kind |
---|---|---|---|
5061919 | Watkins | Oct 1991 | A |
5300948 | Tsujido et al. | Apr 1994 | A |
5543824 | Priem et al. | Aug 1996 | A |
5629723 | West et al. | May 1997 | A |
7394465 | Toni | Jul 2008 | B2 |
7460725 | Malladi et al. | Dec 2008 | B2 |
20040075657 | Chua | Apr 2004 | A1 |
20080165478 | McCoy | Jul 2008 | A1 |
20090033670 | Hochmuth et al. | Feb 2009 | A1 |
20090225088 | Aoki | Sep 2009 | A1 |
20100226441 | Tung et al. | Sep 2010 | A1 |
20110141123 | Kumar et al. | Jun 2011 | A1 |
20120113327 | Li | May 2012 | A1 |
20140125685 | Yeh | May 2014 | A1 |
Number | Date | Country |
---|---|---|
201215148 | Apr 2012 | TW |
Entry |
---|
“Remote Desktop Protocol: RemoteFX Codec Extension”, Oct. 17, 2012, pp. 1-142; 2012 Microsoft Corporation. MS-RDPRFX, Microsoft Technical Documents, <http://msdn.microsoft.com/en-us/library/jj712081(v=prot.20).aspx>. |
“Remote Desktop Protocol: Graphics Pipeline Extension”, Oct. 17, 2012, pp. 1-110; 2012 Microsoft Corporation. MS-RDPEGFX, <http://msdn.microsoft.com/en-us/library/jj712081(v=prot.20).aspx>. |
“Remote Desktop Protocol: Graphics Device Interface (GDI) Acceleration Extensions ”,Oct. 17, 2012, pp. 1-280; 2012 Microsoft Corporation; MS-RDPEGDI, Microsoft Technical Documents< http://msdn.microsoft.com/en-us/library/jj712081(v=prot.20).aspx>. |
“Remote Desktop Protocol: Basic Connectivity and Graphics Remoting” , Oct. 17, 2012, pp. 1-454; 2012 Microsoft Corporation MS-RDPBCGR, Microsoft Technical Documents< http://msdn.microsoft.com/en-us/library/jj712081(v=prot.20).aspx>. |
Number | Date | Country | |
---|---|---|---|
20140125685 A1 | May 2014 | US |