DScaler Deinterlace plugin usage

DScaler Deinterlace filter (1.2) is one of most popular DirectShow filters for deinterlace. You can use this filter in our SDK and configure it.

1. We must define filter interface and used enumerations.

    /// <summary>
    /// DScaler deinterlace type.
    /// </summary>
    public enum DScalerDeinterlaceType
    {
        /// <summary>
        /// Weave.
        /// </summary>
        Weave = 1020,

        /// <summary>
        /// Bob.
        /// </summary>
        Bob = 1021,

        /// <summary>
        /// Two frame.
        /// </summary>
        TwoFrame = 1022,

        /// <summary>
        /// Blended clipping.
        /// </summary>
        BlendedClipping = 1023,

        /// <summary>
        /// Field bob.
        /// </summary>
        FieldBob = 1024,

        /// <summary>
        /// DScaler plugin.
        /// </summary>
        DScalerPlugin = 1025
    }

    /// <summary>
    /// DScaler Deinterlace filter 1.2 interface.
    /// </summary>
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("463D645C-48F7-11D4-8464-0008C782A257")]
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity]
    public interface IDeinterlace
    {
        /// <summary>
        /// Gets or sets deinterlace type.
        /// </summary>
        [DispId(1)]
        int DeinterlaceType
        {
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get;
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
        }

        /// <summary>
        /// Gets or sets a value indicating whether odd field will be first.
        /// </summary>
        [DispId(2)]
        bool IsOddFieldFirst
        {
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get;
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
        }

        /// <summary>
        /// Gets or sets DScaler plugin name.
        /// </summary>
        [DispId(3)]
        string DScalerPluginName
        {
            [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
            get; [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set;
        }
    }

2. Add OnFilterAdded event handler for SDK control. In our sample code we using Video Capture SDK .Net.

        private void VideoCapture1_OnFilterAdded(object sender, FilterEventArgs e)
        {
            if (e.Name.Contains("Deinterlace Filter"))
            {
                IDeinterlace deint = e.Filter as IDeinterlace;
                if (deint != null)
                {
                    deint.DeinterlaceType = (int)DScalerDeinterlaceType.Bob;
                    deint.IsOddFieldFirst = false;
                }
            }
        }

This event fired for each added filter. We're checking filter name and getting IDeinterlace filter interface. In our sample we changing deinterlace method to Bob.

Before Start method call you must add Deinterlace filter using the following code:

VideoCapture1.Video_Filters_Add(new VFCustomProcessingFilter("Deinterlace Filter"));

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel