Improve efficiency of GpuVideoDecoder shmem usage.
Previously segments were always pulled from the back of the vector and only the last value was checked before deciding to create a new segment. This allows small buffers on the end to repeatedly result in shmem creation. Instead switch to a first fit algorithm where segments are kept in sorted order by size. Also switch to choosing the minimum segment size based on the resolution and clear between flushes. Since we may be allocating a few more buffers now, the code will expire unused ones if they haven't been used after 1024 frames. tl;dr: reductions in memory of ~42% at 360p or below, ~8% at 480p, ~10% at 720p, equivalent at 1080p, ~38% at 2160p. So this should save us 10s to 100s of KBs on the most common media. Old results: 360p, dec: 1228217, alloc: 409600 (4), d/a: 2.99858, size: 102400 480p, dec: 3170779, alloc: 536946 (5), d/a: 5.90521, size: 102400 720p, dec: 9402525, alloc: 1191936 (8), d/a: 7.88845, size: 102400 1080p, dec: 16676052, alloc: 2052082 (9), d/a: 8.12641, size: 102400 2160p, dec: 63319373, alloc: 3051283 (18), d/a: 20.7517, size: 102400 New results: 360p, dec: 1228217, alloc: 237568 (6), d/a: 5.16996, size: 32768 480p, dec: 3170779, alloc: 495616 (7), d/a: 6.39765, size: 49152 720p, dec: 9402525, alloc: 1077248 (8), d/a: 8.72828, size: 73728 1080p, dec: 16676052, alloc: 2043904 (9), d/a: 8.15892, size: 98304 2160p, dec: 63319373, alloc: 1888256 (7), d/a: 33.5333, size: 196608 BUG=none TEST=manual playback of clips with varying resolutions. Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: I6df3dd41320dcc70dfd23224767b107806b0942e Reviewed-on: https://chromium-review.googlesource.com/565007 Commit-Queue: Dale Curtis <dalecurtis@chromium.org> Reviewed-by:Dan Sanders <sandersd@chromium.org> Cr-Commit-Position: refs/heads/master@{#486006}
Showing
Please register or sign in to comment