DirectShow Animated Header -- Transform Filters DirectShow Animated Header -- Transform Filters* Microsoft DirectShow SDK
*Index  *Topic Contents
*Previous Topic: Source Filters
*Next Topic: Inftee Sample (Infinite-Pin Tee Filter)

Transform Filters


This article details sample transform filters (sometimes called effects). The sample transform filters include an audio effect, some video effects, some MPEG codecs, a VCR controller, and various "null" (pass-through) filters.

Contents of this article:

Contrast Sample (Video Contrast Filter)

The video contrast sample filter, Contrast, illustrates how to define and implement a simple custom interface within the structure provided by the DirectShow™ base classes. This filter demonstrates how to use the CTransformFilter class to implement a simple effect filter.

The Contrast filter also provides a good example of the flexibility of the filter graph architecture. This flexibility is demonstrated when the filter is used in conjunction with a tee filter to produce "before and after" (side-by-side original and modified) video streams.

The Contrast filter is a simple transform filter that adjusts the contrast of the video stream that is passed through it. It provides a custom interface for adjusting the contrast. The Contrast filter also uses the CBasePropertyPage class to provide a property page for applications that do not provide a user interface.

Note The Contrast filter adjusts the contrast by using a trick with palettes. The color palette of an image effectively determines how the image is interpreted. By changing the palette, the filter can change the contrast without changing the image pixels themselves.

This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.

Sample Locations

EzRGB24 Sample (Image Effect Filter)

The RGB 24 image effect filter, EzRGB24, is a sample of an image processing filter. This shows usage of a number of DirectShow classes and interfaces, including CTransformFilter, CPersistStream, CBasePropertyPage, and ISpecifyPropertyPages.

This filter's purpose is to provide fast and single stream effects. The EzRGB24 filter also shows how to add image processing effects using DirectShow. You can use this filter as a component of an DirectShow video editor. Effects with fast execution were selected to help demonstrate the power of DirectShow in enabling real-time effects — the idea was to show something that could not have been built by using Microsoft Video for Windows®.

This filter performs a number of individual video effects. These include red, green, blue, darken, XOR, blur, gray, and emboss image-processing effects.

This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.

Sample Locations

Gargle Sample (Gargle Filter)

The audio processing filter, Gargle, illustrates how to create a simple sound effect. More sophisticated effects such as echo, flanging, band-pass filtering, and other effects can be created in a way similar to that demonstrated by the Gargle filter. This sample demonstrates the CTransInPlaceFilter, CPersistStream, and CBasePropertyPage classes. It also shows use of the ASSERT, DbgBreak, DbgLog, and DbgBreakPoint debug macros.

The Gargle filter modulates the waveform passing through it by multiplying the waveform by another waveform that is mathematically generated within the filter. The modulating waveform is, by default, a triangular wave. The property sheet also offers the alternative of a square wave. You can set the frequency of the modulating wave through the filter's property sheet. At low frequencies (near 1 Hz), the sound grows and diminishes. At medium frequencies (5 to 15 Hz), the sound has a tremolo quality, which is why it is referred to as gargling. At higher frequencies (100 Hz and up), the filter generates extra frequencies in the original sound. If a 500 hertz (Hz) sound is played at 100 Hz, then it produces additional frequencies of 400 Hz, 600 Hz, 200 Hz, 800 Hz, and so on.

This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.

Sample Locations

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page