User guide

Table Of Contents
6–2 Chapter 6: Alpha Blending MegaCore Function
Functional Description
Video and Image Processing Suite January 2013 Altera Corporation
User Guide
This behavior is illustrated by the following pseudo-code:
go = 0;
while (true)
{
status = 0;
read_non_image_data_packet_from background_layer();
read_control_first_pass(); // Check layer status
(disable/displayed/consumed)
for_each_layer layer_id
{
// process non-image data packets for displayed or consumed
layers
if (layer_id is not disabled)
{
handle_non_image_packet_from_foreground_layer(layer_id);
}
}
while (go != 1)
wait;
status = 1;
read_control_second_pass(); // Copies top-left coordinates to
internal registers
send_image_data_header();
process_frame();
}
For information about using Avalon-MM Slave interfaces for run-time control, refer to
“Avalon-MM Slave Interfaces” on page 3–17. For details of the control register maps,
refer to Table 6–5 on page 6–7. For information about the Avalon-MM interface
signals, refer to Table 6–4 on page 6–6.
Alpha Blending
When you turn on Alpha blending, the Avalon-ST input ports for the alpha channels
expect a video stream compliant with the Avalon-ST Video protocol. Alpha frames
contain a single color plane and are transmitted in video data packets. The first value
in each packet, transmitted while the
startofpacket
signal is high, contains the
packet type identifier 0. This condition holds true even when the width of the alpha
channels data ports is less than 4 bits wide. The last alpha value for the bottom-right
pixel is transmitted while the
endofpacket
signal is high.
It is not necessary to send control packets to the ports of the alpha channels. The
width and height of each alpha layer are assumed to match with the dimensions of the
corresponding foreground layer. The Alpha Blending Mixer MegaCore function must
recover cleanly if there is a mismatch although there may be throughput issues at the
system-level if erroneous pixels have to be discarded. All non-image data packets
(including control packets) are ignored and discarded just before the processing of a
frame starts.
The valid range of alpha coefficients is 0 to 1, where 1 represents full translucence, and
0 represents fully opaque.
For n-bit alpha values (RGBAn) coefficients range from 0 to 2
n
–1. The model interprets
(2
n
–1) as 1, and all other values as (Alpha value)/2
n
. For example, 8-bit alpha value
255 => 1, 254 => 254/256, 253 => 253/256 and so on.