PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::encoding::simd Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  vec128_int
 Portable 128-bit integer vector wrapper. More...
 
struct  vec256_int
 Portable 256-bit integer vector wrapper. More...
 
class  window_level_lut
 Precomputed LUT for fast repeated window/level application. More...
 
struct  window_level_params
 Window/Level parameters. More...
 

Enumerations

enum class  simd_feature : uint32_t {
  none = 0 , sse2 = 1 << 0 , ssse3 = 1 << 1 , sse41 = 1 << 2 ,
  avx = 1 << 3 , avx2 = 1 << 4 , avx512f = 1 << 5 , neon = 1 << 6
}
 SIMD feature flags for runtime detection. More...
 

Functions

constexpr simd_feature operator| (simd_feature a, simd_feature b) noexcept
 Bitwise OR for simd_feature flags.
 
constexpr simd_feature operator& (simd_feature a, simd_feature b) noexcept
 Bitwise AND for simd_feature flags.
 
constexpr bool has_feature (simd_feature features, simd_feature check) noexcept
 Check if a specific feature is set.
 
simd_feature detect_features () noexcept
 Detect available SIMD features at runtime.
 
simd_feature get_features () noexcept
 Get cached SIMD features (singleton pattern)
 
bool has_sse2 () noexcept
 Check if SSE2 is available.
 
bool has_ssse3 () noexcept
 Check if SSSE3 is available.
 
bool has_sse41 () noexcept
 Check if SSE4.1 is available.
 
bool has_avx () noexcept
 Check if AVX is available.
 
bool has_avx2 () noexcept
 Check if AVX2 is available.
 
bool has_avx512f () noexcept
 Check if AVX-512F is available.
 
bool has_neon () noexcept
 Check if NEON is available.
 
size_t optimal_vector_width () noexcept
 Get optimal vector width in bytes for current CPU.
 
void invert_monochrome_8bit (const uint8_t *src, uint8_t *dst, size_t pixel_count) noexcept
 Invert 8-bit monochrome pixels (MONOCHROME1 <-> MONOCHROME2)
 
void invert_monochrome_16bit (const uint16_t *src, uint16_t *dst, size_t pixel_count, uint16_t max_value) noexcept
 Invert 16-bit monochrome pixels.
 
void rgb_to_ycbcr_8bit (const uint8_t *src, uint8_t *dst, size_t pixel_count) noexcept
 Convert RGB to YCbCr color space (ITU-R BT.601)
 
void ycbcr_to_rgb_8bit (const uint8_t *src, uint8_t *dst, size_t pixel_count) noexcept
 Convert YCbCr to RGB color space (ITU-R BT.601)
 
void interleaved_to_planar_rgb8 (const uint8_t *src, uint8_t *r, uint8_t *g, uint8_t *b, size_t pixel_count) noexcept
 Convert interleaved RGB to planar format using best available SIMD.
 
void planar_to_interleaved_rgb8 (const uint8_t *r, const uint8_t *g, const uint8_t *b, uint8_t *dst, size_t pixel_count) noexcept
 Convert planar RGB to interleaved format using best available SIMD.
 
void split_16bit_to_planes (const uint8_t *src, uint8_t *high, uint8_t *low, size_t pixel_count) noexcept
 Split 16-bit data into high and low byte planes.
 
void merge_planes_to_16bit (const uint8_t *high, const uint8_t *low, uint8_t *dst, size_t pixel_count) noexcept
 Merge high and low byte planes into 16-bit data.
 
template<size_t Alignment>
constexpr bool is_aligned (const void *ptr) noexcept
 Check if a pointer is aligned to the specified boundary.
 
template<size_t Alignment>
constexpr size_t align_offset (const void *ptr) noexcept
 Get the aligned portion start offset.
 
void swap_bytes_16_simd (const uint8_t *src, uint8_t *dst, size_t byte_count) noexcept
 Swap bytes in 16-bit words using best available SIMD.
 
void swap_bytes_32_simd (const uint8_t *src, uint8_t *dst, size_t byte_count) noexcept
 Swap bytes in 32-bit words using best available SIMD.
 
void swap_bytes_64_simd (const uint8_t *src, uint8_t *dst, size_t byte_count) noexcept
 Swap bytes in 64-bit words using best available SIMD.
 
