INNER CODE UNIT · C++

src

TheAssemblyArmada/Vanilla-Conquer · common/auduncmp.cpp:23

    unsigned char* src = (unsigned char*)(source);
    unsigned char* dst = (unsigned char*)(dest);
    unsigned short remaining = size;

    while (remaining > 0) { // expecting more output
        shifted = *src++;
        shifted <<= 2;
        code = (shifted & 0xFF00) >> 8;
        count = (shifted & 0x00FF) >> 2;

        switch (code) {
        case 2: // no compression...
            if (count & 0x20) {
                count <<= 3;          // here it's significant that (count) is signed:
                sample += count >> 3; // the sign bit will be copied by these shifts!
                *dst++ = clamp(sample, 0, 255);
                remaining--; // one byte added to output
            } else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…