Design Overview


This module shows how to move the 2D convolution filter from software to hardware using the PL optimized hls_video library that provides an OpenCV equivalent function.

btrd_dm8_2017.2.png



Design Components


This module requires the following components:
  • zcu102_base_trd (SDSoC)
  • filter2d (HW)
  • video_lib
  • video_qt2



Build Flow Tutorials


2D Filter Sample


This tutorial shows how to build the hls_video version of the 2D filter sample based on the Base TRD SDSoC platform.

  • Set the SYSROOT environment variable. This requires that you have previously completed the PetaLinux build step.
    Note 1 : Make sure you set the env variable in the same shell that is used to launch SDx. Also make sure the env variable is set before starting SDx, otherwise close and re-start SDx.
    Note 2: The below command assumes you are using the default yocto tmp directory. If you are using a custom yocto tmp directory, you need to modify the path accordingly.
    % export SYSROOT=$TRD_HOME/apu/petalinux_bsp/tmp/sysroots/plnx_aarch64
  • Open the existing SDx workspace from design module 7 using the SDx tool.
    % cd $TRD_HOME/apu/video_app
    % sdx -workspace . &
  • Expand the filter2d project and sources in the project explorer, select the filter2d_sds function and click 'Toggle HW/SW' to select this function for hardware acceleration.
    base-trd-2016-3-dm8-sdx-filter2d-hw.png
  • Verify the function was added to the HW functions in the project settings panel and the clock frequency is set to 299.97MHz
    base-trd-2017-1-dm8-sdx-project-settings.png
  • Right-click the filter2d project and select 'Clean Project' followed by 'Build Project'.
    Note: This step will take a while to complete.
    base-trd-2016-3-dm7-sdx-filter2d-build.png
  • Copy the content of the generated sd_card folder to the dm8 SD card directory
    % mkdir -p $TRD_HOME/images/dm8
    % cp -r filter2d/Release/sd_card/* $TRD_HOME/images/dm8

Video Qt Application


There is no need to rebuild the video_qt2 application if you have already built it in module 7, otherwise follow the instructions from module 7.

  • Copy the generated video_qt2 executable to the dm8 SD card directory.
    % cd $TRD_HOME/apu/video_app/video_qt2
    % cp video_qt2 $TRD_HOME/images/dm8/



Run Flow Tutorial


  • See here for board setup instructions.
  • Copy all the files from the $TRD_HOME/images/dm8 SD card directory to a FAT formatted SD card.
  • Power on the board to boot the images; make sure INIT_B, done and all power rail LEDs are lit green.
  • After ~30 seconds, the display will turn on and the application will start automatically, targeting the max supported resolution of the monitor (one of 3840x2160 or 1920x1080 or 1280x720). The application will detect whether DP Tx or HDMI Tx is connected and output on the corresponding display device.
  • To re-start the TRD application with the max supported resolution, run
    % run_video.sh
  • To re-start the TRD application with a specific supported resolution use the -r switch e.g. for 1920x1080, run
    % run_video.sh -r 1920x1080
  • The user can now control the application from the GUI's control bar (bottom) displayed on the monitor.
  • The user can select from the following video source options:
    • TPG (SW): virtual video device that emulates a USB webcam purely in software
    • USB: USB Webcam using the universal video class (UVC) driver
    • TPG (PL): Test Pattern Generator implemented in the PL
    • HDMI: HDMI input implemented in the PL
  • The user can select from the following accelerator options:
    • 2D convolution filter with configurable coefficients
  • The supported accelerator modes depend on the selected filter:
    • OFF - accelerator is disabled/bypassed
    • SW - accelerator is run on A53
    • HW - accelerator is run on PL
    btrd-dm8-run-2017.1.jpg
  • The video info panel (top left) shows essential settings/statistics.
  • The CPU utilization graph (top right) shows CPU load for each of the four A53 cores.



Return to the Design Tutorials Overview.