Altera Home Page
文档资料 许可
在线购买 下载

  主页   |   产品   |   支持   |   最终市场   |   技术中心   |   教育与活动   |   公司介绍   |   在线购买  
  mySupport   |   器件   |   软件   |   IP   |   设计范例   |   参考设计  

 产品
      MAX/MAX II
      Stratix/Stratix GX
      Nios II
  
 功能
      算法
      存储器
      总线及I/O
      逻辑
      接口与外设
      DSP
      通信
      PLL & Clocking
  
 设计输入方法
      Quartus II软件工程
      Tcl
      VHDL
      Verilog HDL
      C Code 范例
      DSP Builder
      TimeQuest
   片内调试
  
 仿真工具
      Mentor Graphics ModelSim
      Cadence NCsim
      Synopsys VCS
  
 旧范例
      图形编辑器
      AHDL
  

Alpha Blending Mixer Picture-in-Picture Design Example

This design example illustrates how to implement picture-in-picture (PiP) video mixing using Altera's Alpha Blending Mixer MegaCore® function in DSP Builder. In PiP, the background video is played in the center of the screen, while smaller square video clips are played in corners of the screen. The Alpha Blending Mixer MegaCore function allows up to eight video image layers to play simultaneously. Furthermore, every foreground layer can use a different alpha value to control its transparency, resulting in true image blending effects.

In this design example, two video image layers demonstrate the operation of PiP. User-specified location information for the foreground layer is loaded into the Alpha Blending Mixer MegaCore function's control registers (via the Avalon® memory-mapped control interface) prior to the input of the video streams. Once the location information is decided for all image layers, the input data streams are mixed in the Alpha Blending Mixer MegaCore function. The output video data is written into a binary data file using MATLAB Simulink Video Sink. Using a video conversion utility provided in this package, you can convert the output binary file to an .avi file for display. A binary-to-avi conversion block is included in the design to implement the video conversion automatically. The final output of this design example is pre-simulated and stored as a reference in caroutput.avi at 3 fps.

Download the files used in this example:

The use of this design is governed by, and subject to, the terms and conditions of the Altera Hardware Reference Design License Agreement.

Files in the zip download include:

  • alpha_mixer.mdl - DSP Builder design file
  • ini.m - MATLAB initialization file for the design example
  • avi-is-avi.exe - DOS executable to convert an avi file to and from a binary file
  • background.bin - Input 640 x 480 background binary video stream
  • foreground.bin - Input 176 x 144 foreground binary video stream
  • caroutput.avi - Pre-simulated output video

Figure 1. Top-Level Diagram of the Alpha Blending Mixer Picture-in-Picture Design Example in DSP Builder

Figure 1. Top-Level Diagram of the Alpha Blending Mixer Picture-in-Picture Design Example in DSP Builder
View Full Size

In this example, the Alpha Blending Mixer intellectual property (IP) MegaCore function uses the parameters shown in Table 1.

Table 1. Parameter Description 
Parameter Value Description
Number of Layers 2 Number of image layers to overlay
Input Resolution - 640 width x 480 height (pixels) for background layer
176 width x 144 height (pixels) for foreground layer
Bits-Per-Pixel Per Color Plane 8 Number of bits per pixel per plane
Number of Color Planes in Sequence 3 Input video streams are sent as R'G'B' R'G'B' R'G'B'
Enable Alpha Blending on Alpha data sink ports are generated for streams of alpha values
Alpha Bits-Per-Pixel Per Color Plane 4 Number of bits used to represent the alpha coefficient
Foreground Alpha Input Value 4 Foreground layer has equivalent alpha value 0.25
Foreground Image Location
X Coordinate
463 The X coordinate of the bottom-left corner of the foreground layer
Foreground Image Location
Y Coordinate
335 The Y coordinate of the bottom-left corner of the foreground layer

Signals

Table 2 defines the input and output signals of the Alpha Blending Mixer MegaCore function.

Table 2. Signals for the Alpha Blending Mixer MegaCore Function
Signal Direction Description
alpha_in_1_data Input Alpha data stream for the foreground layer.
alpha_in_1_valid Input Alpha data valid signal for the foreground layer.
alpha_in_0_data Input Alpha data stream for the foreground layer.
alpha_in_0_valid Input Alpha data valid signal for the foreground layer.
din_0_data Input Data input bus for the background layer.
din_0_valid Input Data valid signal for the background video stream.
din_1_data Input Data input bus for the foreground layer.
din_1_valid Input Data valid signal for the foreground video stream.
dout_ready Input Data output ready signal.
control_av_address Input Avalon memory-mapped slave interface mixer control address lines.  Specifies control register offsets into the slave address space.
control_av_chipselect Input Avalon slave interface mixer control chip-select signal. The input port ignores all other Avalon signal inputs unless this signal is asserted.
control_av_write Input Avalon slave interface mixer control write request signal.
control_av_writedata Input Avalon slave interface mixer control lines for write data transfers. Video image location information is written into the control registers.
control_test_writetog Output Test port associated with Avalon-MM slave port mix_control. This port exists for internal testing purposes only and should not be connected in the user design.
reset Input MegaCore function asynchronous reset signal.
alpha_in_0_ready Output Alpha data input ready signal for the background.
alpha_in_1_ready Output Alpha data input ready signal for the foreground.
din_0_ready Output Video image data input ready signal for the background.
din_1_ready Output Video image data input ready signal for the foreground.
dout_data Output Data output bus.
control_av_readdata Output Avalon-MM readdata bus of slave port mix_control. These output lines are used for read transfers.
control_test_writeack Input Test port associated with Avalon-MM slave port mix_control. This port exists for internal testing purposes only and should not be connected in the user design.
dout_valid Output Data valid signal that indicates the validity of the output data signals.

Related Links

Design Examples Disclaimer

These design examples may only be used within Altera Corporation devices and remain the property of Altera. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.

  请填写反馈意见