From 922d8e7834df411818341639dd859d3f6ff21880 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sun, 28 Apr 2024 16:29:35 -0400 Subject: Fix typos --- decoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decoder.py b/decoder.py index efa9a81..cb34487 100644 --- a/decoder.py +++ b/decoder.py @@ -22,7 +22,7 @@ cheight = cwidth = max(args.height // 10, args.width // 10) frame_size = args.height * args.width - 4 * cheight * cwidth frame_bytes = frame_size * 3 // 8 frame_xor = np.arange(frame_bytes, dtype=np.uint8) -rs_bytes = frame_bytes - (frame_size // 2 + 254) // 255 * int(args.level * 255) - 4 +rs_bytes = frame_bytes - (frame_bytes + 254) // 255 * int(args.level * 255) - 4 rsc = RSCodec(int(args.level * 255)) decoder = Decoder.with_defaults(args.size, rs_bytes) @@ -123,7 +123,7 @@ while data is None: ) ) # erase_pos = bytearray(np.where(frame == 0)[0]) if args.erasure else bytearray() - data = decoder.decode(bytes(rsc.decode(bytearray(np.packbits(frame) ^ frame_xor))[0])) + data = decoder.decode(bytes(rsc.decode(bytearray(np.packbits(frame) ^ frame_xor))[0][:-4])) print("Decoded frame") except KeyboardInterrupt: sys.exit() -- cgit v1.2.3-70-g09d2