} else { *(sg_output_plane + x) = P1; *(sg_output_plane + x + 1) = P1; *(sg_output_plane + sg_stride + x) = P1; *(sg_output_plane + sg_stride + x + 1) = P1;
static int ipvideo_decode_block_opcode_0x7(void){    int x, y;    unsigned char P0, P1;    unsigned char B[8];    unsigned int flags;    int bitmask;    /* 2-color encoding */    CHECK_STREAM_PTR(2);    P0 = *sg_stream_ptr++;    P1 = *sg_stream_ptr++;    if (P0 <= P1) {        /* need 8 more bytes from the stream */        CHECK_STREAM_PTR(8);        for (y = 0; y < 8; y++)            B[y] = *sg_stream_ptr++;        for (y = 0; y < 8; y++) {            flags = B[y];            for (x = 0x01; x <= 0x80; x <<= 1) {                if (flags & x)                    *sg_output_plane++ = P1;                else                    *sg_output_plane++ = P0;            }            sg_output_plane += sg_line_inc;        }    } else {        /* need 2 more bytes from the stream */        CHECK_STREAM_PTR(2);        B[0] = *sg_stream_ptr++;        B[1] = *sg_stream_ptr++;        flags = (B[1] << 8) | B[0];        bitmask = 0x0001;        for (y = 0; y < 8; y += 2) {            for (x = 0; x < 8; x += 2, bitmask <<= 1) {                if (flags & bitmask) {                    *(sg_output_plane + x) = P0;                    *(sg_output_plane + x + 1) = P0;                    *(sg_output_plane + sg_stride + x) = P0;                    *(sg_output_plane + sg_stride + x + 1) = P0;                } else {                    *(sg_output_plane + x) = P1;                    *(sg_output_plane + x + 1) = P1;                    *(sg_output_plane + sg_stride + x) = P1;                    *(sg_output_plane + sg_stride + x + 1) = P1;                }            }            sg_output_plane += sg_stride * 2;        }    }    /* report success */    return 0;}