Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, electronic equipment manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not in function. In the following description and in the claims, the terms “include” and “comprise” are used in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to . . . ”. Also, the term “couple” is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
In a first data processing scheme of the present disclosure, each VFU also has the same amount of data (or the same bit rate); this is generally known as constant bit rate (CBR) coding. In this case, the predefined VFU structure includes both fixed digital frame numbers (i.e. fixed time period) and fixed compressed data size. Please note that each individual encoded frame in a VFU will differ from other encoded frames in the VFU in terms of the amount of data it contains, but each VFU can contain a fixed data size when the encoding module 220 performs data encoding by referencing the allocated fixed data size for the VFU and the cumulative data size used in encoding previous frames. Each encoded frame of a VFU may be composed of pure video data or it may contain any combination of video data, side information, and padding data. Each data address of the first frame of a VFU (e.g. I frame) corresponds to a timing information, and the time between a first VFU and a following VFU is a constant. As a typical rate of data transmission is 30 frames per second, if each VFU comprises 15 frames then the timing of one VFU=0.5 seconds. Therefore, searches utilizing time constraints can easily be performed. For example, if a viewer wishes to see action that was displayed 2 minutes ago, as 2 minutes=120 seconds, the microprocessor 230 merely needs to calculate 120 seconds divided by the time interval of a VFU (120/0.5) to calculate the position in the buffer 250 that needs to be located. In this case, the microprocessor 230 needs to search back 240 VFUs.
Grouping the encoded frames into groups where each group has the same data size might reduce the overall display quality or coding efficiency of the pictures. To avoid this, a second data processing scheme of the present disclosure groups the data into groups of pictures, where each VFU only has a fixed number of encoded frames but does not have a fixed amount of data. In this method, each VFU will take up a different amount of storage space in the buffer 250, and therefore a look-up table (LUT) may be used to store the address information. The look-up table (LUT) is stored in the memory 240, such as a DRAM. It should be noted that the memory 240 and the buffer 250 are shown as separate storage devices. However, this is not meant to be a limitation of the present disclosure. In addition, any devices having data storage capability can be used by the system 200 to store the desired data, such as the VFUs and/or the look-up table (LUT). For example, the memory 240 and the buffer 250 are both implemented in a single random access memory, where the memory 240 is assigned with one storage space and the buffer 250 is assigned with another storage space.
An exemplary look-up table (LUT) contains information relating to timing, bit size, and address information. As each VFU has a different data size, the amount of storage space allocated to each VFU will vary, therefore the look-up table (LUT) contains the data size of each VFU. The microprocessor 230 may monitor the total data size of the VFUs stored in the buffer 250 to ensure there is available storage space for the new encoded bit stream. As data is stored in the buffer 250 in a cyclical fashion, once the allocated size of the buffer 250 is reached, oldest data will be overwritten. Therefore, the look-up table (LUT) will be updated by the microprocessor 130 each time the buffer 250 is updated due to overwriting. The look-up table (LUT) will also generate an address for each added VFU. This is achieved by accumulating an address of a previous VFU with the data size of a current VFU to index the current VFU. In some other embodiments, when the time-shift buffer 250 stores data in a continuous manner, the look-up table (LUT) may contain entries that are address information corresponding to every N video frames. Every two consecutive entries has a fixed time duration, thus the address information of a specific frame related to a desired time may be searched by shifting a certain number of entries.
Please refer to
i=current recording time-interval entry index of LUT;
j=earliest recording time-interval entry index of LUT (i.e. corresponding to the earliest VFU stored in buffer 250 that has not been overwritten)
g=frame number of current frame
N=entry number of LUT
P=number of frames remaining in a current VFU
Taking video encoding for example, the afore-mentioned frames in the digital data stream are video frames and the steps shown in
Step 301: Configure the look-up table (LUT). Set i=0, j=0, g=P, and set the pre-defined video frame unit structure (e.g. “IBBPBB . . . ” in MPEG GOP structure) to the encoding module 220;
Step 302: Begin encoding and set g=P;
Step 303: Encode one video frame;
Step 304: Generate an address of the encoded frame and set g=g−1;
Step 305: Is the current encoded frame the beginning of a VFU (e.g. an I frame)? If yes go to Step 306, if no go to Step 307;
Step 306: Keep m and the related information in the ith entry of the LUT; go to Step 308;
Step 307: Is the buffer 250 full? If yes go to Step 312, if no go to Step 309;
Step 308: Is the most recent encoded frame the last frame corresponding to the ith entry, i.e. does (g=0)? If yes, go to Step 309, if no go back to Step 303 to encode the next frame;
Step 309: Set g=P;
Step 310: Update information in the ith entry of the look-up table LUT; set i=(i+1)% N, which means if i+1 reaches N, i is reset to 0;
Step 311: Check if the next recording and the earliest recording time-interval entry are overlaid, i.e. does i=j? If yes go to Step 312, if no go back to Step 303 to encode the next VFU;
Step 312: Notify playback device 280 that j is invalid;
Step 313: Remove the entry of j from the look-up table (LUT); free the memory space in the buffer 250 corresponding to j; set j=(j+1)% N, which means j is reset to 0 when j+1 reaches N; go back to Step 303.
Initially, as no data has been written yet, the look-up table (LUT) is configured so that i=0 and j=0 (Step 301), g is set to P. The encoding process begins (Step 302). When a video frame is encoded by the encoding module 220 (Step 303), an address is generated for the video frame and g will be set to g−1 (Step 304). The parameter g relates to the number of frames that have not been encoded in the VFU, therefore when g=0, it can be determined that a new VFU is encoded, and the look-up table (LUT) can be updated accordingly. The system 200 determines if the current frame is the first frame of a VFU (e.g. an I frame) (Step 305). If this is not true the flow will proceed to Step 307. If this is true then m and related information will be stored in the ith entry of the look-up table (Step 306). The system 200 then determines if the buffer 250 is full (Step 307). If the buffer 250 is full the flow will proceed to Step 311. If there is still space in the buffer 250 the system 200 then determines if the parameter g=0 (Step 308), i.e. a VFU has been completely stored to the buffer 250. If this is not true the flow will return to Step 303. If g=0, the flow will update the information stored in the ith entry of the look-up table (LUT) and set (i+1)% N, and g is set to P (Step 309). The system 200 then determines if i=j (Step 310), i.e. if the next entry in the look-up table (LUT) must be written in the entry indexing the earliest VFU stored in the buffer 250—in other words, if the look-up table (LUT) is full. If this is not true then the flow will return to Step 303. If this is true the flow will proceed to Step 311. In Step 311 the playback device 280 is notified that the earliest recording index j is invalid. The space corresponding to j in the buffer 250 is removed, the entry j is removed from the look-up table (LUT), j is set to j+1 (Step 312). As each VFU has a different data size, it is possible that the VFU to be recorded in a final storage space of the buffer 250 is larger than the storage space. In this case, although the look-up table (LUT) shows that there is still space for a VFU, the corresponding space in the buffer 250 is insufficient. Therefore, the look-up table (LUT) will also store the data size of each VFU so the microprocessor 230 can assign space in the storage accordingly. In such a case, some frames of the VFU will have to overwrite the earliest recorded entry in the buffer, and therefore recording index j is invalid (Steps 307, 311, 312). Similarly, a successive VFU may also exceed the previously allocated storage space in the buffer 250. In this case, two entries of the look-up table (LUT) will have to be erased, and replaced by a single entry corresponding to a single VFU. These processes are all carried out by the microprocessor 230.
When a user requires viewing data frames that have been played a specific time before a current frame, the user merely needs to input the time information (e.g. the time-shift parameter). In a case where the encoded frames are grouped into groups where each group has the same data size, the system 200 searches the buffer 250 for the encoded frame according to the time-shift parameter and the number of encoded frames per VFU.
In another case where each VFU is not limited to have the same data size, the system 200 will then access the look-up table to determine a VFU or a target encoded frame (e.g. the first encoded frame) in a VFU that corresponds to the specific time. The system 200 can then utilize the determined address to locate the correct VFU in the buffer 250. Please refer to
Step 501: Access the look-up table LUT and set i=0.
Step 502: Obtain address information from the ith entry of the look-up table LUT.
Step 503: Does the system 200 need to play a next VFU? If yes go to Step 504, if no go to Step 505.
Step 504: Play next VFU and set i=(i+1)% N.
Step 505: Is the current entry i invalid? If yes go to Step 506, if no go back to Step 502.
Step 506: Stop playback and jump to live video.
Initially, an entry number or a shift amount is utilized in the look-up table to search for the address corresponding to a desired frame or a VFU. In this case, i is initially set to zero (Step 501). The address information in the ith entry of the look-up table is consulted, and the corresponding VFU or frame of a VFU is played back (Step 502). The system 200 then determines if a next VFU (or a group of frames corresponding to the address stored in the next entry in the look-up table) is required to be played back on the playback device 280 through the decoding module 260 and the display module 270 (Step 503). If so, the system 200 will set i to be equal to i+1 (Step 504), and desired information will be obtained from the (i+1)th entry of the look-up table (LUT). Furthermore, if a current VFU (or current entry i in the look-up table) is determined to be invalid (Step 505), the system 200 may stop playback and jump to live video (Step 506). For example, the entry i is determined to be invalid when the corresponding entry in the look-up table is empty or an address pointing to a very old frame or VFU. When the current VFU or current entry i is determined to be invalid, the system 200 may find a valid entry k and set k to i. This usage of the look-up table (LUT) advantageously limits the possibility of a failure when invalid frames are encountered or avoiding displaying the earliest frame after a most recent frame.
The present disclosure allows data (i.e. encoded frames) to be grouped according to timing, therefore enabling a user to access desired data utilizing a time parameter. Creating a look-up table that contains timing information of the data allows data to be grouped into groups of data frames, wherein each group of data frames can have a different bit size. Therefore, since the address information is stored in the look-up table, it is clear that the VFUs can be randomly stored in the buffer, that is, stored in a discontinuous fashion. If each group of data frames has a fixed bit size, the look-up table may be omitted since a particular group of data frames may be located by calculating based on the time information. The ability of the system to allow searching for data utilizing time parameters enables trick mode operations to be performed.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.