Gradual Decoder Refresh (GDR) when GOPCtrlMode
is
set to LOW_DELAY_P, the GDRMode parameter used to specify whether GDR scheme should be
used or not. When GDR is enabled (horizontal/vertical), the encoder inserts intra MBs
row/column in the picture to refresh the decoder. The Gop.FreqIDR specifies the
frequency at which the refresh pattern should happen. To allow full picture refreshing,
Gop.FreqIDR parameter should be greater than the number of CTB/MB rows (GDR_HORIZONTAL)
or columns (GDR_VERTICAL).
When the GDR is enabled, the encoder inserts SPS/PPS along with an SEI recovery message at the start of a refresh pattern, and the decoder can synchronize to the SEI recovery points in the bit-stream. The advantage of having the non-IDR decoder synchronization is that there is no longer any need to send IDR pictures in case of a packet loss scenario. Inserting periodic IDR pictures in video encoding generates a spike in bit consumption which is not recommended for video streaming. Vertical GDR mode has an MV (motion vector) limitation that can cause full picture reconstruction to take more than one refresh cycle. Refer to the following table for more details:
AVC/H.264 | HEVC/H.265 | |
---|---|---|
GDR_VERTICAL: A vertical intra-column moving from left to right | Exact match is supported. Deblocking filter is automatically disabled | Exact match is NOT supported; it can take up to two refresh intervals to fully reconstruct the frame deblocking filter is automatically disabled |
GDR_HORIZONTAL: A horizontal intra-row moving from top-to-bottom | Exact match is supported deblocking filter is automatically disabled | Exact match is supported deblocking filter is automatically disabled |
A sample gstreamer pipeline is as follows. Use "gdr-mode=horizontal" & "periodicity-idr=<higher than Picture Height in Mbs>" in the encoder element.
gst-launch-1.0 filesrc location="/mnt/test_4Kp60_NV12.yuv"! rawvideoparse width=3840 height=2160 format=nv12 framerate=30/1! omxh264enc control-rate=constant target-bitrate=60000 gop-mode=low-delay-p gdr-mode=horizontal periodicity-idr=270! video/x-h264, profile=high! Filesink location="/run/test_output.avc"
At the control software level, add the following section and parameter (in the GOP section of the cfg file)
[GOP] #---------------------------------------------------
GopCtrlMode = LOW_DELAY_P
Gop.GdrMode = GDR_HORIZONTAL
Gop.FreqIDR = 270
GOP.FreqIDR
at
control software and periodicity-idr at gstreamer when GDR mode is enabled.