This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62A7-Q1: Encoder limitation

Part Number: AM62A7-Q1

Tool/software:

Hi Expert,

as you know, the AM62A support encoder up to 240MP/s, in a new DRV project from CAR OEM, they need 8M*30fps for Front Camera+ 2M*30fps for Rear camera. I think the encoder will be the bottle neck, do you have any suggestion to support this using AM62A?

BR,

Biao

  • Hi Biao,

    I used the following script to test this with the imx219 RPi camera:

    #!/bin/bash
    
    MULTICASTADDR=224.1.1.1
    PORT=5000
    MULTICASTADDR1=224.2.2.1
    PORT1=5000
    
    HEVC_PROFILE="main"
    HEVC_LEVEL="1"
    VIDEO_BITRATE=0
    
    TEMP=$(getopt -o 'p:l:b:h' --long 'profile:,level:,bitrate:,input:,output:,help,mc:,port:,mc1:,port1:' -n '$0' -- "$@")
    
    if [ $? -ne 0 ]; then
            echo 'Terminating...' >&2
            exit 1
    fi
    
    eval set -- "$TEMP"
    unset TEMP
    
    while true; do
            case "$1" in
                    '-h'|'--help')
                            echo "$0 - H.265 compress a JPEG file into a one second stream"
                            echo "Parameters:"
                            echo "  -p main|main-still-picture|main-10 (HEVC Profile)"
                            echo "  -l 1|2|2.1|3|3.1|4|4.1|5|5.1 (HEVC Level)"
                            echo "  -b 0..700000000 (Video Bitrate)"
                            echo "  --mc <multicast ip address>"
                            echo "  --port <port number> (default 5000)"
                            echo "  --mc1 <multicast ip address>"
                            echo "  --port1 <port number> (default 5000)"
                            echo "  -h This help"
                            exit 0
                            shift
                            continue
                    ;;
                    '-p'|'--profile')
                            case "$2" in
                                    'main'|'Main'|'0')
                                            HEVC_PROFILE="main"
                                            ;;
                                    'main-still-picture'|'1')
                                            HEVC_PROFILE="main-still-picture"
                                            ;;
                                    'main-10'|'2')
                                            HEVC_PROFILE="main-10"
                                            ;;
                                    *)
                                            HEVC_PROFILE="main"
                                            ;;
                            esac
                            echo "HEVC Profile: '$HEVC_PROFILE'"
                            shift 2
                            continue
                    ;;
                    '-l'|'--level')
                            case "$2" in
                                    '1'|'2'|'2.1'|'3'|'3.1'|'4'|'4.1'|'5'|'5.1')
                                            HEVC_LEVEL="$2"
                                            ;;
                                    *)
                                            HEVC_LEVEL="1"
                                            ;;
                            esac
                            echo "HEVC Level: '$HEVC_LEVEL'"
                            shift 2
                            continue
                    ;;
                    '-b'|'--bitrate')
                            echo "Video Bitrate: '$2'"
                            VIDEO_BITRATE=$2
                            shift 2
                            continue
                    ;;
                    'mc')
                            MULTICASTADDR=$2
                            shift 2
                            continue
                    ;;
                    'port')
                            PORT=$2
                            shift 2
                            continue
                    ;;
                    'mc1')
                            MULTICASTADDR1=$2
                            shift 2
                            continue
                    ;;
                    'port1')
                            PORT1=$2
                            shift 2
                            continue
                    ;;
                    '--')
                            shift
                            break
                    ;;
                    *)
                            echo 'Internal error!' >&2
                            exit 1
                    ;;
            esac
    done
    
    media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB10_1X10/1920x1080 field:none]'
    gst-launch-1.0 -q v4l2src device=/dev/video3 io-mode=dmabuf-import do-timestamp=true \
            ! video/x-bayer, width=1920, height=1080, framerate=30/1, format=rggb10 \
            ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_SONY_IMX219_RPI" \
                    dcc-isp-file=/opt/imaging/imx219/linear/dcc_viss_10b.bin \
                    sink_0::dcc-2a-file=/opt/imaging/imx219/linear/dcc_2a_10b.bin format-msb=9 \
            ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 \
            ! tiovxmultiscaler name=multi target=0 \
            multi.src_0 \
            ! video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1 \
            ! mosaic.sink_0 \
            multi.src_1 \
            ! video/x-raw, format=NV12,width=1920, height=1080, framerate=30/1 \
            ! mosaic.sink_1 \
            multi.src_2 \
            ! video/x-raw, format=NV12,width=1920, height=1080, framerate=30/1 \
            ! mosaic.sink_2 \
            multi.src_3 \
            ! video/x-raw, format=NV12,width=1920, height=1080, framerate=30/1 \
            ! mosaic.sink_3 \
            multi.src_4 \
            ! video/x-raw, format=NV12,width=1920, height=1080, framerate=30/1 \
            ! queue max-size-buffers=1 leaky=0 \
            ! v4l2h265enc extra-controls="enc,prepend_sps_and_pps_to_idr=1,video_gop_size=5" \
            ! rtph265pay config-interval=1 pt=96 \
            ! udpsink host=${MULTICASTADDR1} auto-multicast=true port=${PORT1} \
            tiovxmosaic name=mosaic target=2 \
            sink_0::startx="<0>" sink_0::starty="<0>" \
            sink_1::startx="<1920>" sink_1::starty="<1080>" \
            sink_2::startx="<0>" sink_2::starty="<1080>" \
            sink_3::startx="<1920>" sink_3::starty="<0>" \
            ! video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 \
            ! queue max-size-buffers=1 leaky=0 \
            ! v4l2h265enc extra-controls="enc,prepend_sps_and_pps_to_idr=1,video_gop_size=5" \
            ! rtph265pay config-interval=1 pt=96 \
            ! udpsink host=${MULTICASTADDR} auto-multicast=true port=${PORT}

    This script receives a 2MP (Full HD) video from the camera, runs it through the ISP, passes it to the multiscaler, and then uses the multiscaler to generate 5 streams with the same resolution. Four of those streams are passed to the tiovxmosaic element, and are combined into a single 3840x2160 (8 MP) stream. The fifth stream is used as a second Full HD stream. Both streams are passed into the encoder, and then passed to the RTP payloader and an udp sink.

    This runs at 30 fps at full speed, and in my opinion shows that the encoder can handle a 8M*30fps and a 2M*30fps stream.

    Please note however that I am running into trouble when running a similar setup with an 8MP sensor, where I use a tee to duplicate the 8M stream, and scale the second one down to full HD. I'm not sure if you would run into the same bottlenecks that I do (and I'm not sure yet what the bottlenecks are).

  • Hi Bas,

    Thanks for the test, I said this is bottleneck because of the theory calculation, 8M*30+2M*30 require 300MP/s encoder bandwidth, but AM62A only support 240MP/s, correct me if my theory calculation is wrong.

    BR,

    Biao 

  • Hi Biao,

    According to the reference manual (7.4.1 first alinea):


    The Video Accelerator is a 4K codec that supports both HEVC and H.264/AVC video formats. It provides high
    performance encode and decode capability up to 8bit 4K@60fps with a single-core architecture.

    If it can do 4K @ 60 FPS, it ought to be able to do two times 4K @ 30 FPS, and 4K @ 30 and Full HD @ 30 fps should be pretty comfortably within margins.

    Regards,

    Bas Vermeulen

  • Hi Bas,

    Sure, thanks for support.

    BR,

    Biao

  • Thanks Bas for the clarification.

    Biao, Li - I will go ahead and close this thread.

    Best Regards,

    Suren