Switch on the filter once per row rather than once per byte. This allows each row to be processed with a much tighter loop.