NvVideoConverter limits YUV range to [16...235] after updating Jetpack to 4.6.1

Hello,

I’m using NvVideoConverter and NvJpegEncoder to convert image to jpeg on Jetson Xavier NX. After updating Jetpack from 4.5.0 to 4.6.1, value ranges of output jpeg are limited to [16…235].

My program does:

NV12 in full range – (NvVideoConverter) → YUV420 – (NvJpegEncoder) → jpeg output

I tried calling NvVideoConverter::setYUVRescale with V4L2_YUV_RESCALE_NONE and V4L2_YUV_RESCALE_STD_TO_EXT, but it did not solve the problem. Passing full range YUV420 to NvJpegEncoder without NvVideoConverter, the output range retains full [0…255].

I found a similar problem in this post.
NvBufferColorFormat_YUV420 range difference in new Tegra Release?

How can I keep full range with NvVideoConverter? It would be great if anyone can help me. Thank you for your time in advance!

Passing full range YUV420 to NvJpegEncoder without NvVideoConverter, the output range retains full [0…255].

This comment was my mistake. It seems, creating buffer using NvBufferCreateEx() with NvBufferColorFormat_YUV420_709_ER works around the problem. However, I found no way to change the type of buffer created by NvVideoConverter.

Hi,
Please call NvBufferTransform() instead of usingNvVideoConverter. And if there is further issues, please replace this prebuilt lib and give it a try:

Jetson/L4T/r32.7.x patches - eLinux.org

[MMAPI] 07_video_convert sample result not match as expected