ENH: Refactor per pixel conversion function to per scan-line method

This patch changes the implementation of conversion from the TIFF
scanline buffer from a function call on each pixel to a function call
per scanline. The enable efficient copying of similar scanline and
better reuse of variables for palette look ups.

This can increase the performance of reading grayscale images by up to
3X for cached files.

Change-Id: I24bb744fda35629f1c1ed7154e26e5708e912059
PERF: Refactor color table lookup

Change to use a index lookup for the color and gray scale
palettes. The remove excessive exception checking done on a per pixel
basis with the GetColor method. Additionally the InitializeColor
method was change do initialize the color palette variables.

An exception no longer occurs when an index exceeds the number of
entries in a palette. Instead a module operator is used to prevent
out of bounds memory access.

Change-Id: Ia62c65cd8b1be0d66c488540709a8fb961190cc9
Merge topic 'TIFFRefactorPerformance'

40afd951 PERF: Refactor color table lookup
d98cbeb7 ENH: Refactor per pixel conversion function to per scan-line method