[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Benchmarking alpha blits (was Re: How do I make a image transparent?)



One thing to note: I think RLEACCEL is highly dependent on the content of the image, and the name implies "run-length encoding" which implies that images with large areas that are the same color would benefit most.

I think it would be useful to run these tests "scientifically" with various test images such as:

- Image containing random color/alpha noise
- Image that is a block of one color, with no alpha
- Image that is a block of one color with a single alpha value
- Image that is a block of one color with random alpha values
- Image containing a circle (2 colors) with no alpha
- Image containing a circle with alpha blending at the edges
- Image containing a circle of random colors with alpha blending at the edges and a single color surrounding it with alpha 0

And test these images at various sizes.

-Casey


On Sep 16, 2007, at 10:12 AM, Ethan Glasser-Camp wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ethan Glasser-Camp wrote:
Content-Type: image/svg+xml;

I have no idea what happened here. I sent a follow-up email to try to
rephrase, but it hasn't gone through yet. Maybe it needs to be
moderated; it's 107 KB. I've decided to take the attachments and put
them online instead of attaching them. They're at:

http://betacantrips.com/attic/pygame-blits/pygame-blits.csv

http://betacantrips.com/attic/pygame-blits/pygame-plot-graph1.png

http://betacantrips.com/attic/pygame-blits/pygame-plot-graph2.png

Here's the text:


Yikes, what happened here?

As I was trying to say:

I took the liberty of converting your numbers into CSV and
constructing a few plots. No hard-and-fast conclusions, especially
without some idea of the alpha values in the images, but:

1) without RLE, colorkey can be one of the slowest things you can do
- -- possibly even slower than alpha?

2) a colorkey that isn't in your image is worse than a colorkey that
is -- presumably the same number of checks must be performed, but more
pixels are blitted because none match the colorkey.

3) sometimes alpha with RLE is slower than alpha without RLE (the last
image). I would guess this is due to a widely varying number of alpha
values, for which RLE doesn't cut down on memory use but inflates it?

4) sometimes colorkey with RLE is much faster than alpha (a factor of
2-4x on some images).

Thanks Casey for these numbers! And also thanks for the code, using
"from __main__ import" is very clever and I'll have to use it in the
future.

Ethan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG7WP/hRlgoLPrRPwRAjrfAKDUbSvErLZscgfjnqEsWPimyGBOuQCfW66f
VYFXKf2hEEHtZR4Hn5v4XHE=
=XL52
-----END PGP SIGNATURE-----