Home | History | Annotate | Download | only in libvpx

Lines Matching defs:hist

40   struct rate_hist *hist = malloc(sizeof(*hist));
45 hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000;
48 if (hist->samples == 0)
49 hist->samples = 1;
51 hist->frames = 0;
52 hist->total = 0;
54 hist->pts = calloc(hist->samples, sizeof(*hist->pts));
55 hist->sz = calloc(hist->samples, sizeof(*hist->sz));
57 hist->bucket[i].low = INT_MAX;
58 hist->bucket[i].high = 0;
59 hist->bucket[i].count = 0;
62 return hist;
65 void destroy_rate_histogram(struct rate_hist *hist) {
66 if (hist) {
67 free(hist->pts);
68 free(hist->sz);
69 free(hist);
73 void update_rate_histogram(struct rate_hist *hist,
84 int idx = hist->frames++ % hist->samples;
85 hist->pts[idx] = now;
86 hist->sz[idx] = (int)pkt->data.frame.sz;
94 for (i = hist->frames; i > 0 && hist->frames - i < hist->samples; i--) {
95 const int i_idx = (i - 1) % hist->samples;
97 then = hist->pts[i_idx];
100 sum_sz += hist->sz[i_idx];
112 if (hist->bucket[idx].low > avg_bitrate)
113 hist->bucket[idx].low = (int)avg_bitrate;
114 if (hist->bucket[idx].high < avg_bitrate)
115 hist->bucket[idx].high = (int)avg_bitrate;
116 hist->bucket[idx].count++;
117 hist->total++;
268 void show_rate_histogram(struct rate_hist *hist,
274 if (hist->bucket[i].low == INT_MAX)
276 hist->bucket[buckets++] = hist->bucket[i];
280 scale = merge_hist_buckets(hist->bucket, max_buckets, &buckets);
281 show_histogram(hist->bucket, buckets, hist->total, scale);