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

◆ encode_word_pairs()

std::vector< uint8_t > MayaFlux::Yantra::OperationHelper::encode_word_pairs ( std::span< const double > values,
size_t padded_words = 0,
bool order_key = false,
bool complement = false )
static

Encode doubles as little-endian 64-bit words, two 32-bit lanes each.

Parameters
valuesDoubles to encode
padded_wordsWord count to return. Words past values are all ones
order_keyTrue to encode order keys, false to encode the IEEE 754 bits
complementComplements every encoded word

Definition at line 211 of file OperationHelper.cpp.

213{
214 const size_t count = std::max(padded_words, values.size());
215 std::vector<uint8_t> bytes(count * sizeof(uint64_t));
216 for (size_t i = 0; i < count; ++i) {
217 uint64_t word = ~uint64_t { 0 };
218 if (i < values.size()) {
219 word = order_key
221 : std::bit_cast<uint64_t>(values[i]);
222 word = complement ? ~word : word;
223 }
224 Transitive::Protocol::store_le_u64(bytes.data() + i * sizeof(uint64_t), word);
225 }
226 return bytes;
227}
constexpr uint64_t order_key(double value) noexcept
The order key of a value.
Definition OrderKey.hpp:24
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506
void store_le_u64(uint8_t *dst, uint64_t val) noexcept
Store a uint64 as eight little-endian bytes.

References MayaFlux::Kinesis::Discrete::order_key(), and MayaFlux::Transitive::Protocol::store_le_u64().

Referenced by MayaFlux::Yantra::WordPairExecutionContext::stage_words(), and MayaFlux::Yantra::WaveformAnalyzer< std::vector< Kakshya::DataVariant >, Eigen::MatrixXd >::upload_chunk().

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