#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/parsers/vp8_parser.h"
#include <cstring>
#include "base/check_op.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
namespace media {
#define ERROR_RETURN(what) …
#define BD_READ_BOOL_OR_RETURN(out) …
#define BD_READ_BOOL_WITH_PROB_OR_RETURN(out, prob) …
#define BD_READ_UNSIGNED_OR_RETURN(num_bits, out) …
#define BD_READ_SIGNED_OR_RETURN(num_bits, out) …
Vp8FrameHeader::Vp8FrameHeader() = default;
Vp8FrameHeader::~Vp8FrameHeader() = default;
Vp8FrameHeader::Vp8FrameHeader(const Vp8FrameHeader& fhdr) = default;
Vp8FrameHeader& Vp8FrameHeader::operator=(const Vp8FrameHeader& fhdr) = default;
Vp8Parser::Vp8Parser() : … { … }
Vp8Parser::~Vp8Parser() = default;
bool Vp8Parser::ParseFrame(const uint8_t* ptr,
size_t frame_size,
Vp8FrameHeader* fhdr) { … }
static inline uint32_t GetBitsAt(uint32_t data, size_t shift, size_t num_bits) { … }
bool Vp8Parser::ParseFrameTag(Vp8FrameHeader* fhdr) { … }
bool Vp8Parser::ParseFrameHeader(Vp8FrameHeader* fhdr) { … }
bool Vp8Parser::ParseSegmentationHeader(bool keyframe) { … }
bool Vp8Parser::ParseLoopFilterHeader(bool keyframe) { … }
bool Vp8Parser::ParseQuantizationHeader(Vp8QuantizationHeader* qhdr) { … }
const uint8_t kCoeffUpdateProbs[kNumBlockTypes][kNumCoeffBands]
[kNumPrevCoeffContexts][kNumEntropyNodes] = …;
const uint8_t kKeyframeYModeProbs[kNumYModeProbs] = …;
const uint8_t kKeyframeUVModeProbs[kNumUVModeProbs] = …;
const uint8_t kDefaultYModeProbs[kNumYModeProbs] = …;
const uint8_t kDefaultUVModeProbs[kNumUVModeProbs] = …;
const uint8_t kDefaultCoeffProbs[kNumBlockTypes][kNumCoeffBands]
[kNumPrevCoeffContexts][kNumEntropyNodes] = …;
const uint8_t kMVUpdateProbs[kNumMVContexts][kNumMVProbs] = …;
const uint8_t kDefaultMVProbs[kNumMVContexts][kNumMVProbs] = …;
void Vp8Parser::ResetProbs() { … }
bool Vp8Parser::ParseTokenProbs(Vp8EntropyHeader* ehdr,
bool update_curr_probs) { … }
bool Vp8Parser::ParseIntraProbs(Vp8EntropyHeader* ehdr,
bool update_curr_probs,
bool keyframe) { … }
bool Vp8Parser::ParseMVProbs(Vp8EntropyHeader* ehdr, bool update_curr_probs) { … }
bool Vp8Parser::ParsePartitions(Vp8FrameHeader* fhdr) { … }
}