Coverage Report

Created: 2026-01-20 07:37

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
38.9k
                                                 void *fun_ctxt) {
24
38.9k
  if (!xd->up_available) return;
25
26
21.1k
  const int num_planes = av1_num_planes(cm);
27
21.1k
  int nb_count = 0;
28
21.1k
  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
21.1k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
21.1k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
21.1k
  uint8_t mi_step;
34
44.4k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
23.2k
       above_mi_col += mi_step) {
36
23.2k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
23.2k
    mi_step =
38
23.2k
        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
23.2k
    if (mi_step == 1) {
45
759
      above_mi_col &= ~1;
46
759
      above_mi = prev_row_mi + above_mi_col + 1;
47
759
      mi_step = 2;
48
759
    }
49
23.2k
    if (is_neighbor_overlappable(*above_mi)) {
50
22.6k
      ++nb_count;
51
22.6k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
22.6k
          *above_mi, fun_ctxt, num_planes);
53
22.6k
    }
54
23.2k
  }
55
21.1k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
3.20k
                                                 void *fun_ctxt) {
24
3.20k
  if (!xd->up_available) return;
25
26
3.20k
  const int num_planes = av1_num_planes(cm);
27
3.20k
  int nb_count = 0;
28
3.20k
  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
3.20k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
3.20k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
3.20k
  uint8_t mi_step;
34
6.81k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
3.61k
       above_mi_col += mi_step) {
36
3.61k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
3.61k
    mi_step =
38
3.61k
        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.61k
    if (mi_step == 1) {
45
182
      above_mi_col &= ~1;
46
182
      above_mi = prev_row_mi + above_mi_col + 1;
47
182
      mi_step = 2;
48
182
    }
49
3.61k
    if (is_neighbor_overlappable(*above_mi)) {
50
3.57k
      ++nb_count;
51
3.57k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
3.57k
          *above_mi, fun_ctxt, num_planes);
53
3.57k
    }
54
3.61k
  }
55
3.20k
}
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
35.7k
                                                 void *fun_ctxt) {
24
35.7k
  if (!xd->up_available) return;
25
26
17.9k
  const int num_planes = av1_num_planes(cm);
27
17.9k
  int nb_count = 0;
28
17.9k
  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
17.9k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
17.9k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
17.9k
  uint8_t mi_step;
34
37.6k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
19.6k
       above_mi_col += mi_step) {
36
19.6k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
19.6k
    mi_step =
38
19.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
19.6k
    if (mi_step == 1) {
45
577
      above_mi_col &= ~1;
46
577
      above_mi = prev_row_mi + above_mi_col + 1;
47
577
      mi_step = 2;
48
577
    }
49
19.6k
    if (is_neighbor_overlappable(*above_mi)) {
50
19.1k
      ++nb_count;
51
19.1k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
19.1k
          *above_mi, fun_ctxt, num_planes);
53
19.1k
    }
54
19.6k
  }
55
17.9k
}
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
24.3k
                                                void *fun_ctxt) {
61
24.3k
  if (!xd->left_available) return;
62
63
12.3k
  const int num_planes = av1_num_planes(cm);
64
12.3k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
12.3k
  const int mi_row = xd->mi_row;
68
12.3k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
12.3k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
12.3k
  uint8_t mi_step;
71
25.0k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
12.7k
       left_mi_row += mi_step) {
73
12.7k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
12.7k
    mi_step =
75
12.7k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
12.7k
    if (mi_step == 1) {
77
796
      left_mi_row &= ~1;
78
796
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
796
      mi_step = 2;
80
796
    }
81
12.7k
    if (is_neighbor_overlappable(*left_mi)) {
82
12.1k
      ++nb_count;
83
12.1k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
12.1k
          fun_ctxt, num_planes);
85
12.1k
    }
86
12.7k
  }
87
12.3k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
3.00k
                                                void *fun_ctxt) {
61
3.00k
  if (!xd->left_available) return;
62
63
3.00k
  const int num_planes = av1_num_planes(cm);
64
3.00k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
3.00k
  const int mi_row = xd->mi_row;
68
3.00k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
3.00k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
3.00k
  uint8_t mi_step;
71
6.02k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
3.01k
       left_mi_row += mi_step) {
73
3.01k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
3.01k
    mi_step =
75
3.01k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
3.01k
    if (mi_step == 1) {
77
258
      left_mi_row &= ~1;
78
258
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
258
      mi_step = 2;
80
258
    }
81
3.01k
    if (is_neighbor_overlappable(*left_mi)) {
82
2.79k
      ++nb_count;
83
2.79k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
2.79k
          fun_ctxt, num_planes);
85
2.79k
    }
86
3.01k
  }
87
3.00k
}
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
21.3k
                                                void *fun_ctxt) {
61
21.3k
  if (!xd->left_available) return;
62
63
9.33k
  const int num_planes = av1_num_planes(cm);
64
9.33k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
9.33k
  const int mi_row = xd->mi_row;
68
9.33k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
9.33k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
9.33k
  uint8_t mi_step;
71
19.0k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
9.69k
       left_mi_row += mi_step) {
73
9.69k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
9.69k
    mi_step =
75
9.69k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
9.69k
    if (mi_step == 1) {
77
538
      left_mi_row &= ~1;
78
538
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
538
      mi_step = 2;
80
538
    }
81
9.69k
    if (is_neighbor_overlappable(*left_mi)) {
82
9.40k
      ++nb_count;
83
9.40k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
9.40k
          fun_ctxt, num_planes);
85
9.40k
    }
86
9.69k
  }
87
9.33k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_