Derive source image bit depth instead of hardcoding 8-bit result