# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/arm.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/libgav1/options.gni")
# Public configuration exported to users of the libgav1_parser target.
config("libgav1_public_config") {
include_dirs = [
"src",
"src/src",
]
defines = [
"LIBGAV1_MAX_BITDEPTH=10",
"LIBGAV1_THREADPOOL_USE_STD_MUTEX", # to avoid abseil dependency.
"LIBGAV1_ENABLE_LOGGING=0", # to avoid debug log of libgav1 in chromium
# debug build.
# Don't let libgav1 export any symbols. Otherwise the verify_order step on
# macOS can fail since these exports end up in the final Chromium binary.
"LIBGAV1_PUBLIC=",
# The following directive macro definition is set to treat some libgav1
# bitstream check results as warnings, so that the decoding job can be
# continued.
"CHROMIUM",
]
}
# Private configuration used in building libgav1.
config("libgav1_config") {
configs = []
# dsp intrinsics will generate much better code when optimized for speed
# rather than size.
if (!is_debug) {
configs += [ "//build/config/compiler:optimize_max" ]
}
if (current_cpu == "arm64" ||
(current_cpu == "arm" && arm_version >= 7 && arm_use_neon)) {
# The default thumb mode will impact performance of dsp intrinsics.
configs += [ "//build/config/compiler:compiler_arm" ]
}
}
if (use_libgav1_parser) {
static_library("libgav1_parser") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":libgav1_config" ]
public_configs = [ ":libgav1_public_config" ]
sources = [
"//third_party/libgav1/src/src/buffer_pool.cc",
"//third_party/libgav1/src/src/buffer_pool.h",
"//third_party/libgav1/src/src/frame_buffer.cc",
"//third_party/libgav1/src/src/internal_frame_buffer_list.cc",
"//third_party/libgav1/src/src/internal_frame_buffer_list.h",
"//third_party/libgav1/src/src/obu_parser.cc",
"//third_party/libgav1/src/src/obu_parser.h",
"//third_party/libgav1/src/src/quantizer.cc",
"//third_party/libgav1/src/src/quantizer.h",
"//third_party/libgav1/src/src/status_code.cc",
"//third_party/libgav1/src/src/symbol_decoder_context.cc",
"//third_party/libgav1/src/src/symbol_decoder_context.h",
"//third_party/libgav1/src/src/utils/bit_reader.cc",
"//third_party/libgav1/src/src/utils/bit_reader.h",
"//third_party/libgav1/src/src/utils/constants.cc",
"//third_party/libgav1/src/src/utils/constants.h",
"//third_party/libgav1/src/src/utils/logging.cc",
"//third_party/libgav1/src/src/utils/logging.h",
"//third_party/libgav1/src/src/utils/raw_bit_reader.cc",
"//third_party/libgav1/src/src/utils/raw_bit_reader.h",
"//third_party/libgav1/src/src/utils/segmentation.cc",
"//third_party/libgav1/src/src/utils/segmentation.h",
"//third_party/libgav1/src/src/utils/segmentation_map.cc",
"//third_party/libgav1/src/src/utils/segmentation_map.h",
"//third_party/libgav1/src/src/warp_prediction.cc",
"//third_party/libgav1/src/src/warp_prediction.h",
"//third_party/libgav1/src/src/yuv_buffer.cc",
"//third_party/libgav1/src/src/yuv_buffer.h",
]
}
fuzzer_test("libgav1_obu_parser_fuzzer") {
sources = [
"//third_party/libgav1/src/examples/file_reader.cc",
"//third_party/libgav1/src/examples/file_reader.h",
"//third_party/libgav1/src/examples/file_reader_constants.cc",
"//third_party/libgav1/src/examples/file_reader_constants.h",
"//third_party/libgav1/src/examples/file_reader_factory.cc",
"//third_party/libgav1/src/examples/file_reader_factory.h",
"//third_party/libgav1/src/examples/file_reader_interface.h",
"//third_party/libgav1/src/examples/ivf_parser.cc",
"//third_party/libgav1/src/examples/ivf_parser.h",
"//third_party/libgav1/src/examples/logging.h",
"//third_party/libgav1/src/tests/fuzzer/obu_parser_fuzzer.cc",
]
deps = [ ":libgav1_parser" ]
defines = [ "LIBGAV1_EXAMPLES_ENABLE_LOGGING=0" ]
additional_configs = [ ":libgav1_config" ]
}
}