INNER CODE UNIT · TypeScript
decodeDC
margelo/react-native-blurhash · src/utils.ts:24
export function decodeDC(value: number): RGB {
const intR = value >> 16;
const intG = (value >> 8) & 255;
const intB = value & 255;
return { r: sRGBToLinear(intR) * 255, g: sRGBToLinear(intG) * 255, b: sRGBToLinear(intB) * 255 };
}
export function decode83(str: string): number {
let value = 0;
for (let i = 0; i < str.length; i++) {
const c = str[i];
const digit = digitCharacters.indexOf(c);
value = value * 83 + digit;
}
return value;
}
function validateBlurhash(blurhash: string): void {