Coverage Report

Created: 2025-12-31 07:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/aom/aom_dsp/recenter.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2018, Alliance for Open Media. All rights reserved
3
 *
4
 * This source code is subject to the terms of the BSD 2 Clause License and
5
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
 * was not distributed with this source code in the LICENSE file, you can
7
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
 * Media Patent License 1.0 was not distributed with this source code in the
9
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
 */
11
12
#ifndef AOM_AOM_DSP_RECENTER_H_
13
#define AOM_AOM_DSP_RECENTER_H_
14
15
#include "config/aom_config.h"
16
17
#include "aom/aom_integer.h"
18
19
// Inverse recenters a non-negative literal v around a reference r
20
569k
static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) {
21
569k
  if (v > (r << 1))
22
81.9k
    return v;
23
487k
  else if ((v & 1) == 0)
24
260k
    return (v >> 1) + r;
25
226k
  else
26
226k
    return r - ((v + 1) >> 1);
27
569k
}
bitreader_buffer.c:inv_recenter_nonneg
Line
Count
Source
20
139k
static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) {
21
139k
  if (v > (r << 1))
22
1.63k
    return v;
23
137k
  else if ((v & 1) == 0)
24
79.5k
    return (v >> 1) + r;
25
58.4k
  else
26
58.4k
    return r - ((v + 1) >> 1);
27
139k
}
Unexecuted instantiation: bitwriter_buffer.c:inv_recenter_nonneg
binary_codes_reader.c:inv_recenter_nonneg
Line
Count
Source
20
429k
static INLINE uint16_t inv_recenter_nonneg(uint16_t r, uint16_t v) {
21
429k
  if (v > (r << 1))
22
80.3k
    return v;
23
349k
  else if ((v & 1) == 0)
24
181k
    return (v >> 1) + r;
25
168k
  else
26
168k
    return r - ((v + 1) >> 1);
27
429k
}
Unexecuted instantiation: binary_codes_writer.c:inv_recenter_nonneg
28
29
// Inverse recenters a non-negative literal v in [0, n-1] around a
30
// reference r also in [0, n-1]
31
static INLINE uint16_t inv_recenter_finite_nonneg(uint16_t n, uint16_t r,
32
569k
                                                  uint16_t v) {
33
569k
  if ((r << 1) <= n) {
34
369k
    return inv_recenter_nonneg(r, v);
35
369k
  } else {
36
199k
    return n - 1 - inv_recenter_nonneg(n - 1 - r, v);
37
199k
  }
38
569k
}
bitreader_buffer.c:inv_recenter_finite_nonneg
Line
Count
Source
32
139k
                                                  uint16_t v) {
33
139k
  if ((r << 1) <= n) {
34
129k
    return inv_recenter_nonneg(r, v);
35
129k
  } else {
36
10.2k
    return n - 1 - inv_recenter_nonneg(n - 1 - r, v);
37
10.2k
  }
38
139k
}
Unexecuted instantiation: bitwriter_buffer.c:inv_recenter_finite_nonneg
binary_codes_reader.c:inv_recenter_finite_nonneg
Line
Count
Source
32
429k
                                                  uint16_t v) {
33
429k
  if ((r << 1) <= n) {
34
240k
    return inv_recenter_nonneg(r, v);
35
240k
  } else {
36
189k
    return n - 1 - inv_recenter_nonneg(n - 1 - r, v);
37
189k
  }
38
429k
}
Unexecuted instantiation: binary_codes_writer.c:inv_recenter_finite_nonneg
39
40
// Recenters a non-negative literal v around a reference r
41
0
static INLINE uint16_t recenter_nonneg(uint16_t r, uint16_t v) {
42
0
  if (v > (r << 1))
43
0
    return v;
44
0
  else if (v >= r)
45
0
    return ((v - r) << 1);
46
0
  else
47
0
    return ((r - v) << 1) - 1;
48
0
}
Unexecuted instantiation: bitreader_buffer.c:recenter_nonneg
Unexecuted instantiation: bitwriter_buffer.c:recenter_nonneg
Unexecuted instantiation: binary_codes_reader.c:recenter_nonneg
Unexecuted instantiation: binary_codes_writer.c:recenter_nonneg
49
50
// Recenters a non-negative literal v in [0, n-1] around a
51
// reference r also in [0, n-1]
52
static INLINE uint16_t recenter_finite_nonneg(uint16_t n, uint16_t r,
53
0
                                              uint16_t v) {
54
0
  if ((r << 1) <= n) {
55
0
    return recenter_nonneg(r, v);
56
0
  } else {
57
0
    return recenter_nonneg(n - 1 - r, n - 1 - v);
58
0
  }
59
0
}
Unexecuted instantiation: bitreader_buffer.c:recenter_finite_nonneg
Unexecuted instantiation: bitwriter_buffer.c:recenter_finite_nonneg
Unexecuted instantiation: binary_codes_reader.c:recenter_finite_nonneg
Unexecuted instantiation: binary_codes_writer.c:recenter_finite_nonneg
60
61
#endif  // AOM_AOM_DSP_RECENTER_H_