Skip to content
Myr

more resampling notes

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 6f779fb · Browse files · 1 file+19 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+19 added−1 removed

  • other:+19 added−1 removed

1 file+19 added−1 removed

modified:docs/stb_resample_ideas.txt+19 added-1 removed
55 unmodified lines
56need four scanline buffers, and in general the number of57buffers will be limited by the max filter width, which is58presumably hardcoded.5960It turns out to be slightly different for two reasons:6162 1. when using an arbitrary filter and downsampling,63 you actually need N output buffers and 1 input buffer64 (vs 1 output buffer and N input buffers upsampling)6566 2. this approach will be very inefficient as written.67 you want to use separable filters and actually do68 seperable computation: first decode an input scanline69 into a 'decode' buffer, then horizontally resample it70 into the "input" buffer (kind of a misnomer, but71 they're the inputs to the vertical resampler)7273(The above approach isn't optimal for non-uniform resampling;74optimal is to do whichever axis is smaller first, but I don't75think we have to care about doing that right.)767760You want to avoid memory allocations (since you're passing78Now, you probably want to avoid memory allocations (since you're passing79in the target buffer already), so instead of using a scanline-width80temp buffer, use some fixed-width temp buffer that's W pixels,81and scale the image in vertical stripes that are that wide.82Suppose you make the temp buffers 256 wide; then an upsample
91 unmodified lines