void apply_window_level_8bit (const uint8_t *src, uint8_t *dst, size_t pixel_count, const window_level_params &params) noexcept
 Apply window/level transformation to 8-bit grayscale data.
 
void apply_window_level_16bit (const uint16_t *src, uint8_t *dst, size_t pixel_count, const window_level_params &params) noexcept
 Apply window/level transformation to 16-bit unsigned grayscale data.
 
void apply_window_level_16bit_signed (const int16_t *src, uint8_t *dst, size_t pixel_count, const window_level_params &params) noexcept
 Apply window/level transformation to 16-bit signed grayscale data.
 

Variables

constexpr size_t SSE_ALIGNMENT = 16
 
constexpr size_t AVX_ALIGNMENT = 32
 
constexpr size_t AVX512_ALIGNMENT = 64
 

Enumeration Type Documentation

◆ simd_feature

enum class kcenon::pacs::encoding::simd::simd_feature : uint32_t
strong

SIMD feature flags for runtime detection.

Enumerator
none 
sse2 
ssse3 
sse41 
avx 
avx2 
avx512f 
neon 

Definition at line 87 of file simd_config.h.

Function Documentation

◆ align_offset()

template<size_t Alignment>
size_t kcenon::pacs::encoding::simd::align_offset ( const void * ptr)
nodiscardconstexprnoexcept

Get the aligned portion start offset.

Definition at line 219 of file simd_types.h.

219 {
220 const auto addr = reinterpret_cast<uintptr_t>(ptr);
221 const auto remainder = addr % Alignment;
222 return remainder == 0 ? 0 : Alignment - remainder;
223}

References align_offset().

Referenced by align_offset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_window_level_16bit()

void kcenon::pacs::encoding::simd::apply_window_level_16bit ( const uint16_t * src,
uint8_t * dst,
size_t pixel_count,
const window_level_params & params )
inlinenoexcept

Apply window/level transformation to 16-bit unsigned grayscale data.

Parameters
srcSource pixel data (16-bit unsigned grayscale)
dstDestination pixel data (8-bit display values)
pixel_countNumber of pixels to process
paramsWindow/level parameters

Definition at line 860 of file simd_windowing.h.

862 {
863#if defined(PACS_SIMD_AVX2)
864 if (has_avx2()) {
865 detail::apply_window_level_16bit_avx2(src, dst, pixel_count, params);
866 return;
867 }
868#endif
869#if defined(PACS_SIMD_SSE2)
870 if (has_sse2()) {
871 detail::apply_window_level_16bit_sse2(src, dst, pixel_count, params);
872 return;
873 }
874#endif
875#if defined(PACS_SIMD_NEON)
876 if (has_neon()) {
877 detail::apply_window_level_16bit_neon(src, dst, pixel_count, params);
878 return;
879 }
880#endif
881 detail::apply_window_level_16bit_scalar(src, dst, pixel_count, params);
882}

References kcenon::pacs::encoding::simd::detail::apply_window_level_16bit_scalar(), has_avx2(), has_neon(), and has_sse2().

Here is the call graph for this function:

◆ apply_window_level_16bit_signed()

void kcenon::pacs::encoding::simd::apply_window_level_16bit_signed ( const int16_t * src,
uint8_t * dst,
size_t pixel_count,
const window_level_params & params )
inlinenoexcept

Apply window/level transformation to 16-bit signed grayscale data.

Handles signed pixel data commonly found in CT images.

Parameters
srcSource pixel data (16-bit signed grayscale)
dstDestination pixel data (8-bit display values)
pixel_countNumber of pixels to process
paramsWindow/level parameters

Definition at line 894 of file simd_windowing.h.

896 {
897#if defined(PACS_SIMD_AVX2)
898 if (has_avx2()) {
899 detail::apply_window_level_16bit_signed_avx2(src, dst, pixel_count, params);
900 return;
901 }
902#endif
903#if defined(PACS_SIMD_SSE2)
904 if (has_sse2()) {
905 detail::apply_window_level_16bit_signed_sse2(src, dst, pixel_count, params);
906 return;
907 }
908#endif
909#if defined(PACS_SIMD_NEON)
910 if (has_neon()) {
911 detail::apply_window_level_16bit_signed_neon(src, dst, pixel_count, params);
912 return;
913 }
914#endif
915 detail::apply_window_level_16bit_signed_scalar(src, dst, pixel_count, params);
916}

