-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathquality_type.cpp
More file actions
62 lines (57 loc) · 2.91 KB
/
quality_type.cpp
File metadata and controls
62 lines (57 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "quality_type.h"
namespace nvimgcodec {
void QualityType::exportToPython(py::module& m)
{
// clang-format off
py::enum_<nvimgcodecQualityType_t>(m, "QualityType", "Supported quality types (algorithms), which determines how ``quality_value`` is interpreted..")
.value("DEFAULT", NVIMGCODEC_QUALITY_TYPE_DEFAULT,
R"pbdoc(
Each plugin decides its default quality setting. ``quality_value`` is ignored in this case.
)pbdoc")
.value("LOSSLESS", NVIMGCODEC_QUALITY_TYPE_LOSSLESS,
R"pbdoc(
Image encoding is reversible and keeps original image quality. ``quality_value`` is ignored, except for:
- the CUDA TIFF encoder backend, for which ``quality_value = 0`` means no compression,
and ``quality_value = 1`` means LZW compression,
- the CPU PNG encoder backend, for which ``quality_value`` can be in range from 0
(lowest compression ratio, fastest) to 9 (highest compression ratio, slowest).
)pbdoc")
.value("QUALITY", NVIMGCODEC_QUALITY_TYPE_QUALITY,
R"pbdoc(
``quality_value`` is interpreted as JPEG-like quality in range from 1 (worst) to 100 (best).
)pbdoc")
.value("QUANTIZATION_STEP", NVIMGCODEC_QUALITY_TYPE_QUANTIZATION_STEP,
R"pbdoc(
``quality_value`` is interpreted as quantization step (by how much pixel data will be divided).
The higher the value, the worse quality image is produced.
)pbdoc")
.value("PSNR", NVIMGCODEC_QUALITY_TYPE_PSNR,
R"pbdoc(
``quality_value`` is interpreted as desired Peak Signal-to-Noise Ratio (PSNR) target for the encoded image.
The higher the value, the better quality image is produced. Value should be positive.
)pbdoc")
.value("SIZE_RATIO", NVIMGCODEC_QUALITY_TYPE_SIZE_RATIO,
R"pbdoc(
``quality_value`` is interpreted as desired encoded image size ratio compared to original size, should be floating point in range (0.0, 1.0).
E.g. value 0.1 means target size of 10% of original image.
)pbdoc")
.export_values();
// clang-format on
}
} // namespace nvimgcodec