Decoder Error with Bt.709 H264

There is a problem with the decoder if the fields colour_primaries, transfer_characteristics and matrix_coefficients in the SPS NAL Unit are all set to 1 (Bt.709).
cuGraphicsEGLRegisterImage will fail with CUDA_ERROR_INVALID_VALUE when called on a EGLImageKHR from a capture-plane-buffer dma_fd.
If the same capture-plane-buffer is queued to the V4L2 Video Converter instead as done in the 02_video_dec_cuda sample, you get following error:
libv4l2_nvvidconv (0):(1688) (ERROR) : NvDdkVicConfigure Failed
libv4l2_nvvidconv (0):(1710) (ERROR) : NVVIDCONV ERROR 2

Steps to reproduce:

cd /usr/src/jetson_multimedia_api
ffmpeg -i ./data/Video/sample_outdoor_car_1080p_10fps.h264  -color_primaries bt709  -color_trc bt709  -colorspace bt709 ./data/Video/sample_outdoor_car_1080p_10fps_bt709.h264
./samples/02_video_dec_cuda/video_dec_cuda ./data/Video/sample_outdoor_car_1080p_10fps_bt709.h264 H264 --disable-rendering -o test.nv12

this will result in the following output:

Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Starting decoder capture loop thread
Video Resolution: 1920x1080
libv4l2_nvvidconv (0):(802) (INFO) : Allocating (14) OUTPUT PLANE BUFFERS Layout=1
libv4l2_nvvidconv (0):(818) (INFO) : Allocating (14) CAPTURE PLANE BUFFERS Layout=0
Query and set capture successful
Input file read complete
libv4l2_nvvidconv (0):(1688) (ERROR) : NvDdkVicConfigure Failed
libv4l2_nvvidconv (0):(1710) (ERROR) : NVVIDCONV ERROR 2

Version used:

cat /etc/nv_tegra_release
# R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t186ref, EABI: aarch64, DATE: Mon Jul 26 19:36:31 UTC 2021
nvidia-l4t-jetson-multimedia-api: 32.6.1-20210916210945
nvidia-l4t-multimedia: 32.6.1-20210916210945

Hi,
In 02 sample it uses NvVideoConverter class and bt709 is not supported. Please refer to 00_video_decode to use NvBufferTransform() function.

should bt709 FullRange work with NvBuffer and cuGraphicsEGLRegisterImage?
Because right now i have the same issue as cuGraphicsEGLRegisterImage fails on NvBufferColorFormat_NV12_709 frames but with NvBufferColorFormat_NV12_709_ER instead of NvBufferColorFormat_NV12_709. (NvBufferColorFormat_NV12_709 is working)

Hi,
In the topic NvBufferColorFormat_NV12_709 is added to cuGraphicsEGLRegisterImage(). NvBufferColorFormat_NV12_709_ER is not added. Does it work in your use-case by converting to NvBufferColorFormat_NV12_709 whiling calling cuGraphicsEGLRegisterImage(). And then convert back to NvBufferColorFormat_NV12_709_ER through NvBufferTransform()?

i want to keep the input colorspace and map it to cuda. so converting to NV12_709 would not be an option for me.
could you please add NvBufferColorFormat_NV12_709_ER to cuGraphicsEGLRegisterImage as well.
is there any other colorspace known not to work with cuGraphicsEGLRegisterImage?
does cuGraphicsEGLRegisterImage() do any Colorspace transformation or why is it depending on this information?

Hi,
Please try with the attachment.
r32_6_1_TEST_libcuda.so.1.1.zip (3.6 MB)

In the prebuilt lib, NvBufferColorFormat_NV12_709_ER is added in cuGraphicsEGLRegisterImage(). Please backup original prebuilt lib before the replacement.

i tested your prebuild. It is working now. thank you.
when can i expect this to be released as an update?

Hi,
The latest release is Jetpack 4.6.1(r32.7.1) and is just out-of-the-oven. The next release will not be seen in a short time. If you need the fix for r32.7.1, we can attach the prebuilt lib on this topic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.