Coverage Report

Created: 2024-09-06 07:53

/src/libvpx/vpx_dsp/prob.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#include "./prob.h"
12
13
const uint8_t vpx_norm[256] = {
14
  0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
15
  3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
16
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
17
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
18
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
19
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
24
};
25
26
static unsigned int tree_merge_probs_impl(unsigned int i,
27
                                          const vpx_tree_index *tree,
28
                                          const vpx_prob *pre_probs,
29
                                          const unsigned int *counts,
30
0
                                          vpx_prob *probs) {
31
0
  const int l = tree[i];
32
0
  const unsigned int left_count =
33
0
      (l <= 0) ? counts[-l]
34
0
               : tree_merge_probs_impl(l, tree, pre_probs, counts, probs);
35
0
  const int r = tree[i + 1];
36
0
  const unsigned int right_count =
37
0
      (r <= 0) ? counts[-r]
38
0
               : tree_merge_probs_impl(r, tree, pre_probs, counts, probs);
39
0
  const unsigned int ct[2] = { left_count, right_count };
40
0
  probs[i >> 1] = mode_mv_merge_probs(pre_probs[i >> 1], ct);
41
0
  return left_count + right_count;
42
0
}
43
44
void vpx_tree_merge_probs(const vpx_tree_index *tree, const vpx_prob *pre_probs,
45
0
                          const unsigned int *counts, vpx_prob *probs) {
46
0
  tree_merge_probs_impl(0, tree, pre_probs, counts, probs);
47
0
}