Coverage Report

Created: 2026-02-14 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/aom/av1/common/obmc.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2017, 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_AV1_COMMON_OBMC_H_
13
#define AOM_AV1_COMMON_OBMC_H_
14
15
typedef void (*overlappable_nb_visitor_t)(MACROBLOCKD *xd, int rel_mi_row,
16
                                          int rel_mi_col, uint8_t op_mi_size,
17
                                          int dir, MB_MODE_INFO *nb_mi,
18
                                          void *fun_ctxt, const int num_planes);
19
20
static inline void foreach_overlappable_nb_above(const AV1_COMMON *cm,
21
                                                 MACROBLOCKD *xd, int nb_max,
22
                                                 overlappable_nb_visitor_t fun,
23
25.8k
                                                 void *fun_ctxt) {
24
25.8k
  if (!xd->up_available) return;
25
26
8.27k
  const int num_planes = av1_num_planes(cm);
27
8.27k
  int nb_count = 0;
28
8.27k
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
8.27k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
8.27k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
8.27k
  uint8_t mi_step;
34
17.3k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
9.10k
       above_mi_col += mi_step) {
36
9.10k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
9.10k
    mi_step =
38
9.10k
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
9.10k
    if (mi_step == 1) {
45
325
      above_mi_col &= ~1;
46
325
      above_mi = prev_row_mi + above_mi_col + 1;
47
325
      mi_step = 2;
48
325
    }
49
9.10k
    if (is_neighbor_overlappable(*above_mi)) {
50
8.90k
      ++nb_count;
51
8.90k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
8.90k
          *above_mi, fun_ctxt, num_planes);
53
8.90k
    }
54
9.10k
  }
55
8.27k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
729
                                                 void *fun_ctxt) {
24
729
  if (!xd->up_available) return;
25
26
729
  const int num_planes = av1_num_planes(cm);
27
729
  int nb_count = 0;
28
729
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
729
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
729
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
729
  uint8_t mi_step;
34
1.54k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
818
       above_mi_col += mi_step) {
36
818
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
818
    mi_step =
38
818
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
818
    if (mi_step == 1) {
45
47
      above_mi_col &= ~1;
46
47
      above_mi = prev_row_mi + above_mi_col + 1;
47
47
      mi_step = 2;
48
47
    }
49
818
    if (is_neighbor_overlappable(*above_mi)) {
50
811
      ++nb_count;
51
811
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
811
          *above_mi, fun_ctxt, num_planes);
53
811
    }
54
818
  }
55
729
}
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_above
Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_above
reconinter.c:foreach_overlappable_nb_above
Line
Count
Source
23
25.1k
                                                 void *fun_ctxt) {
24
25.1k
  if (!xd->up_available) return;
25
26
7.54k
  const int num_planes = av1_num_planes(cm);
27
7.54k
  int nb_count = 0;
28
7.54k
  const int mi_col = xd->mi_col;
29
  // prev_row_mi points into the mi array, starting at the beginning of the
30
  // previous row.
31
7.54k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
7.54k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
7.54k
  uint8_t mi_step;
34
15.8k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
8.28k
       above_mi_col += mi_step) {
36
8.28k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
8.28k
    mi_step =
38
8.28k
        AOMMIN(mi_size_wide[above_mi[0]->bsize], mi_size_wide[BLOCK_64X64]);
39
    // If we're considering a block with width 4, it should be treated as
40
    // half of a pair of blocks with chroma information in the second. Move
41
    // above_mi_col back to the start of the pair if needed, set above_mbmi
42
    // to point at the block with chroma information, and set mi_step to 2 to
43
    // step over the entire pair at the end of the iteration.
44
8.28k
    if (mi_step == 1) {
45
278
      above_mi_col &= ~1;
46
278
      above_mi = prev_row_mi + above_mi_col + 1;
47
278
      mi_step = 2;
48
278
    }
49
8.28k
    if (is_neighbor_overlappable(*above_mi)) {
50
8.09k
      ++nb_count;
51
8.09k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
8.09k
          *above_mi, fun_ctxt, num_planes);
53
8.09k
    }
54
8.28k
  }
55
7.54k
}
56
57
static inline void foreach_overlappable_nb_left(const AV1_COMMON *cm,
58
                                                MACROBLOCKD *xd, int nb_max,
59
                                                overlappable_nb_visitor_t fun,
60
20.1k
                                                void *fun_ctxt) {
61
20.1k
  if (!xd->left_available) return;
62
63
11.8k
  const int num_planes = av1_num_planes(cm);
64
11.8k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
11.8k
  const int mi_row = xd->mi_row;
68
11.8k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
11.8k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
11.8k
  uint8_t mi_step;
71
23.9k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
12.1k
       left_mi_row += mi_step) {
73
12.1k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
12.1k
    mi_step =
75
12.1k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
12.1k
    if (mi_step == 1) {
77
1.47k
      left_mi_row &= ~1;
78
1.47k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
1.47k
      mi_step = 2;
80
1.47k
    }
81
12.1k
    if (is_neighbor_overlappable(*left_mi)) {
82
11.9k
      ++nb_count;
83
11.9k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
11.9k
          fun_ctxt, num_planes);
85
11.9k
    }
86
12.1k
  }
87
11.8k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
1.66k
                                                void *fun_ctxt) {
61
1.66k
  if (!xd->left_available) return;
62
63
1.66k
  const int num_planes = av1_num_planes(cm);
64
1.66k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
1.66k
  const int mi_row = xd->mi_row;
68
1.66k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
1.66k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
1.66k
  uint8_t mi_step;
71
3.33k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
1.67k
       left_mi_row += mi_step) {
73
1.67k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
1.67k
    mi_step =
75
1.67k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
1.67k
    if (mi_step == 1) {
77
78
      left_mi_row &= ~1;
78
78
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
78
      mi_step = 2;
80
78
    }
81
1.67k
    if (is_neighbor_overlappable(*left_mi)) {
82
1.62k
      ++nb_count;
83
1.62k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
1.62k
          fun_ctxt, num_planes);
85
1.62k
    }
86
1.67k
  }
87
1.66k
}
Unexecuted instantiation: rdopt.c:foreach_overlappable_nb_left
Unexecuted instantiation: reconinter_enc.c:foreach_overlappable_nb_left
reconinter.c:foreach_overlappable_nb_left
Line
Count
Source
60
18.4k
                                                void *fun_ctxt) {
61
18.4k
  if (!xd->left_available) return;
62
63
10.1k
  const int num_planes = av1_num_planes(cm);
64
10.1k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
10.1k
  const int mi_row = xd->mi_row;
68
10.1k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
10.1k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
10.1k
  uint8_t mi_step;
71
20.5k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
10.4k
       left_mi_row += mi_step) {
73
10.4k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
10.4k
    mi_step =
75
10.4k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
10.4k
    if (mi_step == 1) {
77
1.39k
      left_mi_row &= ~1;
78
1.39k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
1.39k
      mi_step = 2;
80
1.39k
    }
81
10.4k
    if (is_neighbor_overlappable(*left_mi)) {
82
10.2k
      ++nb_count;
83
10.2k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
10.2k
          fun_ctxt, num_planes);
85
10.2k
    }
86
10.4k
  }
87
10.1k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_