MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ as_normalised_float()

std::span< const float > MayaFlux::Kakshya::TextureContainer::as_normalised_float ( uint32_t  layer = 0) const

Layer pixel data as a normalised float span.

uint8_t source is divided by 255.0f. uint16_t by 65535.0f. float source is zero-copy into the variant's own storage. Returns empty span if layer is out of range or the variant holds a non-pixel type.

Result is cached per layer and reused until set_pixels() or from_image() invalidates it for that layer.

Parameters
layerArray layer index. Defaults to 0.
Returns
Normalised float span, w * h * channels elements.

Definition at line 641 of file TextureContainer.cpp.

642{
643 if (layer >= m_data.size())
644 return {};
645
646 if (!m_normalised_dirty[layer].load(std::memory_order_acquire))
647 return { m_normalised_cache[layer] };
648
649 std::span<const float> result;
650 seqlock_read_void(m_slot_locks[layer], 8, [&] {
652 });
653
654 if (!result.empty())
655 m_normalised_dirty[layer].store(false, std::memory_order_release);
656
657 return result;
658}
std::vector< std::atomic< bool > > m_normalised_dirty
std::vector< std::vector< float > > m_normalised_cache
std::span< const float > as_normalised_float(const DataVariant &variant, std::vector< float > &storage)
Extract a DataVariant holding pixel data as a normalised float span.
Definition DataUtils.cpp:61
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.
Definition SeqLock.hpp:222
std::shared_ptr< T > store(std::shared_ptr< T > obj)
Transfer ownership of an existing object to the persistent store for process lifetime.
Definition Persist.hpp:28

References MayaFlux::store().

+ Here is the call graph for this function: