Revert "VP9 decoder: Sets thread count based on resolution, reinit on change."

This reverts commit d5925756980f6e82a55f57532c8d855e954459fb.

Reason for revert: May cause crashes.

Original change's description:
> VP9 decoder: Sets thread count based on resolution, reinit on change.
> 
> Previously, number of decoder threads for VP9 were always set to 8 but
> with a cap at number of cores. This was done since we "can't know" the
> resolution that will be used.
> 
> With this change, we now intialize the number of threads based on
> resolution given in InitDecode(). If a resolution change happens in
> flight, it requires a keyframe. We therefore parse the header from
> any key frame and if it has a new resolution, we re-initialize the
> decoder.
> 
> The number of threads used is based on pixel count. We set one thread
> as target for 1280x720, and scale up lineraly from there. The 8-thread
> cap is gone, but still limit it core count.
> 
> This means for instance: 1 <= 720p, 2 for 1080p, 4 for 1440p, 9 for 4K.
> 
> Bug: webrtc:11551
> Change-Id: I14c169a6c651c50bd1b870c4b22bc4495c8448fd
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174460
> Commit-Queue: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31507}

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

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

Bug: webrtc:11551
Change-Id: Id235c8ded83b3e1fc1d132c8f56c9f20001f6f22
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177242
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31521}
This commit is contained in:
Erik Språng
2020-06-15 08:43:22 +00:00
committed by Commit Bot
parent ce971b0f10
commit ef377ec6d5
4 changed files with 46 additions and 192 deletions

View File

@ -13,7 +13,6 @@
#include <stddef.h>
#include <stdint.h>
#include "absl/types/optional.h"
namespace webrtc {
@ -23,65 +22,6 @@ namespace vp9 {
// Returns true on success, false otherwise.
bool GetQp(const uint8_t* buf, size_t length, int* qp);
// Bit depth per channel. Support varies by profile.
enum class BitDept : uint8_t {
k8Bit = 8,
k10Bit = 10,
k12Bit = 12,
};
enum class ColorSpace : uint8_t {
CS_UNKNOWN = 0, // Unknown (in this case the color space must be signaled
// outside the VP9 bitstream).
CS_BT_601 = 1, // CS_BT_601 Rec. ITU-R BT.601-7
CS_BT_709 = 2, // Rec. ITU-R BT.709-6
CS_SMPTE_170 = 3, // SMPTE-170
CS_SMPTE_240 = 4, // SMPTE-240
CS_BT_2020 = 5, // Rec. ITU-R BT.2020-2
CS_RESERVED = 6, // Reserved
CS_RGB = 7, // sRGB (IEC 61966-2-1)
};
enum class ColorRange {
kStudio, // Studio swing:
// For BitDepth equals 8:
// Y is between 16 and 235 inclusive.
// U and V are between 16 and 240 inclusive.
// For BitDepth equals 10:
// Y is between 64 and 940 inclusive.
// U and V are between 64 and 960 inclusive.
// For BitDepth equals 12:
// Y is between 256 and 3760.
// U and V are between 256 and 3840 inclusive.
kFull // Full swing; no restriction on Y, U, V values.
};
enum class YuvSubsampling {
k444,
k440,
k422,
k420,
};
struct FrameInfo {
int profile = 0; // Profile 0-3 are valid.
bool show_frame = false;
bool error_resilient = false;
BitDept bit_detph = BitDept::k8Bit;
ColorSpace color_space = ColorSpace::CS_UNKNOWN;
ColorRange color_range;
YuvSubsampling sub_sampling;
int frame_width = 0;
int frame_height = 0;
int render_width = 0;
int render_height = 0;
};
// Parses frame information for a VP9 key-frame or all-intra frame from a
// bitstream. Returns nullopt on failure or if not a key-frame.
absl::optional<FrameInfo> ParseIntraFrameInfo(const uint8_t* buf,
size_t length);
} // namespace vp9
} // namespace webrtc