skufog / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

webrtc scale test is slow #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
webrtc uses libyuv scaler and runs benchmarks that have poor performance.
Most likely the sizes are odd, and/or buffers/stride unaligned, hitting a slow 
path.
Consider 'Any' scale functions to deal with oddness.

build\Debug\common_video_unittests.exe
[ RUN      ] TestScaler.PointScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.08
Scaling[176 144] => [352 288]: Average time per frame[ms]: 0.75
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
28.045769
Scaling[352 288] => [320 240]: Average time per frame[ms]: 0.57
Scaling[352 288] => [704 576]: Average time per frame[ms]: 3.43
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.57
Scaling[352 288] => [400 300]: Average time per frame[ms]: 1.09
Scaling[352 288] => [282 231]: Average time per frame[ms]: 0.55
Scaling[282 231] => [352 288]: Average time per frame[ms]: 0.85
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
27.963268
Scaling[352 288] => [699 531]: Average time per frame[ms]: 3.22
Scaling[699 531] => [352 288]: Average time per frame[ms]: 0.97
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
37.964722
[       OK ] TestScaler.PointScaleTest (37856 ms)
[ RUN      ] TestScaler.BiLinearScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.10
Scaling[176 144] => [352 288]: Average time per frame[ms]: 1.89
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
27.675187
Scaling[352 288] => [320 240]: Average time per frame[ms]: 1.13
Scaling[352 288] => [704 576]: Average time per frame[ms]: 6.26
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.89
Scaling[352 288] => [400 300]: Average time per frame[ms]: 1.86
Scaling[352 288] => [282 231]: Average time per frame[ms]: 0.99
Scaling[282 231] => [352 288]: Average time per frame[ms]: 3.46
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
29.788135
Scaling[352 288] => [699 531]: Average time per frame[ms]: 5.22
Scaling[699 531] => [352 288]: Average time per frame[ms]: 3.46
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
31.555418
[       OK ] TestScaler.BiLinearScaleTest (26759 ms)
[ RUN      ] TestScaler.BoxScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.09
Scaling[176 144] => [352 288]: Average time per frame[ms]: 1.58
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
27.675187
Scaling[352 288] => [320 240]: Average time per frame[ms]: 1.18
Scaling[352 288] => [704 576]: Average time per frame[ms]: 5.96
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.91
Scaling[352 288] => [400 300]: Average time per frame[ms]: 1.80
Scaling[352 288] => [282 231]: Average time per frame[ms]: 1.06
Scaling[282 231] => [352 288]: Average time per frame[ms]: 3.50
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
29.788135
Scaling[352 288] => [699 531]: Average time per frame[ms]: 5.36
Scaling[699 531] => [352 288]: Average time per frame[ms]: 3.62
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
31.555418
[       OK ] TestScaler.BoxScaleTest (21171 ms)
[----------] 7 tests from TestScaler (85850 ms total)

Original issue reported on code.google.com by fbarch...@google.com on 28 Nov 2012 at 11:19

GoogleCodeExporter commented 9 years ago
Release build runs faster, which indicates C code (slow) is being used

build\Release\common_video_unittests.exe
[ RUN      ] TestScaler.PointScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.02
Scaling[176 144] => [352 288]: Average time per frame[ms]: 0.27
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
28.045769
Scaling[352 288] => [320 240]: Average time per frame[ms]: 0.16
Scaling[352 288] => [704 576]: Average time per frame[ms]: 0.91
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.16
Scaling[352 288] => [400 300]: Average time per frame[ms]: 0.32
Scaling[352 288] => [282 231]: Average time per frame[ms]: 0.16
Scaling[282 231] => [352 288]: Average time per frame[ms]: 0.24
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
27.963268
Scaling[352 288] => [699 531]: Average time per frame[ms]: 0.87
Scaling[699 531] => [352 288]: Average time per frame[ms]: 0.27
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
37.964722
[       OK ] TestScaler.PointScaleTest (25154 ms)
[ RUN      ] TestScaler.BiLinearScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.04
Scaling[176 144] => [352 288]: Average time per frame[ms]: 0.42
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
27.675187
Scaling[352 288] => [320 240]: Average time per frame[ms]: 0.33
Scaling[352 288] => [704 576]: Average time per frame[ms]: 1.67
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.31
Scaling[352 288] => [400 300]: Average time per frame[ms]: 0.57
Scaling[352 288] => [282 231]: Average time per frame[ms]: 0.31
Scaling[282 231] => [352 288]: Average time per frame[ms]: 1.48
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
29.788135
Scaling[352 288] => [699 531]: Average time per frame[ms]: 1.43
Scaling[699 531] => [352 288]: Average time per frame[ms]: 1.45
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
31.555418
[       OK ] TestScaler.BiLinearScaleTest (30571 ms)
[ RUN      ] TestScaler.BoxScaleTest
Scaling[352 288] => [176 144]: Average time per frame[ms]: 0.04
Scaling[176 144] => [352 288]: Average time per frame[ms]: 0.43
PSNR for scaling from: 352 288, down/up to: 176 144, and back to original size: 
27.675187
Scaling[352 288] => [320 240]: Average time per frame[ms]: 0.35
Scaling[352 288] => [704 576]: Average time per frame[ms]: 1.73
Scaling[352 288] => [300 200]: Average time per frame[ms]: 0.25
Scaling[352 288] => [400 300]: Average time per frame[ms]: 0.55
Scaling[352 288] => [282 231]: Average time per frame[ms]: 0.31
Scaling[282 231] => [352 288]: Average time per frame[ms]: 1.48
PSNR for scaling from: 352 288, down/up to: 282 231, and back to original size: 
29.788135
Scaling[352 288] => [699 531]: Average time per frame[ms]: 1.52
Scaling[699 531] => [352 288]: Average time per frame[ms]: 1.36
PSNR for scaling from: 352 288, down/up to: 699 531, and back to original size: 
31.555418
[       OK ] TestScaler.BoxScaleTest (29016 ms)
[----------] 7 tests from TestScaler (84753 ms total)

Original comment by fbarch...@chromium.org on 28 Nov 2012 at 11:59

GoogleCodeExporter commented 9 years ago
Alignment is main cause for fallbacks.  Solution is aligned allocation in 
caller.

Original comment by fbarch...@google.com on 12 Jan 2013 at 9:11