Skip to content

Commit d47e5cf

Browse files
committed
Add support for image source/sink nodes
1 parent 6c0905e commit d47e5cf

5 files changed

Lines changed: 128 additions & 0 deletions

File tree

api/datatype.proto

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,36 @@ message AnnotatedTensor {
107107
// e.g. pipeline latencies
108108
map<string, google.protobuf.Value> metadata = 2;
109109
}
110+
111+
enum PixelFormat {
112+
kPixelFormatUnknown = 0;
113+
kYUV420_888 = 1;
114+
kRGB888 = 2;
115+
kRGBA8888 = 3;
116+
kGrayscale8 = 4;
117+
kRAW10 = 5;
118+
kRAW16 = 6;
119+
kNV12 = 7;
120+
kNV21 = 8;
121+
}
122+
123+
message ImageFrame {
124+
uint32 width = 1;
125+
uint32 height = 2;
126+
PixelFormat format = 3;
127+
128+
// Stride of the first (Y) plane for multi-plane formats
129+
uint32 stride_bytes = 4;
130+
131+
uint64 sequence_number = 5;
132+
133+
// Sensor exposure midpoint, in nanoseconds
134+
uint64 timestamp_ns = 6;
135+
uint64 unix_timestamp_ns = 7;
136+
137+
// Zero if unknown or not applicable
138+
int64 exposure_ns = 8;
139+
140+
// Empty for internal zero-copy edges, populated for tap transport
141+
bytes data = 9;
142+
}

api/device.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ message Peripheral {
1313
kElectricalStimulation = 2;
1414
kOpticalStimulation = 3;
1515
kSpikeSource = 4;
16+
kCamera = 5;
1617
}
1718
string name = 1;
1819
string vendor = 2;

api/node.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import "api/nodes/disk_writer.proto";
1111
import "api/nodes/spike_source.proto";
1212
import "api/nodes/spike_binner.proto";
1313
import "api/nodes/application.proto";
14+
import "api/nodes/image_source.proto";
15+
import "api/nodes/image_sink.proto";
1416

1517
enum NodeType {
1618
kNodeTypeUnknown = 0;
@@ -27,6 +29,8 @@ enum NodeType {
2729
kDiskWriter = 9;
2830
kSpikeBinner = 10;
2931
kApplication = 11;
32+
kImageSource = 12;
33+
kImageSink = 13;
3034
}
3135

3236
message NodeConfig {
@@ -47,6 +51,8 @@ message NodeConfig {
4751
SpikeSourceConfig spike_source = 12;
4852
SpikeBinnerConfig spike_binner = 13;
4953
ApplicationNodeConfig application = 14;
54+
ImageSourceConfig image_source = 15;
55+
ImageSinkConfig image_sink = 16;
5056
}
5157
}
5258

@@ -63,6 +69,8 @@ message NodeStatus {
6369
ApplicationNodeStatus application = 7;
6470
OpticalStimulationStatus optical_stimulation = 8;
6571
DiskWriterStatus disk_writer = 10;
72+
ImageSourceStatus image_source = 11;
73+
ImageSinkStatus image_sink = 12;
6674
}
6775
}
6876

api/nodes/image_sink.proto

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
syntax = "proto3";
2+
3+
package synapse;
4+
5+
message ImageSinkConfig {
6+
oneof target {
7+
DisplaySinkConfig display = 1;
8+
TapSinkConfig tap = 2;
9+
}
10+
}
11+
12+
message DisplaySinkConfig {
13+
bool front_buffer = 1;
14+
bool vsync = 2;
15+
}
16+
17+
message TapSinkConfig {
18+
ImageEncoding encoding = 1;
19+
20+
// 1-100, interpretation depends on encoding
21+
uint32 quality = 2;
22+
23+
// 0 = unlimited (publish every frame)
24+
float max_rate_hz = 3;
25+
}
26+
27+
enum ImageEncoding {
28+
kImageEncodingUnknown = 0;
29+
kImageEncodingJPEG = 1;
30+
kImageEncodingPNG = 2;
31+
kImageEncodingRAW = 3;
32+
}
33+
34+
message ImageSinkStatus {
35+
uint64 frames_exported = 1;
36+
float actual_rate_hz = 2;
37+
float latency_ms = 3;
38+
}

api/nodes/image_source.proto

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
syntax = "proto3";
2+
3+
package synapse;
4+
5+
import "api/datatype.proto";
6+
7+
message ImageSourceConfig {
8+
oneof source {
9+
CameraSourceConfig camera = 1;
10+
TapSourceConfig tap = 2;
11+
}
12+
}
13+
14+
message CameraSourceConfig {
15+
uint32 peripheral_id = 1;
16+
uint32 width = 2;
17+
uint32 height = 3;
18+
PixelFormat format = 4;
19+
float frame_rate_hz = 5;
20+
CameraISPConfig isp = 6;
21+
}
22+
23+
message TapSourceConfig {
24+
}
25+
26+
message CameraISPConfig {
27+
AutoExposureMode ae_mode = 1;
28+
int64 exposure_ns = 2;
29+
int32 sensitivity_iso = 3;
30+
bool noise_reduction = 4;
31+
bool edge_enhancement = 5;
32+
bool autofocus = 6;
33+
}
34+
35+
enum AutoExposureMode {
36+
kAEUnknown = 0;
37+
kAEOff = 1;
38+
kAEOn = 2;
39+
}
40+
41+
message ImageSourceStatus {
42+
float actual_frame_rate_hz = 1;
43+
int64 actual_exposure_ns = 2;
44+
float focus_diopters = 3;
45+
bool lens_stationary = 4;
46+
uint64 frames_produced = 5;
47+
uint64 frames_dropped = 6;
48+
}

0 commit comments

Comments
 (0)