/// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
 /// <param name="quantizer">The Wu quantizer.</param>
 /// <param name="maxColors">The maximum number of colors to hold in the color palette.</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(Configuration configuration, WuQuantizer quantizer, int maxColors)
     : base(configuration, quantizer, false)
 {
     this.memoryAllocator = this.Configuration.MemoryAllocator;
     this.moments         = this.memoryAllocator.Allocate <Moment>(TableLength, AllocationOptions.Clean);
     this.tag             = this.memoryAllocator.Allocate <byte>(TableLength, AllocationOptions.Clean);
     this.colors          = maxColors;
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
        /// </summary>
        /// <param name="memoryAllocator">The <see cref="MemoryAllocator"/>.</param>
        /// <param name="quantizer">The wu quantizer.</param>
        /// <param name="maxColors">The maximum number of colors to hold in the color palette.</param>
        /// <remarks>
        /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
        /// the second pass quantizes a color based on the position in the histogram.
        /// </remarks>
        public WuFrameQuantizer(MemoryAllocator memoryAllocator, WuQuantizer quantizer, int maxColors)
            : base(quantizer, false)
        {
            Guard.NotNull(memoryAllocator, nameof(memoryAllocator));

            this.vwt = memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmr = memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmg = memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmb = memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vma = memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.m2  = memoryAllocator.Allocate <double>(TableLength, AllocationOptions.Clean);
            this.tag = memoryAllocator.Allocate <byte>(TableLength, AllocationOptions.Clean);

            this.colors = maxColors;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
        /// </summary>
        /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
        /// <param name="quantizer">The Wu quantizer.</param>
        /// <param name="maxColors">The maximum number of colors to hold in the color palette.</param>
        /// <remarks>
        /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
        /// the second pass quantizes a color based on the position in the histogram.
        /// </remarks>
        public WuFrameQuantizer(Configuration configuration, WuQuantizer quantizer, int maxColors)
            : base(configuration, quantizer, false)
        {
            this.memoryAllocator = this.Configuration.MemoryAllocator;

            this.vwt = this.memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmr = this.memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmg = this.memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vmb = this.memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.vma = this.memoryAllocator.Allocate <long>(TableLength, AllocationOptions.Clean);
            this.m2  = this.memoryAllocator.Allocate <double>(TableLength, AllocationOptions.Clean);
            this.tag = this.memoryAllocator.Allocate <byte>(TableLength, AllocationOptions.Clean);

            this.colors = maxColors;
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="memoryAllocator">The <see cref="MemoryAllocator"/>.</param>
 /// <param name="quantizer">The wu quantizer</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(MemoryAllocator memoryAllocator, WuQuantizer quantizer)
     : this(memoryAllocator, quantizer, quantizer.MaxColors)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="quantizer">The wu quantizer</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(WuQuantizer quantizer)
     : base(quantizer, false)
 {
     this.colors = quantizer.MaxColors;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="quantizer">The wu quantizer.</param>
 /// <param name="maxColors">The maximum number of colors to hold in the color palette.</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(WuQuantizer quantizer, int maxColors)
     : base(quantizer, false) => this.colors = maxColors;
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="quantizer">The wu quantizer</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(WuQuantizer quantizer)
     : this(quantizer, quantizer.MaxColors)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WuFrameQuantizer{TPixel}"/> class.
 /// </summary>
 /// <param name="configuration">The configuration which allows altering default behaviour or extending the library.</param>
 /// <param name="quantizer">The Wu quantizer</param>
 /// <remarks>
 /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram,
 /// the second pass quantizes a color based on the position in the histogram.
 /// </remarks>
 public WuFrameQuantizer(Configuration configuration, WuQuantizer quantizer)
     : this(configuration, quantizer, quantizer.MaxColors)
 {
 }