From b798cb803497cb9d60918fe1d6153696b364b07d Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 7 Jul 2017 16:32:55 +0200 Subject: Write statistics to yaml file, add option to stop after N frames --- src/utils.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/utils.cpp') diff --git a/src/utils.cpp b/src/utils.cpp index d0c1273..90231ce 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -29,6 +29,7 @@ #include "utils.hpp" #include +#include #include #include #include @@ -237,3 +238,15 @@ int absolute_to_dB(int16_t value) return value ? round(20*log10((double)value / int16_max)) : -90; } +std::string flag_to_shortlabel(const std::string& label, uint16_t flag) +{ + stringstream shortlabel; + for (size_t i = 0; i < label.size(); ++i) { + if (flag & 0x8000 >> i) { + shortlabel << label[i]; + } + } + + return shortlabel.str(); +} + -- cgit v1.2.3