Coverage Report

Created: 2025-11-16 07:22

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
31.4k
                                                 void *fun_ctxt) {
24
31.4k
  if (!xd->up_available) return;
25
26
16.7k
  const int num_planes = av1_num_planes(cm);
27
16.7k
  int nb_count = 0;
28
16.7k
  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
16.7k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
16.7k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
16.7k
  uint8_t mi_step;
34
35.3k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
18.5k
       above_mi_col += mi_step) {
36
18.5k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
18.5k
    mi_step =
38
18.5k
        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
18.5k
    if (mi_step == 1) {
45
477
      above_mi_col &= ~1;
46
477
      above_mi = prev_row_mi + above_mi_col + 1;
47
477
      mi_step = 2;
48
477
    }
49
18.5k
    if (is_neighbor_overlappable(*above_mi)) {
50
18.0k
      ++nb_count;
51
18.0k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
18.0k
          *above_mi, fun_ctxt, num_planes);
53
18.0k
    }
54
18.5k
  }
55
16.7k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
2.57k
                                                 void *fun_ctxt) {
24
2.57k
  if (!xd->up_available) return;
25
26
2.57k
  const int num_planes = av1_num_planes(cm);
27
2.57k
  int nb_count = 0;
28
2.57k
  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.57k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
2.57k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
2.57k
  uint8_t mi_step;
34
5.51k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
2.93k
       above_mi_col += mi_step) {
36
2.93k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
2.93k
    mi_step =
38
2.93k
        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
2.93k
    if (mi_step == 1) {
45
120
      above_mi_col &= ~1;
46
120
      above_mi = prev_row_mi + above_mi_col + 1;
47
120
      mi_step = 2;
48
120
    }
49
2.93k
    if (is_neighbor_overlappable(*above_mi)) {
50
2.89k
      ++nb_count;
51
2.89k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
2.89k
          *above_mi, fun_ctxt, num_planes);
53
2.89k
    }
54
2.93k
  }
55
2.57k
}
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
28.8k
                                                 void *fun_ctxt) {
24
28.8k
  if (!xd->up_available) return;
25
26
14.2k
  const int num_planes = av1_num_planes(cm);
27
14.2k
  int nb_count = 0;
28
14.2k
  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
14.2k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
14.2k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
14.2k
  uint8_t mi_step;
34
29.8k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
15.6k
       above_mi_col += mi_step) {
36
15.6k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
15.6k
    mi_step =
38
15.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
15.6k
    if (mi_step == 1) {
45
357
      above_mi_col &= ~1;
46
357
      above_mi = prev_row_mi + above_mi_col + 1;
47
357
      mi_step = 2;
48
357
    }
49
15.6k
    if (is_neighbor_overlappable(*above_mi)) {
50
15.1k
      ++nb_count;
51
15.1k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
15.1k
          *above_mi, fun_ctxt, num_planes);
53
15.1k
    }
54
15.6k
  }
55
14.2k
}
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.0k
                                                void *fun_ctxt) {
61
20.0k
  if (!xd->left_available) return;
62
63
10.4k
  const int num_planes = av1_num_planes(cm);
64
10.4k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
10.4k
  const int mi_row = xd->mi_row;
68
10.4k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
10.4k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
10.4k
  uint8_t mi_step;
71
21.1k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
10.7k
       left_mi_row += mi_step) {
73
10.7k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
10.7k
    mi_step =
75
10.7k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
10.7k
    if (mi_step == 1) {
77
620
      left_mi_row &= ~1;
78
620
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
620
      mi_step = 2;
80
620
    }
81
10.7k
    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.7k
  }
87
10.4k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
2.47k
                                                void *fun_ctxt) {
61
2.47k
  if (!xd->left_available) return;
62
63
2.47k
  const int num_planes = av1_num_planes(cm);
64
2.47k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
2.47k
  const int mi_row = xd->mi_row;
68
2.47k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
2.47k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
2.47k
  uint8_t mi_step;
71
4.95k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
2.48k
       left_mi_row += mi_step) {
73
2.48k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
2.48k
    mi_step =
75
2.48k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
2.48k
    if (mi_step == 1) {
77
209
      left_mi_row &= ~1;
78
209
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
209
      mi_step = 2;
80
209
    }
81
2.48k
    if (is_neighbor_overlappable(*left_mi)) {
82
2.27k
      ++nb_count;
83
2.27k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
2.27k
          fun_ctxt, num_planes);
85
2.27k
    }
86
2.48k
  }
87
2.47k
}
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
17.6k
                                                void *fun_ctxt) {
61
17.6k
  if (!xd->left_available) return;
62
63
7.94k
  const int num_planes = av1_num_planes(cm);
64
7.94k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
7.94k
  const int mi_row = xd->mi_row;
68
7.94k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
7.94k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
7.94k
  uint8_t mi_step;
71
16.1k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
8.25k
       left_mi_row += mi_step) {
73
8.25k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
8.25k
    mi_step =
75
8.25k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
8.25k
    if (mi_step == 1) {
77
411
      left_mi_row &= ~1;
78
411
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
411
      mi_step = 2;
80
411
    }
81
8.25k
    if (is_neighbor_overlappable(*left_mi)) {
82
7.98k
      ++nb_count;
83
7.98k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
7.98k
          fun_ctxt, num_planes);
85
7.98k
    }
86
8.25k
  }
87
7.94k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_