diff options
-rw-r--r-- | decoder.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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() |