You mentioned about speed so I'll put some things I notice, take them with a grain of salt! :)

m_spec.width is already an `int`, so no worries about casting.

The `3 * i` could be moved into a constant each iteration (sounds silly, but might help).

Read the colormap[gif_scanline[i]] into a variable and read from this. 

These are probably inconsequential though.