chromium/third_party/libvpx/tests/fuzzer/vp8_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 <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;

// 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 VP8EncodeArbitraryCallSequenceSucceeds(int speed,
                                            const CallSequence& call_sequence) {}

FUZZ_TEST();

// speed: range -16..16
// end_usage: Rate control mode
void VP8EncodeSucceeds(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();