Subject: | BMP file reading inefficient in several ways: |
Date: | Fri, 15 Jul 2011 00:25:45 +1000 |
To: | bug-Imager [...] rt.cpan.org |
From: | tonyc [...] cpan.org |
A few ways:
a) read_packed() calls readcb() word by word, rather then reading
the whole block at once.
b) read_bmp_pal() calls read_packed() for each palette entry, when it
could just read the whole palette with a single read, and ideally
i_addcolors() the whole palette at once.
c) BI_RLE4 code should build an unpacked line buffer and pass that to
i_ppal() instead of calling it one or two pixels at a time.
d) similarly for BI_RLE8
e) we have similar code to skip the offset bytes in each reader which
reads a byte at a time, this should be hoisted and read some number of
bytes at a time.
Ideally we need a buffering on the file and callback layers, but
that's a separate issue.