FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Merge origin/main into m8/export-stage-timings
Brandon Thomas285e81b5da4a
diff --cc crates/platform/src/nvenc/export.rsindex 4a8a13f49,b43a1c863..8f2f67ced--- a/crates/platform/src/nvenc/export.rs+++ b/crates/platform/src/nvenc/export.rs@@@ -57,13 -107,22 +107,26 @@@ impl VideoEncoder for NvencEncoderif f.width != self.w || f.height != self.h {return Err(ExportError::Encode(format!("NVENC: a {}x{} picture for a {}x{} encoder", f.width, f.height, self.w, self.h)));}- filmcraft_export::timed(filmcraft_export::Stage::Convert, || {- filmcraft_export::rgba_to_yuv420_8(f.rgba, self.w as usize, self.h as usize, &mut self.y, &mut self.u, &mut self.v)- });- let ps = self- .enc- .encode(&self.y, &self.u, &self.v, f.index)- .map_err(|e| ExportError::Encode(format!("NVENC: {e} (turn Export ▸ Hardware encoding off to use the software encoder)")))?;+ let (w, h) = (self.w as usize, self.h as usize);+ let hint = if self.enc.codec() == Codec::H264 { " (turn Export ▸ Hardware encoding off to use the software encoder)" } else { "" };+ let ps = match (self.enc.is_ten_bit(), f.hdr) {+ // Main 10 takes the encoded R'G'B' floats: 10-bit limited-range BT.2020 NCL (or the signal's matrix)+ (true, Some(rgb)) => {+ let (kr, kb) = self.signal.kr_kb();- filmcraft_export::rgbf_to_yuv420_10(rgb, w, h, kr, kb, &mut self.y16, &mut self.u16, &mut self.v16)?;++ filmcraft_export::timed(filmcraft_export::Stage::Convert, || {++ filmcraft_export::rgbf_to_yuv420_10(rgb, w, h, kr, kb, &mut self.y16, &mut self.u16, &mut self.v16)++ })?;+ self.enc.encode_10(&self.y16, &self.u16, &self.v16, f.index).map_err(|e| ExportError::Encode(format!("NVENC: {e}{hint}")))?+ }+ (true, None) => return Err(ExportError::Unsupported("NVENC Main 10 needs the HDR picture (EncoderFrame::hdr)".into())),+ (false, Some(_)) => return Err(ExportError::Unsupported("NVENC Main (8-bit) does not take HDR pictures".into())),+ (false, None) => {- filmcraft_export::rgba_to_yuv420_8(f.rgba, w, h, &mut self.y, &mut self.u, &mut self.v);++ filmcraft_export::timed(filmcraft_export::Stage::Convert, || {++ filmcraft_export::rgba_to_yuv420_8(f.rgba, w, h, &mut self.y, &mut self.u, &mut self.v)++ });+ self.enc.encode(&self.y, &self.u, &self.v, f.index).map_err(|e| ExportError::Encode(format!("NVENC: {e}{hint}")))?+ }+ };filmcraft_export::note_hw_encode_frame();Ok(self.packets(ps))}