Here’s a working example of a custom MNF encoder (using a shifted hex alphabet):
MNF_ALPHABET = "MNF0123456789ABCDEF" # 16 chars
HEX_ALPHABET = "0123456789ABCDEF"
def mnf_encode(data: bytes) -> str:
result = []
for byte in data:
high_nibble = (byte >> 4) & 0x0F
low_nibble = byte & 0x0F
result.append(MNF_ALPHABET[high_nibble])
result.append(MNF_ALPHABET[low_nibble])
return ''.join(result) mnf encode
def mnf_decode(encoded: str) -> bytes:
if len(encoded) % 2 != 0:
raise ValueError("MNF string length must be even")
result = []
for i in range(0, len(encoded), 2):
high = MNF_ALPHABET.index(encoded[i])
low = MNF_ALPHABET.index(encoded[i+1])
result.append((high << 4) | low)
return bytes(result) Here’s a working example of a custom MNF
The decoder uses a transposed CNN to reconstruct the frame from the compressed latent features. Because the decoder was trained with a perceptual loss function (LPIPS or DISTS rather than PSNR), the output video looks better to the human eye than a bitrate-equivalent HEVC file, even if the PSNR numbers are slightly lower. Traditional encoding requires looking at a whole frame
Let us walk through the actual workflow of an MNF Encoder pipeline:
Latency is the enemy. Traditional encoding requires looking at a whole frame. MNF Encode can start transmitting the "coarse scale" features immediately, allowing a low-resolution proxy of the frame to display within 5 milliseconds, with details filling in over the next 15ms. This creates the sensation of instantaneous response.
An MNF stream typically starts with a header to define versioning and compression.