chromium/third_party/libvpx/source/libvpx/test/encode_api_test.cc

/*
 *  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include <cassert>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <initializer_list>
#include <vector>

#include "gtest/gtest.h"
#include "test/acm_random.h"
#include "test/video_source.h"
#include "test/y4m_video_source.h"

#include "./vpx_config.h"
#include "vpx/vp8cx.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_encoder.h"
#include "vpx/vpx_image.h"

namespace {

vpx_codec_iface_t *kCodecIfaces[] =;

bool IsVP9(vpx_codec_iface_t *iface) {}

void *Memset16(void *dest, int val, size_t length) {}

vpx_image_t *CreateImage(vpx_bit_depth_t bit_depth, vpx_img_fmt_t fmt,
                         unsigned int width, unsigned int height) {}

void InitCodec(vpx_codec_iface_t &iface, int width, int height,
               vpx_codec_ctx_t *enc, vpx_codec_enc_cfg_t *cfg) {}

// Encodes 1 frame of size |cfg.g_w| x |cfg.g_h| setting |enc|'s configuration
// to |cfg|.
void EncodeWithConfig(const vpx_codec_enc_cfg_t &cfg, vpx_codec_ctx_t *enc) {}

TEST(EncodeAPI, InvalidParams) {}

TEST(EncodeAPI, HighBitDepthCapability) {}

#if CONFIG_VP8_ENCODER
TEST(EncodeAPI, ImageSizeSetting) {}

// Verifies the fix for a float-cast-overflow in vp8_change_config().
//
// Causes cpi->framerate to become the largest possible value (10,000,000) in
// VP8 by setting cfg.g_timebase to 1/10000000 and passing a duration of 1 to
// vpx_codec_encode().
TEST(EncodeAPI, HugeFramerateVp8) {}

// A test that reproduces https://crbug.com/webm/1831.
TEST(EncodeAPI, RandomPixelsVp8) {}

TEST(EncodeAPI, ChangeToL1T3AndSetBitrateVp8) {}

// Emulates the WebCodecs VideoEncoder interface.
class VP8Encoder {};

VP8Encoder::~VP8Encoder() {}

void VP8Encoder::Configure(unsigned int threads, unsigned int width,
                           unsigned int height, vpx_rc_mode end_usage,
                           vpx_enc_deadline_t deadline) {}

void VP8Encoder::Encode(bool key_frame) {}

// This is the reproducer testcase for crbug.com/324459561. However,
// just running this test is not enough to reproduce the bug. We also
// need to send signals to the test.
TEST(EncodeAPI, Chromium324459561) {}

TEST(EncodeAPI, VP8GlobalHeaders) {}

TEST(EncodeAPI, AomediaIssue3509VbrMinSection2PercentVP8) {}

TEST(EncodeAPI, AomediaIssue3509VbrMinSection101PercentVP8) {}

TEST(EncodeAPI, OssFuzz69100) {}

void EncodeOssFuzz69906(int cpu_used, vpx_enc_deadline_t deadline) {}

TEST(EncodeAPI, OssFuzz69906) {}
#endif  // CONFIG_VP8_ENCODER

// Set up 2 spatial streams with 2 temporal layers per stream, and generate
// invalid configuration by setting the temporal layer rate allocation
// (ts_target_bitrate[]) to 0 for both layers. This should fail independent of
// CONFIG_MULTI_RES_ENCODING.
TEST(EncodeAPI, MultiResEncode) {}

TEST(EncodeAPI, SetRoi) {}

TEST(EncodeAPI, ConfigChangeThreadCount) {}

TEST(EncodeAPI, ConfigResizeChangeThreadCount) {}

TEST(EncodeAPI, ConfigResizeBiggerAfterInit) {}

TEST(EncodeAPI, ConfigResizeBiggerAfterEncode) {}

TEST(EncodeAPI, PtsSmallerThanInitialPts) {}

TEST(EncodeAPI, PtsOrDurationTooBig) {}

#if CONFIG_VP9_ENCODER
// Frame size needed to trigger the overflow exceeds the max buffer allowed on
// 32-bit systems defined by VPX_MAX_ALLOCABLE_MEMORY
#if VPX_ARCH_X86_64 || VPX_ARCH_AARCH64
TEST(EncodeAPI, ConfigLargeTargetBitrateVp9) {}
#endif  // VPX_ARCH_X86_64 || VPX_ARCH_AARCH64

// Emulates the WebCodecs VideoEncoder interface.
class VP9Encoder {};

VP9Encoder::~VP9Encoder() {}

void VP9Encoder::Configure(unsigned int threads, unsigned int width,
                           unsigned int height, vpx_rc_mode end_usage,
                           vpx_enc_deadline_t deadline) {}

void VP9Encoder::Encode(bool key_frame) {}

// This is a test case from clusterfuzz.
TEST(EncodeAPI, PrevMiCheckNullptr) {}

// This is a test case from clusterfuzz: based on b/310477034.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, MultipleChangeConfigResize) {}

// This is a test case from clusterfuzz: based on b/310663186.
// Encode set of frames while varying the deadline on the fly from
// good to realtime to best and back to realtime.
TEST(EncodeAPI, DynamicDeadlineChange) {}

TEST(EncodeAPI, Buganizer310340241) {}

// This is a test case from clusterfuzz: based on b/312517065.
TEST(EncodeAPI, Buganizer312517065) {}

// This is a test case from clusterfuzz: based on b/311489136.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer311489136) {}

// This is a test case from clusterfuzz: based on b/312656387.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer312656387) {}

// This is a test case from clusterfuzz: based on b/310329177.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer310329177) {}

// This is a test case from clusterfuzz: based on b/311394513.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer311394513) {}

TEST(EncodeAPI, Buganizer311985118) {}

// This is a test case from clusterfuzz: based on b/314857577.
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer314857577) {}

TEST(EncodeAPI, Buganizer312875957PredBufferStride) {}

// This is a test case from clusterfuzz: based on b/311294795
// Encode a few frames with multiple change config calls
// with different frame sizes.
TEST(EncodeAPI, Buganizer311294795) {}

TEST(EncodeAPI, Buganizer317105128) {}

TEST(EncodeAPI, Buganizer319964497) {}

TEST(EncodeAPI, Buganizer329088759RowMT0) {}

TEST(EncodeAPI, Buganizer329088759RowMT1) {}

TEST(EncodeAPI, Buganizer331086799) {}

TEST(EncodeAPI, Buganizer331108729) {}

TEST(EncodeAPI, Buganizer331108922BitDepth8) {}

#if CONFIG_VP9_HIGHBITDEPTH
TEST(EncodeAPI, Buganizer329674887RowMT0BitDepth12) {}

TEST(EncodeAPI, Buganizer329179808RowMT0BitDepth10) {}

TEST(EncodeAPI, Buganizer329179808RowMT1BitDepth10) {}

TEST(EncodeAPI, Buganizer331108922BitDepth12) {}
#endif  // CONFIG_VP9_HIGHBITDEPTH

TEST(EncodeAPI, VP9GlobalHeaders) {}

TEST(EncodeAPI, AomediaIssue3509VbrMinSection2PercentVP9) {}

TEST(EncodeAPI, AomediaIssue3509VbrMinSection101PercentVP9) {}

TEST(EncodeAPI, Chromium352414650) {}

#endif  // CONFIG_VP9_ENCODER

}  // namespace