FaceAccess/Record/Utility.cpp
2024-09-05 09:59:28 +08:00

12 lines
391 B
C++

#include "Utility.h"
std::vector<uint8_t> duplicate(const uint8_t *data, int32_t byteSize) {
std::vector<uint8_t> ret(byteSize * 2);
auto pcm = reinterpret_cast<const uint16_t *>(data);
auto retPcm = reinterpret_cast<uint16_t *>(ret.data());
for (int i = 0; i < byteSize / 2; i++) {
retPcm[2 * i] = pcm[i];
retPcm[2 * i + 1] = pcm[i];
}
return ret;
}