database: Separate breadth and distribution encoding functions.