sorry,I may not have made myself clear.The GstBuffer (memory:NVMM,format=I420,width=1920,height=1080)is not from decodeToFd,it is from gstreamer pipeline.I can get the dma buffer fd through the pointer to NvbufSurface.I want to compare the difference between the DMA buffer parameters obtained in these two cases。In both cases, the simple code is as follows:
case 1:
//use decodeToFd interface to decode jpg image(1920*1080) to YUV420M
decodeToFd(fd,p_jpeg_in,jpeg_len,format,width,height);
//use NvBufferGetParams interface to get dma buffer params
NvBufferGetParams(fd,¶ms);
//printf params
for(int i = 0;i < params.num_planes;i++)
{
printf(“plane[%d],w=%d,h=%d,pitch=%d\n”,i,
params.width[i],params.height[i],params.pitch[i]};
case2:
//GstBuffer is get from sink pad probe buffer callback //function,memory:NVMM,format=I420,width=1920,height=1080
GstBuffer *buf = (GstBuffer *)info->data;
GstMapInfo in_map_info;
NvBufSurface *in_surf = NULL;
memset(&in_map_info, 0, sizeof(in_map_info));
gst_buffer_map(buf, &in_map_info, GST_MAP_READ))
in_surf = (NvBufSurface *)in_map_info.data;
//also use NvBufferGetParams interface to get dma buffer params
ret = NvBufferGetParams(in_surf->surfaceList[0].bufferDesc, ¶ms);
//printf params
for(int i = 0;i < params.num_planes;i++)
{
printf(“plane[%d],w=%d,h=%d,pitch=%d\n”,i,
params.width[i],params.height[i],params.pitch[i]};
The output parameters are printed as follows:
case 1:
plane[0]:w=1920,h=1088,pitch=2048
plane[1]:w=960,h=544,pitch=1024
plane[2]:w=960,h=544,pitch=1024
case 2:
plane[0]:w=1920,h=1080,pitch=2048
plane[1]:w=960,h=540,pitch=1024
plane[2]:w=960,h=540,pitch=1024
In two cases, the dma buffer is same,but case 1 output width and height are aligned, case 2 output width and height are original width and height。Why are the obtained parameters different?