References kcenon::pacs::encoding::simd::detail::apply_window_level_16bit_signed_scalar(), has_avx2(), has_neon(), and has_sse2().

Here is the call graph for this function:

◆ apply_window_level_8bit()

void kcenon::pacs::encoding::simd::apply_window_level_8bit ( const uint8_t * src,
uint8_t * dst,
size_t pixel_count,
const window_level_params & params )
inlinenoexcept

Apply window/level transformation to 8-bit grayscale data.

Maps input pixel values to output values based on window center and width. Uses SIMD when available for better performance.

Parameters
srcSource pixel data (8-bit grayscale)
dstDestination pixel data (8-bit display values)
pixel_countNumber of pixels to process
paramsWindow/level parameters

Definition at line 828 of file simd_windowing.h.

830 {
831#if defined(PACS_SIMD_AVX2)
832 if (has_avx2()) {
833 detail::apply_window_level_8bit_avx2(src, dst, pixel_count, params);
834 return;
835 }
836#endif
837#if defined(PACS_SIMD_SSE2)
838 if (has_sse2()) {
839 detail::apply_window_level_8bit_sse2(src, dst, pixel_count, params);
840 return;
841 }
842#endif
843#if defined(PACS_SIMD_NEON)
844 if (has_neon()) {
845 detail::apply_window_level_8bit_neon(src, dst, pixel_count, params);
846 return;
847 }
848#endif
849 detail::apply_window_level_8bit_scalar(src, dst, pixel_count, params);
850}

References kcenon::pacs::encoding::simd::detail::apply_window_level_8bit_scalar(), has_avx2(), has_neon(), and has_sse2().

Here is the call graph for this function:

◆ detect_features()

simd_feature kcenon::pacs::encoding::simd::detect_features ( )
inlinenodiscardnoexcept

Detect available SIMD features at runtime.

Returns
Bitwise OR of available simd_feature flags

Definition at line 164 of file simd_config.h.

164 {
165 simd_feature features = simd_feature::none;
166
167#if defined(PACS_ARCH_X64) || defined(PACS_ARCH_X86)
168 int info[4] = {0};
169
170 // Check basic CPUID
171 detail::cpuid(info, 0);
172 int max_function = info[0];
173
174 if (max_function >= 1) {
175 detail::cpuid(info, 1);
176
177 // EDX features
178 if (info[3] & (1 << 26)) {
179 features = features | simd_feature::sse2;
180 }
181
182 // ECX features
183 if (info[2] & (1 << 0)) {
184 features = features | simd_feature::ssse3;
185 }
186 if (info[2] & (1 << 19)) {
187 features = features | simd_feature::sse41;
188 }
189 if (info[2] & (1 << 28)) {
190 features = features | simd_feature::avx;
191 }
192 }
193
194 if (max_function >= 7) {
195 detail::cpuid_ex(info, 7, 0);
196
197 // EBX features
198 if (info[1] & (1 << 5)) {
199 features = features | simd_feature::avx2;
200 }
201 if (info[1] & (1 << 16)) {
202 features = features | simd_feature::avx512f;
203 }
204 }
205
206#elif defined(PACS_ARCH_ARM64)
207 // ARM64 always has NEON
208 features = features | simd_feature::neon;
209
210#elif defined(PACS_ARCH_ARM32)
211 // ARM32: Check for NEON via auxiliary vector or runtime detection
212 // For simplicity, assume NEON is available if compiled with NEON support
213#if defined(PACS_SIMD_NEON)
214 features = features | simd_feature::neon;
215#endif
216
217#endif // Architecture
218
219 return features;
220}
simd_feature
SIMD feature flags for runtime detection.
Definition simd_config.h:87

References avx, avx2, avx512f, neon, none, sse2, sse41, and ssse3.

Referenced by get_features().

Here is the caller graph for this function:

◆ get_features()

simd_feature kcenon::pacs::encoding::simd::get_features ( )
inlinenodiscardnoexcept

Get cached SIMD features (singleton pattern)

Returns
Detected SIMD features

Definition at line 226 of file simd_config.h.

226 {
227 static const simd_feature features = detect_features();
228 return features;
229}

References detect_features().

Referenced by has_avx(), has_avx2(), has_avx512f(), has_neon(), has_sse2(), has_sse41(), and has_ssse3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_avx()

