I found this post: What is the algorithm used to normalize 16-bit valued sentinel-2A bands to 8-bit valued bands? - #7 by TomAugspurger
but the primary answer only references internal Java code that is difficult to follow. Would be great to have the exact equation in the docs in pseudocode.