/tools/pic_compress_8x8.py
#!/usr/bin/env python3
=
=
= |
= >> 1 |
return
=
=
= |
= |
return
= | | | | | | |
= | | | | | | |
return | << 1 | << 2 | << 3
return
return
= 0
+= 32
+= 16
+= 8
-= // 16
-= // 16
return
= |
= |
return ==
return
return +
=
=
= 1
= 2
=
=
=
=
= 0
=
>>= 1
|=
=
=
=
return
return
return
return
# Generate chunk histogram
=
# known chunk
continue
+= 1
= 1
=
return
=
=
=
=
return 3 + * 32 + 3 + * 3
=
=
# Start with the least common patterns
=
# Then search backwards starting at the most common patterns
=
=
# Bad match, move on
continue
=
# Reverse sort so we work from the back forward and don't have to adjust any
# earlier indexes in the dead chunk list
# Clean dead chunks and shift indexes
= +
# Adjust every index above idx down one (except known chunks)
continue
-= 1
return
=
= 0
= 0
=
=
+= 16
= 0
+= 16
return
# chunk list section, number of chunks
= 8 *
# index section, width and height
= 0
= & 0xFF
= >> 8
|= >> 4
= & 0xFF
= 0
+= 3
=
=
=
return 4 +
=
# magic
=
=
=
=
=
=
=
return
=
return
=
=
=
=
=
=
=
=
=
break
-= 1
=
=