Your problem is the order of the bits. The 16 bytes of a BC7 block are treated as a stream of 128 bits, but it goes from the lowest bit of each byte to the highest. So 0x30 isn't 00110000, it's the reverse, 00001100. Similarly, when you read a number from the stream, the first bit is the lowest bit of the result, etc. Btw this is the usual order for storing a bitstream as bytes.
That makes the mode 00001 = 4, so the whole block parses as
which does look like opaque red.
It seems like you could just copy/port an existing decoder. bc7decomp.h / bc7decomp.cpp from bc7enc has essentially no dependencies if that's the problem.
That makes the mode 00001 = 4, so the whole block parses as
Code:
mode 00001
2 bit rotation 10 1
1 bit idxMode 0 0
5 bit R0 11111 31
5 bit R1 11111 31
5 bit G0 00000 0
5 bit G1 00000 0
5 bit B0 00000 0
5 bit B1 00000 0
6 bit A0 111111 63
6 bit A1 111111 63
31 bit index data 1101010101010101010101010101010
47 bit index data 10100100100100100100100100100100100100100100100
which does look like opaque red.
It seems like you could just copy/port an existing decoder. bc7decomp.h / bc7decomp.cpp from bc7enc has essentially no dependencies if that's the problem.