bool kcenon::pacs::encoding::simd::has_avx ( )
inlinenodiscardnoexcept

Check if AVX is available.

Definition at line 255 of file simd_config.h.

255 {
256 return has_feature(get_features(), simd_feature::avx);
257}

References avx, get_features(), and has_feature().

Here is the call graph for this function:

◆ has_avx2()

bool kcenon::pacs::encoding::simd::has_avx2 ( )
inlinenodiscardnoexcept

Check if AVX2 is available.

Definition at line 262 of file simd_config.h.

262 {
263 return has_feature(get_features(), simd_feature::avx2);
264}

References avx2, get_features(), and has_feature().

Referenced by apply_window_level_16bit(), apply_window_level_16bit_signed(), apply_window_level_8bit(), interleaved_to_planar_rgb8(), invert_monochrome_16bit(), invert_monochrome_8bit(), merge_planes_to_16bit(), optimal_vector_width(), planar_to_interleaved_rgb8(), rgb_to_ycbcr_8bit(), split_16bit_to_planes(), swap_bytes_16_simd(), swap_bytes_32_simd(), swap_bytes_64_simd(), and ycbcr_to_rgb_8bit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_avx512f()

bool kcenon::pacs::encoding::simd::has_avx512f ( )
inlinenodiscardnoexcept

Check if AVX-512F is available.

Definition at line 269 of file simd_config.h.

269 {
270 return has_feature(get_features(), simd_feature::avx512f);
271}

References avx512f, get_features(), and has_feature().

Referenced by optimal_vector_width().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_feature()

bool kcenon::pacs::encoding::simd::has_feature ( simd_feature features,
simd_feature check )
nodiscardconstexprnoexcept

Check if a specific feature is set.

Definition at line 119 of file simd_config.h.

120 {
121 return (features & check) == check;
122}

Referenced by has_avx(), has_avx2(), has_avx512f(), has_neon(), has_sse2(), has_sse41(), and has_ssse3().

Here is the caller graph for this function:

◆ has_neon()

bool kcenon::pacs::encoding::simd::has_neon ( )
inlinenodiscardnoexcept

Check if NEON is available.

Definition at line 276 of file simd_config.h.

276 {
277 return has_feature(get_features(), simd_feature::neon);
278}

References get_features(), has_feature(), and neon.

Referenced by apply_window_level_16bit(), apply_window_level_16bit_signed(), apply_window_level_8bit(), invert_monochrome_16bit(), invert_monochrome_8bit(), optimal_vector_width(), rgb_to_ycbcr_8bit(), and ycbcr_to_rgb_8bit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_sse2()

bool kcenon::pacs::encoding::simd::has_sse2 ( )
inlinenodiscardnoexcept

Check if SSE2 is available.

Definition at line 234 of file simd_config.h.

234 {
235 return has_feature(get_features(), simd_feature::sse2);
236}

References get_features(), has_feature(), and sse2.

Referenced by apply_window_level_16bit(), apply_window_level_16bit_signed(), apply_window_level_8bit(), invert_monochrome_16bit(), invert_monochrome_8bit(), and optimal_vector_width().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_sse41()

bool kcenon::pacs::encoding::simd::has_sse41 ( )
inlinenodiscardnoexcept

Check if SSE4.1 is available.

Definition at line 248 of file simd_config.h.

248 {
249 return has_feature(get_features(), simd_feature::sse41);
250}

References get_features(), has_feature(), and sse41.

Here is the call graph for this function:

◆ has_ssse3()

bool kcenon::pacs::encoding::simd::has_ssse3 ( )
inlinenodiscardnoexcept

Check if SSSE3 is available.

Definition at line 241 of file simd_config.h.

241 {
242 return has_feature(get_features(), simd_feature::ssse3);
243}

References get_features(), has_feature(), and ssse3.

Referenced by interleaved_to_planar_rgb8(), merge_planes_to_16bit(), planar_to_interleaved_rgb8(), split_16bit_to_planes(), swap_bytes_16_simd(), swap_bytes_32_simd(), and swap_bytes_64_simd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ interleaved_to_planar_rgb8()

void kcenon::pacs::encoding::simd::interleaved_to_planar_rgb8 ( const uint8_t * src,
uint8_t * r,
uint8_t * g,
uint8_t * b,
size_t pixel_count )
inlinenoexcept

Convert interleaved RGB to planar format using best available SIMD.

Parameters
srcSource interleaved RGB data (RGBRGBRGB...)
rDestination R plane
gDestination G plane
bDestination B plane
pixel_countNumber of pixels to convert

Definition at line 725 of file simd_rle.h.

727 {
728 if (pixel_count == 0) {
729 return;
730 }
731
732#if defined(PACS_SIMD_AVX2)
733 if (has_avx2()) {
734 detail::interleaved_to_planar_rgb8_avx2(src, r, g, b, pixel_count);
735 return;
736 }
737#endif
738
739#if defined(PACS_SIMD_SSSE3)
740 if (has_ssse3()) {
741 detail::interleaved_to_planar_rgb8_ssse3(src, r, g, b, pixel_count);
742 return;
743 }
744#endif
745
746#if defined(PACS_SIMD_NEON)
747 detail::interleaved_to_planar_rgb8_neon(src, r, g, b, pixel_count);
748 return;
749#endif
750
751 detail::interleaved_to_planar_rgb8_scalar(src, r, g, b, pixel_count);
752}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::interleaved_to_planar_rgb8_scalar().

Referenced by kcenon::pacs::encoding::compression::rle_codec::impl::encode_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invert_monochrome_16bit()

void kcenon::pacs::encoding::simd::invert_monochrome_16bit ( const uint16_t * src,
uint16_t * dst,
size_t pixel_count,
uint16_t max_value )
inlinenoexcept

Invert 16-bit monochrome pixels.

Parameters
srcSource pixel data
dstDestination pixel data
pixel_countNumber of pixels to process
max_valueMaximum pixel value (e.g., 4095 for 12-bit, 65535 for 16-bit)

Definition at line 621 of file simd_photometric.h.

623 {
624#if defined(PACS_SIMD_AVX2)
625 if (has_avx2()) {
626 detail::invert_monochrome_16bit_avx2(src, dst, pixel_count, max_value);
627 return;
628 }
629#endif
630#if defined(PACS_SIMD_SSE2)
631 if (has_sse2()) {
632 detail::invert_monochrome_16bit_sse2(src, dst, pixel_count, max_value);
633 return;
634 }
635#endif
636#if defined(PACS_SIMD_NEON)
637 if (has_neon()) {
638 detail::invert_monochrome_16bit_neon(src, dst, pixel_count, max_value);
639 return;
640 }
641#endif
642 detail::invert_monochrome_16bit_scalar(src, dst, pixel_count, max_value);
643}

References has_avx2(), has_neon(), has_sse2(), and kcenon::pacs::encoding::simd::detail::invert_monochrome_16bit_scalar().

Here is the call graph for this function:

◆ invert_monochrome_8bit()

void kcenon::pacs::encoding::simd::invert_monochrome_8bit ( const uint8_t * src,
uint8_t * dst,
size_t pixel_count )
inlinenoexcept

Invert 8-bit monochrome pixels (MONOCHROME1 <-> MONOCHROME2)

Converts between MONOCHROME1 (white = 0) and MONOCHROME2 (white = max). Uses SIMD when available for better performance.

Parameters
srcSource pixel data
dstDestination pixel data (can be same as src for in-place)
pixel_countNumber of pixels to process

Definition at line 590 of file simd_photometric.h.

591 {
592#if defined(PACS_SIMD_AVX2)
593 if (has_avx2()) {
594 detail::invert_monochrome_8bit_avx2(src, dst, pixel_count);
595 return;
596 }
597#endif
598#if defined(PACS_SIMD_SSE2)
599 if (has_sse2()) {
600 detail::invert_monochrome_8bit_sse2(src, dst, pixel_count);
601 return;
602 }
603#endif
604#if defined(PACS_SIMD_NEON)
605 if (has_neon()) {
606 detail::invert_monochrome_8bit_neon(src, dst, pixel_count);
607 return;
608 }
609#endif
610 detail::invert_monochrome_8bit_scalar(src, dst, pixel_count);
611}

References has_avx2(), has_neon(), has_sse2(), and kcenon::pacs::encoding::simd::detail::invert_monochrome_8bit_scalar().

Here is the call graph for this function:

◆ is_aligned()

