Method and device for sharing MPEG frame buffers
A method and device for sharing MPEG frame buffers utilizes a shared bidirectional frame buffer, which is used for temporarily storing bidirectional predicted pictures, to reduce the quantity of bidirectional frame buffers. And, through monitoring and controlling the displaying units and the decoding units, the method and device avoids the decoded image data overwriting the image data, which has not yet been displayed, in the shared bidirectional frame buffer.
Latest Patents:
1. Field of the Invention
The present invention generally relates to a method and device for sharing memory, and more particularly to a method and device for sharing frame buffers of frames in MPEG (Moving Picture Experts Group).
2. Description of the Prior Art
In the prior art, the moment the decoding unit 110 completes decoding the top field T of B1 frame and storing it in the B1 frame buffer, the display unit 130 starts to play the B1 frame. Furthermore, the display unit 130 plays the top field T of the B1 frame (or the first frame F0) at the moment that the decoding unit 110 decodes the bottom field B of the B1 frame and stores it in the B1 frame buffer. When the display unit 130 plays the bottom field B of the B1 frame (or the second frame F1), the decoding unit 110 decodes the top field T of the B2 frame and stores it in the B2 frame buffer. When the display unit 130 plays the top field T of the B2 frame, the decoding unit 110 decodes the bottom field B of the B2 frame and stores it in the B2 frame buffer. And then the display unit 130 plays the bottom field B of the B2 frame. As previously mentioned that the decoding and the playing sequence of the two sequent B frames, the data during reading and playing do not interference with each other by the two B frame buffers for each corresponding decoded frame. In other words, the data of the first B frame that is not displayed yet in the display unit 130 is not overwritten by the data of the second B frame even though the decoding speed is faster than the displaying speed.
Nevertheless, refer to
As previously mentioned that the disadvantage of sharing MPEG frame buffer, it is needed a new and improved method to overcome the disadvantage of the prior art.
SUMMARY OF THE INVENTIONIn consideration of the prior art the process of MPEG decoding and playing, four buffers is provided for fear of overwriting data. Thus, a method and device of sharing MPEG frame buffer are provided herein for reducing the required numbers of buffers and the disadvantage generated by traditional sharing buffer.
The invention provides a sharing B frame buffer for reducing the needed buffers for decoding and playing MPEG.
The invention provides a method and device for sharing the dynamic image compression buffer. By monitoring the data reading speed of the displaying unit and by controlling the data writing speed of the decoding unit, the invention avoids overwriting in the sharing buffer.
The invention provides a method and device for sharing dynamic image compression buffer. It reduces the data writing time by changing the location of the data is stored. It also effectively uses the sharing buffer space for real-time data reading.
In short, the invention provides a method and device for sharing the MPEG frame buffer. It is by sharing a B frame buffer for reducing other B frame buffers used. By monitoring the reading B frame buffer data speed of the display unit and further by controlling the writing B frame buffer data speed of the decoding unit, it is to avoid the image data decoded by decoding unit in the sharing B frame buffer overwriting the display unit unread image data. By changing the position that the data is stored and by the space of the data that has been readout in the B frame buffer, the writing data of the decoding unit could be stored and then it is possible to reduce the waiting writing time of decoding unit.
BRIEF DESCRIPTION OF THE DRAWINGS
Some of the embodiments of the invention will describe in detail and clearly as follows. However, except for the detailed description, the invention can widely apply in others. And the invention is not limited here but the claims.
Otherwise, for easily understanding and clarifying the invention, the parts of the illustration does not depict in corresponding scale. Some scales and related ratio has been exaggerated, and the unrelated parts have not fully shown for the concise drawing.
Generally, there are two display types: field and frame and three picture structures: frame, FTSB (First Top field and Second Bottom field) and FBST (First Bottom field and Second Top field). A frame of 720*480 is an example for following illustrating processing methods in accompanying with different displaying methods and different picture structures, respectively. However, the application scopes of the invention are not limited to the size of a frame. It is noted that there are 720/16=45 macroblocks are in a row and 480/16=30 macroblocks are in a column for the frame of 720*480.
In the embodiment, because the top field row of the first B frame in the B frame buffer (i.e. the first row, the third row, the fifth row . . . odd rows etc..) has been readout before the action of the decoding unit, it is not necessary to wait for reading the top field row of the first B frame in the corresponding position when the decoding unit intends to write the odd frame row of the second B frame into B frame buffer. In other words, the odd frame row of the second B frame can be written into directly.
Similarly, the decoding unit writes all the top field rows of the second B frame into the B frame buffer, followed sequentially by checking the reading progress of the bottom field row of the first B frame and scheduled writing the bottom field row of the second B frame, on the ground that the top field row of the first B frame stored in every other position alternatively in B frame buffer has been readout before the action of the decoding unit and the first top field and second bottom field data structure is applied on decoding the second B frame data.
In the embodiment, because the second B frame data decoded by decoding unit is the first bottom field and the second top field data structure (FBST), it is necessary to wait for all the bottom field of the first B frame to be read and then write the bottom field of the second B frame row. The following step is sequentially decoding and writing in all the top field row of the second B frame.
In the embodiment, the display unit reads one row of the first B frame and immediately the decoding unit writes one row of the second B frame in the corresponding row.
In the embodiment, the second B frame data decoded by the decoding unit is the structure of the first top field and the second bottom field (FTSB) and it needs to wait until all the top field macorblock row of the first B frame readout to write all the top field row of the second B frame. And then sequentially decodes and writes all the bottom field row of the second B frame.
In the embodiment, the second B frame data decoded by decoding unit is the structure of the first bottom field and the second top field (FBST) and it needs to wait until all the top field macorblock rows of the first B frame readout to write all the bottom field rows of the second B frame. And then sequentially decode and write in all the top field rows of the second B frame.
As the previous embodiments mentioned, the decoding unit writes the decoded row data in the corresponding row of the B frame buffer. The decoding unit needs to wait until the corresponding row is readout in the corresponding macroblock. In other words, the decoding unit does not write data in even though the B frame buffer has space. As the result, the writing speed of the decoding unit is limited to the reading speed of the display unit. As shown in
In the embodiment, the decoding unit does not need to wait for the bottom field row of the first B frame readout when writing the bottom row of the second B frame. As the result, the executing speed of the decoding unit in not limited to the executing speed of the display unit in the period (for normal hardware technology, the speed of the decoding unit is twice faster than the speed of the display unit). When the display unit reads the bottom field row of the first B frame, the decoding unit possibly could finish writing all the bottom field row of the second B frame and then the decoding unit could continuously and sequentially writes the top field row of the second B frame in place, which has been readout in the bottom field row of the first B frame. By this, the data writing time is reduced for real-time reading.
In the embodiment, the decoding unit immediately writes a row of the bottom field row of the second B frame in place, which originally stored the macroblock frame of the first B frame after the display unit reads a row of the macroblock frame row of the first B frame, wherein the row of the second B frame includes a top field row and bottom field row. In other words, the decoding unit immediately writes all the top field rows of the second B frame into the B frame buffer when the display unit reads half the frame rows of the first B frame. And the decoding unit also immediately writes all the bottom field rows of the second B frame in the B frame buffer when the display unit continuously reads the other half frame row of the first B frame. By this, the data writing time has been reduced for real-time reading.
In the embodiment, the decoding unit immediately writes a row of the row of the second B frame in place, which originally stored the frame macroblock of the first B frame after the display unit reads a row of the frame row of the first B frame. Wherein the row of the second B frame includes a bottom field row and top field row. In other words, the decoding unit immediately writes all the bottom field rows of the second B frame in B frame buffer when the display unit reads the half frame row of the first B frame. And the decoding unit immediately writes all the top field rows of the second B frame in the B frame buffer when the display unit continuously reads the other half frame row of the first B frame. By this, the data writing time has been reduced for real-time reading.
Other embodiments of the invention will appear to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It is intended that the specification and examples to be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
Claims
1. A device for sharing MPEG buffer comprising:
- a bidirectional frame buffer providing successive a first bidirectional frame and a second bidirectional frame with storing temporary data for writing during decoding and reading during displaying;
- a display unit coupled with said bidirectional frame, said display unit sequentially reads said first bi-directional frame and said second bidirectional frame; and
- a decoding unit coupled with said bi-directional frame, said decoding unit sequentially writes said first bidirectional frame and said second bidirectional frame, wherein said decoding unit writes said second bi-directional frame into a position in a storing unit, wherein said position is previously occupied by said first bi-directional frame that has been readout by said display unit.
2. The device according to claim 1, wherein said decoding unit writes a plurality of bottom field row of said second bidirectional frame into a position that is previously occupied by a plurality of top field row of said first bidirectional frame.
3. The device according to claim 1, wherein said decoding unit writes a plurality of top field row of said second bidirectional frame in a position that is previously occupied by a plurality of first half frame row of said first bidirectional frame.
4. The device according to claim 1, wherein said decoding unit writes a plurality of bottom field row of said second bidirectional frame in a position that is previously occupied by a plurality of first half frame row of said first bidirectional frame.
5. The device according to claim 1, wherein said display unit reads a position being corresponding to a specific position where said second bi-directional frame is stored in said storing unit.
6. The device according to claim 5, wherein said decoding unit writes a plurality of frame row of said second bi-directional frame into a corresponding position that is previously occupied by both a plurality of top field row and a plurality of bottom field row of said first bi-directional frame that have readout by said display unit.
7. The device according to claim 5, wherein said decoding unit writes a plurality of top field row of said second bi-directional frame into a corresponding position that is previously occupied by a plurality of top field row of said first bidirectional frame that has readout by said display unit.
8. The device according to claim 5, wherein said decoding unit writes a plurality of bottom field row of said second bi-directional frame into a corresponding position that is previously occupied by a plurality of bottom field row of said first bidirectional frame that has readout by said display unit.
9. The device according to claim 5, wherein said decoding unit writes a plurality of frame row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bidirectional frame that has readout by said display unit.
10. The device according to claim 5, wherein said decoding unit writes a plurality of top field row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bi-directional frame that has readout by said display unit.
11. The device according to claim 5, wherein said decoding unit writes a plurality of bottom field row of said second bi-directional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bidirectional frame that has readout by said display unit.
12. The device according to claim 1 further comprising a forward reference buffer and a backward reference buffer, wherein said forward reference buffer is for storing a forward reference frame and said backward reference buffer is for storing a backward reference frame.
13. A method for sharing MPEG buffer comprising:
- storing a first bidirectional frame and a second bi-directional frame in a storage device; and
- writing a plurality of row of said second bidirectional frame into a position that is previously occupied by a plurality of row of said first bidirectional frame that has been readout.
14. The method according to claim 13, when frame display and first bottom field and second top field image data (FBST) structure are currently applied, said writing step comprising writing a plurality of bottom field row of said second bidirectional frame into a position that is previously occupied by a plurality of top field row of said first bidirectional frame that has been readout.
15. The method according to claim 13, when frame display and first top field and second bottom field image data (FTSB) structure are currently applied, said writing step comprising writing a plurality of top field row of said second bi-directional frame into a position that is previously occupied by a plurality of frame row of first half of said first bidirectional frame that has been readout.
16. The method according to claim 13, when frame display and first bottom field and second top field image data (FBST) structure are currently applied, said writing step comprising writing a plurality of bottom field row of said second bi-directional frame into a position that is previously occupied by a plurality of frame row of first half of said first bi-directional frame that has been readout.
17. The method according to claim 13, wherein a position of read said first bidirectional frames is corresponding to a position of said storage device where said second bidirectional frame is stored.
18. The method according to claim 17, when field display and frame structure are applied, said writing step comprising writing a plurality of frame row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of top field row and a plurality of bottom field row of said first bidirectional frame that has readout.
19. The method according to claim 17, when field display and first top and second bottom field image data (FTSB) structure are applied, said writing step comprising writing a plurality of top field row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of top field row of said first bi-directional frame that has readout.
20. The method according to claim 17, when field display and first bottom field and second top field image data (FBST) structure are applied, said writing step comprising writing a plurality of bottom field row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of bottom field row of said first bidirectional frame that has readout.
21. The method according to claim 17, when frame display and frame structure are applied, said writing step comprising writing a plurality of frame row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bidirectional frame that has readout.
22. The method according to claim 17, when frame display and first top field and second bottom field image data (FTSB) structure are applied, said writing step comprising writing a plurality of top field row of said second bi-directional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bidirectional frame that has readout.
23. The method according to claim 17, when frame display and first bottom field and second top field image data (FBST) structure are applied, said writing step comprising writing a plurality of bottom field row of said second bidirectional frame into a corresponding position that is previously occupied by a plurality of frame row of said first bidirectional frame that has readout.
Type: Application
Filed: Nov 22, 2004
Publication Date: Jun 9, 2005
Applicant:
Inventors: Roy Wang (Taipei), Renwei Chiang (Taipei)
Application Number: 10/992,849