- * halves; need 20 more bytes */
- CHECK_STREAM_PTR(20);
-
- memcpy(B, s->stream_ptr, 8);
- s->stream_ptr += 8;
- memcpy(P + 4, s->stream_ptr, 4);
- s->stream_ptr += 4;
- memcpy(B + 8, s->stream_ptr, 8);
- s->stream_ptr += 8;
-
- if (P[4] <= P[5]) {
-
- /* block is divided into left and right halves */
- for (y = 0; y < 8; y++) {
-
- flags = (B[y + 8] << 8) | B[y];
- split = 0;
-
- for (x = 0; x < 8; x++, flags >>= 2) {
- if (x == 4)
- split = 4;
- *s->pixel_ptr++ = P[split + (flags & 0x03)];
- }
-
- s->pixel_ptr += s->line_inc;
+ * halves */
+
+ for (y = 0; y < 16; y++) {
+ // load values for each half
+ if (!(y & 7)) {
+ memcpy(P, s->stream_ptr, 4);
+ s->stream_ptr += 4;
+ flags = bytestream_get_le64(&s->stream_ptr);