Class D3D12RemapBlock
- Assembly
- VisioForge.Core.dll
Direct3D 12 block that remaps the video on the GPU through a UV map: every output point shows the input point the map gives for it, which covers lens calibration, warping and any other geometric transformation. The map (VisioForge.Core.Types.X.VideoEffects.D3D12RemapSettings.Map) can be replaced while the pipeline runs: change VisioForge.Core.MediaBlocks.VideoProcessing.D3D12RemapBlock.Settings and call VisioForge.Core.MediaBlocks.VideoProcessing.D3D12RemapBlock.Update. The block uploads the map to the GPU the frames are on and owns the GPU copy; the application never handles a Direct3D resource. The output has the input's size, format and frame rate; add a resize block after it for another size. The block moves frames to and from the GPU itself: its input and its output each take system, D3D11 or D3D12 memory, whichever the neighbouring block uses, and D3D12 memory passes through without a copy on both sides. Requires a Direct3D 12 capable GPU. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals.
public class D3D12RemapBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
D3D12RemapBlock(D3D12RemapSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.D3D12RemapBlock class.
public D3D12RemapBlock(D3D12RemapSettings settings)Parameters
settingsD3D12RemapSettings-
The remap settings.
Exceptions
- ArgumentNullException
-
settingsisnull.
Properties
Input
Gets the input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets the remap settings. They are applied when the block is built, and the map again by VisioForge.Core.MediaBlocks.VideoProcessing.D3D12RemapBlock.Update.
public D3D12RemapSettings Settings { get; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the block.
public override bool Build()Returns
- bool
-
trueif successful,falseotherwise.
CleanUp()
Releases the GStreamer elements and resets the build state.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper of the upload, remap and download elements.
GetElement()
Gets the underlying GStreamer d3d12remap element.
The block sets its uv-remap property whenever the map or the frames' GPU changes, replacing a value set directly.
public Element GetElement()Returns
- Element
-
The d3d12remap element, or
nullbefore the block is built.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project. It does not check for a Direct3D 12 GPU: a missing device is reported as a pipeline error on start.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
Update()
Applies the current VisioForge.Core.Types.X.VideoEffects.D3D12RemapSettings.Map to the running block. The map is uploaded to the GPU with the next frame, which shows it and waits for the upload; a failed upload is reported as a pipeline error and the previous map stays in use (the video passes through unchanged if there is none, or it was made for another GPU) until the next call, which tries again, or until the frames move to another GPU. VisioForge.Core.Types.X.VideoEffects.D3D12RemapSettings.AdapterIndex is not changed after the block is built. Before the block is built there is nothing to do: the build takes the settings.
public void Update()IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this block with a pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.