US 20070079351 A1
System and method for balancing video encoding tasks between multiple processors. The method may include receiving a real time video stream, performing picture level and upper processing on a main processor, executing a macroblock loop in parallel on a main processor and a co-processor, wherein executing includes processing a first group of video encoding tasks on the main processor and processing a second group of video encoding tasks on the co-processor, and outputting an encoded version of the real time broadcast. The method may be implemented on a system that includes a main processor, a co-processor, and an interface to receive the real time video stream, each coupled to one or more buses. The encoding may be performed according to the well known Moving Pictures Experts Group (MPEG) standards.
1. A system comprising:
an interface coupled to a bus to receive a real time video stream;
a main processor coupled to the bus, the main processor to process a first group of video encoding tasks comprising those video encoding tasks not including variable length encoding involved with encoding the real time video stream;
a co-processor coupled to the bus, the co-processor to process a second group of video encoding tasks including variable length encoding tasks involved with encoding the real time video stream.
This application claims the benefit of U.S. Provisional Application No. 60/254,825 filed Dec. 11, 2000.
The invention relates generally to encoding digital video, and more specifically, to encoding digital video according to the Moving Pictures Expert Group (MPEG) standard.
Video compression is becoming a requirement of many electronic devices. Video compression is an important component in devices such as personal computers, digital cameras, digital video cameras or camcorders, and personal video recorders (PVRs), also known as digital video recorders. To better understand how an why compression is becoming more commonplace, review of the history of how consumers view and use television signals is instructive.
Historically, television signals were broadcast from a transmitter and received and displayed immediately upon receipt on a television receiver. As television evolved, cable television became widespread. However, with the advent of cable television, viewers still watched television shows as they were broadcast. With the introduction of the video cassette recorder (VCR), television viewers were able to record television broadcasts to be viewed at a time after the original broadcast of the particular television program. This provided television viewers a greater freedom to enjoy the television broadcasts at their convenience.
Relatively recently, PVRs had been made available to consumers. PVRs including the functionality provided by TiVo, Inc. of Alviso, Calif., and Replay TV/Sonicblue, Inc. of Santa Clara, Calif., now allow the television viewer even more options as to how and when a television program or other video content will be viewed. Among other things, PVRs allow a television viewer to pause a live broadcast of a program while, for example, answering the telephone or attending to some task in the viewer's home. In addition, PVRs may include technology which records specific programs selected by a viewer from a program guide and may also include smart technology which automatically records programs meeting criteria selected by a viewer while the viewer is not available or not watching television. Generally, a PVR must receive a television broadcast and store it in a format which later will be displayed to the television viewer. Such storage must also occur in real time while the viewing of a currently live broadcast program is paused. To efficiently store broadcast programs, programs are compressed prior to storage. Similarly, other personal electronic devices compress sequences of real time images before storing them as video.
Personal video recorders (PVRs) receive television broadcasts in one format and encode the television broadcasts in real time in a second format for storage on a hard disk drive or other storage device within the PVR. The broadcast material may be encoded according to the well known Moving Picture Expert Group (MPEG) standards before it is stored on the hard disk drive. The MPEG family of standards is entitled “Coding of Moving Pictures and Audio” and is a set of evolving standards, including MPEG-1, MPEG-2, MPEG-4, MPEG-7 and MPEG-21. The MPEG-1, MPEG-2 and MPEG-4 standards are available from the International Organization for Standardization of Geneva, Switzerland as International Standards Organization/International Electrotechnical Commission (ISO/IEC) 11172, ISO/IEC 13818, and ISO/IEC 14496, respectively. Similarly, the material stored on the storage device must be processed, including unencoding, when the stored broadcast material is retrieved for display to a viewer. It is the real time encoding required of a PVR that the systems and methods described herein address. In addition, the methods described herein may be incorporated into any devices that require real time video compression, including, for example, digital cameras, digital video recorders or camcorders, digital versatile disk (DVD) recorders, compact disk (CD) recorders, personal computers, and the like.
In one embodiment, the personal video recorder may include multiprocessor 110, storage device 134, input controller 136, and network interface 138 coupled for communication with each other via bus 140. In addition, memory 132 may be coupled directly to multiprocessor 110 via memory bus 130. In one embodiment, memory 132 may be any form of random access memory (RAM). In one embodiment, input controller 136 may receive user input from a remote control device such as remote control 154. Network interface 138 may be a cable modem or other device which allows for the receipt of broadcast communications in any of a variety of formats according to any of a variety of well known broadcast standards, including digital broadcast, analog broadcast, and other standards. That is, network interface 138 may allow for the receipt of broadcast material via a hardwired connection and/or wirelessly in a format promulgated by the International Telecommunications Union (ITU), the Advanced Television Systems Committee (ATSC), digital television (DTV), the Moving Pictures Expert Group (MPEG), high definition television (HDTV), and other well known formats. In various embodiments, the network interface may be coupled to a hardwired network such as a cable television network or a digital subscriber line (DSL) network, an Ethernet network, a twisted pair network, a fiber optic network such as a synchronous optical network (SONET) or other physically present connection. Similarly, broadcast interface 144 may allow for the receipt of a wireless broadcast in the form of microwave, satellite, radio wave, and the like from broadcast transmitter 142. In another embodiment, two or more network interfaces and/or broadcast interfaces may be included so that two or more kinds of broadcast signals and broadcast streams may be received by PVR 100 over two or more broadcast media including the hardwired networks and wireless broadcasts discussed herein.
In one embodiment, storage device 134 is a hard disk drive. In other embodiments storage device 134 may be any machine readable medium including magnetic disk drives such as hard disks, optical disk drives such as readable and writeable digital versatile disks (DVD-RWs), magnetic tape, semiconductor devices such as electronically erasable programmable read only memory (EEPROM) devices and flash memory devices, etc. Although only one storage device is depicted, PVR 100 may have two or more storage devices. In another embodiment, an external storage device may be coupled to PVR 100. In one embodiment, broadcast material such as television programs, movies, video games, raw data, music, audio, and anything that may be broadcast and received via network interface 138 and/or broadcast interface 140 may be stored on the storage device. In one embodiment, the broadcast material in the form of a television, HDTV or other similar broadcast may be digitally processed and encoded in real time before it is stored on storage device 134. It is multiprocessor 110 that processes and encodes the broadcast material for storage. In one embodiment, the storage device may include instructions which direct and control how multiprocessor 110 will process and encode the broadcast material. In one embodiment, the methods described herein may be implemented in software and stored on storage device 134 as video processing software (VPS) 135.
In one embodiment, multiprocessor 110 may include a variety of components including main processor 112 and co-processor 114. Main processor 112 may have its own private cache memory such as cache 113, and co-processor 114 may have a private cache memory such as cache 116. In one embodiment, main processor 112 may be considered a core processor having a very long instruction word (VLIW), and co-processor 114 may be considered a variable length encoding/decoding (VLx) processor. In one embodiment, the main processor may have a VLIW word size of 64 bits. Also included in multiprocessor 110 is memory controller 118 which allows for transmission of data to and from memory. 132 via memory bus 130. In various embodiments, memory controller 118 may be used by a direct memory access (DMA) controller, such as DMA controller 117, to access memory external to the multiprocessor. DMA is a programmable device that controls the automatic data transfer between any two memory blocks. Multiprocessor 110 may also include audio output interface 122 and video output interface 124, which allow for the broadcast of video signals and associated data from personal video recorder 100 to display 150 and associated speakers 152. Main processor 112, co-processor 114, audio output interface 122 and video output interface 124 may be coupled for communication with one anther via bus 126. It is via bus 126 that multiprocessor 110 communicates with other components of the personal video recorder via bus 140. In one embodiment, multiprocessor 110 may be a media processor such as the media accelerated processor for consumer appliances (MAP-CA) device available from Equator Technologies, Inc. of Campbell, Calif. and may be the TriMedia TM32 system on a chip available from TriMedia Technologies, Inc. of Milpitas, Calif. In another embodiment, each of the components within multiprocessor 110 may be separately and individually included in PVR 100. In this embodiment, one or more buses may be included in the PVR.
Although shown as implemented in PVR 100, the methods described herein may be implemented in any device requiring real time video encoding, including, for example, digital cameras, digital video recorder or camcorders, DVD recorders, CD recorders, personal computers, and the like.
In co-processor 304, execution begins with waiting for data in an infinite loop, as shown in block 330. Then, depending on the mode, execution continues. In one embodiment, there are three possible modes of execution. Mode 1, shown as reference number 332 is a bypass mode in which no variable length encoding preformed. The co-processor bypasses the variable length encoding block 350. The main processor may use this mode to send coded picture level and upper data to the video code buffer in the main memory. As such, when Mode 1 has been selected, execution proceeds from block 330 to block 340 where the video code is written. Execution will then continue at block 360 at which time the currently processed data is written to the co-processor's cache, and execution resumes at block 330. In Mode 2, shown as reference number 334, normal variable length encoding is achieved and this may be considered normal mode. As such, in Mode 2, VLE block 350 is executed. That is, after block 330, when in Mode 2, the macroblock header is encoded, as shown in block 352, the motion vector is encoded, as shown in block 354, and discrete cosine transform (DCT) coefficients are encoded, as shown in block 356. The processing of blocks 352, 354 and 356 are considered variable length encoding and may be thought of as VLE block 350. Upon completion of VLE block 350, the results are written to the co-processor cache, as shown in block 360. The flow of execution then continues at block 330. If when in block 330 the co-processor determines that the main processor has selected Mode 3, shown as reference number 336, execution continues at block 338. Mode 3 may be referred to as the encode slice header code and macroblock mode. In this mode, the co-processor generates a slice header on top of an encoded macroblock. That is, the co-processor encodes the slice header, as shown in block 338. Execution will then continue in the VLE block 350 and its constituent blocks as discussed above.
In macroblock loop 408, main processor 402 waits for the co-processor to finish processing the previous macroblock and for the DMA to transfer data into the local cache of the main processor and then checks the bit count of the data encoded by the co-processor, as shown in block 410. Main processor 402 preprocesses one macroblock of a future frame including performing noise reduction, as shown in block 412. The main processor then performs motion estimation Phase 2 on the current frame, as shown in block 414. The main processor then selects the particular mode, as shown in block 416. A forward discrete cosine transform is then executed by the main processor, as shown in block 418. Rate control is then performed, as shown in block 420. The main processor then performs forward quantization, as shown in block 422. A scan for zig zags is then performed, as shown in block 424. The main processor then performs inverse quantization, inverse discrete cosine transform, and adds these together, as shown in block 426. The main processor then prepares for the next macroblock, as shown in block 428. The flow of execution then continues at block 410.
With regard to the processing of co-processor 404, execution begins with waiting for data in an infinite loop, as shown in block 430. Then, depending on the mode, execution continues. As discussed above, there are three possible modes of execution in one embodiment. Mode 1, shown as reference number 432, is a bypass mode in which there is no variable length encoding preformed. The co-processor bypasses the variable length encoding block 450. As such, when Mode 1 has been selected, execution proceeds from block 430 to block 440 where the video code is written. Execution will then continue at block 460 at which time the currently processed data is written to the cache, and execution resumes at block 430. In Mode 2, shown as reference number 434, variable length encoding is achieved. Mode 2 may be considered normal mode. As such, in Mode 2, VLE block 450 is executed. That is, after block 430, when in Mode 2, the macroblock header is encoded, as shown in block 452, the motion vector is encoded, as shown in block 454, and discrete cosine transform (DCT) coefficients are encoded, as shown in block 456. Upon completion of VLE block 450, the results are written to the co-processor cache, as shown in block 460. The flow of execution then continues at block 430. Mode 3, shown as reference number 436, may be referred to as the encode slice header code on top of an encoded macroblock mode. In this mode, the co-processor encodes the slice header, as shown in block 438. Execution will then continue in the VLE block 450 and its constituent blocks as discussed above.
In the foregoing specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes can be made thereto without departing from the broader spirit and scope of the invention as set forth in the appended claims. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.