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 test/api/encoder_test.cpp (1 of 7 files). Show all
Unified · Split
| @@ -123,7 +123,12 @@ static const EncodeFileParam kFileParamArray[] = { · 122 unmodified lines | |||
| 123 | }, | 123 | }, |
| 124 | { | 124 | { |
| 125 | "res/CiscoVT2people_320x192_12fps.yuv", | 125 | "res/CiscoVT2people_320x192_12fps.yuv", |
| 126 | "73156dfc1dc45924349b5b79f8debcac13d7231d", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false | 126 | #ifdef X86_ASM |
| 127 | "a5341d588b769809c1f1d983e5a0fcef7362f3ad", | ||
| 128 | #else | ||
| 129 | "73156dfc1dc45924349b5b79f8debcac13d7231d", | ||
| 130 | #endif | ||
| 131 | CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false | ||
| 127 | }, | 132 | }, |
| 128 | { | 133 | { |
| 129 | "res/Cisco_Absolute_Power_1280x720_30fps.yuv", | 134 | "res/Cisco_Absolute_Power_1280x720_30fps.yuv", |
| @@ -131,7 +136,12 @@ static const EncodeFileParam kFileParamArray[] = { · 1 unmodified line | |||
| 131 | }, | 136 | }, |
| 132 | { | 137 | { |
| 133 | "res/Cisco_Absolute_Power_1280x720_30fps.yuv", | 138 | "res/Cisco_Absolute_Power_1280x720_30fps.yuv", |
| 134 | "3943145545a2bd27a642b2045d4e3dbae55c6870", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false | 139 | #ifdef X86_ASM |
| 140 | "ec9d776a7d92cf0f6640065aee8af2450af0e993", | ||
| 141 | #else | ||
| 142 | "3943145545a2bd27a642b2045d4e3dbae55c6870", | ||
| 143 | #endif | ||
| 144 | CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false | ||
| 135 | }, | 145 | }, |
| 136 | // the following values may be adjusted for times since we start tuning the strategy | 146 | // the following values may be adjusted for times since we start tuning the strategy |
| 137 | { | 147 | { |