Average vertically before horizontally; horizontal averaging is more worksome. Doing the vertical averaging first reduces the number of horizontal averages by half. Use pmaddubsw and pavgw to do the horizontal averaging for a slight performance improvement. Minor tweaks. Improve the SSSE3 dyadic downsample routines and drop the SSE4 routines. The non-temporal loads used in the SSE4 routines do nothing for cache- backed memory AFAIK. Adjust tests because averaging vertically first gives slightly different output. ~2.39x speedup for the widthx32 routine on Haswell when not memory-bound. ~2.20x speedup for the widthx16 routine on Haswell when not memory-bound. Note that the widthx16 routine can be unrolled for further speedup.
Showing the changes to codec/processing/src/downsample/downsample.h (1 of 7 files). Show all
Unified · Split
| @@ -94,10 +94,6 @@ HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse; · 93 unmodified lines | ||
| 94 | 94 | HalveDownsampleFunc DyadicBilinearDownsamplerWidthx16_ssse3; |
| 95 | 95 | // iSrcWidth= x32 pixels |
| 96 | 96 | HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_ssse3; |
| 97 | −// iSrcWidth= x16 pixels | |
| 98 | −HalveDownsampleFunc DyadicBilinearDownsamplerWidthx16_sse4; | |
| 99 | −// iSrcWidth= x32 pixels | |
| 100 | −HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse4; | |
| 101 | 97 | |
| 102 | 98 | GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_sse2; |
| 103 | 99 | GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse2; |