Revert "Adjusts allowable thread count for vp9 decoders."

This reverts commit 26e50469513a3df2abb88c9ae2a5af70de0b029c.

Reason for revert: Part of change that may cause crashes.

Original change's description:
> Adjusts allowable thread count for vp9 decoders.
> 
> Set 2 thread as target for 1280x720 pixel count, and then scale up
> linearly from there - but cap at physical core count.
> For common resolutions this results in:
> 1 for 360p
> 2 for 720p
> 4 for 1080p
> 8 for 1440p
> 18 for 4K
> 
> Bug: webrtc:11551
> Change-Id: I666bd971eccddee096749f20d3b08eb40fe868ad
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177012
> Reviewed-by: Johannes Kron <kron@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31513}

TBR=sprang@webrtc.org,kron@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:11551
Change-Id: I4ea5166efeed3d55255a0243a69deb584a0e19e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177240
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31517}
This commit is contained in:
Erik Språng
2020-06-15 07:20:47 +00:00
committed by Commit Bot
parent 6f727da62b
commit aa5c1e8fd2

View File

@ -1671,16 +1671,10 @@ int VP9DecoderImpl::InitDecode(const VideoCodec* inst, int number_of_cores) {
// We want to use multithreading when decoding high resolution videos. But not
// too many in order to avoid overhead when many stream are decoded
// concurrently.
// Set 2 thread as target for 1280x720 pixel count, and then scale up linearly
// Set 1280x720 pixel count as target for one core, and then scale up linearly
// from there - but cap at physical core count.
// For common resolutions this results in:
// 1 for 360p
// 2 for 720p
// 4 for 1080p
// 8 for 1440p
// 18 for 4K
int num_threads =
std::max(1, 2 * (inst->width * inst->height) / (1280 * 720));
// This results in 2 for 1080p, 4 for 1440p and 8 for 4K.
int num_threads = std::max(1, (inst->width * inst->height) / (1280 * 720));
cfg.threads = std::min(number_of_cores, num_threads);
#endif
current_codec_ = *inst;