chromium/media/base/video_util_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/base/video_util.h"

#include <stdint.h>

#include <cmath>
#include <memory>

#include "base/memory/raw_ptr_exclusion.h"
#include "media/base/limits.h"
#include "media/base/video_frame.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h"

namespace {

// Initialize a plane's visible rect with value circularly from 0 to 255.
void FillPlaneWithPattern(uint8_t* data,
                          int stride,
                          const gfx::Size& visible_size) {}

// Create a VideoFrame and initialize the visible rect using
// |FillPlaneWithPattern()|. For testing purpose, the VideoFrame should be
// filled with varying values, which is different from
// |VideoFrame::CreateColorFrame()| where the entrire VideoFrame is filled
// with a given color.
scoped_refptr<media::VideoFrame> CreateFrameWithPatternFilled(
    media::VideoPixelFormat format,
    const gfx::Size& coded_size,
    const gfx::Rect& visible_rect,
    const gfx::Size& natural_size,
    base::TimeDelta timestamp) {}

// Helper function used to verify the data in the coded region after copying the
// visible region and padding the remaining area.
bool VerifyPlanCopyWithPadding(const uint8_t* src,
                               size_t src_stride,
                               // Size of visible region.
                               const gfx::Size& src_size,
                               const uint8_t* dst,
                               size_t dst_stride,
                               // Coded size of |dst|.
                               const gfx::Size& dst_size) {}

bool VerifyCopyWithPadding(const media::VideoFrame& src_frame,
                           const media::VideoFrame& dst_frame) {}

}  // namespace

namespace media {

class VideoUtilTest : public testing::Test {};

namespace {

uint8_t src6x4[] =;

// Target images, name pattern target_rotation_flipV_flipH.
uint8_t* target6x4_0_n_n =;

uint8_t target6x4_0_n_y[] =;

uint8_t target6x4_0_y_n[] =;

uint8_t target6x4_0_y_y[] =;

uint8_t target6x4_90_n_n[] =;

uint8_t target6x4_90_n_y[] =;

uint8_t target6x4_90_y_n[] =;

uint8_t target6x4_90_y_y[] =;

uint8_t* target6x4_180_n_n =;
uint8_t* target6x4_180_n_y =;
uint8_t* target6x4_180_y_n =;
uint8_t* target6x4_180_y_y =;

uint8_t* target6x4_270_n_n =;
uint8_t* target6x4_270_n_y =;
uint8_t* target6x4_270_y_n =;
uint8_t* target6x4_270_y_y =;

uint8_t src4x6[] =;

uint8_t* target4x6_0_n_n =;

uint8_t target4x6_0_n_y[] =;

uint8_t target4x6_0_y_n[] =;

uint8_t target4x6_0_y_y[] =;

uint8_t target4x6_90_n_n[] =;

uint8_t target4x6_90_n_y[] =;

uint8_t target4x6_90_y_n[] =;

uint8_t target4x6_90_y_y[] =;

uint8_t* target4x6_180_n_n =;
uint8_t* target4x6_180_n_y =;
uint8_t* target4x6_180_y_n =;
uint8_t* target4x6_180_y_y =;

uint8_t* target4x6_270_n_n =;
uint8_t* target4x6_270_n_y =;
uint8_t* target4x6_270_y_n =;
uint8_t* target4x6_270_y_y =;

struct VideoRotationTestData {};

const VideoRotationTestData kVideoRotationTestData[] =;

}  // namespace

class VideoUtilRotationTest
    : public testing::TestWithParam<VideoRotationTestData> {};

TEST_P(VideoUtilRotationTest, Rotate) {}

INSTANTIATE_TEST_SUITE_P();

// Tests the ComputeLetterboxRegion function.  Also, because of shared code
// internally, this also tests ScaleSizeToFitWithinTarget().
TEST_F(VideoUtilTest, ComputeLetterboxRegion) {}

// Tests the ComputeLetterboxRegionForI420 function.
TEST_F(VideoUtilTest, ComputeLetterboxRegionForI420) {}

// Tests the MinimallyShrinkRectForI420 function.
TEST_F(VideoUtilTest, MinimallyShrinkRectForI420) {}

TEST_F(VideoUtilTest, ScaleSizeToEncompassTarget) {}

TEST_F(VideoUtilTest, CropSizeForScalingToTarget) {}

TEST_F(VideoUtilTest, PadToMatchAspectRatio) {}

TEST_F(VideoUtilTest, LetterboxVideoFrame) {}

TEST_F(VideoUtilTest, I420CopyWithPadding) {}

TEST_F(VideoUtilTest, WrapAsI420VideoFrame) {}

}  // namespace media