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.
26 * A USB camera suppporting YUYV output format is plugged into your target.
35 ### To clean up all generated files
43 $ ./capture-cuda [options]
45 ### To view supported options
48 $ ./capture-cuda --help
52 - - - - - - - - - - - - - - -
55 This is the overall process flow of capture-cuda:
58 USB camera ------> captured image (YUYV) ------> converted image (RGB)
61 As shown in the following diagrams, the buffer flow differs depending on V4L2
62 capturing modes and CUDA memory management.
64 V4L2 memory-mapped buffers (V4L2_MEMORY_MMAP) are allocated in kernel space. The
65 application maps them in user space and copies them to the CUDA device allocated
66 memory for CUDA processing.
68 The application allocates V4L2 user-space buffers (V4L2_MEMORY_USERPTR). In
69 this situation, the driver directly fills in the user-space memory. When you allocate
70 CUDA-mappable memory (with `cudaHostAlloc`), the CUDA device can access the V4L2
71 captured buffer without memory copy.
73 ### Using Memory-Mapped Buffers (-m option)
75 $ ./capture-cuda -d /dev/video0 -m
78 | | mmap copy | | convert | | copy | | write
79 |_| ------> ptr ------> |_| =========> |_| ------> |_| -------> file
83 ### Using Memory-Mapped Buffers and Zero-Copy CUDA Memory (-m and -z options)
85 $ ./capture-cuda -d /dev/video0 -m -z
88 | | mmap copy | | convert | | write
89 |_| ------> ptr ------> |_| =========> |_| -------> file
93 ### Using Application-Allocated Buffers (-u option)
95 $ ./capture-cuda -d /dev/video0 -u
98 userptr | | copy | | convert | | copy | | write
99 ---------> |_| ------> |_| =========> |_| ------> |_| -------> file
103 ### Using Application-Allocated Buffers and Zero-Copy CUDA Memory (-u and -z options)
105 $ ./capture-cuda -d /dev/video0 -u -z
108 userptr | | convert | | write
109 ---------> |_| =========> |_| -------> file