1. A method for encoding an input sequence of binary symbols using a context model having a set of context states and a respective 2 L -ary encoding tree associated with each context state, the method comprising: for a length-L string of consecutive symbols, determining the context state for a first symbol of the length-L string, and selecting the 2 L -ary encoding tree associated with that context state; appending subsequent length-L strings of consecutive symbols to the length-L string of consecutive symbols to form a sequence of strings and encoding that sequence of strings as a codeword using the selected 2 L -ary encoding tree; and updating the context state based on the symbols in that sequence of strings and the context model.