КА
Size: a a a
КА
⟁ᴡ
КА
⟁ᴡ
⟁ᴡ
⟁ᴡ
КА
⟁ᴡ
⟁ᴡ
⟁ᴡ
./utils.py:1244:def encode_waveform(waveform)
./utils.py:1285:def decode_waveform(waveform)
КА
./utils.py:1244:def encode_waveform(waveform)
./utils.py:1285:def decode_waveform(waveform)
⟁ᴡ
def decode_waveform(waveform):
bit_count = len(waveform) * 8
value_count = bit_count // 5
if value_count == 0:
return b""
result = bytearray(value_count)
for i in range(value_count - 1):
byte_index, bit_shift = divmod(i * 5, 8)
value = struct.unpack("<H", waveform[byte_index : byte_index + 2])[0]
result[i] = (value >> bit_shift) & 0b00011111
byte_index, bit_shift = divmod(value_count - 1, 8)
if byte_index == len(waveform) - 1:
value = waveform[byte_index]
else:
value = struct.unpack("<H", waveform[byte_index : byte_index + 2])[0]
result[value_count - 1] = (value >> bit_shift) & 0b00011111
return bytes(result)
⟁ᴡ
/usr/local/lib/python3.8/dist-packages/telethon/util.py
КА
def decode_waveform(waveform):
bit_count = len(waveform) * 8
value_count = bit_count // 5
if value_count == 0:
return b""
result = bytearray(value_count)
for i in range(value_count - 1):
byte_index, bit_shift = divmod(i * 5, 8)
value = struct.unpack("<H", waveform[byte_index : byte_index + 2])[0]
result[i] = (value >> bit_shift) & 0b00011111
byte_index, bit_shift = divmod(value_count - 1, 8)
if byte_index == len(waveform) - 1:
value = waveform[byte_index]
else:
value = struct.unpack("<H", waveform[byte_index : byte_index + 2])[0]
result[value_count - 1] = (value >> bit_shift) & 0b00011111
return bytes(result)
⟁ᴡ
⟁ᴡ