enum ConvertLayout {
Nv12,
P010,
Yuv444P10,
}Expand description
The 4:2:0 convert that replaces NVENC’s own, because the hardware’s fixed-function
conversion weights the two columns of a block 3:1 instead of averaging them, leaving half the
color of a subpixel-antialiased glyph edge in the chroma plane where the software and VA-API
converts leave none. It follows the matrix the session declares
(gpu_hardware_conversion_matches_the_declared_matrix), so only the siting is at stake, and
4:4:4 — which subsamples nothing — keeps it.
The kernels ship as PTX the driver JIT-compiles (cuModuleLoadData), so the only library
involved is the libcuda NVENC already needs — nothing to install, and no runtime compiler.
They read the session’s packed ARGB surface, or a texture over an array-typed dmabuf import,
and write the NV12 surface NVENC then encodes, averaging each block’s RGB before the matrix
as the host convert does.
The surface a ChromaConvert writes for NVENC: NV12 for an 8-bit 4:2:0 session, and for a
10-bit one P010 or planar 4:4:4, whose samples the kernel computes from the 8-bit RGB at
10 bits. NVENC upconverts an 8-bit surface itself, but from samples already rounded to
eight: a 4:4:4 HEVC session coded that way measured 41.6 dB against its 8-bit 45.5 at one
quantizer on an RTX 3060, its luma half a level low.
Variants§
Implementations§
Source§impl ConvertLayout
impl ConvertLayout
Sourcefn of(fullcolor: bool, bit_depth: u32) -> Option<Self>
fn of(fullcolor: bool, bit_depth: u32) -> Option<Self>
The layout a session of this chroma and depth converts into; None for 8-bit 4:4:4, which subsamples nothing and keeps NVENC’s own conversion.
Sourcefn kernels(self) -> (&'static CStr, &'static CStr)
fn kernels(self) -> (&'static CStr, &'static CStr)
The kernels reading a linear surface and a texture.
Sourcefn extent(self, width: u32, height: u32) -> (usize, usize)
fn extent(self, width: u32, height: u32) -> (usize, usize)
The bytes a row and the rows a widthxheight picture take: a luma plane and half as
many rows of interleaved chroma, or three whole planes.
fn format(self) -> NV_ENC_BUFFER_FORMAT
Trait Implementations§
Source§impl Clone for ConvertLayout
impl Clone for ConvertLayout
Source§fn clone(&self) -> ConvertLayout
fn clone(&self) -> ConvertLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConvertLayout
Source§impl Debug for ConvertLayout
impl Debug for ConvertLayout
impl Eq for ConvertLayout
Source§impl PartialEq for ConvertLayout
impl PartialEq for ConvertLayout
impl StructuralPartialEq for ConvertLayout
Auto Trait Implementations§
impl Freeze for ConvertLayout
impl RefUnwindSafe for ConvertLayout
impl Send for ConvertLayout
impl Sync for ConvertLayout
impl Unpin for ConvertLayout
impl UnsafeUnpin for ConvertLayout
impl UnwindSafe for ConvertLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more