예제 #1
0
 public FlatSink(long maxValue)
 {
     clamp = new SegmentClamping()
     {
         MinValue = 0,
         MaxValue = maxValue, //400 megapixels
         Segments = new [] {
             new SegmentPrecision {
                 Above = 0, Loss = 1
             }
         }
     };
     clamp.Validate();
 }
예제 #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();
 }
예제 #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();
 }
예제 #4
0
        public long[] GetPercentiles(IEnumerable <float> percentiles, SegmentClamping clamp)
        {
            var set = GetAllValues(clamp);

            return(percentiles.Select(p => set.GetPercentile(p)).ToArray());
        }
예제 #5
0
 public long GetPercentile(float percentile, SegmentClamping clamp)
 {
     return(GetAllValues(clamp).GetPercentile(percentile));
 }
예제 #6
0
 /// <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());
 }