Simple and well explained encoder and decoder for AMF