Răsfoiți Sursa

app: cleanup rav1d build stuff in Makefile and Cargo.toml

darkfi 7 luni în urmă
părinte
comite
a05956d412
5 a modificat fișierele cu 23 adăugiri și 25 ștergeri
  1. 1 0
      bin/app/Cargo.lock
  2. 6 5
      bin/app/Cargo.toml
  3. 2 16
      bin/app/Makefile
  4. 9 1
      bin/app/src/gfx/mod.rs
  5. 5 3
      bin/app/src/ui/vid/decode.rs

+ 1 - 0
bin/app/Cargo.lock

@@ -4722,6 +4722,7 @@ dependencies = [
 [[package]]
 name = "rav1d"
 version = "1.1.0"
+source = "git+https://github.com/narodnik/rav1d?branch=add-rust-api#c438996a3c2c008e6e7fa7a064496168e869c343"
 dependencies = [
  "assert_matches",
  "atomig",

+ 6 - 5
bin/app/Cargo.toml

@@ -65,11 +65,6 @@ fluent = "0.17.0"
 unic-langid = { version = "0.9.6", features = ["unic-langid-macros"] }
 indoc = "2.0.7"
 
-# AV1 video decoding - rav1d with Rust API from leo030303 fork
-# Disable default features to avoid NASM dependency (asm)
-#rav1d = { git = "https://github.com/leo030303/rav1d", branch = "add-rust-api", features = ["bitdepth_8"] }
-rav1d = { git = "https://github.com/narodnik/rav1d", branch = "add-rust-api", features = ["bitdepth_8"] }
-
 # This makes a HUGE difference to decoding speed.
 # Over 160s to like 2s.
 [profile.dev.package.rav1d]
@@ -96,11 +91,17 @@ halo2_gadgets = { git="https://github.com/parazyd/halo2", branch="v032" }
 
 [target.'cfg(not(target_os = "android"))'.dependencies]
 dirs = "5.0.1"
+# AV1 video decoding - rav1d with Rust API from leo030303 fork
+# Enable ASM routines for non-Android platforms.
+#rav1d = { git = "https://github.com/leo030303/rav1d", branch = "add-rust-api", features = ["bitdepth_8"] }
+rav1d = { git = "https://github.com/narodnik/rav1d", branch = "add-rust-api", features = ["bitdepth_8"] }
 
 [target.'cfg(target_os = "android")'.dependencies]
 tracing-android = "0.2.0"
 # Required by Arti: tor-dirmgr
 tor-dirmgr = { version="0.37.0", features=["static"] }
+# Disable asm for Android due to PIC relocation issues
+rav1d = { git = "https://github.com/narodnik/rav1d", branch = "add-rust-api", default-features = false, features = ["bitdepth_8"] }
 
 [target.'cfg(target_os = "windows")'.dependencies]
 # Used by tor-dirmgr

+ 2 - 16
bin/app/Makefile

@@ -69,28 +69,14 @@ ibm-plex-mono-regular.otf:
 NotoColorEmoji.ttf:
 	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/NotoColorEmoji.ttf
 
-forest_1920x1080.zip:
-	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_1920x1080.zip
-assets/forest_1920x1080/000.qoi:
-	cd assets && unzip ../forest_1920x1080.zip
-forest_1920x1080: forest_1920x1080.zip assets/forest_1920x1080/000.qoi
-	rm -fr assets/forest_729x1280/
-
-forest_720x1280.zip:
-	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_720x1280.zip
-assets/forest_720x1280/000.qoi:
-	cd assets && unzip ../forest_720x1280.zip
-forest_720x1280: forest_720x1280.zip assets/forest_720x1280/000.qoi
-	rm -fr assets/forest_1920x1080/
-
 # Developer targets
 
-dev: $(SRC) fonts forest_1920x1080
+dev: $(SRC) fonts
 	$(CARGO) lbuild $(DEV_FEATURES)
 	-mv target/debug/darkfi-app .
 	./darkfi-app
 
-apk: $(SRC) fonts forest_720x1280
+apk: $(SRC) fonts
 	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEV_FEATURES)
 	$(MAKE) install-apk
 

+ 9 - 1
bin/app/src/gfx/mod.rs

@@ -20,7 +20,6 @@ use darkfi_serial::{
     async_trait, AsyncEncodable, AsyncWrite, Decodable, Encodable, FutAsyncWriteExt,
     SerialDecodable, SerialEncodable, VarInt,
 };
-use indoc::indoc;
 #[cfg(target_os = "android")]
 use miniquad::native::egl;
 use miniquad::{
@@ -1132,6 +1131,15 @@ impl Stage {
         format: TextureFormat,
         gfx_texture_id: TextureId,
     ) {
+        let fmt_size = format.size(width as u32, height as u32) as usize;
+        assert_eq!(
+            fmt_size,
+            data.len(),
+            "Texture data size mismatch for ID={gfx_texture_id}: \
+             expected {fmt_size}, got {} for {width}x{height} {:?}",
+            data.len(),
+            format
+        );
         let texture = self.ctx.new_texture_from_data_and_format(
             data,
             TextureParams {

+ 5 - 3
bin/app/src/ui/vid/decode.rs

@@ -19,8 +19,8 @@
 use miniquad::TextureFormat;
 use parking_lot::Mutex as SyncMutex;
 use rav1d::{
-    Decoder as Rav1dDecoder, Picture as Rav1dPicture, PlanarImageComponent, Rav1dError,
-    Settings as Rav1dSettings,
+    Decoder as Rav1dDecoder, InloopFilterType, Picture as Rav1dPicture, PlanarImageComponent,
+    Rav1dError, Settings as Rav1dSettings,
 };
 use std::sync::{
     mpsc::{Receiver, Sender},
@@ -65,7 +65,9 @@ pub fn spawn_decoder_thread(
     // 0 is auto detect
     settings.set_n_threads(4);
     // 0 is auto
-    settings.set_max_frame_delay(0);
+    settings.set_max_frame_delay(1);
+    settings.set_apply_grain(false);
+    settings.set_inloop_filters(InloopFilterType::empty());
 
     let mut decoder = Rav1dDecoder::with_settings(&settings).unwrap();
     //let mut decoder = Rav1dDecoder::new().unwrap();