#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/av1_decoder.h"
#include <bitset>
#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/gpu/av1_picture.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/libgav1/src/src/decoder_state.h"
#include "third_party/libgav1/src/src/gav1/status_code.h"
#include "third_party/libgav1/src/src/utils/constants.h"
#include "ui/gfx/hdr_metadata.h"
namespace media {
namespace {
constexpr unsigned int kDefaultOperatingPoint = …;
VideoCodecProfile AV1ProfileToVideoCodecProfile(
libgav1::BitstreamProfile profile) { … }
bool IsSpatialLayerDecoding(int operating_point_idc) { … }
bool IsValidBitDepth(uint8_t bit_depth, VideoCodecProfile profile) { … }
VideoChromaSampling GetAV1ChromaSampling(
const libgav1::ColorConfig& color_config) { … }
gfx::HdrMetadataSmpteSt2086 ToGfxSmpteSt2086(
const libgav1::ObuMetadataHdrMdcv& mdcv) { … }
gfx::HdrMetadataCta861_3 ToGfxCta861_3(const libgav1::ObuMetadataHdrCll& cll) { … }
}
scoped_refptr<AV1Picture> AV1Decoder::AV1Accelerator::CreateAV1PictureSecure(
bool apply_grain,
uint64_t secure_handle) { … }
AV1Decoder::AV1Accelerator::Status AV1Decoder::AV1Accelerator::SetStream(
base::span<const uint8_t> stream,
const DecryptConfig* decrypt_config) { … }
AV1Decoder::AV1Decoder(std::unique_ptr<AV1Accelerator> accelerator,
VideoCodecProfile profile,
const VideoColorSpace& container_color_space)
: … { … }
AV1Decoder::~AV1Decoder() { … }
bool AV1Decoder::Flush() { … }
void AV1Decoder::Reset() { … }
void AV1Decoder::SetStream(int32_t id, const DecoderBuffer& decoder_buffer) { … }
void AV1Decoder::ClearCurrentFrame() { … }
AcceleratedVideoDecoder::DecodeResult AV1Decoder::Decode() { … }
AcceleratedVideoDecoder::DecodeResult AV1Decoder::DecodeInternal() { … }
void AV1Decoder::UpdateReferenceFrames(scoped_refptr<AV1Picture> pic) { … }
void AV1Decoder::ClearReferenceFrames() { … }
bool AV1Decoder::CheckAndCleanUpReferenceFrames() { … }
AV1Decoder::AV1Accelerator::Status AV1Decoder::DecodeAndOutputPicture(
scoped_refptr<AV1Picture> pic,
const libgav1::Vector<libgav1::TileBuffer>& tile_buffers) { … }
std::optional<gfx::HDRMetadata> AV1Decoder::GetHDRMetadata() const { … }
gfx::Size AV1Decoder::GetPicSize() const { … }
gfx::Rect AV1Decoder::GetVisibleRect() const { … }
VideoCodecProfile AV1Decoder::GetProfile() const { … }
uint8_t AV1Decoder::GetBitDepth() const { … }
VideoChromaSampling AV1Decoder::GetChromaSampling() const { … }
VideoColorSpace AV1Decoder::GetVideoColorSpace() const { … }
size_t AV1Decoder::GetRequiredNumOfPictures() const { … }
size_t AV1Decoder::GetNumReferenceFrames() const { … }
}