template<size_t Alignment>
bool kcenon::pacs::encoding::simd::is_aligned ( const void * ptr)
nodiscardconstexprnoexcept

Check if a pointer is aligned to the specified boundary.

Definition at line 211 of file simd_types.h.

211 {
212 return (reinterpret_cast<uintptr_t>(ptr) % Alignment) == 0;
213}

References is_aligned().

Referenced by is_aligned().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ merge_planes_to_16bit()

void kcenon::pacs::encoding::simd::merge_planes_to_16bit ( const uint8_t * high,
const uint8_t * low,
uint8_t * dst,
size_t pixel_count )
inlinenoexcept

Merge high and low byte planes into 16-bit data.

Parameters
highSource high byte plane
lowSource low byte plane
dstDestination 16-bit little-endian data
pixel_countNumber of 16-bit values to merge

Definition at line 837 of file simd_rle.h.

839 {
840 if (pixel_count == 0) {
841 return;
842 }
843
844#if defined(PACS_SIMD_AVX2)
845 if (has_avx2()) {
846 detail::merge_planes_to_16bit_avx2(high, low, dst, pixel_count);
847 return;
848 }
849#endif
850
851#if defined(PACS_SIMD_SSSE3)
852 if (has_ssse3()) {
853 detail::merge_planes_to_16bit_ssse3(high, low, dst, pixel_count);
854 return;
855 }
856#endif
857
858#if defined(PACS_SIMD_NEON)
859 detail::merge_planes_to_16bit_neon(high, low, dst, pixel_count);
860 return;
861#endif
862
863 detail::merge_planes_to_16bit_scalar(high, low, dst, pixel_count);
864}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::merge_planes_to_16bit_scalar().

Referenced by kcenon::pacs::encoding::compression::rle_codec::impl::decode_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator&()

simd_feature kcenon::pacs::encoding::simd::operator& ( simd_feature a,
simd_feature b )
nodiscardconstexprnoexcept

Bitwise AND for simd_feature flags.

Definition at line 110 of file simd_config.h.

111 {
112 return static_cast<simd_feature>(static_cast<uint32_t>(a) &
113 static_cast<uint32_t>(b));
114}

◆ operator|()

simd_feature kcenon::pacs::encoding::simd::operator| ( simd_feature a,
simd_feature b )
nodiscardconstexprnoexcept

Bitwise OR for simd_feature flags.

Definition at line 101 of file simd_config.h.

102 {
103 return static_cast<simd_feature>(static_cast<uint32_t>(a) |
104 static_cast<uint32_t>(b));
105}

◆ optimal_vector_width()

size_t kcenon::pacs::encoding::simd::optimal_vector_width ( )
inlinenodiscardnoexcept

Get optimal vector width in bytes for current CPU.

Returns
Vector width (16 for SSE/NEON, 32 for AVX2, 64 for AVX-512)

Definition at line 284 of file simd_config.h.

284 {
285 if (has_avx512f()) {
286 return 64;
287 }
288 if (has_avx2()) {
289 return 32;
290 }
291 if (has_sse2() || has_neon()) {
292 return 16;
293 }
294 return 0; // No SIMD
295}

References has_avx2(), has_avx512f(), has_neon(), and has_sse2().

Here is the call graph for this function:

◆ planar_to_interleaved_rgb8()

void kcenon::pacs::encoding::simd::planar_to_interleaved_rgb8 ( const uint8_t * r,
const uint8_t * g,
const uint8_t * b,
uint8_t * dst,
size_t pixel_count )
inlinenoexcept

Convert planar RGB to interleaved format using best available SIMD.

Parameters
rSource R plane
gSource G plane
bSource B plane
dstDestination interleaved RGB data (RGBRGBRGB...)
pixel_countNumber of pixels to convert

Definition at line 763 of file simd_rle.h.

765 {
766 if (pixel_count == 0) {
767 return;
768 }
769
770#if defined(PACS_SIMD_AVX2)
771 if (has_avx2()) {
772 detail::planar_to_interleaved_rgb8_avx2(r, g, b, dst, pixel_count);
773 return;
774 }
775#endif
776
777#if defined(PACS_SIMD_SSSE3)
778 if (has_ssse3()) {
779 detail::planar_to_interleaved_rgb8_ssse3(r, g, b, dst, pixel_count);
780 return;
781 }
782#endif
783
784#if defined(PACS_SIMD_NEON)
785 detail::planar_to_interleaved_rgb8_neon(r, g, b, dst, pixel_count);
786 return;
787#endif
788
789 detail::planar_to_interleaved_rgb8_scalar(r, g, b, dst, pixel_count);
790}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::planar_to_interleaved_rgb8_scalar().

