MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / decodeBlockBc6h

Function decodeBlockBc6h

Source/3rdParty/bimg/src/image.cpp:1869–2292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1867 };
1868
1869 static void decodeBlockBc6h(uint16_t _dst[16*3], const uint8_t _src[16], bool _signed)
1870 {
1871 if (!BX_ENABLED(BIMG_DECODE_BC6) )
1872 {
1873 return;
1874 }
1875
1876 uint8_t src[16];
1877 bx::memCopy(src, _src, 16);
1878
1879 BitReader bit(src);
1880
1881 uint8_t mode = uint8_t(bit.read(2));
1882
1883 uint16_t epR[4] = { /* rw, rx, ry, rz */ };
1884 uint16_t epG[4] = { /* gw, gx, gy, gz */ };
1885 uint16_t epB[4] = { /* bw, bx, by, bz */ };
1886
1887 if (mode & 2)
1888 {
1889 // 5-bit mode
1890 mode |= bit.read(3) << 2;
1891
1892 if (0 == s_bc6hModeInfo[mode].endpointBits)
1893 {
1894 bx::memSet(_dst, 0, 16*3*2);
1895 return;
1896 }
1897
1898 switch (mode)
1899 {
1900 case 2:
1901 epR[0] |= bit.read(10) << 0;
1902 epG[0] |= bit.read(10) << 0;
1903 epB[0] |= bit.read(10) << 0;
1904 epR[1] |= bit.read( 5) << 0;
1905 epR[0] |= bit.read( 1) << 10;
1906 epG[2] |= bit.read( 4) << 0;
1907 epG[1] |= bit.read( 4) << 0;
1908 epG[0] |= bit.read( 1) << 10;
1909 epB[3] |= bit.read( 1) << 0;
1910 epG[3] |= bit.read( 4) << 0;
1911 epB[1] |= bit.read( 4) << 0;
1912 epB[0] |= bit.read( 1) << 10;
1913 epB[3] |= bit.read( 1) << 1;
1914 epB[2] |= bit.read( 4) << 0;
1915 epR[2] |= bit.read( 5) << 0;
1916 epB[3] |= bit.read( 1) << 2;
1917 epR[3] |= bit.read( 5) << 0;
1918 epB[3] |= bit.read( 1) << 3;
1919 break;
1920
1921 case 3:
1922 epR[0] |= bit.read(10) << 0;
1923 epG[0] |= bit.read(10) << 0;
1924 epB[0] |= bit.read(10) << 0;
1925 epR[1] |= bit.read(10) << 0;
1926 epG[1] |= bit.read(10) << 0;

Callers 1

imageDecodeToRgba32fFunction · 0.85

Calls 6

memCopyFunction · 0.85
memSetFunction · 0.85
signExtendFunction · 0.85
bc6hUnquantizeFunction · 0.85
bc6hUnquantizeFinalFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected