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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#ifndef LIB_UFODECODE_H
#define LIB_UFODECODE_H
#include <inttypes.h>
typedef struct _UfoDecoder UfoDecoder;
typedef struct {
unsigned dummy1:2;
unsigned fsm_master_readout:4;
unsigned dummy2:4;
unsigned fsm_daq:4;
unsigned pixel_full:1;
unsigned control_lock:1;
unsigned data_lock:16;
} UfoDecoderStatus1;
typedef struct {
unsigned end_of_frames:1;
unsigned busy_or:1;
unsigned busy_ddr:1;
unsigned busy_interl:1;
unsigned error_status:4; /* What the heck? */
unsigned data_fifo_read_count:10;
unsigned data_fifo_full:1;
unsigned data_fifo_empty:1;
unsigned dummy:2;
unsigned ddr_fifo_write_count:8;
unsigned ddr_fifo_full:1;
unsigned ddr_fifo_empty:1;
} UfoDecoderStatus2;
typedef struct {
unsigned dummy:2;
unsigned row_counter:10;
unsigned pixel_counter:8;
unsigned ddr_read:4;
unsigned ddr_write:4;
unsigned ddr_arbiter:4;
} UfoDecoderStatus3;
typedef struct {
uint32_t frame_number;
uint32_t time_stamp;
uint32_t n_rows;
uint8_t n_skipped_rows;
uint16_t cmosis_start_address;
union {
uint32_t bits;
UfoDecoderStatus1 desc;
} status1;
union {
uint32_t bits;
UfoDecoderStatus2 desc;
} status2;
union {
uint32_t bits;
UfoDecoderStatus3 desc;
} status3;
} UfoDecoderMeta;
#ifdef __cplusplus
extern "C" {
#endif
UfoDecoder *ufo_decoder_new (int32_t height,
uint32_t width,
uint32_t *raw,
size_t num_bytes);
void ufo_decoder_free (UfoDecoder *decoder);
size_t ufo_decoder_decode_frame (UfoDecoder *decoder,
uint32_t *raw,
size_t num_bytes,
uint16_t *pixels,
UfoDecoderMeta *meta);
void ufo_decoder_set_raw_data (UfoDecoder *decoder,
uint32_t *raw,
size_t num_bytes);
int ufo_decoder_get_next_frame (UfoDecoder *decoder,
uint16_t **pixels,
UfoDecoderMeta *meta_data);
void ufo_deinterlace_interpolate (const uint16_t *frame_in,
uint16_t *frame_out,
int width,
int height);
void ufo_deinterlace_weave (const uint16_t *in1,
const uint16_t *in2,
uint16_t *out,
int width,
int height);
#ifdef __cplusplus
}
#endif
#endif
|