Xilinx is disclosing this user guide, manual, release note, and/or specification (the “Documentation”) to you solely for use in the development
of designs to operate with Xilinx hardware devices. You may not reproduce, distribute, republish, download, display, post, or transmit the
Documentation in any form or by any means including, but not limited to, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written consent of Xilinx. Xilinx expressly disclaims any liability arising out of your use of the Documentation. Xilinx reserves
the right, at its sole discretion, to change the Documentation without notice at any time. Xilinx assumes no obligation to correct any errors
contained in the Documentation, or to advise you of any corrections or updates. Xilinx expressly disclaims any liability in connection with
technical support or assistance that may be provided to you in connection with the Information.
THE DOCUMENTATION IS DISCLOSED TO YOU “AS-IS” WITH NO WARRANTY OF ANY KIND. XILINX MAKES NO OTHER
WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, REGARDING THE DOCUMENTATION, INCLUDING ANY
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT OF THIRD-PARTY
RIGHTS. IN NO EVENT WILL XILINX BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, EXEMPLARY, SPECIAL, OR INCIDENTAL
DAMAGES, INCLUDING ANY LOSS OF DATA OR LOST PROFITS, ARISING FROM YOUR USE OF THE DOCUMENTATION.
XILINX, the Xilinx logo, the Brand Window, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks
are the property of their respective owners.
Revision History
The following table shows the revision history for this document.
DateVersionRevision
10/24/071.0Initial Xilinx release.
04/23/081.1Updated “Running the Test Bench” in Chapter 4.
H.264 Motion Estimation Enginewww.xilinx.comUG453 (v1.1) April 23, 2008
UG453 (v1.1) April 23, 2008www.xilinx.comH.264 Motion Estimation Engine
H.264 Motion Estimation Enginewww.xilinx.comUG453 (v1.1) April 23, 2008
R
About This Guide
This document is intended to guide the user through all aspects of installation,
demonstration, simulation, verification, and general usage of the Motion Estimation
Engine core. It should be read in conjunction with the Xilinx Motion Estimation Engine Product Specification (DS648).
Guide Contents
This manual contains the following chapters:
•“Introduction,” provides information about the core, recommended design
experience, additional core resources, technical support, and core and document
feedback.
•“Installing the H.264 Motion Estimation Engine Core,” provides instructions for
installing the core.
•“Designing with the H.264 Motion Estimation Engine Core,” describes how to include
the core into the designer’s system, along with a list of the files provided.
•“Simulating the H. 264 Motion Estimation Engine Core,” describes a test bench
architecture that was created in the ModelSim® environment for simulation of the
core.
•“Verifying the System,”describes the verification environment delivered with the
core.
•Appendix , “Supporting Information,”provides the input sequences, directory tree
structure, regression test summary, and references.
Preface
Additional Resources
To find additional documentation, see the Xilinx website at:
http://www.xilinx.com/literature.
To search the Answer Database of silicon, software, and IP questions and answers, or to
create a technical support WebCase, see the Xilinx website at:
http://www.xilinx.com/support.
Conventions
This document uses the following conventions. An example illustrates each convention.
H.264 Motion Estimation Enginewww.xilinx.com9
UG453 (v1.1) April 23, 2008
Preface: About This Guide
Typographical
The following typographical conventions are used in this document:
Courier font
ConventionMeaning or UseExample
Messages, prompts, and
program files that the system
displays
speed grade: - 100
R
Courier bold
Helvetica bold
Italic font
Square brackets [ ]
Braces { }
Vertical bar |
Literal commands that you enter
in a syntactical statement
Commands that you select from
a menu
Keyboard shortcutsCtrl+C
Variables in a syntax statement
for which you must supply
values
References to other manuals
Emphasis in text
An optional entry or parameter.
However, in bus specifications,
such as bus[7:0], they are
required.
A list of items from which you
must choose one or more
Separates items in a list of
choices
ngdbuild design_name
File → Open
ngdbuild design_name
See the Development System
Reference Guide for more
information.
If a wire is drawn so that it
overlaps the pin of a symbol, the
two nets are not connected.
ngdbuild [option_name]
design_name
lowpwr ={on|off}
lowpwr ={on|off}
Vertical ellipsis
.
.
.
Horizontal ellipsis . . .
Repetitive material that has
been omitted
Repetitive material that has
been omitted
IOB #1: Name = QOUT’
IOB #2: Name = CLKIN’
.
.
.
allow block block_name loc1
loc2 ... locn;
Online Document
The following conventions are used in this document:
ConventionMeaning or UseExample
See the section “Additional
Blue text
10www.xilinx.comH.264 Motion Estimation Engine
Cross-reference link to a location
in the current document
Resources” for details.
Refer to “Title Formats” in
Chapter 1 for details.
UG453 (v1.1) April 23, 2008
R
Conventions
ConventionMeaning or UseExample
Red text
Blue, underlined text
Cross-reference link to a location
in another document
Hyperlink to a website (URL)
See Figure 2-5 in the Virtex-II
Platform FPGA User Guide.
Go to http://www.xilinx.com
for the latest speed files.
H.264 Motion Estimation Enginewww.xilinx.com11
UG453 (v1.1) April 23, 2008
Preface: About This Guide
R
12www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 23, 2008
R
Introduction
This user guide is required reading for the engineer using or considering using the Xilinx®
Motion Estimation Engine core. The release of this product is given in ZIP file form.
About the Core
The Xilinx Motion Estimation Engine core accepts input parameters on a frame and
macroblock basis and a stream of pixels in macroblock format and generates output
motion vectors, Sum-of-Absolute Difference (SAD) values, and coded block pattern with
best motion vector for each block.
Chapter 1
Recommended Design Experience
Although the Motion Estimation Engine core is a fully-verified solution, the challenge
associated with implementing a complete design varies depending on the configuration
and functionality of the application. For best results, previous experience building highperformance pipelined FPGA designs using Xilinx implementation software and user
constraints files (UCF) is recommended.
Contact your local Xilinx representative for a closer review and estimation for your specific
site requirements.
Additional Core Resources
For detailed information and updates about the Motion Estimation Engine core, see the
documents located on the Motion Estimation Engine
document should always be used in conjunction with the following:
For technical support, go to www.xilinx.com/support. Questions are routed to a team of
engineers with expertise using the Motion Estimation Engine core.
product page. In general, this
Xilinx provides technical support for use of this product as described in this guide.
Xilinx cannot guarantee timing, functionality, or support of this product for designs that do
not follow these guidelines.
H.264 Motion Estimation Enginewww.xilinx.com13
UG453 (v1.1) April 23, 2008
Chapter 1: Introduction
Feedback
Xilinx welcomes comments and suggestions about the Motion Estimation Engine core and
the accompanying documentation. For comments or suggestions about the Motion
Estimation Engine core, submit a WebCase from
www.xilinx.com/support. Be sure to
include the following information:
•Product name
•Core version number
•Explanation of your comments
For comments or suggestions about this document, submit a WebCase from
www.xilinx.com/support. Be sure to include the following information:
•Document title
•Document number
•Page number(s) to which your comments refer
•Explanation of your comments
R
14www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 23, 2008
R
Chapter 2
Installing the H.264 Motion Estimation
Engine Core
This chapter provides instructions for installing the H. 264 Motion Estimation Engine core.
The Motion Estimation Engine fixed netlist is provided under the Xilinx LogiCORE™ Site
License Agreement, which conforms to the terms of the
defined by the Common License Consortium.
Install the core by performing a manual installation after downloading the core from the
web.
SignOnce IP Site License standard
System Requirements
Windows
•Windows® 2000 Professional with Service Pack 2 or greater
•Windows XP Professional Service Pack 2 or greater
Software
•Xilinx ISE™9.1i with Service Pack 3
•ModelSim® 6.1c SE
•MicroSoft Visual C++ 6.0
•ActivePerl 5.8.3
Manual Installation
1.Download the IP Update ZIP file from the following location and save it to a
temporary directory:
Chapter 2: Installing the H.264 Motion Estimation Engine Core
4.Allow the extractor utility you use to overwrite all existing files and maintain the
directory structure defined in the archive. See “Appendix , “Supporting Information””
for an illustration of the correct directory tree structure.
Netlists
The netlists given in this release of the H. 264 Motion Estimation Engine are all in the
\ReleasedNetlists directory. They have been synthesized using Synplify_Pro 8.8.0.4
for Spartan™-3A (S3A), Virtex™-4 (V4), and Virtex-5 (V5) FPGAs:
•MotionEstimation_S3A.edf
•MotionEstimation_V4.edf
•MotionEstimation_V5.edf
To learn how to instantiate the cores in your system, refer to Chapter 3, “Designing with
the H.264 Motion Estimation Engine Core.”
R
16www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 23, 2008
R
Chapter 3
Designing with the H.264 Motion
Estimation Engine Core
This chapter describes how to include a Motion Estimation Engine core into the next
hierarchy of system architecture.
VHDL Template Files
To help the user design the core into his system, the release provides the following
template files. Neither the core source code nor the HDL libraries have been provided in
source form but in object code format for simulation purposes.
Note: These VHDL template files are for reference only.
Figure 3-1 shows the Motion Estimator in a typical implementation of an encoder. For
more information on the system-level integration, refer to the H.264 specification [Ref 1].
X-Ref Target - Figure 3-1
Input
Video
Signal
Split into
Macroblocks
16 x 16 pixels
-
Intra/Inte
Coder
Control
Transf orm/
Scal./Quant
Intra-frame
Compensation
Prediction
Morion
Scaling & Inv.
Transf orm
De-blocking
Output
Video
Signal
Control
Quant.
Transf.
Entropy
Coding
Motion
Motion
Estimation
UG453_01_09107
Figure 3-1: H.264 Encoder
H.264 Motion Estimation Enginewww.xilinx.com17
UG453 (v1.1) April 23, 2008
Chapter 3: Designing with the H.264 Motion Estimation Engine Core
Motion estimation requires a definition of a search region and a search scheme to find the
best match (motion vector) within a search region. Rate-Distortion theory also takes into
consideration vectors that may be close together, but not necessarily the best SAD value in
finding the optimal motion vector to choose for entropy coding. Searching within the
search region can be done exhaustively, but the computational overhead is prohibitive.
Thus, a search scheme with seed motion vectors and regions to search are desired. In this
implementation of the motion estimation, 10 seed vectors are provided for each 8x4 block
with eight 8x4 blocks in a 16x16 macroblock. A 4x3 region is searched to the right and
down from the seed vector.
Another difficult part of motion estimation is the localization of memory to allow for easy
access to the search region. In this implementation, a sliding window of eight macroblocks
high and seven macroblocks wide is utilized to keep the external memory transfers
efficient and the bandwidth manageable.
Processing begins with frame parameters being updated each frame and the first
macroblock being sent to the core. Macroblock parameters in the form of seed vectors (80)
are send to the core and the H.264 Motion Estimation Engine processes and produces SADs
and the list of Motion Vectors searched corresponding to the SADs produced. See
Figure 3-2.
H.264 allows for variable block sizes within a macroblock. If through the search process the
best motion vector (minimum SAD) for two blocks is identical, then the block can be
merged to be a larger block, that is, two 8x4 blocks to an 8x8 block. The Variable Block Size
Decision block performs this processing and provides as an output the coded block pattern
for a macroblock and corresponding best motion vectors and SADs.
Chapter 3: Designing with the H.264 Motion Estimation Engine Core
R
20www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 23, 2008
R
Simulating the H. 264 Motion
Estimation Engine Core
This chapter describes a test bench architecture that was created in the ModelSim
environment for simulation of the Motion Estimation Engine core. It does not describe the
verification platform. The simulation described may be used for visualization of the I/O
signals at the periphery of the cores. Although the same precompiled libraries are used in
the verification of the Motion Estimation Engine core, this process is described in detail in
Chapter 5, “Verifying the System.”
Test Bench Release
Chapter 4
For the purposes of running, viewing, and understanding the test bench and the
architectures used, the release provides the following files under
1.Double-click on the vsim_gui.bat file. This spawns the ModelSim GUI. Two wave
windows are given. One (MotionEstimation_user) is meant to contain userdefined signals. The user may use this window to view any internal signals of his
choice. The other (MotionEstimation_core) shows the signals at the periphery of
the core to give the user a feel for the typical interfacing activity required.
If the the following error is received, the user needs to run the refresh command,
vcom -refresh:
#**Error: (vsim-13) Recompile work.vfbc_infrastructure because
C:\opt\Modeltech_6.1f\xilinx_libs_9_2_03i_ip2\.\unisims.vcomponents
has changed.
2.In the ModelSim environment, enter run -all. This runs for about 15 minutes.
The stimulus data for this simulation is held in the
\HDL\LowCost_MotionEstimation\MotionEstimation\Testbench\stimul
i directory, consisting of several input text files and some expected output text files.
The stimulus data files and expected output files provided contain data extracted from
the reference C model (see [Ref 1]).
Estimation Engine core. It is not provided as compilable source code for ModelSim. All simulations
are to be run using the precompiled libraries provided.
Xilinx has provided a .vho source file as an example of how to instantiate the Motion
In Chapter 5, “Verifying the System,” of this document, the process by which stimulus and
expected results are generated from the reference code is described. The generated files
may be used in place of the default simulation files provided with the release, but must
reside in the locations mentioned above during simulation.
22www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 22, 2008
R
Verifying the System
This chapter describes the verification environment delivered with the Motion Estimation
Engine core. Ultimately, the system is verified by using long regression tests with several
different resolution input sequences. The output of the hardware from these tests must
exactly match the output given by the reference software that runs with the same stimulus.
Verification Platform Release
For the purposes of running, viewing, and understanding the verification process, the
release provides the following files:
1.Libraries of object (precompiled) source (same as Simulation):
There are five tests that can be run by the user. Each test has varying characteristics,
including varying video formats, parameter settings, etc. A description of the tests is given
in the
Appendix, “Supporting Information”and is also summarized in the batch scripts
listed under item 3 (Verification scripts) above.
Verification is automated down to running the simple editable Level1 batch script. It
contains the command line:
minutes to run two frames on a modern laptop. This time increases for tests that bring extra
complexity into the stimulus generation, for example, formats with increased frame size, main
and high profile settings, etc.
Verification Notes
When test number is set to 0 in the batch script file, all tests are run in sequence from 1 to
10. When doing this, by default, all tests are run regardless of whether they have been run
in the past. If some tests have already been run, but some others have not been run or their
results deleted, then the user may wish to run only the remaining tests. The user can do
this by editing the MotionEstimation_Verification.pl script, commenting out the
line:
$ForceRegenerateAll = "1";
Use ‘#’ to comment).
Also, if you want to take this approach, but rerun one or some tests selectively, delete the
test directory of the test(s) you want to rerun:
MotionEstimation\Level1\testxx
The whole process takes some time. For QCIF (176 x 144), it should take at least a 15
and rerun the script.
H.264 Motion Estimation Enginewww.xilinx.com25
UG453 (v1.1) April 23, 2008
Chapter 5: Verifying the System
R
26www.xilinx.comH.264 Motion Estimation Engine
UG453 (v1.1) April 23, 2008
R
Supporting Information
Input Sequences
The files provided as video input source files are: