Copyright© 2007-2008 Elemental Technologies, Inc. A portion of the disclosure of this patent document contains material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever provided under at least 37 CFR §1.71(d).
Digital video processing, namely compression, decompression and transcoding especially using stream processors of a GPU.
Processing compressed digital video requires an enormous amount of computational horsepower. Modern central processing units (CPUs) are not keeping up with the demand for horsepower, resulting in the slow processing of video compression and processing tasks. This result has different ramifications for different users. For high-end professionals and broadcast infrastructure applications, specialized hardware is currently used. This hardware is produced in low volumes and thus tends to be expensive. On the other hand, for video editing hobbyists and average consumers, it is unusual to purchase expensive hardware to augment an off-the-shelf personal computer. Instead, these users rely entirely on the computer's CPU to sequentially perform the tasks. This runs much slower than real-time, causing the user to wait long periods of time for basic operations like converting a video file from one format to another.
Moving to a parallel architecture has the potential to accelerate many of these tasks. However, significant parallelization is difficult to achieve because block-based codec algorithms require some serialization due to the requirement for neighbor blocks to have been coded prior to the current block. Multiple blocks cannot be processed at the same time because each relies on information from neighboring blocks, which may not have been processed yet. Operations such as intra prediction, motion estimation and compensation, and deblocking are just a few examples of block-based algorithm calculations which rely on neighboring blocks. Utilizing stream processor architectures with conventional algorithms provides no performance increase for these operations.
The need remains therefore for improvements in video processing to achieve improvements in performance, especially speed, while leveraging relatively low-cost hardware. Several preferred examples of the present application will now be described with reference to the accompanying drawings. Various other examples of the invention are also possible and practical. This application may be exemplified in many different forms and should not be construed as being limited to the examples set forth herein.
Block based video compression, especially H.264, takes advantage of correlations of any given block to surrounding neighbor blocks by predicting a block based on the neighbor blocks.1 Intra-frame prediction is calculated generally in the following manner (we will describe the process for luma blocks, but chroma is processed in a similar fashion). A prediction (for the current block) is formed based on previously encoded neighboring blocks in a reconstructed frame.2 This block is subtracted from the current block prior to encoding, and for the luma case may be formed for each 16×16 macroblock or 4×4 partitions inside the macroblock. In the 4×4 partitioning case, there are 9 optional prediction modes that can be applied, while in the 16×16 macroblock case, there are 4 optional modes. The difference between the actual block and the prediction is called the residual macroblock, and the residual is what is encoded and sent to a decoder. A similar process is applied to every macroblock of the frame. Inter-frame prediction works in a similar manner, but the prediction is based on motion from previously encoded frames. 1 ITU-T Recommendation H.264; a video coding standard. Also called Advanced Video Coding or “AVC”.2 Reconstructed frame is the one that is currently being encoded. It becomes the reference frame for the next picture.
To illustrate the intra-frame prediction 16×16 pixel macroblock case, see
To illustrate the 4×4 block partitioning case, see
To obtain the best compression performance, the Sum of Absolute Differences must be performed for each prediction mode for the 16×16 macroblock and for the 4×4 sub-block. Implementation of these calculations on a sequential processor such as a CPU processes each macroblock in raster scan order (i.e. from left to right, processing row 0, then row 1, row 2, etc).
Inter-frame block prediction requires searching each block of pixels for a matching block of pixels closest to the predicted motion vector in any cached reference frame. Again, SAD or SATD is used to find the best matching block. This process is called motion estimation and is a valuable tool in video compression. Motion is highly correlated to neighboring blocks and thus the predicted motion vector is calculated with neighboring block motion vectors, thus creating yet another dependency on neighboring blocks from the block currently being encoded. Moreover, macroblocks may be partitioned at least four different ways and motion compensated either as one 16×16 macroblock partition, two 16×8 partitions, two 8×16 partitions or four 8×8 partitions. In the 8×8 mode, each of the four sub-macroblocks may be further split in four ways. There are many possible combinations, and a separate motion vector is required for each partition or sub-macroblock, all of which presents an imposing processing challenge to meet reasonable timing constraints.
After predictions are calculated, the next step in video compression is transforming the residuals into a frequency representation of the data (such as DCT) and then quantizing the high frequency content away before entropy encoding of the result. These processes as well are computationally expensive. We have discovered techniques to improve parallelism of these kinds of processes.
Accordingly we disclose herein various implementations that enable efficient processing of macroblocks with neighboring block dependencies, utilizing highly parallel stream processing architectures. Various embodiments will offer tradeoffs between compression efficiency and parallelism. To illustrate, our examples focus on a modern block-based image compression format variously known as H.264, Advanced Video Codec (AVC), or MPEG-4 Part 10. For the purposes of this document, we will use “AVC” to refer to the format.
There are several computationally-intensive portions of the AVC compression or decompression processes where the current block being processed has dependency on neighboring blocks. We mentioned several of these processes above. Specifically, these include block predictions (inter- and intra-frame) and the block transforms (which include the forward DCT transform, quantizing, inverse quantizing, and inverse DCT transform of each block). One aspect of the present invention addresses these processes using any stream processor-based architecture that includes a mechanism for scheduling software threads to run on any of the available processors, and in which data can be shared among blocks of processors for SIMD (single instruction, multiple data) type of execution. For example, the most commonly available stream processor architectures are those implemented on commercially available graphics processing units (GPUs) such as those from NVIDIA of Santa Clara, Calif. Commercially available units offer, for example, 64 or 128 processor cores.
In one presently preferred embodiment, predictions and transforms are solved using stream processors as illustrated conceptually in
The integer N (number of threads) will vary, depending on the particular implementation and the specific process running at a given time. In some cases, N may be a multiple of 32. We have discovered that N=64 is a preferred arrangement for each phase of the encoding: prediction, transforms, and reconstruction. Each phase of the encoding may have a different allocation of the threads to the problem. In the case of the DCT calculation, for example, each thread preferably calculates the matrix multiplication for 4 pixels (first a column of 4 pixels, then a row).
The threads and their respective tasks are divided up so that they do not conflict with each other during calculations. To illustrate, a 16×16 block may be partitioned into 16 4×4 blocks, each sub-block having 4 rows and 4 columns. There are thus 64 columns of 4 pixels, and one thread may be applied to each column for parallel execution.
Each phase of the codec must allocate threads in a similar manner, but each is unique in what each thread does and how many pixels are being operated on, and the number of processors available.
Sweep Processing a Full Frame
Allocated blocks of stream processors process a frame of video in a “sweeping” manner—a term we used to describe techniques for ordering the processing in order to maintain the neighbor dependencies required to code each block. For example,
The frame depicted in
Parallelism continues to increase as the resolution increases; for example, for a 1080p (1920×1080) resolution image, the speedup over a conventional implementation is 32 times. Once the transformed coefficients have been calculated and the reconstructed frame complete, the run-length encoded coefficients are sent to the CPU to complete the serial entropy encoding which is the final step in video compression.
In an alternative embodiment, a 45-degree diagonal sweep implementation may also be utilized as depicted in
In the first sweep, Macroblock (0,0) is processed. In the second sweep, Macroblocks (1,0) and (0,1) are processed. In the third sweep, Macroblocks (2,0), (1,1), and (0,2) are processed, and so on. Again, the pattern continues until all the macroblocks in the image are processed. Using this diagonal method instead of the low-angle method results in a 36% increase in performance relative to the low-angle method, and 43 times faster than a conventional implementation.
Prediction Kernel Processing
Another way to gain more parallelism is to process the predictions and the transforms in two steps and allocate processors differently in each step. In this case, some minor compression efficiency is lost as the predictions are being made on a different set of data. A best-guess prediction can be made for all blocks in complete parallel without using a sweep by comparing the prediction block to the input block instead of the reconstructed reference block.
Motion vectors can also be found by searching in a window around the current block without using the predicted motion vector. This technique increases the overall speed of processing at the expense of compression efficiency by allowing more threads to run concurrently to select the proper prediction. This prediction selection for each block is then sent to the transform kernel (described below) which may be processed in a sweep as described previously to produce the coefficients used in the entropy encoding.
This technique is illustrated conceptually in
The results of the prediction kernel (prediction modes, prediction type, and motion vectors) for each block are then sent to a transform kernel. As illustrated in sample frame 502, the transform kernel also applies a sweep processing technique and calculates the final coefficients to be sent to the CPU for entropy encoding. A diagonal sweep is illustrated. Any macroblock predicted using inter-frame prediction (such as the macroblock at (3,3)) can also be processed in sweep 0 because there is no dependence on neighboring macroblocks, only reference frames are required which have already been processed. As above, sets of processors are allocated, for example in a GPU, to each macroblock for processing. This technique dramatically increases parallelism and processing speed especially for P and B frames due to better use of the processors and more threads executing concurrently.
During a transcode operation such as MPEG2 to H.264, motion vectors from the original encoding may be available for cueing the motion estimation process. In this case, compression efficiency is gained as the previously coded motion vectors offer a good starting point for the motion estimation algorithms and are likely to be closer to the predicted motion vector resulting in less bits being used to encode it.
Thus we have seen that
The methods disclosed above can be applied to any block-based video compression system that requires information from neighboring blocks before a current block is processed. Beside intra-frame block prediction (the example described above), other processes to which various embodiments can be applied advantageously include motion estimation, in-loop deblocking, and rate control. In addition to AVC/H.264, many block-based codecs utilize these algorithms including VC-1, MPEG-2, Flash (or On2), and other video compression standards.
Digital Processors, Software and Memory Nomenclature
As explained above, the invention preferably is carried out by a digital computing system, for example a CPU working in tandem with a GPU. More specifically, by the term “digital computing system” we mean any system that includes at least one digital processor and associated memory, wherein the digital processor can execute instructions or “code” stored in that memory. (The memory may store data as well.) A digital processor includes but is not limited to a microprocessor, multi-core processor, DSP (digital signal processor), GPU, processor array, network processor, etc. A digital processor (or many of them) may be embedded into an integrated circuit such as a GPU. In other arrangements, one or more processors may be deployed on a circuit board (motherboard, daughter board, rack blade, etc.). Processors often form part of a larger device such as a laptop or desktop computer, a PDA, cell phone, iPhone PDA, Blackberry® PDA/phone, or indeed virtually any electronic device. The concepts of the present invention may be deployed to advantage in many of these various environments. Preferably, the methods may be implemented in software stored in memory, further defined below. In a GPU, processors may be arranged in groups, for example eight processors, for SIMD operation. One example of a multiprocessor array is illustrated in
Digital memory, further explained below, may be integrated together with a processor, for example RAM or FLASH memory embedded in an integrated circuit CPU, GPU or the like. In other examples, the memory comprises a physically separate device, such as an external disk drive, storage array, or portable FLASH key fob. In such cases, the memory becomes “associated” with the digital processor when the two are operatively coupled together, or in communication with each other, for example by an I/O port, network connection, etc. such that the processor can read a file stored on the memory. Associated memory may be “read only” by design (ROM) or by virtue of permission settings, or not. Other examples include but are not limited to WORM, EPROM, EEPROM, FLASH, etc. Those technologies often are implemented in solid state semiconductor devices. Other memories may comprise moving parts, such a conventional rotating disk drive. All such memories are “machine readable” in that they are readable by a compatible digital processor. Many interfaces and protocols for data transfers (data here includes software) between processors and memory are well known, standardized and documented elsewhere, so they are not enumerated here.
Storage of Computer Programs
As explained above, the present invention preferably is implemented or embodied in computer software (also known as a “computer program” or “code”; we use these terms interchangeably). In some embodiments, we described program “threads” which are relatively simple programs. Multiple program threads typically can be executed concurrently in a block of SIMD processors, each processor in the block executing the same code on a different set of data. See
Computer Program Product
Where executable code has been stored in a machine-readable storage medium for distribution, we may refer to that storage medium as a “computer program product.” For example, a portable digital storage medium may be used as a convenient means to store and transport (deliver, buy, sell, license) a computer program. Historically, this method was often used for retail point-of-sale delivery of packaged (“shrink wrapped”) programs. Examples of such storage media include without limitation CD-ROM and the like. Such a CD-ROM, containing a stored computer program, thus would be an example of a “computer program product.” In other cases, disks, tape, or other machine-readable storage media are used for distributing software from the owner or creator to an OEM for installation in the OEM's products, for example, to install embedded code into a video card or GPU prior to sale of that product. That “master” disk is again a computer program product. The receiving OEM typically would be licensed by the owner to make and distribute copies of the code in embedded form. Each such product then includes the code stored in machine-readable media, although generally the end product would not be considered a “computer program product” as the embedded code is not intended for subsequent transfer or installation in another product.
It will be obvious to those having skill in the art that many changes may be made to the details of the above-described embodiments without departing from the underlying principles of the invention. The scope of the present invention should, therefore, be determined only by the following claims.
This application is a continuation of U.S. patent application Ser. No. 12/189,735 filed on Aug. 11, 2008, now pending, which claims priority from U.S. Provisional Application No. 60/964,340 filed Aug. 9, 2007, both of which are incorporated herein by this reference.
Number | Name | Date | Kind |
---|---|---|---|
5280349 | Wang | Jan 1994 | A |
5414468 | Lee | May 1995 | A |
5557332 | Koyanagi | Sep 1996 | A |
5565920 | Lee | Oct 1996 | A |
5675331 | Watanabe | Oct 1997 | A |
5699460 | Kopet | Dec 1997 | A |
5701164 | Kato | Dec 1997 | A |
5963260 | Bakhmutsky | Oct 1999 | A |
6058143 | Golin | May 2000 | A |
6434196 | Sethuraman | Aug 2002 | B1 |
6504872 | Fimoff | Jan 2003 | B1 |
6577767 | Lee | Jun 2003 | B2 |
6587590 | Pan | Jul 2003 | B1 |
6771704 | Hannah | Aug 2004 | B1 |
6870883 | Iwata | Mar 2005 | B2 |
6888477 | Lai | May 2005 | B2 |
6952211 | Cote | Oct 2005 | B1 |
7339993 | Brooks | Mar 2008 | B1 |
7376590 | Lee | May 2008 | B2 |
7634776 | Parameswaran | Dec 2009 | B2 |
7646810 | Tourapis | Jan 2010 | B2 |
20010047517 | Christopoulos | Nov 2001 | A1 |
20020064314 | Comaniciu | May 2002 | A1 |
20020136298 | Anantharamu | Sep 2002 | A1 |
20020157112 | Kuhn | Oct 2002 | A1 |
20030028643 | Jabri | Feb 2003 | A1 |
20030123748 | Sebot | Jul 2003 | A1 |
20040076333 | Zhang | Apr 2004 | A1 |
20040101056 | Wong | May 2004 | A1 |
20040161035 | Wedi | Aug 2004 | A1 |
20040213345 | Holcomb | Oct 2004 | A1 |
20040218673 | Wang | Nov 2004 | A1 |
20040252901 | Klein Gunnewick | Dec 2004 | A1 |
20050019000 | Lim | Jan 2005 | A1 |
20050091696 | Wolfe | Apr 2005 | A1 |
20050134735 | Swartz | Jun 2005 | A1 |
20050147033 | Chin | Jul 2005 | A1 |
20050160471 | Cohen | Jul 2005 | A1 |
20050262510 | Parameswaran | Nov 2005 | A1 |
20060018378 | Piccinelli | Jan 2006 | A1 |
20060056513 | Shen et al. | Mar 2006 | A1 |
20060083308 | Schwarz | Apr 2006 | A1 |
20060093042 | Kashima | May 2006 | A1 |
20060095944 | Demircin | May 2006 | A1 |
20060114989 | Panda | Jun 2006 | A1 |
20060126667 | Smith | Jun 2006 | A1 |
20060153299 | Iwata et al. | Jul 2006 | A1 |
20060193388 | Woods | Aug 2006 | A1 |
20060268991 | Segall | Nov 2006 | A1 |
20070025628 | Sekiguchi et al. | Feb 2007 | A1 |
20070033494 | Wenger et al. | Feb 2007 | A1 |
20070053436 | Van Eggelen | Mar 2007 | A1 |
20070086528 | Mauchly | Apr 2007 | A1 |
20070091815 | Tinnakornsrisuphap | Apr 2007 | A1 |
20070098070 | Saigo et al. | May 2007 | A1 |
20070223580 | Ye | Sep 2007 | A1 |
20070285285 | Puri et al. | Dec 2007 | A1 |
20080025412 | Lee et al. | Jan 2008 | A1 |
20080063082 | Watanabe | Mar 2008 | A1 |
20080123750 | Bronstein et al. | May 2008 | A1 |
20080126278 | Bronstein et al. | May 2008 | A1 |
20080232464 | Tahara et al. | Sep 2008 | A1 |
20090034856 | Moriya et al. | Feb 2009 | A1 |
20090092326 | Fukuhara | Apr 2009 | A1 |
20090290635 | Kim | Nov 2009 | A1 |
Number | Date | Country |
---|---|---|
2004140473 | May 2004 | JP |
2007174569 | Jul 2007 | JP |
03036980 | May 2003 | WO |
2004010670 | Jan 2004 | WO |
Entry |
---|
Thinh M. Le et al. SMID Processor Arrays for Image and Video Processing: A Review, Multimedia Hardware Architectures, 1998, vol. 3311 of SPIE Proceedings (http://www.doe.carleton.ca˜thinh/./papers/mha98/array98.ps). |
Wedi, “New Results on Adaptive Interpolation Filter,”; Joint Video Team (JVT) of ISO/IEC MPEG & ITU-T VCEG; 3rd Meeting; Fairfax, Virginia, USA; May 6-10, 2002; 14 pages. |
Tambankar et al., “An Overview of H.264/MPEG-4 Part 10,” 4th EURASIP Conference; University of Texas at Arlington; Jul. 2-5, 2003; 51 pages. |
Wedi, “Advanced Motion Compensated Prediction Methods,” ITU-T Video Coding Experts Group; 24th Meeting; Oct. 18-22, 2003; 8 pages. |
Blaszak et al., “Scalable AVC Codec,” International Organization for Standardization; Coding of Moving Pictures and Audio; Munich; Mar. 6, 2004; 12 pages. |
Schwarz et al., “SVC Core Experiment 2.1: Inter-Layer Prediction of motion and Residual Data,” International Organization for Standardization; Coding of Moving Picture and Audio; Fraunhofer Institute for Telecommunications—Heinrich Hertz Institute; Jul. 14, 2004; 6 pages. |
Teng et al., “Design and Evaluation of mProducer: a Mobile Authoring Tool for Personal Experience Computing”; Oct. 27-29, 2004; 8 pages. |
Stolowitz Ford Cowger LLP List of Related Cases dated May 7, 2012; 1 page. |
Number | Date | Country | |
---|---|---|---|
20120219068 A1 | Aug 2012 | US |
Number | Date | Country | |
---|---|---|---|
60964340 | Aug 2007 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 12189735 | Aug 2008 | US |
Child | 13463526 | US |