added output reading

This commit is contained in:
Nickiel12 2024-10-18 01:18:01 +00:00
parent 6f4239adb9
commit a4dba41c13

View file

@ -107,18 +107,24 @@ pub fn main() !void {
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("Writing vstream data\n", .{}); std.debug.print("Writing vstream data\n", .{});
//for (0..100) |_| {
status = hlo.hailo_vstream_write_raw_buffer(input_vstreams[0], input_data.ptr, input_frame_size); status = hlo.hailo_vstream_write_raw_buffer(input_vstreams[0], input_data.ptr, input_frame_size);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
//}
std.debug.print("Input written\n", .{}); std.debug.print("Input written\n", .{});
status = hlo.hailo_flush_input_vstream(input_vstreams[0]); status = hlo.hailo_flush_input_vstream(input_vstreams[0]);
assert(status == hlo.HAILO_SUCCESS); assert(status == hlo.HAILO_SUCCESS);
std.debug.print("input flushed!\n", .{}); std.debug.print("input flushed!\n", .{});
var output_frame_size: usize = 0;
status = hlo.hailo_get_output_vstream_frame_size(input_vstreams[0], &output_frame_size);
assert(status == hlo.HAILO_SUCCESS);
std.debug.print("output frame size is: {d}\n", .{ output_frame_size });
const output_frame_count = output_frame_size / @sizeOf(u8);
const output_data: [:0]u8 = try alloc.allocSentinel(u8, output_frame_count, 0);
status = hlo.hailo_vstream_read_raw_buffer(output_vstreams[0], output_data.ptr, output_frame_size);
assert(status == hlo.HAILO_SUCCESS);
_ = hlo.hailo_release_output_vstreams(&output_vstreams, output_vstream_size); _ = hlo.hailo_release_output_vstreams(&output_vstreams, output_vstream_size);