Encoding pictures with maximal codes of pictures