This description relates to memory sharing in video transcoding and displaying.
A video transcoder is useful in decoding an encoded video (e.g., compressed video) and subsequently encoding the decoded video according to a different encoding scheme. A video includes a sequence of frames (also referred to as pictures), each frame including rows and columns of pixels. The transcoder may receive a first compressed video and generate a second compressed video, in which the second compressed video, for example, has a higher compression ratio and/or a lower resolution as compared to the first compressed video.
In some examples, the first and second compressed videos have the same resolution (i.e., each frame in the first compressed video has the same number of columns and rows as each frame in the second compressed video) but have different bit rates (e.g., the first compressed video may have a bit rate of 150 to 300 kbps, whereas the second compressed video may have a bit rate of 30 to 150 kbps). For video that is compressed according to an MPEG standard, changing a quantization level can change the bit rate of the video without changing the resolution. Increasing the quantization level will cause more bits to be truncated during the encoding process, resulting in a compressed video having a lower bit rate and a lower image quality.
In some examples, the first and second compressed videos having different resolutions. For example, the first compressed video can be a high definition television (HDTV) program having 1920×1080 resolution. If the user has a television with 1366×768 resolution, when he records the HDTV program for future viewing, it is useful to transcode the compressed 1920×1080 video to a compressed 1366×768 video to match the resolution of his television. By increasing the compression ratio and/or decreasing the resolution of a video, the user can reduce the bit rate of the compressed video so that more video programs can be stored in a given amount of storage.
For some compression algorithms, such as MPEG-2 or MPEG-4, the order in which frames are displayed is different from the order in which the frames are encoded/decoded. The MPEG standard defines intra (I), unidirectional (P), and bi-directional (B) frames, in which the I frames are compressed without reference to the other frames, the P frames are compressed/decompressed using information from a previous I frame or P frame, and the B frames are compressed/decompressed using information from a previous I or P frame and a subsequent I or P frame. For example, the frames may be displayed according to a “display order”: I0, B1, B2, P3, B4, B5, P6, B7, B8, P9, B10, B11, etc., in which the frame I0 is an I-frame that is displayed during time interval T0, the frame B1 is a B-frame that is displayed during time interval T1, and so forth. On the other hand, the frames may be encoded/decoded according to an “encode order”: I0, P3, B1, B2, P6, B4, B5, P9, B7, B8, P12, B10, B11, etc., indicating that the frame P3 is encoded/decoded before the frames B1 and B2, even though the frames B1 and B2 are displayed before the frame P3. Because the encoding/decoding sequence is different from the display sequence, when a compressed video is transcoded so that it can be viewed on a display and recorded in a storage medium, several memory buffers are used to temporarily store frames during the decoding, displaying, and encoding processes.