Transformation of image with small dimensions fails

• Hardware Platform (Jetson / GPU)
Jetson Orin NX
• DeepStream Version
6.1, I think
• JetPack Version (valid for Jetson only)
• Issue Type( questions, new requirements, bugs)
Failure in NvBufSurfTransform with an image dimension below 16x16.

We have a few image creation and transformation tests that use images that are 2x2 for simplicity and ease of testing. We found that after we moved from the deprecated nvbuf_utils API to nvbufsurface, the test stopped working. Specifically, NvBufSurfTransform returned NvBufSurfTransformError_Execution_Error:

sudo DBG_NVBUFSURFTRANSFORM=1 ./imagebuffertest 
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:1710: NvBufSurfTransformSessionCreate=> Session created 0x213f1c30 (nil)
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:1836: libnvbufsurf_transform_init=> Init lib 0x213f1c30
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:819: taskTrim=> Starting clean up thread
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:2378: NvBufSurfTransformAsync=> Using default session created 
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:4370: NvBufSurfTransform_VIC=> NvVicCompose Failed

/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:2472: NvBufSurfTransformAsync=> VIC used srcbuf=0x214d4df0, filled=1, 2x2 fmt=NVBUF_COLOR_FORMAT_RGBA dstbuf=0x214d5560 filled=1, 2x2, fmt=NVBUF_COLOR_FORMAT_BGRA method=NvBufSurfTransformInter_Algo4 session=0x213f1c30 totaltime=173us
/dvs/git/dirty/git-master_linux/nvutils/nvbufsurftransform/nvbufsurftransform.cpp:2482: NvBufSurfTransformAsync=> Failed
NvBufSurfTransform() error with result -2

We spent a good while trying to figure out if we had performed the API migration improperly, but eventually discovered that if we made our test image 16x16 or greater, the conversion worked fine.

Is this an expected result? If so, is the size limitations documented/defined in code somewhere so we can refer to them in the future?

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
I have attached two pieces of sample code which are similar, one with 2x2 dimensions and one with 16x16 dimensions.

imagebuffertest_2x2.cpp (2.6 KB)
imagebuffertest_16x16.cpp (2.6 KB)

please share the result of “deepstream-app -v”

build command:
g++ -std=c++11 -o imagebuffertest imagebuffertest_16x16.cpp -I/usr/local/cuda-11.4/include -I/usr/src/jetson_multimedia_api/include -L/usr/local/cuda-11.4/lib64/ -L/opt/nvidia/deepstream/deepstream-6.2/lib -lcudart -lcuda -lnvbufsurftransform -lnvbufsurface

I can reproduce this issue, imagebuffertest_2x2 run fine, imagebuffertest_16x16 run failed. currently I also did not find the size limitations documented. we will check.
2x2 resolution is an extreme case, why do you need to process very small picture? you can use detected-min-w/detected-min-h to filter some small object when doing inference. please refer to nvinfer.

We use it in unit tests as it is easy to manually write out a 2x2 image and understand what each pixel is. Then we run through image conversions (like BGRA to RGBA) and confirm the pixels are converted properly. I understand this is not a normal image use, but it was functional before the nvbuf API change.

using NvBufSurfTransformCompute_VIC and NvBufSurfTransformCompute_GPU both failed.
Thanks for the shareing, currently please set min width and height to 16 for workaround. we will check.

1 Like