Skip to content

Commit 15d40a4

Browse files
YLouWashUmeta-codesync[bot]
authored andcommitted
{CUDA Decoding} Add NVCODEC build-test CI job and nv-codec-headers docs (#260)
Summary: Pull Request resolved: #260 Adds a Linux build-only CI job (`build-nvcodec`) to VRS `build-and-test.yml` that installs `nv-codec-headers`, configures with `-DBUILD_WITH_XPRS=ON -DENABLE_NVCODEC=ON`, and builds. GitHub-hosted runners have no NVIDIA GPU, so this compiles the NVDEC path -- which needs only `nv-codec-headers`, not a GPU or CUDA toolkit -- to catch OSS build breakage. GPU decode is validated manually on a GPU machine. Also documents `nv-codec-headers` as an optional dependency for GPU-accelerated H.265 decoding in the README. Part of the GPU-accelerated H.265 decoding rollout. Lands after the xprs CUDA decoder files are synced to the GitHub VRS mirror (configerator cconf change), since the NVCODEC build needs those sources. Reviewed By: georges-berenger Differential Revision: D110227873 fbshipit-source-id: 435f4b9dfb61be7e2c8bd1551f1dbdb6a6a51ed1
1 parent 7fe2a08 commit 15d40a4

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,50 @@ jobs:
7575
cd build
7676
ninja all
7777
ctest -j8
78+
79+
build-nvcodec:
80+
name: Build VRS NVCODEC (Linux, build-only)
81+
runs-on: ubuntu-latest
82+
# GitHub-hosted runners have no NVIDIA GPU, so this only compiles the
83+
# ENABLE_NVCODEC path -- which needs nv-codec-headers but neither a GPU nor a
84+
# CUDA toolkit -- to catch OSS build breakage. GPU decode is validated
85+
# manually on a GPU machine (see projectaria_tools shipping docs).
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Install dependencies
90+
run: |
91+
sudo apt-get update -y
92+
sudo apt-get install -o Acquire::Retries=5 \
93+
cmake git ninja-build libgtest-dev libfmt-dev \
94+
libjpeg-dev libturbojpeg-dev libpng-dev \
95+
liblz4-dev libzstd-dev libxxhash-dev \
96+
libboost-dev \
97+
libopus-dev \
98+
qtbase5-dev portaudio19-dev \
99+
libeigen3-dev
100+
101+
- name: Install nv-codec-headers
102+
run: |
103+
git clone --depth 1 --branch n12.1.14.0 \
104+
https://github.com/FFmpeg/nv-codec-headers.git /tmp/nv-codec-headers
105+
sudo make -C /tmp/nv-codec-headers install PREFIX=/usr
106+
pkg-config --modversion ffnvcodec
107+
108+
- name: Build FFMPEG
109+
shell: bash
110+
run: |
111+
./build_third_party_libs/build_ffmpeg_linuxunix.sh
112+
113+
- name: Configure (XPRS + NVCODEC)
114+
shell: bash
115+
run: |
116+
mkdir build
117+
cmake -S . -B build -G Ninja \
118+
-DBUILD_WITH_XPRS:BOOL=ON -DENABLE_NVCODEC:BOOL=ON
119+
120+
- name: Build C++
121+
shell: bash
122+
run: |
123+
cd build
124+
ninja all

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ _These instructions are validated using Ubuntu 20.04, whereas Ubuntu 18.04 doesn
8484
sudo apt-get install npm doxygen
8585
```
8686

87+
### Optional: GPU-accelerated H.265 decoding (Linux x86_64, NVIDIA)
88+
89+
XPRS can decode H.265 on NVIDIA GPUs via NVDEC. This requires the header-only
90+
[nv-codec-headers](https://github.com/FFmpeg/nv-codec-headers) at build time (no CUDA
91+
toolkit needed; the driver's `libcuda`/`libnvcuvid` are loaded at runtime):
92+
93+
```
94+
git clone --branch n12.1.14.0 https://github.com/FFmpeg/nv-codec-headers.git
95+
sudo make -C nv-codec-headers install PREFIX=/usr
96+
```
97+
98+
Then configure with `-DBUILD_WITH_XPRS=ON -DENABLE_NVCODEC=ON`. The resulting library is
99+
CUDA-agnostic: it auto-accelerates color (YUV420) H.265 streams when an NVIDIA driver is
100+
present and falls back to CPU decoding otherwise (monochrome streams always use CPU, as
101+
NVDEC does not support them).
102+
87103
## Build & run (macOS & Linux)
88104

89105
- Run cmake:

0 commit comments

Comments
 (0)