removed loop shoving data till it crashed
This commit is contained in:
parent
6f95699d19
commit
6f4239adb9
1 changed files with 7 additions and 17 deletions
24
src/main.zig
24
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);
|
||||
|
|
Loading…
Reference in a new issue