NvBufferTransform Two Point Green Square

Hi guys
I have a problem with NvBufferTransform to transform CPU UYVY I422 buffer to I420 NVMM buffer through NvBufferTransform.


It is clear from image that we have two extra tiny green square after transformation, does it need any extra settings for transformation to remove them?
Thanks so much.

Hi,
We don’t see this kind of issue before. Would need your help to share a test sample, or a patch on our reference sample to replicate the issue. So that we can set up and check. OUr reference samples are in

/usr/src/jetson_multimedia_api

Hi
Thanks so much for your attention. This is our code we want convert UYVY 1920*1080 CPU frame to NVMM I420 frame without using nvvidconv. We see these two green square.

GstFlowReturn onNewSampleFromSink(GstElement *elt,  gpointer *This)
{
    //initial setup phase
    int dmabuf_fd;
    int dst_fd;
    //input frame color space is UYVY and 1920*1080 from v4l2src
    NvBufferCreate(&dmabuf_fd, 1920, 1080, NvBufferLayout_Pitch, NvBufferColorFormat_UYVY);
    NvBufferCreateParams outPut_params  = {0};
    NvBufferParams paramsOut;
    NvBufferGetParams(dmabuf_fd,&paramsOut);
    outPut_params.payloadType = NvBufferPayload_SurfArray;
    outPut_params.layout = NvBufferLayout_Pitch;
    outPut_params.width = 1920;
    outPut_params.height = 1080;
    outPut_params.colorFormat = NvBufferColorFormat_YUV420;
    outPut_params.nvbuf_tag = NvBufferTag_VIDEO_CONVERT;
    //converted frame color space is I420 NVMM without cropping, 
    //scaling, flipping or any filter 
    NvBufferCreateEx(&dst_fd, &outPut_params);
    // for each frmae 
    GstSample *sample;
    GstBuffer  *buffer;
    GstElement *source;
    GstFlowReturn ret;
    /* get the sample from appsink */
    sample = gst_app_sink_pull_sample(GST_APP_SINK (elt));
    GstBuffer  * buffer_sample = gst_sample_get_buffer (sample);
    // GstBuffer  * app_buffer = gst_buffer_copy (buffer_sample);
    GstMapInfo map;
    //    /* Mapping a buffer can fail (non-writable) */
    gst_buffer_map (buffer_sample, &map, GST_MAP_READ);
    source = gst_bin_get_by_name (
                GST_BIN (This->appSource),
                "appSrc");
    char *virtual_addr;
    Raw2NvBuffer(map.data, 0, 1920, 1080, dmabuf_fd);
  
    NvBufferCreateParams outPut_params  = {0};
    NvBufferParams paramsOut;
    NvBufferGetParams(dmabuf_fd, &paramsOut);
    outPut_params.payloadType = NvBufferPayload_SurfArray;
    outPut_params.layout = NvBufferLayout_Pitch;
    outPut_params.width = 1920;
    outPut_params.height = 1080;
    outPut_params.colorFormat = NvBufferColorFormat_YVU420;
    outPut_params.nvbuf_tag = NvBufferTag_NONE;
    //NvBufferCreateEx(&dst_fd, &outPut_params);
    NvBufferTransformParams transParams ={0};
    memset(&transParams, 0, sizeof(transParams));
    transParams.transform_flag = NVBUFFER_TRANSFORM_FLIP;
    transParams.transform_filter = NvBufferTransform_Filter_Bilinear;
    NvBufferTransform(dmabuf_fd , dst_fd, &transParams);
    NvBufferParamsEx params = { 0, };
    
    if (NvBufferGetParamsEx (dst_fd, &params)) {
        
    }
    buffer = gst_buffer_new_wrapped(params.params.nv_buffer, params.params.nv_buffer_size);
    g_signal_emit_by_name(GST_APP_SRC (source), "push-buffer", buffer, &ret);
    
}

Thanks a lot.

Hi,
This is partial code and we are not able to build and run it. Would be great if you can share a complete sample.

Is your source from USB camera? If yes, you may try nvv4l2camerasrc plugin.

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