Update nvImageCodec to 0.7.0 by jantonguirao · Pull Request #6105 · NVIDIA/DALI
Greptile Overview
Greptile Summary
Updates nvImageCodec dependency from 0.6.0 to 0.7.0, adapting to API changes and optimizing performance.
- Removed deprecated
buffer_sizefield fromimage_infostructure (API change in 0.7.0) - Optimized resource reuse: sub code stream and image instances are now reused across iterations instead of being recreated, reducing allocation overhead
- Simplified image descriptor creation by removing parallel initialization task and creating images inline in the main loop
- Updated version requirements, tarball URLs, hashes, and git tags across cmake and conda configurations
- Reordered stub generator function declarations to follow create-destroy pattern
Confidence Score: 4/5
- This PR is a straightforward dependency update with well-contained API adaptations that follow established patterns in the codebase.
- Score of 4 reflects: clean dependency version bump, logical API adaptation for removed buffer_size field, and reasonable optimization for instance reuse. The instance reuse pattern appears correct based on nvImageCodec's API semantics. Deducted 1 point because the image decoder changes involve subtle resource management that benefits from integration testing.
- Pay attention to
dali/operators/imgcodec/image_decoder.h- the instance reuse optimization should be verified with integration tests to ensure ROI handling works correctly.
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| cmake/Dependencies.common.cmake | 5/5 | Version bump from 0.6.0 to 0.7.0 for nvImageCodec dependency. Updated min/max versions, tarball URL, hash, and git tag. Standard dependency update. |
| conda/third_party/dali_nvimagecodec/recipe/meta.yaml | 5/5 | Updated build_version and git_rev from 0.6.0 to 0.7.0 for the conda package recipe. |
| dali/operators/imgcodec/image_decoder.h | 4/5 | Major refactoring: removed deprecated buffer_size field, optimized sub code stream and image instance reuse across iterations, simplified image descriptor creation by removing parallel init task. |
| internal_tools/stub_generator/nvimgcodec.json | 5/5 | Reordered function declarations: moved nvimgcodecImageDestroy after nvimgcodecImageCreate to follow create-destroy pattern. |
Sequence Diagram
sequenceDiagram
participant TP as ThreadPool
participant ID as ImageDecoder
participant NIC as nvImageCodec
participant State as SampleState
Note over ID: RunImplImpl() called
loop For each sample (parallel in blocks)
ID->>State: ParseSample()
alt ROI requested
ID->>State: Check sub_encoded_stream exists
alt Reuse existing stream
ID->>NIC: nvimgcodecCodeStreamGetSubCodeStream(existing)
else Create new stream
ID->>NIC: NvImageCodecCodeStream::FromSubCodeStream()
end
NIC-->>State: Store sub_encoded_stream
end
ID->>State: PrepareOutput()
end
Note over ID: Allocate output memory
loop For each sample (sequential)
alt Not cached
ID->>State: Set image_info.buffer
alt Reuse existing image
ID->>NIC: nvimgcodecImageCreate(existing)
else Create new image
ID->>NIC: NvImageCodecImage::Create()
end
ID->>ID: Add to batch_images
end
end
ID->>NIC: nvimgcodecDecoderDecode(batch)
NIC-->>ID: Future with results
ID->>NIC: nvimgcodecFutureWaitForAll()
opt Need processing
loop For each decoded sample
TP->>ID: ConvertGPU/ConvertCPU()
end
end