1st attempt to arithmetic encoding