Skip to content

Commit 7024038

Browse files
committed
Adding code for release v0.4.1 (commit 92a8fcd)
1 parent 3f96ea0 commit 7024038

11 files changed

Lines changed: 411 additions & 70 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report_form.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ body:
2828
attributes:
2929
label: Version
3030
description: What version of nvImageCodec are you running?
31-
placeholder: "example: 0.4.0"
31+
placeholder: "example: 0.4.1"
3232
validations:
3333
required: true
3434

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
1818
include(CMakeDependentOption)
1919

2020
set(NVIMGCODEC_PROJECT_NAME "nvimgcodec")
21-
set(NVIMGCODEC_VERSION "0.4.0")
21+
set(NVIMGCODEC_VERSION "0.4.1")
2222

2323
if (NVIMGCODEC_FLAVOR)
2424
set(NVIMGCODEC_FLAVOR "${NVIMGCODEC_FLAVOR}") # could be nightly, weekly, etc if necessary

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## nvImageCodec OSS Contribution Rules
2+
3+
The nvImageCodec project is develop internally at NVIDIA. The source code of nvImageCodec are made available to the public regularly with each release. External contributions are welcome with the reservation that you must agree to the Developer Certificate of Origin presented below and certify that contribution is under the Apache License Version 2.0.
4+
5+
All enhancement, bugfix, or change requests must begin with the creation of a [nvImageCodec Issue Request](https://github.com/nvidia/nvImageCodec/issues).
6+
7+
### Developer Certificate of Origin
8+
9+
```
10+
Developer Certificate of Origin
11+
Version 1.1
12+
13+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
14+
15+
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
16+
17+
18+
Developer's Certificate of Origin 1.1
19+
20+
By making a contribution to this project, I certify that:
21+
22+
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
23+
24+
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
25+
26+
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
27+
28+
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
29+
```

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# nvImageCodec
22

3-
![Version](https://img.shields.io/badge/Version-v0.4.0--beta-blue)
3+
![Version](https://img.shields.io/badge/Version-v0.4.1--beta-blue)
44
[![License](https://img.shields.io/badge/License-Apache_2.0-yellogreen.svg)](https://opensource.org/licenses/Apache-2.0)
55

66
![Platform](https://img.shields.io/badge/Platform-linux--x86__64_%7C_linux--aarch64_%7C_windows--64_wsl2_%7C_windows--64-blue)
@@ -114,6 +114,12 @@ pip install nvidia-nvimgcodec-cu11
114114
pip install nvidia-nvimgcodec-cu12
115115
```
116116

117+
### nvImageCodec Python for Tegra (CUDA 12.x only)
118+
119+
```
120+
pip install nvidia-nvimgcodec-tegra-cu12
121+
```
122+
117123
### Optional installation of nvJPEG library
118124

119125
If you do not have CUDA Toolkit installed, or you would like install nvJPEG library independently, you can use the instructions described below.
@@ -246,17 +252,17 @@ This will generate in build directory *.zip or *tar.xz files
246252
#### Tar file installation
247253

248254
```
249-
tar -xvf nvimgcodec-0.4.0.0-cuda12-x86_64-linux-lib.tar.gz -C /opt/nvidia/
255+
tar -xvf nvimgcodec-0.4.1.0-cuda12-x86_64-linux-lib.tar.gz -C /opt/nvidia/
250256
```
251257

252258
#### DEB File Installation
253259
```
254-
sudo apt-get install -y ./nvimgcodec-0.4.0.0-cuda12-x86_64-linux-lib.deb
260+
sudo apt-get install -y ./nvimgcodec-0.4.1.0-cuda12-x86_64-linux-lib.deb
255261
```
256262
#### Python WHL File Installation
257263

258264
```
259-
pip install nvidia_nvimgcodec_cu12-0.4.0-py3-none-manylinux2014_x86_64.whl
265+
pip install nvidia_nvimgcodec_cu12-0.4.1-py3-none-manylinux2014_x86_64.whl
260266
```
261267

262268
### Installation from sources
@@ -316,7 +322,7 @@ Run Python API tests
316322
First install python wheel. You would also need to have installed all Python tests dependencies (see Dockerfiles).
317323

318324
```
319-
pip install nvidia_nvimgcodec_cu12-0.4.0.x-py3-none-manylinux2014_x86_64.whl
325+
pip install nvidia_nvimgcodec_cu12-0.4.1.x-py3-none-manylinux2014_x86_64.whl
320326
```
321327

322328
Run tests

example/nvimtrans/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void fill_encode_params(const CommandLineParams& params, fs::path output_path, n
143143
}
144144

145145
void generate_backends_without_hw_gpu(std::vector<nvimgcodecBackend_t>& nvimgcds_backends) {
146-
nvimgcds_backends.resize(3);
146+
nvimgcds_backends.resize(3, nvimgcodecBackend_t{NVIMGCODEC_STRUCTURE_TYPE_BACKEND, sizeof(nvimgcodecBackend_t), nullptr});
147147
nvimgcds_backends[0].kind = NVIMGCODEC_BACKEND_KIND_CPU_ONLY;
148148
nvimgcds_backends[0].params = {NVIMGCODEC_STRUCTURE_TYPE_BACKEND_PARAMS, sizeof(nvimgcodecBackendParams_t), nullptr, 1.0f, NVIMGCODEC_LOAD_HINT_POLICY_FIXED};
149149
nvimgcds_backends[1].kind = NVIMGCODEC_BACKEND_KIND_GPU_ONLY;

extensions/nvtiff/cuda_decoder.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,12 @@ nvimgcodecStatus_t Decoder::decode(const nvimgcodecImageDesc_t* image, const nvi
527527
}
528528

529529
auto& nvtiff_decoder = resources.decoder(image_info.cuda_stream);
530-
XM_CHECK_NVTIFF(nvtiffDecodeCheckSupported(resources.nvtiff_stream_, nvtiff_decoder, resources.decode_params_, 0));
530+
bool decode_check_ret = nvtiffDecodeCheckSupported(resources.nvtiff_stream_, nvtiff_decoder, resources.decode_params_, 0);
531+
if (decode_check_ret != NVTIFF_STATUS_SUCCESS) {
532+
NVIMGCODEC_LOG_INFO(framework_, plugin_id_, "nvtiffDecodeCheckSupported returned error code: " << decode_check_ret);
533+
image->imageReady(image->instance, NVIMGCODEC_PROCESSING_STATUS_CODESTREAM_UNSUPPORTED);
534+
return NVIMGCODEC_STATUS_CODESTREAM_UNSUPPORTED;
535+
}
531536

532537
bool need_conversion =
533538
(dec_image_info.sample_format != image_info.sample_format && image_info.sample_format != NVIMGCODEC_SAMPLEFORMAT_I_UNCHANGED) ||
@@ -560,6 +565,9 @@ nvimgcodecStatus_t Decoder::decode(const nvimgcodecImageDesc_t* image, const nvi
560565
NVIMGCODEC_LOG_DEBUG(framework_, plugin_id_, "LaunchConvertNormKernel");
561566
nvimgcodec::LaunchConvertNormKernel(image_info, dec_image_info, image_info.cuda_stream);
562567

568+
// Record event on user stream to synchronize on next iteration
569+
XM_CHECK_CUDA(cudaEventRecord(resources.event_, image_info.cuda_stream));
570+
563571
image->imageReady(image->instance, NVIMGCODEC_PROCESSING_STATUS_SUCCESS);
564572
return NVIMGCODEC_STATUS_SUCCESS;
565573
} else {
@@ -569,6 +577,9 @@ nvimgcodecStatus_t Decoder::decode(const nvimgcodecImageDesc_t* image, const nvi
569577
XM_CHECK_NVTIFF(nvtiffDecodeImage(
570578
resources.nvtiff_stream_, nvtiff_decoder, resources.decode_params_, 0, output_ptr, image_info.cuda_stream));
571579

580+
// Record event on user stream to synchronize on next iteration
581+
XM_CHECK_CUDA(cudaEventRecord(resources.event_, image_info.cuda_stream));
582+
572583
image->imageReady(image->instance, NVIMGCODEC_PROCESSING_STATUS_SUCCESS);
573584
return NVIMGCODEC_STATUS_SUCCESS;
574585
}

python/bundle-wheel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ echo "Fixed hashed names"
209209
patch_rpath() {
210210
local FILE=$1
211211
UPDIRS=$(dirname $(echo "$FILE" | sed "s|$PKGNAME_PATH||") | sed 's/[^\/][^\/]*/../g')
212-
echo "Setting rpath of $FILE to '\$ORIGIN:\$ORIGIN$UPDIRS:\$ORIGIN$UPDIRS/.libs:\$ORIGIN/../../nvjpeg/lib:\$ORIGIN/../../nvjpeg2k/lib:/usr/local/cuda/lib64'"
213-
patchelf --set-rpath "\$ORIGIN:\$ORIGIN$UPDIRS:\$ORIGIN$UPDIRS/.libs:\$ORIGIN/../../nvjpeg/lib:\$ORIGIN/../../nvjpeg2k/lib:/usr/local/cuda/lib64" $FILE
212+
echo "Setting rpath of $FILE to '\$ORIGIN:\$ORIGIN$UPDIRS:\$ORIGIN$UPDIRS/.libs:\$ORIGIN/../../nvjpeg/lib:\$ORIGIN/../../nvjpeg2k/lib:\$ORIGIN/../../nvtiff/lib:\$ORIGIN/../../nvcomp:/usr/local/cuda/lib64'"
213+
patchelf --set-rpath "\$ORIGIN:\$ORIGIN$UPDIRS:\$ORIGIN$UPDIRS/.libs:\$ORIGIN/../../nvjpeg/lib:\$ORIGIN/../../nvjpeg2k/lib:\$ORIGIN/../../nvtiff/lib:\$ORIGIN/../../nvcomp:/usr/local/cuda/lib64" $FILE
214214
patchelf --print-rpath $FILE
215215
}
216216
echo "Fixing rpath of main files..."

src/image_generic_codec.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,15 @@ struct SampleEntry : public IImage
146146

147147
struct PerThread
148148
{
149-
explicit PerThread()
149+
explicit PerThread(int device_id)
150150
{
151-
CHECK_CUDA(cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking));
152-
CHECK_CUDA(cudaEventCreate(&event));
151+
if (device_id == NVIMGCODEC_DEVICE_CPU_ONLY) {
152+
stream = nullptr;
153+
event = nullptr;
154+
} else {
155+
CHECK_CUDA(cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking));
156+
CHECK_CUDA(cudaEventCreate(&event));
157+
}
153158
}
154159
PerThread(const PerThread& oth) = delete;
155160
PerThread& operator=(const PerThread& oth) = delete;
@@ -245,7 +250,10 @@ class ImageGenericCodec
245250
}
246251
}
247252
}
248-
per_thread_.resize(num_threads_ + 1);
253+
per_thread_.reserve(num_threads_ + 1);
254+
for (size_t i = 0; i < num_threads_ + 1; i++) {
255+
per_thread_.emplace_back(exec_params_.device_id);
256+
}
249257

250258
size_t total_num_processors = 0;
251259
for (size_t codec_idx = 0; codec_idx < codec_registry_->getCodecsCount(); codec_idx++) {
@@ -384,6 +392,8 @@ class ImageGenericCodec
384392

385393
void preSync(SampleEntry<ProcessorEntry>& sample, int tid)
386394
{
395+
if (exec_params_.device_id == NVIMGCODEC_DEVICE_CPU_ONLY)
396+
return;
387397
auto& t = per_thread_[tid];
388398
auto user_cuda_stream = sample.orig_image_info.cuda_stream;
389399
if (t.user_streams.find(user_cuda_stream) == t.user_streams.end()) {
@@ -400,6 +410,8 @@ class ImageGenericCodec
400410

401411
void postSync(int tid)
402412
{
413+
if (exec_params_.device_id == NVIMGCODEC_DEVICE_CPU_ONLY)
414+
return;
403415
auto& t = per_thread_[tid];
404416
if (!t.user_streams.empty()) {
405417
nvtx3::scoped_range marker{"sync"};

0 commit comments

Comments
 (0)