chromium/third_party/libvpx/tests/fuzzer/vp9_encoder_fuzz_test.cc

/*
 *  Copyright (c) 2023 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 <cstdint>
#include <cstring>
#include <variant>
#include <vector>

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/fuzztest/src/fuzztest/fuzztest.h"
#include "third_party/libvpx/source/libvpx/vpx/vp8cx.h"
#include "third_party/libvpx/source/libvpx/vpx/vpx_codec.h"
#include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h"
#include "third_party/libvpx/source/libvpx/vpx/vpx_image.h"

Arbitrary;
ElementOf;
FlatMap;
InRange;
Just;
StructOf;
VariantOf;
VectorOf;

auto AnyBitDepth() {}

// Represents a VideoEncoder::configure() method call.
// Parameters:
//   VideoEncoderConfig config
struct Configure {};

auto AnyConfigureWithSize(unsigned int width, unsigned int height) {}

auto AnyConfigureWithMaxSize(unsigned int max_width, unsigned int max_height) {}

// Represents a VideoEncoder::encode() method call.
// Parameters:
//   VideoFrame frame
//   optional VideoEncoderEncodeOptions options = {}
struct Encode {};

auto AnyEncode() {}

MethodCall;

auto AnyMethodCallWithMaxSize(unsigned int max_width, unsigned int max_height) {}

struct CallSequence {};

auto AnyCallSequenceWithMaxSize(unsigned int max_width,
                                unsigned int max_height) {}

auto AnyCallSequence() {}

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

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

void VP9EncodeArbitraryCallSequenceSucceeds(int speed,
                                            unsigned int row_mt,
                                            vpx_bit_depth_t bit_depth,
                                            vpx_img_fmt_t fmt,
                                            const CallSequence& call_sequence) {}

FUZZ_TEST();

// speed: range -9..9
// end_usage: Rate control mode
void VP9EncodeSucceeds(unsigned int threads,
                       int speed,
                       vpx_rc_mode end_usage,
                       unsigned int width,
                       unsigned int height,
                       int num_frames) {}

// Chrome's WebCodecs uses at most 16 threads.
FUZZ_TEST();