fix run length dtype
1 changed file+4−0
benchcompress/src/benchcompress/algorithms/simple_ans/__init__.pymodified+4−0View file
@@ -290,6 +290,8 @@ def simple_ans_markov_sparse_encode(x: np.ndarray) -> bytes:
290290 run_length_dtype_code = 0
291291 elif run_lengths.dtype == np.uint16:
292292 run_length_dtype_code = 1
293+ elif run_lengths.dtype == np.uint32:
294+ run_length_dtype_code = 2
293295 else:
294296 raise ValueError(f"Unsupported run length dtype: {run_lengths.dtype}")
295297
@@ -365,6 +367,8 @@ def simple_ans_markov_sparse_decode(x: bytes, dtype: str) -> np.ndarray:
365367 run_lengths = np.frombuffer(x[bitstream_end:], dtype=np.uint8)
366368 elif run_length_dtype_code == 1:
367369 run_lengths = np.frombuffer(x[bitstream_end:], dtype=np.uint16)
370+ elif run_length_dtype_code == 2:
371+ run_lengths = np.frombuffer(x[bitstream_end:], dtype=np.uint32)
368372 else:
369373 raise ValueError(f"Unsupported run length dtype code: {run_length_dtype_code}")
370374