Refactor rank filter package as combined implementation for 8- and 16-bit