#include "src/obu_parser.h"
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include "src/buffer_pool.h"
#include "src/decoder_impl.h"
#include "src/motion_vector.h"
#include "src/utils/common.h"
#include "src/utils/logging.h"
namespace libgav1 {
namespace {
int TileLog2(int block_size, int target) { … }
void ParseBitStreamLevel(BitStreamLevel* const level, uint8_t level_bits) { … }
void SetDefaultRefDeltas(LoopFilter* const loop_filter) { … }
bool InTemporalLayer(int operating_point_idc, int temporal_id) { … }
bool InSpatialLayer(int operating_point_idc, int spatial_id) { … }
int GetLastNonzeroByteIndex(const uint8_t* data, size_t size) { … }
class RefCountedBufferPtrCleanup { … };
}
bool ObuSequenceHeader::ParametersChanged(const ObuSequenceHeader& old) const { … }
#define OBU_LOG_AND_RETURN_FALSE …
#define OBU_PARSER_FAIL …
#define OBU_READ_BIT_OR_FAIL …
#define OBU_READ_LITERAL_OR_FAIL …
#define OBU_READ_UVLC_OR_FAIL …
bool ObuParser::ParseColorConfig(ObuSequenceHeader* sequence_header) { … }
bool ObuParser::ParseTimingInfo(ObuSequenceHeader* sequence_header) { … }
bool ObuParser::ParseDecoderModelInfo(ObuSequenceHeader* sequence_header) { … }
bool ObuParser::ParseOperatingParameters(ObuSequenceHeader* sequence_header,
int index) { … }
bool ObuParser::ParseSequenceHeader(bool seen_frame_header) { … }
void ObuParser::MarkInvalidReferenceFrames() { … }
bool ObuParser::ParseFrameSizeAndRenderSize() { … }
bool ObuParser::ParseSuperResParametersAndComputeImageSize() { … }
bool ObuParser::ValidateInterFrameSize() const { … }
bool ObuParser::ParseReferenceOrderHint() { … }
int ObuParser::FindLatestBackwardReference(
const int current_frame_hint,
const std::array<int, kNumReferenceFrameTypes>& shifted_order_hints,
const std::array<bool, kNumReferenceFrameTypes>& used_frame) { … }
int ObuParser::FindEarliestBackwardReference(
const int current_frame_hint,
const std::array<int, kNumReferenceFrameTypes>& shifted_order_hints,
const std::array<bool, kNumReferenceFrameTypes>& used_frame) { … }
int ObuParser::FindLatestForwardReference(
const int current_frame_hint,
const std::array<int, kNumReferenceFrameTypes>& shifted_order_hints,
const std::array<bool, kNumReferenceFrameTypes>& used_frame) { … }
int ObuParser::FindReferenceWithSmallestOutputOrder(
const std::array<int, kNumReferenceFrameTypes>& shifted_order_hints) { … }
bool ObuParser::SetFrameReferences(const int8_t last_frame_idx,
const int8_t gold_frame_idx) { … }
bool ObuParser::ParseLoopFilterParameters() { … }
bool ObuParser::ParseDeltaQuantizer(int8_t* const delta) { … }
bool ObuParser::ParseQuantizerParameters() { … }
bool ObuParser::ParseSegmentationParameters() { … }
bool ObuParser::ParseQuantizerIndexDeltaParameters() { … }
bool ObuParser::ParseLoopFilterDeltaParameters() { … }
void ObuParser::ComputeSegmentLosslessAndQIndex() { … }
bool ObuParser::ParseCdefParameters() { … }
bool ObuParser::ParseLoopRestorationParameters() { … }
bool ObuParser::ParseTxModeSyntax() { … }
bool ObuParser::ParseFrameReferenceModeSyntax() { … }
bool ObuParser::IsSkipModeAllowed() { … }
bool ObuParser::ParseSkipModeParameters() { … }
bool ObuParser::ParseGlobalParamSyntax(
int ref, int index,
const std::array<GlobalMotion, kNumReferenceFrameTypes>&
prev_global_motions) { … }
bool ObuParser::ParseGlobalMotionParameters() { … }
bool ObuParser::ParseFilmGrainParameters() { … }
bool ObuParser::ParseTileInfoSyntax() { … }
bool ObuParser::ReadAllowWarpedMotion() { … }
bool ObuParser::ParseFrameParameters() { … }
bool ObuParser::ParseFrameHeader() { … }
bool ObuParser::ParsePadding(const uint8_t* data, size_t size) { … }
bool ObuParser::ParseMetadataScalability() { … }
bool ObuParser::ParseMetadataTimecode() { … }
bool ObuParser::ParseMetadata(const uint8_t* data, size_t size) { … }
bool ObuParser::AddTileBuffers(int start, int end, size_t total_size,
size_t tg_header_size,
size_t bytes_consumed_so_far) { … }
bool ObuParser::ParseTileGroup(size_t size, size_t bytes_consumed_so_far) { … }
bool ObuParser::ParseHeader() { … }
#undef OBU_READ_UVLC_OR_FAIL
#undef OBU_READ_LITERAL_OR_FAIL
#undef OBU_READ_BIT_OR_FAIL
#undef OBU_PARSER_FAIL
#undef OBU_LOG_AND_RETURN_FALSE
bool ObuParser::InitBitReader(const uint8_t* const data, size_t size) { … }
bool ObuParser::EnsureCurrentFrameIsNotNull() { … }
bool ObuParser::HasData() const { … }
StatusCode ObuParser::ParseOneFrame(RefCountedBufferPtr* const current_frame) { … }
std::unique_ptr<uint8_t[]> ObuParser::GetAV1CodecConfigurationBox(
const uint8_t* data, size_t size, size_t* const av1c_size) { … }
StatusCode ObuParser::ParseBasicStreamInfo(const uint8_t* data, size_t size,
ObuSequenceHeader* sequence_header,
size_t* sequence_header_offset,
size_t* sequence_header_size) { … }
}