Class GPUVideoEffectSharpen
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
GPU-accelerated sharpening effect that enhances edge definition and fine details in video using DirectX hardware acceleration.
public class GPUVideoEffectSharpen : GPUVideoEffect, IGPUVideoEffectSharpen, IGPUVideoEffectInheritance
Implements
Inherited Members
Remarks
Available in: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)
GPU-accelerated version using DirectX. Real-time processing with hardware acceleration for efficient sharpening of high-resolution video. Significantly faster than CPU-based processing, ideal for 4K and higher resolutions where CPU sharpening would introduce latency or dropped frames.
The sharpen effect emphasizes edges and fine details by detecting and enhancing areas of rapid intensity change in the image. The GPU implementation uses convolution kernels executed in parallel across all pixels via DirectX shaders, applying high-pass filtering or unsharp masking techniques that increase local contrast along edges. This parallel processing approach provides consistent real-time performance regardless of image complexity.
The GPU shader applies a standard sharpening kernel with optimized weights for edge detection and enhancement. The algorithm identifies high-frequency components (edges and details) and amplifies them while preserving low-frequency components (smooth gradients and flat areas). This is achieved through a single-pass shader that samples neighboring pixels, calculates edge strength, and applies proportional enhancement.
Common applications:
- Real-time enhancement of slightly out-of-focus footage during live production
- Improving perceived image quality in broadcast or streaming pipelines
- Compensating for softness introduced by compression in real-time encoding
- Creating crisp, detailed video output for high-resolution displays
- Instant preview of sharpening during video editing without render time
- Live video processing for surveillance or medical imaging applications
The effect has no adjustable intensity parameters - it applies a fixed-strength sharpening filter optimized for general use. Be aware that excessive or repeated sharpening can introduce visual artifacts such as halos around edges, ringing artifacts, or amplified noise. The GPU implementation maintains consistent strength across all pixel intensities and color channels, ensuring uniform enhancement throughout the frame.
Performance characteristics: GPU sharpening typically processes full HD (1920x1080) at over 60fps and 4K (3840x2160) at 30fps or higher on modern graphics cards, with negligible impact on overall system performance. This makes it suitable for real-time applications, live streaming, and interactive editing where immediate visual feedback is essential.
See VisioForge.Core.Types.VideoEffects.VideoEffectSharpen for CPU-based alternative. The CPU version is compatible with systems without dedicated GPU or when DirectX is unavailable, but processes frames sequentially with lower throughput. Choose GPU version for real-time processing and high-resolution video; choose CPU version for maximum compatibility or when running on systems with limited GPU resources.
Constructors
GPUVideoEffectSharpen(bool, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectSharpen class with GPU-accelerated sharpening.
public GPUVideoEffectSharpen(bool enabled, string name = "Sharpen", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the GPU effect immediately;falseto create the effect in a disabled state. The effect can be toggled on/off at any time without GPU resource reallocation overhead. namestring-
An optional name identifier for this effect instance. Default is "Sharpen". Used to retrieve and control specific effect instances from the GPU effects collection. Multiple sharpening effects cannot be stacked meaningfully; use a single instance.
startTimeTimeSpan-
The time at which the effect should start being applied. Default is zero (from beginning). Useful for applying sharpening only to specific segments where softness is problematic.
stopTimeTimeSpan-
The time at which the effect should stop being applied. Default is zero (until end). Combined with
startTime, allows time-limited sharpening application.
Remarks
The GPU-accelerated implementation processes sharpening entirely on the GPU using DirectX compute shaders, ensuring real-time performance with minimal CPU usage. The sharpening kernel is applied in a single pass using texture sampling and parallel execution across all pixels simultaneously.
Requires DirectX-compatible GPU with shader model 3.0 or higher. Automatically falls back to CPU processing if GPU is unavailable, though performance will be significantly reduced. Verify GPU availability in performance-critical scenarios.
Note: Sharpening is most effective on slightly soft footage. Applying it to already-sharp video provides minimal improvement and may amplify noise. It works best after slight defocus or as compensation for codec softening, but should not be used to "fix" severely out-of-focus footage. Consider the source quality before applying this effect.
Methods
GetEffectType()
Gets the specific GPU effect type identifier for this sharpening effect.
public GPUVideoEffectType GetEffectType()Returns
- GPUVideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Sharpen to identify this as a GPU-accelerated sharpening effect.
Remarks
This method is used by the GPU video processing pipeline to route the effect to the appropriate DirectX shader processor for hardware-accelerated edge enhancement and detail sharpening.