libsstvenc
Asynchronous Analogue SSTV encoder
Loading...
Searching...
No Matches
sstvfreq.c
Go to the documentation of this file.
1
6/*
7 * © Stuart Longland VK4MSL
8 * SPDX-License-Identifier: MIT
9 */
10
11#include <libsstvenc/sstvfreq.h>
12
13uint16_t sstvenc_level_freq(uint8_t level) {
14 double flevel = level / ((float)UINT8_MAX);
15 if (flevel >= 1.0) {
16 return SSTVENC_FREQ_WHITE;
17 } else if (flevel <= 0.0) {
18 return SSTVENC_FREQ_BLACK;
19 } else {
20 return (uint16_t)(SSTVENC_FREQ_BLACK
21 + (flevel
22 * (double)(SSTVENC_FREQ_WHITE
24 + 0.5);
25 }
26}
27
#define SSTVENC_FREQ_WHITE
Definition sstvfreq.h:23
#define SSTVENC_FREQ_BLACK
Definition sstvfreq.h:21
uint16_t sstvenc_level_freq(uint8_t level)
Definition sstvfreq.c:13