From 5f369df045e0c3e9a2ed81a1dc15fe6cd06c88da Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 29 Dec 2024 19:15:47 +0100 Subject: [PATCH] tools/haar2c: Align features arrays. To support loading pointers from ROM. --- tools/haar2c.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/haar2c.py b/tools/haar2c.py index 358a2558e..622a06ae4 100755 --- a/tools/haar2c.py +++ b/tools/haar2c.py @@ -170,6 +170,10 @@ def cascade_binary(path, n_stages, name): for s in stages: fout.write(struct.pack('B', s)) # uint8_t + padding = (4 - ((12 + len(stages)) % 4)) % 4 + if padding: + fout.write(b"\x00"*padding) + # write stages thresholds for t in stage_threshold: fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t @@ -266,6 +270,10 @@ def cascade_binary_old(path, n_stages, name): for s in stages: fout.write(struct.pack('B', s)) # uint8_t + padding = (4 - ((12 + len(stages)) % 4)) % 4 + if padding: + fout.write(b"\x00"*padding) + # write stages thresholds for t in stage_threshold: fout.write(struct.pack('h', int(float(t.childNodes[0].nodeValue)*256))) #int16_t