Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Zero copy between V4L2 (uvcvideo) and VPP/ENCODE

RobertE
Beginner
720 Views

Hi,

 

I'd like to capture video frame data from the "uvcvideo" V4L2 device driver, using a number of pixel formats commonly used by webcams like NV12, UYVY, YUYV, etc., and then pass these video frames to a VPL session for VPP processing to convert the pixel format to an acceptable format for 10-bit HEVC encoding (e.g. NV12 -> P010 for 4:2:0, UYVY/YUYV -> Y210 for 4:2:2) on modern Intel GPUs, and then pass the output of VPL VPP processing as input into VPL ENCODE. I think I understand how to do this part OK.

 

I have a demo app that, for simplicity, just sends the V4L2 captured frames from an NV12 camera directly to VPL ENCODE for 8-bit HEVC encoding since that can be done without pixel format conversion.

 

Right now I'm simply calling MFXMemory_GetSurfaceForEncode() to get a mfxFrameSurface1 and memcpy()'ing the V4L2 frame data into the Data.Y and Data.UV members of the mfxFrameSurface1 object.

 

What I'd like to do is eliminate the memcpy() between V4L2 and VPL. I guess I could use either V4L2_MEMORY_MMAP (perhaps VPL can directly import the memory allocated by V4L2?) or V4L2_MEMORY_USERPTR (perhaps V4L2 can write frame data into the memory allocated by VPL?).

 

Is it possible to get rid of this memcpy() between V4L2 and VPL and how might I go about implementing that? Do I need to define a mfxFrameAllocator?

 

Thanks!

Labels (1)
0 Kudos
0 Replies
Reply