Refactors Vp9UncompressedHeaderParser.
Biggest change is a new helper class used to read data from the
bitstream and then pass the result to a function if reading was
successful. There's also helper to do if/else flow based on the read
values. This avoids a bunch of temporaries and in my view makes the
code esaier to read.
For example, this block:
uint32_t bit;
RETURN_FALSE_IF_ERROR(br->ReadBits(&bit, 1));
if (bit) {
RETURN_FALSE_IF_ERROR(br->ConsumeBits(7));
}
...is now written as:
RETURN_IF_FALSE(
br->IfNextBoolean([br] { return br->ConsumeBits(7); }));
In addition, we parse and put a few extra things in FrameInfo:
show_existing_frame, is_keyframe, and base_qp.
Bug: webrtc:12354
Change-Id: Ia0b707b223a1afe0a4521ce2b995437d41243c06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215239
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33776}
This commit is contained in:
@ -65,6 +65,8 @@ enum class YuvSubsampling {
|
||||
|
||||
struct FrameInfo {
|
||||
int profile = 0; // Profile 0-3 are valid.
|
||||
absl::optional<uint8_t> show_existing_frame;
|
||||
bool is_keyframe = false;
|
||||
bool show_frame = false;
|
||||
bool error_resilient = false;
|
||||
BitDept bit_detph = BitDept::k8Bit;
|
||||
@ -75,6 +77,7 @@ struct FrameInfo {
|
||||
int frame_height = 0;
|
||||
int render_width = 0;
|
||||
int render_height = 0;
|
||||
int base_qp = 0;
|
||||
};
|
||||
|
||||
// Parses frame information for a VP9 key-frame or all-intra frame from a
|
||||
|
||||
Reference in New Issue
Block a user