We were deriving the minimum code size from the number of colors in the LZW code table, which is sort of backwards. The spec defines the "clear" code's value (and implicitly, the number of colors in the LZW code table) based on the minimum code size.
I also made some tweaks to emphasize that the number of colors in the LZW code table may not match the color table size, as @rendaw pointed out in #14. The former quantity is now just a local variable in defaultCodeTable, so it's more contained. The latter quantity I renamed to colorTableSize.
We were deriving the minimum code size from the number of colors in the LZW code table, which is sort of backwards. The spec defines the "clear" code's value (and implicitly, the number of colors in the LZW code table) based on the minimum code size.
I also made some tweaks to emphasize that the number of colors in the LZW code table may not match the color table size, as @rendaw pointed out in #14. The former quantity is now just a local variable in
defaultCodeTable
, so it's more contained. The latter quantity I renamed tocolorTableSize
.