Improve LZW dictionary key / index buffer performance.
Instead of rebuilding the key each time and having the index buffer be an
actual buffer, we can track the code representing the index buffer and we can
also build the key as we go.  This is roughly a 2x speedup.
Rearrange handling of the first index in the stream.
Previously it was handled in the loop, but as a special case.  This is now
moved to the initialization and the loop starts at the second index in the
stream.  This follows the algorithm description more closely, and additionally
it seemed a bit nicer to have the variables initialized to something realistic
and not just null.  Additionally this patch moves from range checking the input
to just masking it off.
Add some comments and clean up a bit of LZW code.
Rename emit_bits to emit_bytes, which is more accurate.