refactor decoder of bitmap.