Research Article

FPGA Acceleration of Communication-Bound Streaming Applications: Architecture Modeling and a 3D Image Compositing Case Study

Listing 1

Code for the compositing.
/⋆compose function
 Parameters:
pic_a: base address of first framebuffer
pic_b: base address of second framebuffer
size: frame size in pixels
 Note:
 –pic_a is also the destination of the composed
 frame
 –framebuffers are directly followed
 by z-buffers, that is, z_a = pic_a + size
/
void compose (int pic_a, int pic_b, int size) {
 //calculate base addresses of z-buffers
int z_a = pic_a + size;
int z_b = pic_b + size;
for (int i = 0; i < size; i++) {
   if (z_b[i] < z_a[i]) {
   pic_a[i] = pic_b[i];
   z_a[i] = z_b[i];
 }
}