aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-07-26 14:10:08 -0500
committerAnthony Wang2024-07-26 14:10:08 -0500
commite7f51477d847793432b2410d74a9784d06a0eaf0 (patch)
treee89b8eda98b030a550e740fb04bf24378dab0385
parent463516f48fa7ea340b5703d9786381065294825e (diff)
Don't skip frames when decoding
This increases bandwidth since we don't have to resync after failing to decode a frame, but at the cost of higher CPU usage
-rw-r--r--decoder.py7
1 files changed, 0 insertions, 7 deletions
diff --git a/decoder.py b/decoder.py
index 5b3178c..8166382 100644
--- a/decoder.py
+++ b/decoder.py
@@ -48,7 +48,6 @@ if isinstance(args.input, str) and args.input.isdecimal():
cap = cv2.VideoCapture(args.input)
data = None
start_time = 0
-status = 0
decoded = 0
while data is None:
try:
@@ -56,10 +55,6 @@ while data is None:
if not ret:
print("End of stream")
break
- if isinstance(args.input, int) and (status == 1 or (status == 0 and np.random.rand() < 0.5)):
- status = 2
- print("Skipped")
- continue
# raw_frame is a uint8 BE CAREFUL
cv2.imshow("", raw_frame)
cv2.waitKey(1)
@@ -113,14 +108,12 @@ while data is None:
frame[:reshape_len] = np.ravel(frame[:reshape_len].reshape(255, reshape_len // 255), "F")
data = decoder.decode(bytes(rsc.decode(bytearray(frame ^ frame_xor))[0][: args.psize]))
decoded += 1
- status = 1
if start_time == 0:
start_time = time.time()
print("Decoded frame")
except KeyboardInterrupt:
break
except Exception as e:
- status = 0
print(e)
cap.release()
print(decoded)