Coverage Report

Created: 2026-04-01 07:24

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.3k
                                                 void *fun_ctxt) {
24
31.3k
  if (!xd->up_available) return;
25
26
9.63k
  const int num_planes = av1_num_planes(cm);
27
9.63k
  int nb_count = 0;
28
9.63k
  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
9.63k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
9.63k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
9.63k
  uint8_t mi_step;
34
20.1k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
10.5k
       above_mi_col += mi_step) {
36
10.5k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
10.5k
    mi_step =
38
10.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
10.5k
    if (mi_step == 1) {
45
420
      above_mi_col &= ~1;
46
420
      above_mi = prev_row_mi + above_mi_col + 1;
47
420
      mi_step = 2;
48
420
    }
49
10.5k
    if (is_neighbor_overlappable(*above_mi)) {
50
10.2k
      ++nb_count;
51
10.2k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
10.2k
          *above_mi, fun_ctxt, num_planes);
53
10.2k
    }
54
10.5k
  }
55
9.63k
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
957
                                                 void *fun_ctxt) {
24
957
  if (!xd->up_available) return;
25
26
957
  const int num_planes = av1_num_planes(cm);
27
957
  int nb_count = 0;
28
957
  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
957
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
957
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
957
  uint8_t mi_step;
34
2.01k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
1.05k
       above_mi_col += mi_step) {
36
1.05k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
1.05k
    mi_step =
38
1.05k
        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.05k
    if (mi_step == 1) {
45
69
      above_mi_col &= ~1;
46
69
      above_mi = prev_row_mi + above_mi_col + 1;
47
69
      mi_step = 2;
48
69
    }
49
1.05k
    if (is_neighbor_overlappable(*above_mi)) {
50
1.04k
      ++nb_count;
51
1.04k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
1.04k
          *above_mi, fun_ctxt, num_planes);
53
1.04k
    }
54
1.05k
  }
55
957
}
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
30.4k
                                                 void *fun_ctxt) {
24
30.4k
  if (!xd->up_available) return;
25
26
8.68k
  const int num_planes = av1_num_planes(cm);
27
8.68k
  int nb_count = 0;
28
8.68k
  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.68k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
8.68k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
8.68k
  uint8_t mi_step;
34
18.1k
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
9.44k
       above_mi_col += mi_step) {
36
9.44k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
9.44k
    mi_step =
38
9.44k
        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.44k
    if (mi_step == 1) {
45
351
      above_mi_col &= ~1;
46
351
      above_mi = prev_row_mi + above_mi_col + 1;
47
351
      mi_step = 2;
48
351
    }
49
9.44k
    if (is_neighbor_overlappable(*above_mi)) {
50
9.18k
      ++nb_count;
51
9.18k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
9.18k
          *above_mi, fun_ctxt, num_planes);
53
9.18k
    }
54
9.44k
  }
55
8.68k
}
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.9k
                                                void *fun_ctxt) {
61
24.9k
  if (!xd->left_available) return;
62
63
14.6k
  const int num_planes = av1_num_planes(cm);
64
14.6k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
14.6k
  const int mi_row = xd->mi_row;
68
14.6k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
14.6k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
14.6k
  uint8_t mi_step;
71
29.5k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
14.9k
       left_mi_row += mi_step) {
73
14.9k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
14.9k
    mi_step =
75
14.9k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
14.9k
    if (mi_step == 1) {
77
2.00k
      left_mi_row &= ~1;
78
2.00k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
2.00k
      mi_step = 2;
80
2.00k
    }
81
14.9k
    if (is_neighbor_overlappable(*left_mi)) {
82
14.6k
      ++nb_count;
83
14.6k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
14.6k
          fun_ctxt, num_planes);
85
14.6k
    }
86
14.9k
  }
87
14.6k
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
2.04k
                                                void *fun_ctxt) {
61
2.04k
  if (!xd->left_available) return;
62
63
2.04k
  const int num_planes = av1_num_planes(cm);
64
2.04k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
2.04k
  const int mi_row = xd->mi_row;
68
2.04k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
2.04k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
2.04k
  uint8_t mi_step;
71
4.08k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
2.04k
       left_mi_row += mi_step) {
73
2.04k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
2.04k
    mi_step =
75
2.04k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
2.04k
    if (mi_step == 1) {
77
115
      left_mi_row &= ~1;
78
115
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
115
      mi_step = 2;
80
115
    }
81
2.04k
    if (is_neighbor_overlappable(*left_mi)) {
82
1.99k
      ++nb_count;
83
1.99k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
1.99k
          fun_ctxt, num_planes);
85
1.99k
    }
86
2.04k
  }
87
2.04k
}
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
22.9k
                                                void *fun_ctxt) {
61
22.9k
  if (!xd->left_available) return;
62
63
12.6k
  const int num_planes = av1_num_planes(cm);
64
12.6k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
12.6k
  const int mi_row = xd->mi_row;
68
12.6k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
12.6k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
12.6k
  uint8_t mi_step;
71
25.4k
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
12.8k
       left_mi_row += mi_step) {
73
12.8k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
12.8k
    mi_step =
75
12.8k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
12.8k
    if (mi_step == 1) {
77
1.88k
      left_mi_row &= ~1;
78
1.88k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
1.88k
      mi_step = 2;
80
1.88k
    }
81
12.8k
    if (is_neighbor_overlappable(*left_mi)) {
82
12.6k
      ++nb_count;
83
12.6k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
12.6k
          fun_ctxt, num_planes);
85
12.6k
    }
86
12.8k
  }
87
12.6k
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_