Referenced by kcenon::pacs::encoding::compression::rle_codec::impl::decode_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rgb_to_ycbcr_8bit()

void kcenon::pacs::encoding::simd::rgb_to_ycbcr_8bit ( const uint8_t * src,
uint8_t * dst,
size_t pixel_count )
inlinenoexcept

Convert RGB to YCbCr color space (ITU-R BT.601)

Parameters
srcSource RGB pixel data (interleaved RGBRGB...)
dstDestination YCbCr pixel data (interleaved YCbCrYCbCr...)
pixel_countNumber of pixels to process

Definition at line 652 of file simd_photometric.h.

653 {
654#if defined(PACS_SIMD_AVX2)
655 if (has_avx2()) {
656 detail::rgb_to_ycbcr_8bit_avx2(src, dst, pixel_count);
657 return;
658 }
659#endif
660#if defined(PACS_SIMD_NEON)
661 if (has_neon()) {
662 detail::rgb_to_ycbcr_8bit_neon(src, dst, pixel_count);
663 return;
664 }
665#endif
666 detail::rgb_to_ycbcr_8bit_scalar(src, dst, pixel_count);
667}

References has_avx2(), has_neon(), and kcenon::pacs::encoding::simd::detail::rgb_to_ycbcr_8bit_scalar().

Here is the call graph for this function:

◆ split_16bit_to_planes()

void kcenon::pacs::encoding::simd::split_16bit_to_planes ( const uint8_t * src,
uint8_t * high,
uint8_t * low,
size_t pixel_count )
inlinenoexcept

Split 16-bit data into high and low byte planes.

Parameters
srcSource 16-bit little-endian data
highDestination high byte plane
lowDestination low byte plane
pixel_countNumber of 16-bit values to split

Definition at line 800 of file simd_rle.h.

802 {
803 if (pixel_count == 0) {
804 return;
805 }
806
807#if defined(PACS_SIMD_AVX2)
808 if (has_avx2()) {
809 detail::split_16bit_to_planes_avx2(src, high, low, pixel_count);
810 return;
811 }
812#endif
813
814#if defined(PACS_SIMD_SSSE3)
815 if (has_ssse3()) {
816 detail::split_16bit_to_planes_ssse3(src, high, low, pixel_count);
817 return;
818 }
819#endif
820
821#if defined(PACS_SIMD_NEON)
822 detail::split_16bit_to_planes_neon(src, high, low, pixel_count);
823 return;
824#endif
825
826 detail::split_16bit_to_planes_scalar(src, high, low, pixel_count);
827}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::split_16bit_to_planes_scalar().

Referenced by kcenon::pacs::encoding::compression::rle_codec::impl::encode_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_bytes_16_simd()

void kcenon::pacs::encoding::simd::swap_bytes_16_simd ( const uint8_t * src,
uint8_t * dst,
size_t byte_count )
inlinenoexcept

Swap bytes in 16-bit words using best available SIMD.

Parameters
srcSource data pointer
dstDestination data pointer
byte_countNumber of bytes (should be even)

Definition at line 278 of file simd_utils.h.

279 {
280 if (byte_count < 2) {
281 return;
282 }
283
284#if defined(PACS_SIMD_AVX2)
285 if (has_avx2()) {
286 detail::swap_bytes_16_avx2(src, dst, byte_count);
287 return;
288 }
289#endif
290
291#if defined(PACS_SIMD_SSSE3)
292 if (has_ssse3()) {
293 detail::swap_bytes_16_ssse3(src, dst, byte_count);
294 return;
295 }
296#endif
297
298#if defined(PACS_SIMD_NEON)
299 detail::swap_bytes_16_neon(src, dst, byte_count);
300 return;
301#endif
302
303 detail::swap_bytes_16_scalar(src, dst, byte_count);
304}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::swap_bytes_16_scalar().

Referenced by kcenon::pacs::encoding::swap_ow_bytes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_bytes_32_simd()

