Casey Duncan wrote: > 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: I have constructed the following test images. All are 420x300, which is a suitably large size that I hope differences should stand out clearly. > - Image containing random color/alpha noise I constructed this in the Gimp using Filters->Noise->Hurl, with randomization 100%. > - Image that is a block of one color, with no alpha I constructed this in the Gimp using Bucket Fill and the color #3cff00 (a pretty green). > - Image that is a block of one color with a single alpha value I constructed this as above, except with an alpha layer. To pick an arbitrary alpha, I set the opacity to 51.7% (arbitrarily chosen), and then exported to png. > - Image that is a block of one color with random alpha values I constructed this using the Hurl filter again, and then de-selecting the alpha channel in the Layers menu, and then bucket-filling with #3cff00. > - Image containing a circle (2 colors) with no alpha I constructed this by using the Ellipse tool to select an ellipse the size of the whole image (i.e. its rectangular bounding box was the size of the whole image), then shrinking it by 50 pixels, and then Select->Sharpen. The ellipse was colored #3cff00, and the outside colored #ff004f (an arbitrary red). > - Image containing a circle with alpha blending at the edges I wasn't sure how to interpret this. I assumed that a circle with antialiased edges on a non-alpha image would look weird blitted in other contexts, and took your suggestion to mean a circle with an alpha channel, set to fully transparent, except for the area of the circle, which would be antialiased at the edge. (i.e. If the no-alpha circle case is a colorkey, this would be the same, except with the background alpha instead of it being colorkey.) The ellipse was formed the same way as the no-alpha case, above, except without Select->Sharpen. The ellipse was bucket-filled with #3cff00. The background was #3cff00 too before I cleared it; unsure if this would make a difference, I made a second image like this, but with background #ff004f. > - Image containing a circle of random colors with alpha blending at the > edges and a single color surrounding it with alpha 0 I did this by selecting an ellipse, as above, and filling it with green, as above. Then I de-selected the alpha channel and used the Hurl filter again. I also made some changes to Casey Duncan's scripts, namely: - shebang - print the name of the file as it is being tested I then ran the following commands: $ cat *.png > /dev/null # try to swap the images into RAM $ for x in *.png; do ./blittest.py $x 1000; done At first I ran with 10000, but then I ran out of patience. Paging in the images probably isn't important, since Casey's script loads the images once before timing the blits, but I felt it was good form. I noticed Casey's original script used HWSURFACEs, so I reran the script without them. The results are attached. The images and so forth can also be obtained by: bzr branch http://svn.betacantrips.com/blit-experiments.bzr/ (I know the domain "svn.betacantrips.com" is a little inappropriate but adding a subdomain could take a while.) If you want an ordinary tarball or something, let me know and I'll do that too. Some brief analysis (this email's already pretty long): 1) HWSURFACE | DOUBLEBUF doesn't seem to make much difference on my machine. Alpha images blit a little slower; others a little faster. I think this has been mentioned in the docs somewhere. 2) As expected, RLEACCEL can slow blits down if they have widely varying alphas (image 04). 3) Image 07 is faster with RLEACCEL, suggesting that RLEACCEL only affects the alpha channel of the image, not the R, G, or B channels. 4) 06-circle-alpha.png and 06-circle-alpha-diff.png do behave differently when the alpha channel is stripped and a colorkey added; this is because 06-circle-alpha is all the same color green and when a colorkey is added, nothing is blit. Otherwise they behave pretty much the same. 5) 05-circle-noalpha, running with a colorkey and RLEACCEL, runs 15% faster or so than 06-circle-alpha, running with convert_alpha and RLEACCEL. However both of these are much faster than running without RLEACCEL at all. Ethan
Using Casey's original script: 01-noise.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.1657299995 convert only 0.71323299408 colorkey no RLEACCEL 3.78759384155 colorkey with RLEACCEL 0.229915857315 nonimage colorkey no RLEACCEL 3.69732117653 nonimage colorkey RLEACCEL 0.341987133026 convert_alpha only 1.06078195572 convert_alpha with RLEACCEL 1.39472413063 02-solid-noalpha.png <Surface(420x300x24 SW)> 1000 blits no optimization 3.75875496864 convert only 0.691663980484 colorkey no RLEACCEL 0.962837934494 colorkey with RLEACCEL 0.00650119781494 nonimage colorkey no RLEACCEL 3.6968460083 nonimage colorkey RLEACCEL 0.244396924973 convert_alpha only 0.737591028214 convert_alpha with RLEACCEL 0.285868167877 03-solid-alpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.2370080948 convert only 0.682020902634 colorkey no RLEACCEL 0.966558933258 colorkey with RLEACCEL 0.00202512741089 nonimage colorkey no RLEACCEL 3.72358083725 nonimage colorkey RLEACCEL 0.229556798935 convert_alpha only 1.13177418709 convert_alpha with RLEACCEL 1.3757648468 04-solid-randalpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.4849209785 convert only 0.892124176025 colorkey no RLEACCEL 0.886943101883 colorkey with RLEACCEL 0.00501894950867 nonimage colorkey no RLEACCEL 3.86256599426 nonimage colorkey RLEACCEL 0.23295712471 convert_alpha only 1.08210897446 convert_alpha with RLEACCEL 1.45086193085 05-circle-noalpha.png <Surface(420x300x24 SW)> 1000 blits no optimization 3.88263988495 convert only 0.904305934906 colorkey no RLEACCEL 2.03576588631 colorkey with RLEACCEL 0.121339082718 nonimage colorkey no RLEACCEL 3.86100912094 nonimage colorkey RLEACCEL 0.236008167267 convert_alpha only 0.647639989853 convert_alpha with RLEACCEL 0.288942098618 06-circle-alpha-diff.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.38379502296 convert only 0.716170787811 colorkey no RLEACCEL 2.02223396301 colorkey with RLEACCEL 0.104966878891 nonimage colorkey no RLEACCEL 3.89120388031 nonimage colorkey RLEACCEL 0.260116815567 convert_alpha only 0.430103063583 convert_alpha with RLEACCEL 0.131071090698 06-circle-alpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.05372190475 convert only 0.732563972473 colorkey no RLEACCEL 0.888839006424 colorkey with RLEACCEL 0.00509190559387 nonimage colorkey no RLEACCEL 3.9182908535 nonimage colorkey RLEACCEL 0.254526853561 convert_alpha only 0.47629404068 convert_alpha with RLEACCEL 0.127533912659 07-circle-noise.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.01522803307 convert only 0.660924911499 colorkey no RLEACCEL 1.98063397408 colorkey with RLEACCEL 0.125375986099 nonimage colorkey no RLEACCEL 3.78065896034 nonimage colorkey RLEACCEL 0.250223875046 convert_alpha only 0.443328142166 convert_alpha with RLEACCEL 0.127854824066 After removing HWSURFACE | DOUBLEBUF: 01-noise.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.224558115 convert only 0.856863975525 colorkey no RLEACCEL 3.89549589157 colorkey with RLEACCEL 0.231034994125 nonimage colorkey no RLEACCEL 3.79683709145 nonimage colorkey RLEACCEL 0.240097999573 convert_alpha only 1.2274081707 convert_alpha with RLEACCEL 1.40084910393 02-solid-noalpha.png <Surface(420x300x24 SW)> 1000 blits no optimization 3.89282488823 convert only 0.754720211029 colorkey no RLEACCEL 0.928792953491 colorkey with RLEACCEL 0.00227189064026 nonimage colorkey no RLEACCEL 4.02441000938 nonimage colorkey RLEACCEL 0.275408983231 convert_alpha only 0.802073955536 convert_alpha with RLEACCEL 0.319154024124 03-solid-alpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.2046380043 convert only 0.681333065033 colorkey no RLEACCEL 0.874222040176 colorkey with RLEACCEL 0.00315809249878 nonimage colorkey no RLEACCEL 3.80973696709 nonimage colorkey RLEACCEL 0.256772041321 convert_alpha only 1.02817893028 convert_alpha with RLEACCEL 1.46476101875 04-solid-randalpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 10.2309999466 convert only 0.76749587059 colorkey no RLEACCEL 0.873257160187 colorkey with RLEACCEL 0.00464916229248 nonimage colorkey no RLEACCEL 3.70581483841 nonimage colorkey RLEACCEL 0.263495922089 convert_alpha only 1.04781007767 convert_alpha with RLEACCEL 1.40428805351 05-circle-noalpha.png <Surface(420x300x24 SW)> 1000 blits no optimization 3.75852298737 convert only 0.691025018692 colorkey no RLEACCEL 2.08608412743 colorkey with RLEACCEL 0.114906072617 nonimage colorkey no RLEACCEL 3.80510282516 nonimage colorkey RLEACCEL 0.243493080139 convert_alpha only 0.659535169601 convert_alpha with RLEACCEL 0.27321600914 06-circle-alpha-diff.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.13604688644 convert only 0.84179186821 colorkey no RLEACCEL 1.98526191711 colorkey with RLEACCEL 0.107893943787 nonimage colorkey no RLEACCEL 3.80963611603 nonimage colorkey RLEACCEL 0.236330986023 convert_alpha only 0.446371078491 convert_alpha with RLEACCEL 0.126337051392 06-circle-alpha.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.01860690117 convert only 0.879508018494 colorkey no RLEACCEL 0.873472929001 colorkey with RLEACCEL 0.00703310966492 nonimage colorkey no RLEACCEL 3.79678702354 nonimage colorkey RLEACCEL 0.235830068588 convert_alpha only 0.436877965927 convert_alpha with RLEACCEL 0.137381076813 07-circle-noise.png <Surface(420x300x32 SW)> 1000 blits no optimization 5.06763100624 convert only 0.700836896896 colorkey no RLEACCEL 2.09286117554 colorkey with RLEACCEL 0.114020824432 nonimage colorkey no RLEACCEL 3.83308982849 nonimage colorkey RLEACCEL 0.245964050293 convert_alpha only 0.444734096527 convert_alpha with RLEACCEL 0.124362945557
Attachment:
signature.asc
Description: OpenPGP digital signature