| 918 | } |
| 919 | |
| 920 | void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& data, int numBits) |
| 921 | { |
| 922 | DE_ASSERT(basisu_astc::inRange(numValues, 1, 3)); |
| 923 | |
| 924 | deUint32 m[3]; |
| 925 | m[0] = data.getNext(numBits); |
| 926 | deUint32 Q012 = data.getNext(3); |
| 927 | m[1] = data.getNext(numBits); |
| 928 | deUint32 Q34 = data.getNext(2); |
| 929 | m[2] = data.getNext(numBits); |
| 930 | deUint32 Q56 = data.getNext(2); |
| 931 | |
| 932 | #ifndef __clang__ |
| 933 | #ifndef __EMSCRIPTEN__ |
| 934 | #ifdef __GNUC__ |
| 935 | #pragma GCC diagnostic push |
| 936 | #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" |
| 937 | #endif |
| 938 | #endif |
| 939 | #endif |
| 940 | switch (numValues) |
| 941 | { |
| 942 | // \note Fall-throughs. |
| 943 | case 1: Q34 = 0; |
| 944 | case 2: Q56 = 0; |
| 945 | case 3: break; |
| 946 | default: |
| 947 | DE_ASSERT(false); |
| 948 | } |
| 949 | |
| 950 | #ifndef __clang__ |
| 951 | #ifndef __EMSCRIPTEN__ |
| 952 | #ifdef __GNUC__ |
| 953 | #pragma GCC diagnostic pop |
| 954 | #endif |
| 955 | #endif |
| 956 | #endif |
| 957 | |
| 958 | const deUint32 Q = (Q56 << 5) | (Q34 << 3) | (Q012 << 0); |
| 959 | |
| 960 | static const deUint32 quintsFromQ[256][3] = |
| 961 | { |
| 962 | { 0,0,0 }, { 1,0,0 }, { 2,0,0 }, { 3,0,0 }, { 4,0,0 }, { 0,4,0 }, { 4,4,0 }, { 4,4,4 }, { 0,1,0 }, { 1,1,0 }, { 2,1,0 }, { 3,1,0 }, { 4,1,0 }, { 1,4,0 }, { 4,4,1 }, { 4,4,4 }, |
| 963 | { 0,2,0 }, { 1,2,0 }, { 2,2,0 }, { 3,2,0 }, { 4,2,0 }, { 2,4,0 }, { 4,4,2 }, { 4,4,4 }, { 0,3,0 }, { 1,3,0 }, { 2,3,0 }, { 3,3,0 }, { 4,3,0 }, { 3,4,0 }, { 4,4,3 }, { 4,4,4 }, |
| 964 | { 0,0,1 }, { 1,0,1 }, { 2,0,1 }, { 3,0,1 }, { 4,0,1 }, { 0,4,1 }, { 4,0,4 }, { 0,4,4 }, { 0,1,1 }, { 1,1,1 }, { 2,1,1 }, { 3,1,1 }, { 4,1,1 }, { 1,4,1 }, { 4,1,4 }, { 1,4,4 }, |
| 965 | { 0,2,1 }, { 1,2,1 }, { 2,2,1 }, { 3,2,1 }, { 4,2,1 }, { 2,4,1 }, { 4,2,4 }, { 2,4,4 }, { 0,3,1 }, { 1,3,1 }, { 2,3,1 }, { 3,3,1 }, { 4,3,1 }, { 3,4,1 }, { 4,3,4 }, { 3,4,4 }, |
| 966 | { 0,0,2 }, { 1,0,2 }, { 2,0,2 }, { 3,0,2 }, { 4,0,2 }, { 0,4,2 }, { 2,0,4 }, { 3,0,4 }, { 0,1,2 }, { 1,1,2 }, { 2,1,2 }, { 3,1,2 }, { 4,1,2 }, { 1,4,2 }, { 2,1,4 }, { 3,1,4 }, |
| 967 | { 0,2,2 }, { 1,2,2 }, { 2,2,2 }, { 3,2,2 }, { 4,2,2 }, { 2,4,2 }, { 2,2,4 }, { 3,2,4 }, { 0,3,2 }, { 1,3,2 }, { 2,3,2 }, { 3,3,2 }, { 4,3,2 }, { 3,4,2 }, { 2,3,4 }, { 3,3,4 }, |
| 968 | { 0,0,3 }, { 1,0,3 }, { 2,0,3 }, { 3,0,3 }, { 4,0,3 }, { 0,4,3 }, { 0,0,4 }, { 1,0,4 }, { 0,1,3 }, { 1,1,3 }, { 2,1,3 }, { 3,1,3 }, { 4,1,3 }, { 1,4,3 }, { 0,1,4 }, { 1,1,4 }, |
| 969 | { 0,2,3 }, { 1,2,3 }, { 2,2,3 }, { 3,2,3 }, { 4,2,3 }, { 2,4,3 }, { 0,2,4 }, { 1,2,4 }, { 0,3,3 }, { 1,3,3 }, { 2,3,3 }, { 3,3,3 }, { 4,3,3 }, { 3,4,3 }, { 0,3,4 }, { 1,3,4 } |
| 970 | }; |
| 971 | |
| 972 | const deUint32 (& quints)[3] = quintsFromQ[Q]; |
| 973 | for (int i = 0; i < numValues; i++) |
| 974 | { |
| 975 | dst[i].m = m[i]; |
| 976 | dst[i].tq = quints[i]; |
| 977 | dst[i].v = (quints[i] << numBits) + m[i]; |