Skip to main content

ChromaConvert

Struct ChromaConvert 

Source
struct ChromaConvert {
    module: *mut c_void,
    kernel: *mut c_void,
    kernel_tex: *mut c_void,
    layout: ConvertLayout,
    surface: CUdeviceptr,
    pitch: usize,
    registered: NV_ENC_REGISTERED_PTR,
    mapped: NV_ENC_INPUT_PTR,
}

Fields§

§module: *mut c_void§kernel: *mut c_void§kernel_tex: *mut c_void§layout: ConvertLayout§surface: CUdeviceptr§pitch: usize§registered: NV_ENC_REGISTERED_PTR§mapped: NV_ENC_INPUT_PTR

Implementations§

Source§

impl ChromaConvert

Source

unsafe fn new( cuda: &CudaFunctions, funcs: &NV_ENCODE_API_FUNCTION_LIST, session: *mut c_void, width: u32, height: u32, layout: ConvertLayout, ) -> Option<Self>

JIT the module, allocate the widthxheight surface of layout, and register it with the session. None where any step refuses: the session then encodes the packed RGB itself, which sites chroma at the left of each block but converts with the matrix the session declares all the same.

Source

fn input(&self) -> (NV_ENC_INPUT_PTR, NV_ENC_BUFFER_FORMAT)

The registered surface and its format, as NVENC is handed them.

Source

unsafe fn run( &self, cuda: &CudaFunctions, src: CUdeviceptr, src_pitch: usize, width: u32, height: u32, swap_rb: bool, ) -> Result<(), String>

Convert the widthxheight packed surface at src/src_pitch into the surface, on the default stream so it is ordered behind the upload and ahead of the encode. swap_rb marks an RGBA byte order rather than BGRA.

Source

unsafe fn run_texture( &self, cuda: &CudaFunctions, tex: CUtexObject, width: u32, height: u32, swap_rb: bool, ) -> Result<(), String>

The same convert reading an array-typed import through tex, which leaves its RGB where the compositor put it instead of copying it into linear memory first.

Source

unsafe fn launch( &self, cuda: &CudaFunctions, kernel: *mut c_void, params: &mut [*mut c_void], width: u32, height: u32, ) -> Result<(), String>

One chroma sample per thread, on the default stream so the convert is ordered behind whatever produced the source and ahead of the encode.

Source

unsafe fn texture_for(cuda: &CudaFunctions, array: CUarray) -> CUtexObject

A point-sampled, byte-valued texture over an array-typed import, or zero where the driver refuses one — the frame then stays on NVENC’s own conversion.

Source

unsafe fn release( &self, cuda: &CudaFunctions, funcs: &NV_ENCODE_API_FUNCTION_LIST, session: *mut c_void, )

Inner handle before outer, as the rest of the teardown does.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more