libsstvenc
Asynchronous Analogue SSTV encoder
|
Topics | |
Time-scale units | |
Macros | |
#define | SSTVENC_TS_INFINITE UINT32_MAX |
Functions | |
uint64_t | sstvenc_ts_unit_scale (uint8_t unit) |
uint32_t | sstvenc_ts_clamp_samples (uint64_t samples) |
uint32_t | sstvenc_ts_unit_to_samples (double time, uint32_t sample_rate, uint8_t unit) |
double | sstvenc_ts_samples_to_unit (uint32_t samples, uint32_t sample_rate, uint8_t unit) |
Conversion between discrete samples and real-time. SSTV timings are given in real-world seconds (actually, nanoseconds) as time units but we need to know what that is in the number of discrete samples. There is rounding applied to handle fractional samples.
Time periods down to nanosecond precision may be specified.
Conversion between discrete samples and real-time. SSTV timings are given in real-world seconds (actually, nanoseconds) as time units but we need to know what that is in the number of discrete samples. There is rounding applied to handle fractional samples.
Time periods down to nanosecond precision may be specified.
#define SSTVENC_TS_INFINITE UINT32_MAX |
Infinite time scale. We set this to the maximum number of samples, which at 48kHz sample rates, equates to about a day.
Definition at line 28 of file timescale.h.
Referenced by sstvenc_ts_clamp_samples(), sstvenc_ts_samples_to_unit(), and sstvenc_ts_unit_to_samples().
uint32_t sstvenc_ts_clamp_samples | ( | uint64_t | samples | ) |
Clamp the given number of samples to a safe maximum. If the value is greater than that supported by a uint32_t
data type, it is clamped to SSTVENC_TS_INFINITE.
[in] | samples | Unclamped number of samples. |
Definition at line 38 of file timescale.c.
References SSTVENC_TS_INFINITE.
Referenced by sstvenc_ts_unit_to_samples().
double sstvenc_ts_samples_to_unit | ( | uint32_t | samples, |
uint32_t | sample_rate, | ||
uint8_t | unit ) |
Convert the given number of samples to a time period in the specified unit.
[in] | samples | The number of samples being measured. |
[in] | sample_rate | The sample rate in hertz being used for the discrete timebase. |
[in] | unit | The time unit desired, see Time-scale units |
INFINITY | Infinite number of samples is represented. |
Definition at line 57 of file timescale.c.
References SSTVENC_TS_INFINITE, and sstvenc_ts_unit_scale().
uint64_t sstvenc_ts_unit_scale | ( | uint8_t | unit | ) |
Obtain the scaling factor to convert 1 second of time to the given unit.
[in] | unit | The time scale of interest. Time-scale units |
Definition at line 22 of file timescale.c.
References SSTVENC_TS_UNIT_MICROSECONDS, SSTVENC_TS_UNIT_MILLISECONDS, SSTVENC_TS_UNIT_NANOSECONDS, and SSTVENC_TS_UNIT_SECONDS.
Referenced by sstvenc_sequencer_exec_set_ts(), sstvenc_ts_samples_to_unit(), and sstvenc_ts_unit_to_samples().
uint32_t sstvenc_ts_unit_to_samples | ( | double | time, |
uint32_t | sample_rate, | ||
uint8_t | unit ) |
Convert the given time period to the number of units.
[in] | time | The number of time units being converted. |
[in] | sample_rate | The sample rate in hertz being used for the discrete timebase. |
[in] | unit | The time unit being measured, see Time-scale units |
SSTVENC_TS_INFINITE | Time period is too long to represent. |
Definition at line 46 of file timescale.c.
References sstvenc_ts_clamp_samples(), SSTVENC_TS_INFINITE, and sstvenc_ts_unit_scale().
Referenced by sstvenc_cw_init(), sstvenc_modulator_next_tone(), sstvenc_ps_init(), sstvenc_ps_reset(), and sstvenc_sequencer_begin_silence().