When testing the model with bit loss using the compressai library, the decoder occasionally crashes and returns error code -1073741819 (0xC0000005). This error does not occur consistently; sometimes the decoding is successful, while other times the error occurs. The testing is performed with the project STF. Below are the relevant code snippets and detailed description.
Expected behavior
-1073741819 (0xC0000005)
my bit loss code:
error_probability = 0.01
corrupted_strings = introduce_bit_loss(out_enc["strings"], error_probability, seed=0)
# out_dec = model.decompress(out_enc["strings"], out_enc["shape"])
out_dec = model.decompress(corrupted_strings, out_enc["shape"])
def introduce_bit_loss(data, loss_probability, seed=0):
"""Introduce bit loss into the compressed data."""
if seed is not None:
np.random.seed(seed)
rows = len(data)
cols = len(data[0]) if rows > 0 else 0
corrupted_bytes = [[None for _ in range(cols)] for _ in range(rows)]
corrupted_bytes_temp = []
for byte_string_list in data:
original_byte_string = bytearray(byte_string_list[0])
num_bits = len(original_byte_string)
num_loss = round(num_bits * loss_probability)
loss_indices = np.random.choice(num_bits, num_loss, replace=False)
byte_string_with_loss = original_byte_string.copy()
for index in loss_indices:
if 0 <= index < len(byte_string_with_loss):
byte_string_with_loss[index] = 0
corrupted_bytes_temp.append(byte_string_with_loss)
for i in range(rows):
for j in range(cols):
corrupted_bytes[i][j] = corrupted_bytes_temp[i]
return corrupted_bytes
Bug
Description
When testing the model with bit loss using the compressai library, the decoder occasionally crashes and returns error code
-1073741819 (0xC0000005)
. This error does not occur consistently; sometimes the decoding is successful, while other times the error occurs. The testing is performed with the project STF. Below are the relevant code snippets and detailed description.Expected behavior
-1073741819 (0xC0000005)
my bit loss code: