]> git.lizzy.rs Git - plan9front.git/commit
resample: improve performance (thanks José Miguel Sánchez García)
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sun, 25 Apr 2021 10:16:40 +0000 (12:16 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sun, 25 Apr 2021 10:16:40 +0000 (12:16 +0200)
commite0cf0261d0f81eb1c54c4d4a7636c27de4b00d36
treef309d94bbe629b169aee2f2459078aec6dae75a9
parentb0e2ea4e5ffaec335c2a61ee98d2c5d3f1052569
resample: improve performance (thanks José Miguel Sánchez García)

Resample is well known for taking a long time to resize an image. This
patch brings an important performance boost (in my test image, time
was reduced from ~2850ms to ~500ms). It does that by extracting FP
multiplication and division out of the innermost loop of
resamplex/resampley.

The results differ slightly from the current implementation: in my
test: ~0.3% of the bytes had a ±2 difference in their value, which I
attribute to rounding errors. I'm personally not concerned with that
deviation, given the performance gains. However, I recommend testing
it just to be sure I didn't overlook anything.

José Miguel Sánchez García
sys/src/cmd/resample.c