PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
hevc_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_HEVC_CODEC_HPP
12#define PACS_ENCODING_COMPRESSION_HEVC_CODEC_HPP
13
15
17
45class hevc_codec final : public compression_codec {
46public:
48 static constexpr std::string_view kTransferSyntaxUIDMain =
49 "1.2.840.10008.1.2.4.107";
50
52 static constexpr std::string_view kTransferSyntaxUIDMain10 =
53 "1.2.840.10008.1.2.4.108";
54
56 static constexpr int kDefaultQuality = 23;
57
65 explicit hevc_codec(bool main10 = false,
67
68 ~hevc_codec() override;
69
70 // Non-copyable but movable
71 hevc_codec(const hevc_codec&) = delete;
72 hevc_codec& operator=(const hevc_codec&) = delete;
74 hevc_codec& operator=(hevc_codec&&) noexcept;
75
78
79 [[nodiscard]] std::string_view transfer_syntax_uid() const noexcept override;
80 [[nodiscard]] std::string_view name() const noexcept override;
81 [[nodiscard]] bool is_lossy() const noexcept override;
82 [[nodiscard]] bool can_encode(const image_params& params) const noexcept override;
83 [[nodiscard]] bool can_decode(const image_params& params) const noexcept override;
84
86
89
94 [[nodiscard]] bool is_main10_profile() const noexcept;
95
100 [[nodiscard]] int quality() const noexcept;
101
103
106
107 [[nodiscard]] codec_result encode(
108 std::span<const uint8_t> pixel_data,
109 const image_params& params,
110 const compression_options& options = {}) const override;
111
112 [[nodiscard]] codec_result decode(
113 std::span<const uint8_t> compressed_data,
114 const image_params& params) const override;
115
117
118private:
121};
122
123} // namespace kcenon::pacs::encoding::compression
124
125#endif // PACS_ENCODING_COMPRESSION_HEVC_CODEC_HPP
Abstract base class for image compression codecs.
HEVC/H.265 codec implementation for video-encoded multi-frame DICOM.
Definition hevc_codec.h:45
std::string_view transfer_syntax_uid() const noexcept override
Returns the Transfer Syntax UID supported by this codec.
static constexpr std::string_view kTransferSyntaxUIDMain10
DICOM Transfer Syntax UID for HEVC/H.265 Main 10 Profile / Level 5.1.
Definition hevc_codec.h:52
hevc_codec(bool main10=false, int quality=kDefaultQuality)
Constructs an HEVC codec instance.
bool is_lossy() const noexcept override
Checks if this codec produces lossy compression.
int quality() const noexcept
Gets the current quality setting (CRF).
std::string_view name() const noexcept override
Returns a human-readable name for the codec.
hevc_codec & operator=(const hevc_codec &)=delete
bool is_main10_profile() const noexcept
Checks if this codec is configured for Main 10 Profile.
bool can_decode(const image_params &params) const noexcept override
Checks if this codec can decode data with given parameters.
bool can_encode(const image_params &params) const noexcept override
Checks if this codec supports the given image parameters.
static constexpr std::string_view kTransferSyntaxUIDMain
DICOM Transfer Syntax UID for HEVC/H.265 Main Profile / Level 5.1.
Definition hevc_codec.h:48
codec_result decode(std::span< const uint8_t > compressed_data, const image_params &params) const override
Decompresses compressed pixel data.
codec_result encode(std::span< const uint8_t > pixel_data, const image_params &params, const compression_options &options={}) const override
Compresses uncompressed pixel data.
static constexpr int kDefaultQuality
Default quality for lossy encoding (CRF value, 0-51, lower = better)
Definition hevc_codec.h:56
Compression quality settings for lossy codecs.
Parameters describing image pixel data.