Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Multi-core MPEG-4 Video Encode Partitioning




MPEG-4 Encoder Structure
Video encoding algorithms like MPEG-4 typically consist of the blocks shown in Figure 2.


Figure 2: typical block decomposition of a video encoder

The two most processing-intensive blocks in the MPEG-4 encoder are Motion Estimation (ME) and Texture Encoding (TE). These blocks have different memory and processing requirements and exhibit different data dependencies.

The ME requires large amounts of local memory in order to hold the search area without stressing the DRAM bandwidth. The ME and TE have roughly comparable processing requirements, but both block processing requirements are data dependent. In the case of the ME, low motion translates into a smaller number of search iterations and fewer computations. The quality of the initial motion vectors used by the ME when processing a MB has a noticeable impact on the efficiency of the ME algorithm. Poor initial motion vectors generally lead to longer iterations and potentially poor final motion vectors. The best initial motion vectors are usually derived from neighboring blocks on which the ME processing has already been applied. As a result, in order to obtain a high-quality ME it is necessary to process groups of MBs in a linear fashion, one at a time. Unfortunately, the larger these groups, the less processing that can be done in parallel since only one processor can be assigned to each of these groups. The size of these groups needs to be selected with care in order to obtain a fast, parallel implementation without compromising the compression efficiency of the codec.

Like the ME, the TE can operate on a single macroblock at a time. However, the TE has quite different characteristics. One of the most noticeable differences is that TE doesn't require as much local memory as the ME. TE includes a prediction mechanism that takes advantage of transform coefficients already computed for neighboring MBs in order to encode more efficiently coefficients belonging to the current MB being processed. This mechanism is commonly referred as AC/DC prediction. In order to take advantage of AC/DC prediction, coefficients from previous encoded blocks need to be kept in memory but they require only a fraction of the size needed to keep the large ME search area. The TE also includes a transform function that can be accelerated significantly when the input data contains a lot of zeros, which happens whenever a MB is predicted efficiently from another MB. Like the ME, the TE has some internal data dependencies: the TE can take advantage of an AC/DC coefficient prediction mechanism, which requires neighboring blocks to have already been processed by the TE.

However, because of the lower memory requirements of the TE, it is possible to run TE in parallel on multiple separate slices of a frame. Each slice is encoded separately and markers are inserted to identify the beginning and end of an encoded slice. The ability to work on separate slices in parallel makes TE a good fit for multi-core architectures, especially those able to support run-time allocation of tasks to processors since each slice may take a variable amount of time to be encoded. Having multiple slices per frame is also useful to recover from data corruption, since an error in the bit stream will not impact the entire frame but only a slice. The size of each slice results in a tradeoff between the amount of memory being consumed (since for each slice a buffer is needed to hold the coefficients from the previous row of MB), the quality of the encoding (since AC/DC prediction cannot be used to encode the first row of each slice), and performance (since the more slices we have, the more work can be done in parallel on multiple processors).

Next: MPEG-4 Implementation on the CT3600


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.