Macroblock Motion Detection

Project maintainers


Name: macroblock_motion_detection
Created: Sep 17, 2004
Updated: Dec 16, 2004
SVN Updated: Mar 10, 2009
SVN: Browse
Latest version: download (might take a bit to start...)
Statistics: View
Bugs: 0 reported / 0 solved
Star3you like it: star it!

Other project properties

Development status:Alpha
Additional info:
WishBone compliant: No
WishBone version: n/a


- Currently, there are two sets of files in CVS.
- My apologies for poor CVS structure

- First set of files
- MotionTest.v
- MotoinDetection.v
- MD_Block_Ram.v -- currenly Xilinx specific
- timescale.v

- The test file loads the search block with 9 macroblocks (48x48 pixels.)
- Test values are constant in each macroblock with 16x16 groups
- of solid areas containing macroblock number. ie:

- 1 2 3
- 4 5 6
- 7 8 9

- The current block is loaded with constant values 9 times, and each time
- a search is performed. Note that because of the strange test pattern,
- 2 of the tests will find local minimums and not the desired block. This
- can happen with real video sequences using a log search.

- Second set of files

- FrametoMacroblockTest.v
- motion_detection_top.v
- FrametoMacroblock.v
- HalfPel.v
- HP_Block_Ram.v
- ram_dp_sr_sw.v -- off chip dual port ram for simulation
- written by Deepak Kumar Tala
- copied from with permissioin
- SampleFrames -- 18 files YUV Data for 6 frames
- Uses first set of files (except MotionTest.v)


The 'Macroblock Motion Detection Project' contains modules to perform
motion search of macroblocks in the previous video frame for the best match
to a macroblock in the current frame.

Threre are two sets of files:

MotionTest.v for quick simulation of MotionDetection.v module
which searches for a macroblock in the previous frame in a nine
macroblock area.

FrametoMacroblockTest.v which reads input files to simulate CCIR 601
rate input stream and feeds data to the motion detection core which
performs a log search for the best full pixel match and a half pel search
around the best full search result. Note that simulation takes about an
hour for two small frames using Modelsim Xilinx Edition on a Pentium 1.4.
SampleFrames directory should be placed in the directory where Modelsim
will be running.

The Log Search is as follows:
1st center point and 8 points offset by 8 in x and/or y
2nd best from 1st and 8 points offset by 4 in x and/or y
3rd best from second and 8 points offset by 2 in x and/or y
4th best from third and 8 points offset by 1 in x and/or y

While this does not guarantee optimum selection of motion vectors, only 36
tests need to be performed rather than 32x32 tests for a full search.


- Performs log search of supermacroblock (9x9) area
- Capable of processing full scale (704x480) data at 30 f/s

- Currently outputs motion vectors referenced to upper left
- corner of center block (ie 16,16 = no motion)

- Half pel unit performs 9 point half pel search and "outputs"
- (signals are available on HP_dout) motion vectors and pixel
- differences.


10_09_04 Changed directory in FrametoMacroBlockTest to find frames in SampleFrames directory.

Please let me know if similar problems exist which make it difficult to run simulations. Thanks, JE


Half Pel module added. Performs 9 point half pel search around best match
from motion detection. Outputs motion vectors (x,y) referenced to (32,32)
at count 508.5 and Y value differences four pixels at a time at counts
0.5 - 63.5. Added windows software to generate expected results.


Added informal documentation and module block symbols.


Added information on memory organization and timing.