From 0af370d73669252cf402c3fe8bc60941967c47fc Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 6 May 2024 22:03:49 +0800 Subject: [PATCH] x86 sciter set not support av1 due to slow (#7920) Signed-off-by: 21pages --- libs/scrap/src/common/codec.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/scrap/src/common/codec.rs b/libs/scrap/src/common/codec.rs index de59c3068..a62565733 100644 --- a/libs/scrap/src/common/codec.rs +++ b/libs/scrap/src/common/codec.rs @@ -180,7 +180,9 @@ impl Encoder { } let vp8_useable = decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_vp8 > 0); - let av1_useable = decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_av1 > 0); + let av1_useable = decodings.len() > 0 + && decodings.iter().all(|(_, s)| s.ability_av1 > 0) + && !disable_av1(); let _all_support_h264_decoding = decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_h264 > 0); let _all_support_h265_decoding = @@ -250,8 +252,7 @@ impl Encoder { #[allow(unused_mut)] let mut auto_codec = CodecName::VP9; - // aom is very slow for x86 sciter version on windows x64 - if av1_useable && !(cfg!(windows) && std::env::consts::ARCH == "x86") { + if av1_useable { auto_codec = CodecName::AV1; } let mut system = System::new(); @@ -307,7 +308,7 @@ impl Encoder { #[allow(unused_mut)] let mut encoding = SupportedEncoding { vp8: true, - av1: true, + av1: !disable_av1(), i444: Some(CodecAbility { vp9: true, av1: true, @@ -397,7 +398,7 @@ impl Decoder { let mut decoding = SupportedDecoding { ability_vp8: 1, ability_vp9: 1, - ability_av1: 1, + ability_av1: if disable_av1() { 0 } else { 1 }, i444: Some(CodecAbility { vp9: true, av1: true, @@ -914,3 +915,8 @@ pub fn codec_thread_num(limit: usize) -> usize { } res } + +fn disable_av1() -> bool { + // aom is very slow for x86 sciter version on windows x64 + cfg!(windows) && std::env::consts::ARCH == "x86" +}