codekingpro/portable-devtools
114k
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2022-2026 NVIDIA CORPORATION & AFFILIATES.
3 * All rights reserved. SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11*/
12
13#pragma once
14
15#include "nvcompManager.hpp"
16#include "formatSpec.hpp"
17#include "lz4.h"
18
19namespace nvcomp {
20
21/**
22 * @brief High-level interface class for the LZ4 compressor.
23 *
24 * @warning Any uncompressed data buffer to be compressed MUST be a size that is a
25 * multiple of the data type size, else compression may crash or result in
26 * invalid output.
27 *
28 * @note If user_stream is specified, the lifetime of the LZ4Manager must not
29 * extend beyond that of the user_stream.
30 */
31struct LZ4Manager : detail::PimplManager {
32 /**
33 * @brief Constructor of LZ4Manager.
34 *
35 * @param[in] uncomp_chunk_size Internal chunk size used to partition the input data.
36 * @param[in] compress_opts Compression options to use.
37 * @param[in] decompress_opts Decompression options to use.
38 * @param[in] user_stream The CUDA stream to operate on.
39 * @param[in] checksum_policy The checksum policy to use during compression and decompression.
40 * @param[in] bitstream_kind Setting to configure how the manager compresses the input.
41 */
42 NVCOMP_EXPORT
43 LZ4Manager(
44 size_t uncomp_chunk_size,
45 const nvcompBatchedLZ4CompressOpts_t& compress_opts = nvcompBatchedLZ4CompressDefaultOpts,
46 const nvcompBatchedLZ4DecompressOpts_t& decompress_opts = nvcompBatchedLZ4DecompressDefaultOpts,
47 cudaStream_t user_stream = 0,
48 ChecksumPolicy checksum_policy = NoComputeNoVerify,
49 BitstreamKind bitstream_kind = BitstreamKind::NVCOMP_NATIVE);
50
51 /**
52 * @brief Destructor of LZ4Manager.
53 */
54 NVCOMP_EXPORT
55 ~LZ4Manager() noexcept;
56};
57
58} // namespace nvcomp
59 