StaticdecodeDecode synchsafe data by removing false sync bytes. Any 0x00 byte following a 0xFF byte is stripped out.
StaticencodeEncode data to synchsafe form by inserting a 0x00 byte after every 0xFF.
StaticfromEncode a normal unsigned number to a 4-byte synchsafe ByteVector.
StatictoDecode a synchsafe integer to a normal unsigned number. Each byte contributes 7 bits. Up to 4 bytes are read (28 bits of data).
If any byte has bit 7 set, the data is assumed to have been written by buggy software as a normal big-endian integer and is decoded accordingly.
Synchsafe integer encoding/decoding for ID3v2.
ID3v2 uses "synchsafe integers" where the most significant bit of each byte is always zero, giving 7 bits of data per byte. This avoids false MPEG sync signals (0xFF followed by a byte with bit 7 set) in the tag data.