Introduction | MCP | Matlab Investigation | C Implementation | Results | Conclusions | References | Appendix

Implementation of Motion-Compensated Prediction Algorithm


We chose to implement the MCP Compression Algorithm in C so the compression times were small enough to allow us to perform a number of tests to search out the optimal MCP parameters for the real-time cardiac sequences. We made use of the CIDS library (provided by Professor Girod's group), which provided a useful set of structures and functions for writing image compression algorithms. We also made use of an 8x8 DCT encoder (based on the CIDS library) provided by Markus Flierl.

Our image encoder supports a variable block-match size, variable maximum block-match delta, and a variable long-term memory buffer size. The user must also specify a quantization parameter that determines the degree of compression. For comparison, the encoder also supports frame-difference encoding and simple intra-frame encoding. The motion-compensation vectors (dx, dy, dt) were jointly encoded using a Huffman table, with the dt value differentially encoded based on the previous frame's dt. The block matching algorithm utilizes a lagrangian cost function based on the MSE of the block and the bit cost of encoding the vector (dx, dy, dt).

To verify the functionality of our encoder, we compressed a contrived periodic cardiac sequence (period 10 frames) with a buffer size of 1 and 16 frames respectively. As each frame was compressed, we examined the PSNR of the predicted vs. the original image. As expected, the PSNR of the predicted vs. the original image took a sharp jump upward from the 11th coded frame onward, as shown in Figure 1. Note that we used a very low quantization parameter (meaning we're not compressing the sequence much) in order to make the jump in PSNR more pronounced.



Figure 1.
PSNR of predicted vs. original image as a function
of frame index for a sequence with a period of 10 frames. Note
how the PSNR plateaus at a very high value after the buffer fills
with the corresponding frames in the previous cycle.


We repeated the experiment for seven different quantization levels, and generated the PSNR curves shown in Figure 2. The graph also shows the PSNR curves for simple frame-difference encoding and intra-frame encoding for comparison. Notice that MCP with a buffer size of 1 and frame-difference encoding yield almost identical results due to the strong temporal correllation of the data. Our test sequence was not sub-sampled to reduce this correllation. Also note that simple frame-difference encoding is actually the best at low bit rates. The strong temporal correllation due to the shared fourier-space data of temporally adjacent images makes the previous frame an excellent predictor, as previously discussed.



Figure 2.
Rate vs. PSNR curves of contrived periodic cardiac sequence.


In an attempt to determine the optimal MCP parameters for compression of our cardiac sequences, we ran the compression algorithm in batch mode for the following parameter combinations:

  1. 16x16 block match size, maximum displacements of 8 and 4 pixels
  2. 8x8 block match size, maximum displacements of 8, 4, and 2 pixels
  3. 4x4 block match size, maximum displacements of 4 and 2 pixels
Each of these 7 parameter combinations was tested with a buffer size of 1, 2, 4, 8, and 16 frames respectively, for a total of 35 different MCP parameter combinations. Each of these 35 parameter combinations, in turn, was run at 7 different quantization levels. From these results we were able to generate 35 PSNR curves, and compare the performance of the various parameter combinations on the cardiac sequences. We found that a block size of 4x4 with a maximum displacement of 4 pixels and a 16 frame buffer consistently yielded the best PSNR at a given rate. However, the gain was much smaller than we had anticipated. In fact, the PSNR curves were very tightly clustered. Figure 3 shows the PSNR curves for a 4x4 block size with a max displacement of 4 pixels at buffer sizes of both 1 and 16 frames. Also included on the graph for comparison are the PSNR curves for the same sequence encoded using simple frame-difference encoding and intra-frame encoding.



Figure 3.
Rate vs. PSNR curves of cardiac sequence. Images are
128x128 pixels at 6 frames/sec. In an attempt to reduce some of the
temporal correllation from the cardiac sequences, this sequence is a
sub-sampled version of a shared fourier-space data 18 frames/sec
sequence.


After further verification that our motion compensation algorithm was indeed working on periodic sequences, we examined the PSNR of the predicted vs. the original image as each frame was encoded in an attempt to understand why the gain from increasing the buffer size was so small on the cardiac images. While increasing the buffer size did improve the PSNR (as expected), the improvement was generally limited to a fraction of a decibel. At low bit rates, the additional bit overhead for sending the diplacement vectors overshadowed the small gain in bit rate from reducing the error.

Despite the relatively small improvement we were able to obtain using MCP, we were still able to obtain impressive compression ratios on the cardiac sequences while retaining their diagnostic utility, as discussed in Results.



Introduction | MCP | Matlab Investigation | C Implementation | Results | Conclusions | References | Appendix