Index: source/libvpx/vp9/common/vp9_convolve.c |
=================================================================== |
--- source/libvpx/vp9/common/vp9_convolve.c (revision 281795) |
+++ source/libvpx/vp9/common/vp9_convolve.c (working copy) |
@@ -117,17 +117,25 @@ |
const InterpKernel *const y_filters, |
int y0_q4, int y_step_q4, |
int w, int h) { |
- // Fixed size intermediate buffer places limits on parameters. |
- // Maximum intermediate_height is 324, for y_step_q4 == 80, |
- // h == 64, taps == 8. |
- // y_step_q4 of 80 allows for 1/10 scale for 5 layer svc |
- uint8_t temp[64 * 324]; |
+ // Note: Fixed size intermediate buffer, temp, places limits on parameters. |
+ // 2d filtering proceeds in 2 steps: |
+ // (1) Interpolate horizontally into an intermediate buffer, temp. |
+ // (2) Interpolate temp vertically to derive the sub-pixel result. |
+ // Deriving the maximum number of rows in the temp buffer (135): |
+ // --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative). |
+ // --Largest block size is 64x64 pixels. |
+ // --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the |
+ // original frame (in 1/16th pixel units). |
+ // --Must round-up because block may be located at sub-pixel position. |
+ // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails. |
+ // --((64 - 1) * 32 + 15) >> 4 + 8 = 135. |
+ uint8_t temp[135 * 64]; |
int intermediate_height = (((h - 1) * y_step_q4 + 15) >> 4) + SUBPEL_TAPS; |
assert(w <= 64); |
assert(h <= 64); |
- assert(y_step_q4 <= 80); |
- assert(x_step_q4 <= 80); |
+ assert(y_step_q4 <= 32); |
+ assert(x_step_q4 <= 32); |
if (intermediate_height < h) |
intermediate_height = h; |