Coverage Report

Created: 2025-11-16 07:09

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
3.82M
                                                 void *fun_ctxt) {
24
3.82M
  if (!xd->up_available) return;
25
26
3.65M
  const int num_planes = av1_num_planes(cm);
27
3.65M
  int nb_count = 0;
28
3.65M
  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.65M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
3.65M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
3.65M
  uint8_t mi_step;
34
7.86M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
4.21M
       above_mi_col += mi_step) {
36
4.21M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
4.21M
    mi_step =
38
4.21M
        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
4.21M
    if (mi_step == 1) {
45
270k
      above_mi_col &= ~1;
46
270k
      above_mi = prev_row_mi + above_mi_col + 1;
47
270k
      mi_step = 2;
48
270k
    }
49
4.21M
    if (is_neighbor_overlappable(*above_mi)) {
50
3.67M
      ++nb_count;
51
3.67M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
3.67M
          *above_mi, fun_ctxt, num_planes);
53
3.67M
    }
54
4.21M
  }
55
3.65M
}
decodeframe.c:foreach_overlappable_nb_above
Line
Count
Source
23
571k
                                                 void *fun_ctxt) {
24
571k
  if (!xd->up_available) return;
25
26
571k
  const int num_planes = av1_num_planes(cm);
27
571k
  int nb_count = 0;
28
571k
  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
571k
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
571k
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
571k
  uint8_t mi_step;
34
1.21M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
639k
       above_mi_col += mi_step) {
36
639k
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
639k
    mi_step =
38
639k
        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
639k
    if (mi_step == 1) {
45
42.6k
      above_mi_col &= ~1;
46
42.6k
      above_mi = prev_row_mi + above_mi_col + 1;
47
42.6k
      mi_step = 2;
48
42.6k
    }
49
639k
    if (is_neighbor_overlappable(*above_mi)) {
50
569k
      ++nb_count;
51
569k
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
569k
          *above_mi, fun_ctxt, num_planes);
53
569k
    }
54
639k
  }
55
571k
}
reconinter.c:foreach_overlappable_nb_above
Line
Count
Source
23
3.25M
                                                 void *fun_ctxt) {
24
3.25M
  if (!xd->up_available) return;
25
26
3.08M
  const int num_planes = av1_num_planes(cm);
27
3.08M
  int nb_count = 0;
28
3.08M
  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.08M
  MB_MODE_INFO **prev_row_mi = xd->mi - mi_col - 1 * xd->mi_stride;
32
3.08M
  const int end_col = AOMMIN(mi_col + xd->width, cm->mi_params.mi_cols);
33
3.08M
  uint8_t mi_step;
34
6.65M
  for (int above_mi_col = mi_col; above_mi_col < end_col && nb_count < nb_max;
35
3.57M
       above_mi_col += mi_step) {
36
3.57M
    MB_MODE_INFO **above_mi = prev_row_mi + above_mi_col;
37
3.57M
    mi_step =
38
3.57M
        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.57M
    if (mi_step == 1) {
45
228k
      above_mi_col &= ~1;
46
228k
      above_mi = prev_row_mi + above_mi_col + 1;
47
228k
      mi_step = 2;
48
228k
    }
49
3.57M
    if (is_neighbor_overlappable(*above_mi)) {
50
3.10M
      ++nb_count;
51
3.10M
      fun(xd, 0, above_mi_col - mi_col, AOMMIN(xd->width, mi_step), 0,
52
3.10M
          *above_mi, fun_ctxt, num_planes);
53
3.10M
    }
54
3.57M
  }
55
3.08M
}
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
1.63M
                                                void *fun_ctxt) {
61
1.63M
  if (!xd->left_available) return;
62
63
1.58M
  const int num_planes = av1_num_planes(cm);
64
1.58M
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
1.58M
  const int mi_row = xd->mi_row;
68
1.58M
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
1.58M
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
1.58M
  uint8_t mi_step;
71
3.38M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
1.80M
       left_mi_row += mi_step) {
73
1.80M
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
1.80M
    mi_step =
75
1.80M
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
1.80M
    if (mi_step == 1) {
77
151k
      left_mi_row &= ~1;
78
151k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
151k
      mi_step = 2;
80
151k
    }
81
1.80M
    if (is_neighbor_overlappable(*left_mi)) {
82
1.55M
      ++nb_count;
83
1.55M
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
1.55M
          fun_ctxt, num_planes);
85
1.55M
    }
86
1.80M
  }
87
1.58M
}
decodeframe.c:foreach_overlappable_nb_left
Line
Count
Source
60
574k
                                                void *fun_ctxt) {
61
574k
  if (!xd->left_available) return;
62
63
574k
  const int num_planes = av1_num_planes(cm);
64
574k
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
574k
  const int mi_row = xd->mi_row;
68
574k
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
574k
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
574k
  uint8_t mi_step;
71
1.20M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
631k
       left_mi_row += mi_step) {
73
631k
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
631k
    mi_step =
75
631k
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
631k
    if (mi_step == 1) {
77
58.6k
      left_mi_row &= ~1;
78
58.6k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
58.6k
      mi_step = 2;
80
58.6k
    }
81
631k
    if (is_neighbor_overlappable(*left_mi)) {
82
561k
      ++nb_count;
83
561k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
561k
          fun_ctxt, num_planes);
85
561k
    }
86
631k
  }
87
574k
}
reconinter.c:foreach_overlappable_nb_left
Line
Count
Source
60
1.05M
                                                void *fun_ctxt) {
61
1.05M
  if (!xd->left_available) return;
62
63
1.00M
  const int num_planes = av1_num_planes(cm);
64
1.00M
  int nb_count = 0;
65
  // prev_col_mi points into the mi array, starting at the top of the
66
  // previous column
67
1.00M
  const int mi_row = xd->mi_row;
68
1.00M
  MB_MODE_INFO **prev_col_mi = xd->mi - 1 - mi_row * xd->mi_stride;
69
1.00M
  const int end_row = AOMMIN(mi_row + xd->height, cm->mi_params.mi_rows);
70
1.00M
  uint8_t mi_step;
71
2.18M
  for (int left_mi_row = mi_row; left_mi_row < end_row && nb_count < nb_max;
72
1.17M
       left_mi_row += mi_step) {
73
1.17M
    MB_MODE_INFO **left_mi = prev_col_mi + left_mi_row * xd->mi_stride;
74
1.17M
    mi_step =
75
1.17M
        AOMMIN(mi_size_high[left_mi[0]->bsize], mi_size_high[BLOCK_64X64]);
76
1.17M
    if (mi_step == 1) {
77
92.5k
      left_mi_row &= ~1;
78
92.5k
      left_mi = prev_col_mi + (left_mi_row + 1) * xd->mi_stride;
79
92.5k
      mi_step = 2;
80
92.5k
    }
81
1.17M
    if (is_neighbor_overlappable(*left_mi)) {
82
995k
      ++nb_count;
83
995k
      fun(xd, left_mi_row - mi_row, 0, AOMMIN(xd->height, mi_step), 1, *left_mi,
84
995k
          fun_ctxt, num_planes);
85
995k
    }
86
1.17M
  }
87
1.00M
}
88
89
#endif  // AOM_AV1_COMMON_OBMC_H_