Enable CrabbyAvif for Android framework
Enable the crabbyavif dependency on the Android framework by
adding the relevant dependency in gn_to_bp.py.
This is similar to how we include the current SkHeifDecoder
dependency (which is also Android only).
Test: Applied the changes and tested the Android framework build with the resulting Android.bp and config files.
Bug: b/323753814
Change-Id: Id24a00aa7852696cbbdc5b9f3ee3873eed488dbf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/906896
Reviewed-by: Kaylee Lubick <kjlubick@google.com>
Commit-Queue: Vignesh Venkat <vigneshv@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 68af9e49..cd90de0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1097,6 +1097,18 @@
sources = [ "src/codec/SkAvifCodec.cpp" ]
}
+optional("crabbyavif") {
+ enabled = skia_use_crabbyavif
+ public_defines = [ "SK_CODEC_DECODES_AVIF" ]
+
+ # AVIF decoding is provided by CrabbyAvif (a Rust library). Since skia's
+ # standalone builds do not support Rust, it is only being enabled when
+ # building for the Android framework.
+ # The dependency for Android is set in gn_to_bp.py
+ deps = []
+ sources = [ "src/codec/SkCrabbyAvifCodec.cpp" ]
+}
+
optional("jpeg_mpf") {
enabled = skia_use_jpeg_gainmaps &&
(skia_use_libjpeg_turbo_encode || skia_use_libjpeg_turbo_decode)
@@ -1467,6 +1479,7 @@
deps = [
":android_utils",
":avif",
+ ":crabbyavif",
":heif",
":hsw",
":jpeg_decode",
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index 477e490..720e62d 100755
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -277,6 +277,9 @@
shared_libs: [
"libheif",
],
+ static_libs: [
+ "libcrabbyavif_ffi",
+ ],
},
darwin: {
host_ldlibs: [
@@ -494,9 +497,11 @@
if target_os == '"android"' and not renderengine:
d['skia_use_libheif'] = 'true'
+ d['skia_use_crabbyavif'] = 'true'
d['skia_use_jpeg_gainmaps'] = 'true'
else:
d['skia_use_libheif'] = 'false'
+ d['skia_use_crabbyavif'] = 'false'
if renderengine:
d['skia_use_libpng_decode'] = 'false'
diff --git a/gn/skia.gni b/gn/skia.gni
index 0912d15..276b75b 100644
--- a/gn/skia.gni
+++ b/gn/skia.gni
@@ -39,6 +39,7 @@
skia_update_fuchsia_sdk = false
skia_use_angle = false
skia_use_client_icu = false
+ skia_use_crabbyavif = false
skia_use_dawn = false
skia_use_direct3d = false
skia_use_egl = false