Hello,
I have small problem with NvBufSurfTransform
allocating buffers
source is NVBUF_COLOR_FORMAT_UYVY color format and destination NVBUF_COLOR_FORMAT_RGBA
NvBufSurfaceAllocateParams input_params = {0};
input_params.params.width = _width;
input_params.params.height = _height;
input_params.params.layout = NVBUF_LAYOUT_PITCH;
input_params.params.colorFormat = (NvBufSurfaceColorFormat)colorFormat;
input_params.params.memType = NVBUF_MEM_SURFACE_ARRAY;
input_params.memtag = NvBufSurfaceTag_NONE;
int res = NvBufSurfaceAllocate (&_nvBuffSurface, 1, &input_params);
transformation params
memset(&transform_params, 0, sizeof(transform_params));
transform_params.transform_flag = NVBUFSURF_TRANSFORM_FILTER; // | NVBUFSURF_TRANSFORM_FLIP;//| NVBUFSURF_TRANSFORM_CROP_SRC | NVBUFSURF_TRANSFORM_CROP_DST;
transform_params.transform_filter = NvBufSurfTransformInter_Default;
transform_params.transform_flip = NvBufSurfTransform_None;//userFlipToNvFlip(flip);
transform_params_src_rect.left = 0;
transform_params_src_rect.top = 0;
transform_params_src_rect.width = _origWidth;
transform_params_src_rect.height = _origHeight;
transform_params_dst_rect.left = 0;
transform_params_dst_rect.top = 0;
transform_params_dst_rect.width = _finalWidth;
transform_params_dst_rect.height = _finalHeight;
transform_params.src_rect = &transform_params_src_rect;
transform_params.dst_rect = &transform_params_dst_rect;
copy data from usb cam to source buffer and after try to convert to rgb
int result = Raw2NvBufSurface ((unsigned char *)data, 0, 0, _origWidth, _origHeight, surf_src);
debug("GstirCam::onFrameReadyEx copy done [%d]", result);
debug("after copy: src.dataPtr=%p planes=%d", surf_src->surfaceList[0].dataPtr, surf_src->surfaceList[0].planeParams.num_planes);
if (!surf_src->surfaceList[0].dataPtr) {
error("Source dataPtr NULL after Raw2NvBufSurface");
// _man->release_buf(frame);
return;
}
auto res = NvBufSurfTransform (surf_src, surf_dst, &transform_params);
// result = NvBufferTransform(fd, frame->get_buf_fd(), &transform_params);
debug("GstirCam::onFrameReadyEx to rgba transform %d", res);
Raw2NvBufSurface - always fine (return 0)
but NvBufSurfTransform always return -3
I try to build my plugin that work fine on Nano to Orin platform
➜ ~ cat /etc/nv_tegra_release
R35 (release), REVISION: 5.0, GCID: 35550185, BOARD: t186ref, EABI: aarch64, DATE: Tue Feb 20 04:46:31 UTC 2024
thanks for any help



