Introduce generic pixel conversion function
Fix missing reference in function parameter declaration