void kcenon::pacs::encoding::simd::swap_bytes_32_simd ( const uint8_t * src,
uint8_t * dst,
size_t byte_count )
inlinenoexcept

Swap bytes in 32-bit words using best available SIMD.

Parameters
srcSource data pointer
dstDestination data pointer
byte_countNumber of bytes (should be multiple of 4)

Definition at line 312 of file simd_utils.h.

313 {
314 if (byte_count < 4) {
315 return;
316 }
317
318#if defined(PACS_SIMD_AVX2)
319 if (has_avx2()) {
320 detail::swap_bytes_32_avx2(src, dst, byte_count);
321 return;
322 }
323#endif
324
325#if defined(PACS_SIMD_SSSE3)
326 if (has_ssse3()) {
327 detail::swap_bytes_32_ssse3(src, dst, byte_count);
328 return;
329 }
330#endif
331
332#if defined(PACS_SIMD_NEON)
333 detail::swap_bytes_32_neon(src, dst, byte_count);
334 return;
335#endif
336
337 detail::swap_bytes_32_scalar(src, dst, byte_count);
338}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::swap_bytes_32_scalar().

Referenced by kcenon::pacs::encoding::swap_ol_bytes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap_bytes_64_simd()

void kcenon::pacs::encoding::simd::swap_bytes_64_simd ( const uint8_t * src,
uint8_t * dst,
size_t byte_count )
inlinenoexcept

Swap bytes in 64-bit words using best available SIMD.

Parameters
srcSource data pointer
dstDestination data pointer
byte_countNumber of bytes (should be multiple of 8)

Definition at line 346 of file simd_utils.h.

347 {
348 if (byte_count < 8) {
349 return;
350 }
351
352#if defined(PACS_SIMD_AVX2)
353 if (has_avx2()) {
354 detail::swap_bytes_64_avx2(src, dst, byte_count);
355 return;
356 }
357#endif
358
359#if defined(PACS_SIMD_SSSE3)
360 if (has_ssse3()) {
361 detail::swap_bytes_64_ssse3(src, dst, byte_count);
362 return;
363 }
364#endif
365
366#if defined(PACS_SIMD_NEON)
367 detail::swap_bytes_64_neon(src, dst, byte_count);
368 return;
369#endif
370
371 detail::swap_bytes_64_scalar(src, dst, byte_count);
372}

References has_avx2(), has_ssse3(), and kcenon::pacs::encoding::simd::detail::swap_bytes_64_scalar().

Referenced by kcenon::pacs::encoding::swap_od_bytes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ycbcr_to_rgb_8bit()

void kcenon::pacs::encoding::simd::ycbcr_to_rgb_8bit ( const uint8_t * src,
uint8_t * dst,
size_t pixel_count )
inlinenoexcept

Convert YCbCr to RGB color space (ITU-R BT.601)

Parameters
srcSource YCbCr pixel data (interleaved YCbCrYCbCr...)
dstDestination RGB pixel data (interleaved RGBRGB...)
pixel_countNumber of pixels to process

Definition at line 676 of file simd_photometric.h.

677 {
678#if defined(PACS_SIMD_AVX2)
679 if (has_avx2()) {
680 detail::ycbcr_to_rgb_8bit_avx2(src, dst, pixel_count);
681 return;
682 }
683#endif
684#if defined(PACS_SIMD_NEON)
685 if (has_neon()) {
686 detail::ycbcr_to_rgb_8bit_neon(src, dst, pixel_count);
687 return;
688 }
689#endif
690 detail::ycbcr_to_rgb_8bit_scalar(src, dst, pixel_count);
691}

References has_avx2(), has_neon(), and kcenon::pacs::encoding::simd::detail::ycbcr_to_rgb_8bit_scalar().

Here is the call graph for this function:

Variable Documentation

◆ AVX512_ALIGNMENT

size_t kcenon::pacs::encoding::simd::AVX512_ALIGNMENT = 64
constexpr

Definition at line 28 of file simd_types.h.

◆ AVX_ALIGNMENT

size_t kcenon::pacs::encoding::simd::AVX_ALIGNMENT = 32
constexpr

Definition at line 27 of file simd_types.h.

◆ SSE_ALIGNMENT

size_t kcenon::pacs::encoding::simd::SSE_ALIGNMENT = 16
constexpr

Definition at line 26 of file simd_types.h.