MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / Unquantize

Function Unquantize

cmp_core/shaders/bc6_encode_kernel.cpp:2976–3017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2974}
2975
2976CGU_INT Unquantize(CGU_INT comp, unsigned char uBitsPerComp, CGU_BOOL bSigned)
2977{
2978 CGU_INT unq = 0, s = 0;
2979 if (bSigned)
2980 {
2981 if (uBitsPerComp >= 16)
2982 {
2983 unq = comp;
2984 }
2985 else
2986 {
2987 if (comp < 0)
2988 {
2989 s = 1;
2990 comp = -comp;
2991 }
2992
2993 if (comp == 0)
2994 unq = 0;
2995 else if (comp >= ((1 << (uBitsPerComp - 1)) - 1))
2996 unq = 0x7FFF;
2997 else
2998 unq = ((comp << 15) + 0x4000) >> (uBitsPerComp - 1);
2999
3000 if (s)
3001 unq = -unq;
3002 }
3003 }
3004 else
3005 {
3006 if (uBitsPerComp >= 15)
3007 unq = comp;
3008 else if (comp == 0)
3009 unq = 0;
3010 else if (comp == ((1 << uBitsPerComp) - 1))
3011 unq = 0xFFFF;
3012 else
3013 unq = ((comp << 16) + 0x8000) >> uBitsPerComp;
3014 }
3015
3016 return unq;
3017}
3018
3019CGU_INT finish_unquantizef16(CGU_INT q, CGU_BOOL isSigned)
3020{

Callers 4

decompress_endpoints1Function · 0.70
decompress_endpoints2Function · 0.70
decompress_endpoints1Function · 0.50
decompress_endpoints2Function · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected