summaryrefslogtreecommitdiff
path: root/src/sstv.h
blob: 6a8f819e81807efcce15f44ed46f1085f2c1d837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
 *
 * libsstv is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See LICENSE for details.
 */

#ifndef _SSTV_H_
#define _SSTV_H_

#include "libsstv.h"

/*
 * Mode timings and frequency descriptors
 */
typedef struct {
    uint32_t hz;
    uint32_t phase_delta;
} sstv_freq_desc_t;

typedef struct {
    uint32_t usec;
    uint32_t usamp;
} sstv_timing_desc_t;

typedef struct {
    /* Header */
    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t freq;
    } leader_tone;

    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t freq;
    } break_tone;

    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t sep_freq;
        sstv_freq_desc_t low_freq;
        sstv_freq_desc_t high_freq;
    } vis;

    /* Mode */
    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t freq;
    } sync;

    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t freq;
    } porch;

    struct {
        sstv_timing_desc_t time;
        sstv_freq_desc_t low_freq;
        sstv_freq_desc_t bandwidth;

        /* lookup table from value to delta-phase */
        uint32_t val_phase_delta[256];
    } pixel;
} sstv_mode_descriptor_t;

/*
 * Memory management
 */
extern sstv_malloc_t sstv_malloc_user;
extern sstv_free_t sstv_free_user;

/*
 * Utility functions
 */
extern sstv_error_t
sstv_get_mode_descriptor(sstv_mode_t mode, uint32_t sample_rate, sstv_mode_descriptor_t *desc);

#endif