Scene Change Detection - 2023.1 English

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

Document ID
Release Date
2023.1 English

The AMD video scene change detection IP provides a video processing block that implements scene change detection algorithm. The IP core calculates the histogram on a vertically subsampled luma frame for consecutive frames. The histogram of these frames are then compared using the sum of absolute differences (SAD). This IP core programmable through a comprehensive register interface to control the frame size, video format, and subsampling value. For more information, see the Video Scene Change Detection LogiCORE IP Product Guide (PG322).

The scene change detection IP is a configurable IP core that can read up to eight video streams in memory mode. In memory mode. All inputs are read from memory mapped AXI4 interface. The IP supports resolutions ranging from 64x64 to 8192x4320 with various 8-bit and 10-bit color formats. The IP sends the interrupt after generating the SAD values for all the input streams for every frame. In case of memory mode, the SAD values are calculated for every input stream one after the other sequentially and the interrupt is after the SAD calculation of the final stream. On the interrupt generation, the SAD values are read from SAD registers for configured number of streams to compare them with a user decided threshold value to determine if a scene change has occurred.

Interlaced scene change detection is supported in the memory mode. For interlaced content, SAD values are computed for each field instead of each frame, so a scene change can be detected in between fields of the same frame.

The most important application of scene change detection are video surveillance, machine learning and video conference. In these use cases, the SCD IP would be in the capture pipeline and the generate event is attached with each buffer captured. The same event is passed along with the buffer to the encoder, where the encoder makes decisions to insert an I-frame instead of a P-frame or a B-frame. Inserting an I-frame at the place where a scene is changed would retain the quality of the video.

Gstreamer pipelines:

  • File → decode → scd → encode
    gst-launch-1.0 filesrc location=file.mp4 ! qtdemux ! h264parse ! omxh264dec ! queue ! xilinxscd io-mode=5 ! queue ! omxh264enc target-bitrate=20000 control-rate=2 cpb-size=5000 ! filesink location=file.264
  • YUV → scd → encode
    gst-launch-1.0 filesrc location=file.yuv ! rawvideoparse width=1920 height=1080 format=nv12 framerate=30/1 ! xilinxscd ! omxh264enc target-bitrate=8000 control-rate=2 cpb-size=4000 ! filesink location=file.264