It can be useful to duplicate the entire code for 8-bit vs 10-bit pixels because that does affect nearly everything.