From a4dba41c1321f19a13de870f6668ff6c70858b06 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Fri, 18 Oct 2024 01:18:01 +0000 Subject: [PATCH] added output reading --- src/main.zig | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main.zig b/src/main.zig index 625f53a..35776f3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -107,18 +107,24 @@ pub fn main() !void { assert(status == hlo.HAILO_SUCCESS); 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); - assert(status == hlo.HAILO_SUCCESS); - //} - + status = hlo.hailo_vstream_write_raw_buffer(input_vstreams[0], input_data.ptr, input_frame_size); + assert(status == hlo.HAILO_SUCCESS); std.debug.print("Input written\n", .{}); status = hlo.hailo_flush_input_vstream(input_vstreams[0]); assert(status == hlo.HAILO_SUCCESS); - 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);