Coverage Report

Created: 2026-10-14 06:45

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
48.7k
                                                 void *fun_ctxt) {
24
48.7k
  if (!xd->up_available) return;
25
26
21.4k
  const int num_planes = av1_num_planes(cm);
27
21.4k
  int nb_count = 0;
28
21.4k
  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.4k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
21.4k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
21.4k
  uint8_t mi_step;
34
44.9k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
23.5k
       above_mi_col += mi_step) {
36
23.5k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
23.5k
    mi_step =
38
23.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
23.5k
    if (mi_step == 1) {
45
1.83k
      above_mi_col &= ~1;
46
1.83k
      above_mi = prev_row_mi + above_mi_col + 1;
47
1.83k
      mi_step = 2;
48
1.83k
    }
49
23.5k
    if (is_neighbor_overlappable(*above_mi)) {
50
22.2k
      ++nb_count;
51
22.2k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
22.2k
          *above_mi, fun_ctxt, num_planes);
53
22.2k
    }
54
23.5k
  }
55
21.4k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
1.55k
                                                 void *fun_ctxt) {
24
1.55k
  if (!xd->up_available) return;
25
26
1.55k
  const int num_planes = av1_num_planes(cm);
27
1.55k
  int nb_count = 0;
28
1.55k
  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
1.55k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
1.55k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
1.55k
  uint8_t mi_step;
34
3.23k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
1.68k
       above_mi_col += mi_step) {
36
1.68k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
1.68k
    mi_step =
38
1.68k
        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
1.68k
    if (mi_step == 1) {
45
240
      above_mi_col &= ~1;
46
240
      above_mi = prev_row_mi + above_mi_col + 1;
47
240
      mi_step = 2;
48
240
    }
49
1.68k
    if (is_neighbor_overlappable(*above_mi)) {
50
1.57k
      ++nb_count;
51
1.57k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
1.57k
          *above_mi, fun_ctxt, num_planes);
53
1.57k
    }
54
1.68k
  }
55
1.55k
}
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
47.1k
                                                 void *fun_ctxt) {
24
47.1k
  if (!xd->up_available) return;
25
26
19.8k
  const int num_planes = av1_num_planes(cm);
27
19.8k
  int nb_count = 0;
28
19.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
19.8k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
19.8k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
19.8k
  uint8_t mi_step;
34
41.7k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
21.8k
       above_mi_col += mi_step) {
36
21.8k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
21.8k
    mi_step =
38
21.8k
        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
21.8k
    if (mi_step == 1) {
45
1.59k
      above_mi_col &= ~1;
46
1.59k
      above_mi = prev_row_mi + above_mi_col + 1;
47
1.59k
      mi_step = 2;
48
1.59k
    }
49
21.8k
    if (is_neighbor_overlappable(*above_mi)) {
50
20.6k
      ++nb_count;
51
20.6k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
20.6k
          *above_mi, fun_ctxt, num_planes);
53
20.6k
    }
54
21.8k
  }
55
19.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
32.6k
                                                void *fun_ctxt) {
61
32.6k
  if (!xd->left_available) return;
62
63
19.8k
  const int num_planes = av1_num_planes(cm);
64
19.8k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
19.8k
  const int mi_row = xd->mi_row;
68
19.8k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
19.8k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
19.8k
  uint8_t mi_step;
71
40.5k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
20.6k
       left_mi_row += mi_step) {
73
20.6k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
20.6k
    mi_step =
75
20.6k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
20.6k
    if (mi_step == 1) {
77
2.80k
      left_mi_row &= ~1;
78
2.80k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
2.80k
      mi_step = 2;
80
2.80k
    }
81
20.6k
    if (is_neighbor_overlappable(*left_mi)) {
82
19.9k
      ++nb_count;
83
19.9k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
19.9k
          fun_ctxt, num_planes);
85
19.9k
    }
86
20.6k
  }
87
19.8k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
2.90k
                                                void *fun_ctxt) {
61
2.90k
  if (!xd->left_available) return;
62
63
2.90k
  const int num_planes = av1_num_planes(cm);
64
2.90k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
2.90k
  const int mi_row = xd->mi_row;
68
2.90k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
2.90k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
2.90k
  uint8_t mi_step;
71
5.80k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
2.90k
       left_mi_row += mi_step) {
73
2.90k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
2.90k
    mi_step =
75
2.90k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
2.90k
    if (mi_step == 1) {
77
388
      left_mi_row &= ~1;
78
388
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
388
      mi_step = 2;
80
388
    }
81
2.90k
    if (is_neighbor_overlappable(*left_mi)) {
82
2.69k
      ++nb_count;
83
2.69k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
2.69k
          fun_ctxt, num_planes);
85
2.69k
    }
86
2.90k
  }
87
2.90k
}
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
29.7k
                                                void *fun_ctxt) {
61
29.7k
  if (!xd->left_available) return;
62
63
16.9k
  const int num_planes = av1_num_planes(cm);
64
16.9k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
16.9k
  const int mi_row = xd->mi_row;
68
16.9k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
16.9k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
16.9k
  uint8_t mi_step;
71
34.7k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
17.7k
       left_mi_row += mi_step) {
73
17.7k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
17.7k
    mi_step =
75
17.7k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
17.7k
    if (mi_step == 1) {
77
2.42k
      left_mi_row &= ~1;
78
2.42k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
2.42k
      mi_step = 2;
80
2.42k
    }
81
17.7k
    if (is_neighbor_overlappable(*left_mi)) {
82
17.2k
      ++nb_count;
83
17.2k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
17.2k
          fun_ctxt, num_planes);
85
17.2k
    }
86
17.7k
  }
87
16.9k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_