aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-04-28 16:29:35 -0400
committerAnthony Wang2024-04-28 16:29:35 -0400
commit922d8e7834df411818341639dd859d3f6ff21880 (patch)
tree962cbb26f6d9e047598fcf637888f9749f4b9d24
parent4f9cdeedb7d6a4ee20e503f9c2b20b5b2de1bf51 (diff)
Fix typos
-rw-r--r--decoder.py4
1 files 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()