فهرست منبع

more resampling notes

Sean Barrett 11 سال پیش
والد
کامیت
92b08aa98a
1فایلهای تغییر یافته به همراه19 افزوده شده و 1 حذف شده
  1. 19 1
      docs/stb_resample_ideas.txt

+ 19 - 1
docs/stb_resample_ideas.txt

@@ -57,7 +57,25 @@ need four scanline buffers, and in general the number of
 buffers will be limited by the max filter width, which is
 buffers will be limited by the max filter width, which is
 presumably hardcoded.
 presumably hardcoded.
 
 
-You want to avoid memory allocations (since you're passing
+It turns out to be slightly different for two reasons:
+
+   1. when using an arbitrary filter and downsampling,
+      you actually need N output buffers and 1 input buffer
+      (vs 1 output buffer and N input buffers upsampling)
+
+   2. this approach will be very inefficient as written.
+      you want to use separable filters and actually do
+      seperable computation: first decode an input scanline
+      into a 'decode' buffer, then horizontally resample it
+      into the "input" buffer (kind of a misnomer, but
+      they're the inputs to the vertical resampler)
+
+(The above approach isn't optimal for non-uniform resampling;
+optimal is to do whichever axis is smaller first, but I don't
+think we have to care about doing that right.)
+
+
+Now, you probably want to avoid memory allocations (since you're passing
 in the target buffer already), so instead of using a scanline-width
 in the target buffer already), so instead of using a scanline-width
 temp buffer, use some fixed-width temp buffer that's W pixels,
 temp buffer, use some fixed-width temp buffer that's W pixels,
 and scale the image in vertical stripes that are that wide.
 and scale the image in vertical stripes that are that wide.