#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vaapi/test/av1_decoder.h"
#include <va/va.h>
#include <va/va_dec_av1.h>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "media/base/video_decoder.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/test/macros.h"
#include "media/gpu/vaapi/test/scoped_va_config.h"
#include "media/gpu/vaapi/test/scoped_va_context.h"
#include "media/gpu/vaapi/test/shared_va_surface.h"
#include "media/gpu/vaapi/test/vaapi_device.h"
#include "third_party/libgav1/src/src/warp_prediction.h"
namespace media {
namespace vaapi_test {
namespace {
#define ARRAY_SIZE(ar) …
#define STD_ARRAY_SIZE(ar) …
void FillSegmentInfo(VASegmentationStructAV1& va_seg_info,
const libgav1::Segmentation& segmentation) { … }
void FillFilmGrainInfo(VAFilmGrainStructAV1& va_film_grain_info,
const libgav1::FilmGrainParams& film_grain_params) { … }
void FillGlobalMotionInfo(
VAWarpedMotionParamsAV1 va_warped_motion[7],
const std::array<libgav1::GlobalMotion, libgav1::kNumReferenceFrameTypes>&
global_motion) { … }
bool FillTileInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::TileInfo& tile_info) { … }
void FillLoopFilterInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::LoopFilter& loop_filter) { … }
void FillQuantizationInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::QuantizerParameters& quant_param) { … }
void FillCdefInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::Cdef& cdef,
uint8_t color_bitdepth) { … }
void FillModeControlInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::ObuFrameHeader& frame_header) { … }
void FillLoopRestorationInfo(VADecPictureParameterBufferAV1& va_pic_param,
const libgav1::LoopRestoration& loop_restoration) { … }
bool FillAV1SliceParameters(
const libgav1::Vector<libgav1::TileBuffer>& tile_buffers,
const size_t tile_columns,
base::span<const uint8_t> data,
std::vector<VASliceParameterBufferAV1>& va_slice_params) { … }
unsigned int GetFormatForColorConfig(libgav1::ColorConfig color_config) { … }
}
Av1Decoder::Av1Decoder(std::unique_ptr<IvfParser> ivf_parser,
const VaapiDevice& va_device,
SharedVASurface::FetchPolicy fetch_policy)
: … { … }
Av1Decoder::~Av1Decoder() { … }
Av1Decoder::ParsingResult Av1Decoder::ReadNextFrame(
libgav1::RefCountedBufferPtr& current_frame) { … }
void Av1Decoder::RefreshReferenceSlots(
const uint8_t refresh_frame_flags,
scoped_refptr<SharedVASurface> surface,
libgav1::RefCountedBufferPtr current_frame,
scoped_refptr<SharedVASurface> display_surface) { … }
VideoDecoder::Result Av1Decoder::DecodeNextFrame() { … }
}
}