stb_image: Fast path for matches with dist=1 (runs) in stbi__parse_huffman_block.

master
Fabian Giesen ago%!(EXTRA string=11 years)
parent 92b9e262b7
commit cdc230598e
  1. 8
      stb_image.h

@ -2210,8 +2210,12 @@ static int stbi__parse_huffman_block(stbi__zbuf *a)
zout = a->zout; zout = a->zout;
} }
p = (stbi_uc *) (zout - dist); p = (stbi_uc *) (zout - dist);
while (len--) if (dist == 1) { // run of one byte; common in images.
*zout++ = *p++; stbi_uc v = *p;
do *zout++ = v; while (--len);
} else {
do *zout++ = *p++; while (--len);
}
} }
} }
} }

Loading…
Cancel
Save