Coverage Report

Created: 2025-12-03 07:28

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
34.6k
                                                 void *fun_ctxt) {
24
34.6k
  if (!xd->up_available) return;
25
26
18.6k
  const int num_planes = av1_num_planes(cm);
27
18.6k
  int nb_count = 0;
28
18.6k
  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
18.6k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
18.6k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
18.6k
  uint8_t mi_step;
34
39.2k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
20.6k
       above_mi_col += mi_step) {
36
20.6k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
20.6k
    mi_step =
38
20.6k
        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
20.6k
    if (mi_step == 1) {
45
548
      above_mi_col &= ~1;
46
548
      above_mi = prev_row_mi + above_mi_col + 1;
47
548
      mi_step = 2;
48
548
    }
49
20.6k
    if (is_neighbor_overlappable(*above_mi)) {
50
20.0k
      ++nb_count;
51
20.0k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
20.0k
          *above_mi, fun_ctxt, num_planes);
53
20.0k
    }
54
20.6k
  }
55
18.6k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
2.84k
                                                 void *fun_ctxt) {
24
2.84k
  if (!xd->up_available) return;
25
26
2.84k
  const int num_planes = av1_num_planes(cm);
27
2.84k
  int nb_count = 0;
28
2.84k
  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
2.84k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.84k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.84k
  uint8_t mi_step;
34
6.07k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
3.23k
       above_mi_col += mi_step) {
36
3.23k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
3.23k
    mi_step =
38
3.23k
        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
3.23k
    if (mi_step == 1) {
45
136
      above_mi_col &= ~1;
46
136
      above_mi = prev_row_mi + above_mi_col + 1;
47
136
      mi_step = 2;
48
136
    }
49
3.23k
    if (is_neighbor_overlappable(*above_mi)) {
50
3.19k
      ++nb_count;
51
3.19k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
3.19k
          *above_mi, fun_ctxt, num_planes);
53
3.19k
    }
54
3.23k
  }
55
2.84k
}
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
31.7k
                                                 void *fun_ctxt) {
24
31.7k
  if (!xd->up_available) return;
25
26
15.8k
  const int num_planes = av1_num_planes(cm);
27
15.8k
  int nb_count = 0;
28
15.8k
  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
15.8k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
15.8k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
15.8k
  uint8_t mi_step;
34
33.2k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
17.3k
       above_mi_col += mi_step) {
36
17.3k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
17.3k
    mi_step =
38
17.3k
        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
17.3k
    if (mi_step == 1) {
45
412
      above_mi_col &= ~1;
46
412
      above_mi = prev_row_mi + above_mi_col + 1;
47
412
      mi_step = 2;
48
412
    }
49
17.3k
    if (is_neighbor_overlappable(*above_mi)) {
50
16.8k
      ++nb_count;
51
16.8k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
16.8k
          *above_mi, fun_ctxt, num_planes);
53
16.8k
    }
54
17.3k
  }
55
15.8k
}
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
21.9k
                                                void *fun_ctxt) {
61
21.9k
  if (!xd->left_available) return;
62
63
11.6k
  const int num_planes = av1_num_planes(cm);
64
11.6k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
11.6k
  const int mi_row = xd->mi_row;
68
11.6k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
11.6k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
11.6k
  uint8_t mi_step;
71
23.6k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
12.0k
       left_mi_row += mi_step) {
73
12.0k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
12.0k
    mi_step =
75
12.0k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
12.0k
    if (mi_step == 1) {
77
707
      left_mi_row &= ~1;
78
707
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
707
      mi_step = 2;
80
707
    }
81
12.0k
    if (is_neighbor_overlappable(*left_mi)) {
82
11.4k
      ++nb_count;
83
11.4k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
11.4k
          fun_ctxt, num_planes);
85
11.4k
    }
86
12.0k
  }
87
11.6k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
2.78k
                                                void *fun_ctxt) {
61
2.78k
  if (!xd->left_available) return;
62
63
2.78k
  const int num_planes = av1_num_planes(cm);
64
2.78k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
2.78k
  const int mi_row = xd->mi_row;
68
2.78k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
2.78k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
2.78k
  uint8_t mi_step;
71
5.57k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
2.79k
       left_mi_row += mi_step) {
73
2.79k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
2.79k
    mi_step =
75
2.79k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
2.79k
    if (mi_step == 1) {
77
239
      left_mi_row &= ~1;
78
239
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
239
      mi_step = 2;
80
239
    }
81
2.79k
    if (is_neighbor_overlappable(*left_mi)) {
82
2.57k
      ++nb_count;
83
2.57k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
2.57k
          fun_ctxt, num_planes);
85
2.57k
    }
86
2.79k
  }
87
2.78k
}
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
19.2k
                                                void *fun_ctxt) {
61
19.2k
  if (!xd->left_available) return;
62
63
8.86k
  const int num_planes = av1_num_planes(cm);
64
8.86k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
8.86k
  const int mi_row = xd->mi_row;
68
8.86k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
8.86k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
8.86k
  uint8_t mi_step;
71
18.0k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
9.20k
       left_mi_row += mi_step) {
73
9.20k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
9.20k
    mi_step =
75
9.20k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
9.20k
    if (mi_step == 1) {
77
468
      left_mi_row &= ~1;
78
468
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
468
      mi_step = 2;
80
468
    }
81
9.20k
    if (is_neighbor_overlappable(*left_mi)) {
82
8.91k
      ++nb_count;
83
8.91k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
8.91k
          fun_ctxt, num_planes);
85
8.91k
    }
86
9.20k
  }
87
8.86k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_