Debugging Control Software Application - 2020.2 English

H.264/H.265 Video Codec Unit v1.2 Solutions LogiCORE IP Product Guide (PG252)

Document ID
PG252
Release Date
2020-11-24
Version
2020.2 English

To debug control software based application (ctrlsw_encoder, ctrlsw_decoder), perform the following steps.

  1. Run file to file-based encoder and decoder sample applications to ensure they operate as expected.
    • H.264 decoding file-to-file
      ctrlsw_decoder -avc -in input-avc-file.h264 -out ouput.yuv
    • H.265 decoding file-to-file
      ctrlsw_decoder -hevc -in input-hevc-file.h265 -out ouput.yuv
    • Encoding file-to-file
      ctrlsw_encoder –cfg encode_simple.cfg

    The application exits with appropriate error message. Refer error description table for more details. For example, if the VCU power is insufficient to encode 4kp resolution file at 120fps, the following message appears:

    ctrlsw_encoder -cfg AVC_test.cfg -i test_4Kp120_nv12.yuv -o /dev/null 
    Allegro DVT2 - AVC/HEVC Encoder Reference Software v1.0.41 - Copyright (C) 2018 Confidential material
    Channel creation failed, processing power of the available cores insufficient
    Codec error: Channel creation failed, processing power of the available cores insufficient
    To debug above error, change either Frame rate(4kp60) or resolution(1080p120) in cfg file which can be handled by VCU and re-run.

    Application exit with memory error if CMA is insufficient. For example:

    ctrlsw_encoder -cfg AVC_test.cfg -i test_4Kp60_nv12.yuv -o /dev/null 
    Allegro DVT2 - AVC/HEVC Encoder Reference Software v1.0.41 - Copyright (C) 2018
    Confidential material
    [53.119829] cma: cma_alloc: alloc failed, req-size: 3078 pages, ret: -12
    [53.126542] al5e a0100000.al5e: Can't alloc DMA buffer of size 12607488
    GET_DMA_FD: Cannot allocate memory
    [53.137916] cma: cma_alloc: alloc failed, req-size: 10522 pages, ret: -12
    [53.144712] al5e a0100000.al5e: Failed internal buffers allocation, channel wasn't 
    created
    Memory shortage detected (DMA, embedded memory or virtual memory)
    Codec error: Memory shortage detected (DMA, embedded memory or virtual memory)

    To mitigate the memory error, check that CMATotal and CMAFree are sufficient using the following command:

    cat /proc/meminfo

    Increase CMA size either in U-Boot using a command, setenv bootargs ${bootargs} cma=xxxxM or, while building the Linux kernel using kernel configuration property.

  2. If the output file is not generated and no failure/error message occurs on the terminal, check for kernel level message using a command:
    dmesg

    Check "al5e", “al5d” keyword in the dmesg log for the error, if any.

  3. If the application freezes, debug using “gdb”. For that, remove optimization from control software Makefile as below.
    replace: CFLAGS+=-O3
    By CFLAGS+=-O0

    Then run the application using the following command:

    gdb –args ctrlsw_encoder -cfg AVC_test.cfg -i test_4Kp60_nv12.yuv -o /dev/null

    which provides the gdb shell. Type “run” to execute the application

    (gdb)run

    When it hangs, use the backtrace function to view the last function flow from where it hangs.

    (gdb)bt