PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
jpegxl_codec.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
11#ifndef PACS_ENCODING_COMPRESSION_JPEGXL_CODEC_HPP
12#define PACS_ENCODING_COMPRESSION_JPEGXL_CODEC_HPP
13
15
17
47class jpegxl_codec final : public compression_codec {
48public:
50 static constexpr std::string_view kTransferSyntaxUIDLossless =
51 "1.2.840.10008.1.2.4.110";
52
54 static constexpr std::string_view kTransferSyntaxUIDJPEGRecompression =
55 "1.2.840.10008.1.2.4.111";
56
58 static constexpr std::string_view kTransferSyntaxUIDLossy =
59 "1.2.840.10008.1.2.4.112";
60
62 static constexpr float kDefaultQualityDistance = 1.0f;
63
73 explicit jpegxl_codec(bool lossless = true,
74 bool jpeg_recompression = false,
76
77 ~jpegxl_codec() override;
78
79 // Non-copyable but movable
80 jpegxl_codec(const jpegxl_codec&) = delete;
83 jpegxl_codec& operator=(jpegxl_codec&&) noexcept;
84
87
88 [[nodiscard]] std::string_view transfer_syntax_uid() const noexcept override;
89 [[nodiscard]] std::string_view name() const noexcept override;
90 [[nodiscard]] bool is_lossy() const noexcept override;
91 [[nodiscard]] bool can_encode(const image_params& params) const noexcept override;
92 [[nodiscard]] bool can_decode(const image_params& params) const noexcept override;
93
95
98
99 [[nodiscard]] bool is_lossless_mode() const noexcept;
100 [[nodiscard]] bool is_jpeg_recompression_mode() const noexcept;
101 [[nodiscard]] float quality_distance() const noexcept;
102
104
107
108 [[nodiscard]] codec_result encode(
109 std::span<const uint8_t> pixel_data,
110 const image_params& params,
111 const compression_options& options = {}) const override;
112
113 [[nodiscard]] codec_result decode(
114 std::span<const uint8_t> compressed_data,
115 const image_params& params) const override;
116
118
119private:
123};
124
125} // namespace kcenon::pacs::encoding::compression
126
127#endif // PACS_ENCODING_COMPRESSION_JPEGXL_CODEC_HPP
Abstract base class for image compression codecs.
JPEG XL codec implementation (Supplement 232).
static constexpr std::string_view kTransferSyntaxUIDJPEGRecompression
DICOM Transfer Syntax UID for JPEG XL JPEG Recompression.
codec_result decode(std::span< const uint8_t > compressed_data, const image_params &params) const override
Decompresses compressed pixel data.
static constexpr float kDefaultQualityDistance
Default quality distance for lossy mode (1.0 = visually lossless)
std::string_view name() const noexcept override
Returns a human-readable name for the codec.
jpegxl_codec & operator=(const jpegxl_codec &)=delete
static constexpr std::string_view kTransferSyntaxUIDLossy
DICOM Transfer Syntax UID for JPEG XL (any mode)
std::string_view transfer_syntax_uid() const noexcept override
Returns the Transfer Syntax UID supported by this codec.
bool can_encode(const image_params &params) const noexcept override
Checks if this codec supports the given image parameters.
bool can_decode(const image_params &params) const noexcept override
Checks if this codec can decode data with given parameters.
bool is_lossy() const noexcept override
Checks if this codec produces lossy compression.
static constexpr std::string_view kTransferSyntaxUIDLossless
DICOM Transfer Syntax UID for JPEG XL Lossless.
jpegxl_codec(bool lossless=true, bool jpeg_recompression=false, float quality_distance=kDefaultQualityDistance)
Constructs a JPEG XL codec instance.
codec_result encode(std::span< const uint8_t > pixel_data, const image_params &params, const compression_options &options={}) const override
Compresses uncompressed pixel data.
Compression quality settings for lossy codecs.
Parameters describing image pixel data.