1 Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 @page l4t_mm_v4l2cuda_group v4l2cuda (capture-cuda)
6 - [Overview](#overview)
7 - [Building and Running](#build_and_run)
9 - [Key Classes and Methods](#key)
11 - - - - - - - - - - - - - - -
15 This sample uses V4L2 image capturing with
16 NVIDIA<sup>®</sup> CUDA<sup>®</sup> format conversion.
19 <a name=
"build_and_run">
20 ## Building and Running ##
22 #### Prerequisites ####
23 * You have followed Steps 1-3 in @ref mmapi_build.
27 * A USB camera suppporting YUYV output format is plugged into your target.
36 ### To clean up all generated files
44 $ ./capture-cuda [options]
46 ### To view supported options
49 $ ./capture-cuda --help
53 - - - - - - - - - - - - - - -
56 This is the overall process flow of capture-cuda:
59 USB camera ------> captured image (YUYV) ------> converted image (RGB)
62 As shown in the following diagrams, the buffer flow differs depending on V4L2
63 capturing modes and CUDA memory management.
65 V4L2 memory-mapped buffers (V4L2_MEMORY_MMAP) are allocated in kernel space. The
66 application maps them in user space and copies them to the CUDA device allocated
67 memory for CUDA processing.
69 The application allocates V4L2 user-space buffers (V4L2_MEMORY_USERPTR). In
70 this situation, the driver directly fills in the user-space memory. When you allocate
71 CUDA-mappable memory (with `cudaHostAlloc`), the CUDA device can access the V4L2
72 captured buffer without memory copy.
74 ### Using Memory-Mapped Buffers (-m option)
76 $ ./capture-cuda -d /dev/video0 -m
79 | | mmap copy | | convert | | copy | | write
80 |_| ------> ptr ------> |_| =========> |_| ------> |_| -------> file
84 ### Using Memory-Mapped Buffers and Zero-Copy CUDA Memory (-m and -z options)
86 $ ./capture-cuda -d /dev/video0 -m -z
89 | | mmap copy | | convert | | write
90 |_| ------> ptr ------> |_| =========> |_| -------> file
94 ### Using Application-Allocated Buffers (-u option)
96 $ ./capture-cuda -d /dev/video0 -u
99 userptr | | copy | | convert | | copy | | write
100 ---------> |_| ------> |_| =========> |_| ------> |_| -------> file
104 ### Using Application-Allocated Buffers and Zero-Copy CUDA Memory (-u and -z options)
106 $ ./capture-cuda -d /dev/video0 -u -z
109 userptr | | convert | | write
110 ---------> |_| =========> |_| -------> file