#include "media/gpu/test/video_frame_helpers.h"
#include <utility>
#include <vector>
#include "base/bits.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/color_plane_layout.h"
#include "media/base/format_utils.h"
#include "media/base/video_frame.h"
#include "media/gpu/test/image.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/gpu_memory_buffer.h"
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
#include <sys/mman.h>
#endif
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/video_frame_mapper.h"
#include "media/gpu/video_frame_mapper_factory.h"
#endif
namespace media {
namespace test {
namespace {
#define ASSERT_TRUE_OR_RETURN(predicate, return_value) …
bool ConvertVideoFrameToI420(const VideoFrame* src_frame,
VideoFrame* dst_frame) { … }
bool ConvertVideoFrameToYUV420P10(const VideoFrame* src_frame,
VideoFrame* dst_frame) { … }
bool ConvertVideoFrameToARGB(const VideoFrame* src_frame,
VideoFrame* dst_frame) { … }
bool CopyVideoFrame(const VideoFrame* src_frame,
scoped_refptr<VideoFrame> dst_frame) { … }
}
bool ConvertVideoFrame(const VideoFrame* src_frame, VideoFrame* dst_frame) { … }
scoped_refptr<VideoFrame> ConvertVideoFrame(const VideoFrame* src_frame,
VideoPixelFormat dst_pixel_format) { … }
scoped_refptr<VideoFrame> ScaleVideoFrame(const VideoFrame* src_frame,
const gfx::Size& dst_resolution) { … }
scoped_refptr<VideoFrame> CloneVideoFrame(
const VideoFrame* const src_frame,
const VideoFrameLayout& dst_layout,
VideoFrame::StorageType dst_storage_type,
std::optional<gfx::BufferUsage> dst_buffer_usage) { … }
scoped_refptr<VideoFrame> CreateDmabufVideoFrame(
const VideoFrame* const frame) { … }
scoped_refptr<VideoFrame> CreateGpuMemoryBufferVideoFrame(
const VideoFrame* const frame,
gfx::BufferUsage buffer_usage) { … }
scoped_refptr<const VideoFrame> CreateVideoFrameFromImage(const Image& image) { … }
std::optional<VideoFrameLayout> CreateVideoFrameLayout(
VideoPixelFormat pixel_format,
const gfx::Size& dimension,
const uint32_t alignment,
std::vector<size_t>* plane_rows) { … }
}
}