chromium/third_party/libaom/fuzz/av1_encoder_fuzz_test.cc

/*
 * Copyright (c) 2023, Alliance for Open Media. All rights reserved
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

#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/libaom/source/libaom/aom/aom_codec.h"
#include "third_party/libaom/source/libaom/aom/aom_encoder.h"
#include "third_party/libaom/source/libaom/aom/aom_image.h"
#include "third_party/libaom/source/libaom/aom/aomcx.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) {}

aom_image_t* CreateGrayImage(aom_bit_depth_t bit_depth,
                             aom_img_fmt_t fmt,
                             unsigned int width,
                             unsigned int height) {}

void AV1EncodeArbitraryCallSequenceSucceeds(int speed,
                                            aom_bit_depth_t bit_depth,
                                            aom_img_fmt_t fmt,
                                            const CallSequence& call_sequence) {}

FUZZ_TEST();

// speed: range 5..11
// end_usage: Rate control mode
void AV1EncodeSucceeds(unsigned int threads,
                       int speed,
                       aom_rc_mode end_usage,
                       unsigned int width,
                       unsigned int height,
                       int num_frames) {}

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