mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
15 lines
No EOL
302 B
C++
15 lines
No EOL
302 B
C++
#include "utils.h"
|
|
#include <cmath>
|
|
|
|
void char_array_to_uchar(int8_t *in, uint8_t *out, int nsamples)
|
|
{
|
|
for (int i = 0; i < nsamples; i++)
|
|
{
|
|
double r = in[i] * 127.0;
|
|
if (r < 0)
|
|
r = 0;
|
|
else if (r > 255)
|
|
r = 255;
|
|
out[i] = floor(r);
|
|
}
|
|
} |