| | |
| | | return elems; |
| | | } |
| | | |
| | | std::vector<std::string> SplitStr(const std::string &s, string delimiter) { |
| | | std::vector<std::string> tokens; |
| | | size_t start = 0; |
| | | size_t end = s.find(delimiter); |
| | | |
| | | while (end != std::string::npos) { |
| | | tokens.push_back(s.substr(start, end - start)); |
| | | start = end + delimiter.length(); |
| | | end = s.find(delimiter, start); |
| | | } |
| | | tokens.push_back(s.substr(start, end - start)); |
| | | |
| | | return tokens; |
| | | } |
| | | |
| | | template<typename T> |
| | | void PrintMat(const std::vector<std::vector<T>> &mat, const std::string &name) { |
| | | std::cout << name << ":" << std::endl; |
| | |
| | | sum -=(1.0 - 1e-4); |
| | | } |
| | | } |
| | | // fix case: sum > 1 |
| | | int cif_idx = cif_peak.size()-1; |
| | | while(sum>=1.0 - 1e-4 && cif_idx >= 0 ){ |
| | | if(cif_peak[cif_idx] < 1.0 - 1e-4){ |
| | | cif_peak[cif_idx] = sum; |
| | | sum -=(1.0 - 1e-4); |
| | | } |
| | | cif_idx--; |
| | | } |
| | | |
| | | fire_place.clear(); |
| | | for (int i = 0; i < num_frames; i++) { |