mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
H.264 High 4:4:4 / HEVC FRExt with chromaFormatIDC 3 and AQ off when 真彩 is requested; GPUs without YUV444 encode fail the capability check and fall back. full_chroma_available() no longer excludes the in-process path. UU_PROBE_CHROMA=444 for the probe. Co-authored-by: ferstar <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
8 files changed
+45
-20
No files matched your search
@@ -26,6 +26,7 @@ struct NvencConfigFFI {
|
||||
max_bps: i64,
|
||||
buffer_bits: i64,
|
||||
is_hevc: libc::c_int,
|
||||
chroma_444: libc::c_int,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@@ -70,6 +71,8 @@ pub struct Config {
|
||||
pub max_bps: i64,
|
||||
pub buffer_bits: i64,
|
||||
pub codec: crate::capture_setting::VideoCodec,
|
||||
/// ChromaFormat (capture_setting::CHROMA_444 = 4:4:4).
|
||||
pub chroma: u64,
|
||||
}
|
||||
|
||||
pub fn disabled() -> bool {
|
||||
@@ -145,14 +148,16 @@ pub fn run(
|
||||
0
|
||||
};
|
||||
|
||||
let chroma_444 = libc::c_int::from(config.chroma == crate::capture_setting::CHROMA_444);
|
||||
log::info!(
|
||||
"Initializing Native In-Process NVENC: {}x{}, {} fps, GOP {}, CQ {}, HEVC={}",
|
||||
"Initializing Native In-Process NVENC: {}x{}, {} fps, GOP {}, CQ {}, HEVC={}, 4:4:4={}",
|
||||
width,
|
||||
height,
|
||||
config.fps,
|
||||
config.gop,
|
||||
config.cq,
|
||||
is_hevc == 1
|
||||
is_hevc == 1,
|
||||
chroma_444 == 1
|
||||
);
|
||||
|
||||
let ffi_cfg = NvencConfigFFI {
|
||||
@@ -165,6 +170,7 @@ pub fn run(
|
||||
max_bps: config.max_bps,
|
||||
buffer_bits: config.buffer_bits,
|
||||
is_hevc,
|
||||
chroma_444,
|
||||
};
|
||||
|
||||
let mut capture = DamageCapture::open(&config.display)
|
||||
|
||||
+7
-6
@@ -198,11 +198,9 @@ impl Encoder {
|
||||
fn nvidia_present() -> bool {
|
||||
std::path::Path::new("/proc/driver/nvidia/version").exists() || std::path::Path::new("/dev/nvidia0").exists()
|
||||
}
|
||||
/// 真彩 (4:4:4) needs the FFmpeg process pipeline with NVENC or libx264 (h264_vaapi and the
|
||||
/// in-process encoder are 4:2:0 only).
|
||||
/// 真彩 (4:4:4): NVENC (in-process or FFmpeg) and libx264; h264_vaapi is 4:2:0 only.
|
||||
/// A GPU without 4:4:4 NVENC falls back to libx264, which keeps 4:4:4.
|
||||
pub fn full_chroma_available() -> bool {
|
||||
#[cfg(feature = "inproc-av")]
|
||||
if crate::inproc_encoder::selected(Encoder::requested()) { return false; }
|
||||
Encoder::requested() != Encoder::Vaapi
|
||||
}
|
||||
|
||||
@@ -618,7 +616,7 @@ async fn read_encoder_with(
|
||||
display: display.clone(), input: size, output: settings.output, fps: u32::from(settings.fps),
|
||||
gop: gop_frames(settings.fps, true) as u32, cq: settings.cq() as u32,
|
||||
target_bps: settings.max_kbps().map_or(16_000, |k| i64::from(k) * 3 / 4) * 1000,
|
||||
max_bps: max_kbps * 1000, buffer_bits: i64::from(buffer_for(&settings, encoder)) * 1000, codec: settings.codec,
|
||||
max_bps: max_kbps * 1000, buffer_bits: i64::from(buffer_for(&settings, encoder)) * 1000, codec: settings.codec, chroma: settings.chroma,
|
||||
};
|
||||
log::info!("Desktop encoder: display={} source={}x{} output={:?} fps={} cq={} maxrate={}k encoder={} pipeline=in-process",
|
||||
display,size.0,size.1,settings.output,settings.fps,config.cq,max_kbps,encoder.name_for(settings.codec));
|
||||
@@ -793,7 +791,10 @@ fn probe_settings() -> Result<VideoSettings,String> {
|
||||
None=>crate::capture_setting::QUALITY_AUTO,
|
||||
Some(v)=>v.parse::<u64>().ok().filter(|q|(1..=5).contains(q)).ok_or("UU_PROBE_QUALITY must be 1-5")?,
|
||||
};
|
||||
Ok(VideoSettings {fps,quality,codec:probe_codec(),..VideoSettings::default()})
|
||||
let mut settings=VideoSettings {fps,quality,codec:probe_codec(),..VideoSettings::default()};
|
||||
// UU_PROBE_CHROMA=444 requests 真彩 like the viewer does (only where full_chroma_available()).
|
||||
if std::env::var("UU_PROBE_CHROMA").as_deref()==Ok("444") && full_chroma_available() { settings.chroma=crate::capture_setting::CHROMA_444; }
|
||||
Ok(settings)
|
||||
}
|
||||
|
||||
/// The probe follows `UU_VIDEO_CODEC` so the HEVC path can be measured at all (H.264 otherwise),
|
||||
|
||||
Reference in new issue
Block a user