Set quality instead of quantizer in fuzz test
diff --git a/tests/gtest/avif_fuzztest_helpers.cc b/tests/gtest/avif_fuzztest_helpers.cc index cfb0f7b..95d7693 100644 --- a/tests/gtest/avif_fuzztest_helpers.cc +++ b/tests/gtest/avif_fuzztest_helpers.cc
@@ -105,23 +105,16 @@ } EncoderPtr CreateAvifEncoder(avifCodecChoice codec_choice, int max_threads, - int min_quantizer, int max_quantizer, - int min_quantizer_alpha, int max_quantizer_alpha, - int tile_rows_log2, int tile_cols_log2, - int speed) { + int quality, int quality_alpha, int tile_rows_log2, + int tile_cols_log2, int speed) { EncoderPtr encoder(avifEncoderCreate()); if (encoder.get() == nullptr) { return encoder; } encoder->codecChoice = codec_choice; encoder->maxThreads = max_threads; - // minQuantizer must be at most maxQuantizer. - encoder->minQuantizer = std::min(min_quantizer, max_quantizer); - encoder->maxQuantizer = std::max(min_quantizer, max_quantizer); - encoder->minQuantizerAlpha = - std::min(min_quantizer_alpha, max_quantizer_alpha); - encoder->maxQuantizerAlpha = - std::max(min_quantizer_alpha, max_quantizer_alpha); + encoder->quality = quality; + encoder->qualityAlpha = quality_alpha; encoder->tileRowsLog2 = tile_rows_log2; encoder->tileColsLog2 = tile_cols_log2; encoder->speed = speed;
diff --git a/tests/gtest/avif_fuzztest_helpers.h b/tests/gtest/avif_fuzztest_helpers.h index 14dda45..6a8fbf5 100644 --- a/tests/gtest/avif_fuzztest_helpers.h +++ b/tests/gtest/avif_fuzztest_helpers.h
@@ -59,9 +59,8 @@ bool has_alpha, const std::vector<uint16_t>& samples); EncoderPtr CreateAvifEncoder(avifCodecChoice codec_choice, int max_threads, - int min_quantizer, int max_quantizer, - int min_quantizer_alpha, int max_quantizer_alpha, - int tile_rows_log2, int tile_cols_log2, int speed); + int quality, int quality_alpha, int tile_rows_log2, + int tile_cols_log2, int speed); DecoderPtr CreateAvifDecoder(avifCodecChoice codec_choice, int max_threads, avifDecoderSource requested_source, bool allow_progressive, bool allow_incremental, @@ -261,23 +260,16 @@ {AVIF_CODEC_CHOICE_AUTO, AVIF_CODEC_CHOICE_AOM}); // MAX_NUM_THREADS from libaom/aom_util/aom_thread.h const auto max_threads = fuzztest::InRange(0, 64); - const auto min_quantizer = fuzztest::InRange(AVIF_QUANTIZER_BEST_QUALITY, - AVIF_QUANTIZER_WORST_QUALITY); - const auto max_quantizer = fuzztest::InRange(AVIF_QUANTIZER_BEST_QUALITY, - AVIF_QUANTIZER_WORST_QUALITY); - const auto min_quantizer_alpha = fuzztest::InRange( - AVIF_QUANTIZER_BEST_QUALITY, AVIF_QUANTIZER_WORST_QUALITY); - const auto max_quantizer_alpha = fuzztest::InRange( - AVIF_QUANTIZER_BEST_QUALITY, AVIF_QUANTIZER_WORST_QUALITY); + const auto quality = fuzztest::InRange(AVIF_QUALITY_WORST, AVIF_QUALITY_BEST); + const auto quality_alpha = + fuzztest::InRange(AVIF_QUALITY_WORST, AVIF_QUALITY_BEST); const auto tile_rows_log2 = fuzztest::InRange(0, 6); const auto tile_cols_log2 = fuzztest::InRange(0, 6); // Fuzz only a small range of 'speed' values to avoid slowing down the fuzzer // too much. The main goal is to fuzz libavif, not the underlying AV1 encoder. const auto speed = fuzztest::InRange(6, AVIF_SPEED_FASTEST); - return fuzztest::Map(CreateAvifEncoder, codec_choice, max_threads, - min_quantizer, max_quantizer, min_quantizer_alpha, - max_quantizer_alpha, tile_rows_log2, tile_cols_log2, - speed); + return fuzztest::Map(CreateAvifEncoder, codec_choice, max_threads, quality, + quality_alpha, tile_rows_log2, tile_cols_log2, speed); } // Generator for an arbitrary DecoderPtr with base options fuzzed (i.e.