Keep track of relative pixel offsets and utilize pshufb to efficiently extract relevant pixels for horizontal scaling ratios <= 4. Fall back to a generic approach for ratios > 4. Note that the generic approach can be backported to SSE2. The implementation assumes that data beyond the end of each line, before the next line begins, can be dirtied; which AFAICT is safe with the current usage of these routines. Speedup is ~6.67x/~3.26x (32-bit/64-bit) for horizontal ratios <= 2, ~6.24x/~3.00x for ratios within (2, 4], and ~4.89x/~2.17x for ratios > 4 when not memory-bound on Haswell as compared with the current SSE2 implementation.
Showing the changes to codec/processing/src/downsample/downsamplefuncs.cpp (1 of 6 files). Show all
Unified · Split
| @@ -282,6 +282,7 @@ static void GeneralBilinearDownsamplerWrap (uint8_t* pDst, const int32_t kiDstSt · 281 unmodified lines | |||
| 282 | #ifdef X86_ASM | 282 | #ifdef X86_ASM |
| 283 | DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2) | 283 | DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2) |
| 284 | DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2) | 284 | DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2) |
| 285 | DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (ssse3) | ||
| 285 | #endif //X86_ASM | 286 | #endif //X86_ASM |
| 286 | 287 | ||
| 287 | #ifdef HAVE_NEON | 288 | #ifdef HAVE_NEON |