0

I'm working with a custom card that have customized Yocto distribution and use Imx6q SOC. This card purpose is mainly read video from Fpga and save it to a file. Fpga has trible buffer and generate an interrupt when Fpga memory was filled .Now I'm read and save video with these code part. But Frame rate is ~12 with 1360x1024 resolution and with 1080p I get ~5 fps. On Imx6q, specs said that SOC have capability to encode 1080p 30fps video but in reality I can't reach this speed.

  int fd_mem = open("/dev/mem", O_RDWR );
    
  if (fd_mem < 0) 
  {
    printf("/dev/mem error \n");
    exit(0);
  }

  void *vbase1  = NULL;
  void *vbase2  = NULL;
  void *vbase3  = NULL;
  void *vbase  = NULL;

  isize = width * height * 3/2;

  vbase1 = mmap (0, isize, PROT_READ|PROT_WRITE, MAP_SHARED, fd_mem, mParameters.mBufferAdd[0]);
  vbase2 = mmap (0, isize, PROT_READ|PROT_WRITE, MAP_SHARED, fd_mem, mParameters.mBufferAdd[1]);
  vbase3 = mmap (0, isize, PROT_READ|PROT_WRITE, MAP_SHARED, fd_mem, mParameters.mBufferAdd[2]);


  if (vbase == (void *) -1) 
  {
    printf ("mmap on given addr");
    close (fd_mem);
    exit(0);
  }


   while(1)
    {

      pause();
      if(msi_signal == mParameters.mSignalNumber[0])
        {
            t->input.paddr = mParameters.mBufferAdd[2];
            vbase = vbase1;
        }
        else if(msi_signal == mParameters.mSignalNumber[1])
        {
            t->input.paddr = mParameters.mBufferAdd[0];
            vbase = vbase2;
        }
        else if (msi_signal == mParameters.mSignalNumber[2])
        {
            t->input.paddr = mParameters.mBufferAdd[1];
            vbase = vbase3;
        }
        

        source = gst_bin_get_by_name (GST_BIN (pipeline), "appsrc");
        
        buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, vbase , isize, 0, isize,NULL, NULL);
        
        gst_app_src_push_buffer (GST_APP_SRC (source), buffer);
}


I want to find an effective way to pass video from Fpga memory to VPU?
  • I clearly need more details to help you. Yes Imx6q clearly encode full HD 1080p 30fps, Are you using the good encoder element (vpuenc_h264 ? ) Are you sure your buffers arrive with the expected framerate ? if your board has a screen could you send the raw frame to the screen ( with for example FpsDisplaySink element) ? Could you send us the pipeline with (in think you are using vpuenc_h264) are you doing some color conversions ? You also probably need to set timestamps on your buffer or you have configured appsrc to set pipeline buffer timestamp ? Best regards. – Ludovic Bouguerra Nov 23 '22 at 09:46
  • appsrc name=appsrc format=3 ! video/x-raw ,width=1360,height=1024,format=I420, framerate=25/1 ! queue2 ! imxvpuenc_h264 gop-size=30 bitrate=6000 ! rtph264pay ! udpsink host=192.168.1.5 port=5000 – N.karagöz Apr 05 '23 at 06:05

0 Answers0