本案例处理的是RGB+a,每个色彩的采样为10位位宽。
1、在Mixer IP中打开Alpha Blending Enable 和Alpha Input Stream Enable。这样在Block Diagram中可以看到din0_data位宽为80位,而dout_data依然为60位位宽。
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180154793-1477285199.png)
2、在FrameBufferII IP、Scaler II IP和CVI ii中都要把Number of Color planes设置为4。其实就 RGB+A 4个处理通道。
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180230832-1630175737.png)
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180236038-1253605287.png)
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180239566-1224371262.png)
3、要明白alpha通道是怎样传输数据的。这一点可以从VIP相关的文档上找到答案。所以在CVI的输入信号处理上如下:
.cvi_rgb_din1_vid_data ({ch2_cvi_rgb_din[59:30],alpha_data,ch2_cvi_rgb_din[29:0],alpha_data}),
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180305388-1470901897.png)
4、最后要在Nios中打开动态的alpha功能。这也就是在Mixer中控制寄存器中Input control n中把10+5n的第3:2位设置为10(b).在程序中altera也为我们提供了相应的程序。我们只需要在程序中打开即可。
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180312430-317035765.png)
![](https://img2018.cnblogs.com/blog/378458/201810/378458-20181029180319836-1211340285.png)
void MixerII::set_input_dynamic_alpha_enable(int input_stream,bool enabled )
{
int status = this ->do_read(get_register_addr(MixerII::INPUT_CONTROL,input_stream));
if( enabled )
status |= STATUS_DYNAMIC_ALPHA;
else
status &= STATUS_DYNAMIC_ALPHA;
this -> do_write(get_register_addr(MixerII::INPUT_CONTROL,input_stream),status);
}