public FlatSink(long maxValue)
 {
     clamp = new SegmentClamping()
     {
         MinValue = 0,
         MaxValue = maxValue, //400 megapixels
         Segments = new [] {
             new SegmentPrecision {
                 Above = 0, Loss = 1
             }
         }
     };
     clamp.Validate();
 }
Beispiel #2
0
 public PixelCountSink()
 {
     clamp = new SegmentClamping()
     {
         MinValue = 0,
         MaxValue = 1000000 * 400, //400 megapixels
         Segments = new [] {
             new SegmentPrecision {
                 Above = 0, Loss = 100000
             },                                                 // 0.1mp up to 8mp (80)
             new SegmentPrecision {
                 Above = 8000000, Loss = 500000
             },                                                       // 0.5mp up to 40mp (64)
             new SegmentPrecision {
                 Above = 40000000, Loss = 5000000
             }                                                         //5mp (~100)
         }
     };
     clamp.Sort();
     clamp.Validate();
 }
Beispiel #3
0
 public ResolutionsSink()
 {
     clamp = new SegmentClamping()
     {
         MinValue = 0,
         MaxValue = 16000,
         Segments = new SegmentPrecision[]
         {
             new SegmentPrecision {
                 Above = 0, Loss = 8
             },
             new SegmentPrecision {
                 Above = 600, Loss = 16
             },
             new SegmentPrecision {
                 Above = 3200, Loss = 100
             }
         }
     };
     clamp.Sort();
     clamp.Validate();
 }
        public long[] GetPercentiles(IEnumerable <float> percentiles, SegmentClamping clamp)
        {
            var set = GetAllValues(clamp);

            return(percentiles.Select(p => set.GetPercentile(p)).ToArray());
        }
 public long GetPercentile(float percentile, SegmentClamping clamp)
 {
     return(GetAllValues(clamp).GetPercentile(percentile));
 }
 /// <summary>
 /// Gets a sorted list of all values that have been recorded
 /// (and, of course, some that haven't, due to hash collisions)
 /// values recorded multiple times will appear multiple times;
 /// </summary>
 /// <param name="clamp"></param>
 /// <returns></returns>
 public long[] GetAllValues(SegmentClamping clamp)
 {
     return(clamp.PossibleValues()
            .SelectMany(v => Enumerable.Repeat(v, (int)Estimate((uint)v)))
            .OrderBy(n => n).ToArray());
 }