From 6f4239adb9074b13eaa597b8a0e48ea635121dbc Mon Sep 17 00:00:00 2001 From: Nicholas Young Date: Thu, 17 Oct 2024 18:13:55 -0700 Subject: [PATCH] removed loop shoving data till it crashed --- src/main.zig | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/main.zig b/src/main.zig index a4e901a..625f53a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -7,7 +7,7 @@ const hlo = @cImport({ const Allocator = std.mem.Allocator; const assert = std.debug.assert; -const hef_file = "yolov7.hef"; +const hef_file = "yolov3.hef"; const max_edge_layers = 32; @@ -93,22 +93,13 @@ pub fn main() !void { assert(status == hlo.HAILO_SUCCESS); const frame_count = input_frame_size / @sizeOf(u8); - std.debug.print("Trying to create {d} u8s\n", .{ frame_count }); var input_data: [:0]u8 = try alloc.allocSentinel(u8, frame_count, 0); - var prng = std.Random.DefaultPrng.init(blk: { - var seed: u64 = undefined; - try std.posix.getrandom(std.mem.asBytes(&seed)); - break :blk seed; - }); - const rand = prng.random(); - - for (0..frame_count) |i| { - input_data[i] = rand.int(u8); + for (0..(frame_count + 1)) |i| { + input_data[i] = 5; } - std.debug.print("Random numbers filled!\n", .{}); std.debug.print("Getting vstream info\n", .{}); var stream_info: hlo.hailo_vstream_info_t = undefined; @@ -116,12 +107,10 @@ pub fn main() !void { assert(status == hlo.HAILO_SUCCESS); std.debug.print("Writing vstream data\n", .{}); - // Here we simulate taking our data and chunking it into frame_size, then uploading each frame until we have uploaded - // all of our data - for (0..frame_count) |_| { - status = hlo.hailo_vstream_write_raw_buffer(input_vstreams[0], @ptrCast(input_data.ptr), input_frame_size); + //for (0..100) |_| { + 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", .{}); @@ -131,6 +120,7 @@ pub fn main() !void { std.debug.print("input flushed!\n", .{}); + _ = hlo.hailo_release_output_vstreams(&output_vstreams, output_vstream_size); _ = hlo.hailo_release_input_vstreams(&input_vstreams, input_vstream_size); _ = hlo.hailo_release_hef(hef);